Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Mar 2015 13:59:05 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r280220 - head/usr.bin/ldd
Message-ID:  <201503181359.t2IDx5MO086217@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Wed Mar 18 13:59:04 2015
New Revision: 280220
URL: https://svnweb.freebsd.org/changeset/base/280220

Log:
  Allowus to exclude a.out support from ldd and use it with arm64 as it won't
  support the a.out format.
  
  Reviewed by:	emaste
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.bin/ldd/ldd.c

Modified: head/usr.bin/ldd/ldd.c
==============================================================================
--- head/usr.bin/ldd/ldd.c	Wed Mar 18 13:54:53 2015	(r280219)
+++ head/usr.bin/ldd/ldd.c	Wed Mar 18 13:59:04 2015	(r280220)
@@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$");
 
 #include <arpa/inet.h>
 
-#include <a.out.h>
 #include <dlfcn.h>
 #include <err.h>
 #include <errno.h>
@@ -49,6 +48,12 @@ __FBSDID("$FreeBSD$");
 
 #include "extern.h"
 
+/* We don't support a.out executables on arm64 */
+#ifndef __aarch64__
+#include <a.out.h>
+#define	AOUT_SUPPORTED
+#endif
+
 /*
  * 32-bit ELF data structures can only be used if the system header[s] declare
  * them.  There is no official macro for determining whether they are declared,
@@ -274,7 +279,9 @@ static int
 is_executable(const char *fname, int fd, int *is_shlib, int *type)
 {
 	union {
+#ifdef AOUT_SUPPORTED
 		struct exec aout;
+#endif
 #if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED)
 		Elf32_Ehdr elf32;
 #endif
@@ -290,6 +297,7 @@ is_executable(const char *fname, int fd,
 		return (0);
 	}
 
+#ifdef AOUT_SUPPORTED
 	if ((size_t)n >= sizeof(hdr.aout) && !N_BADMAG(hdr.aout)) {
 		/* a.out file */
 		if ((N_GETFLAG(hdr.aout) & EX_DPMASK) != EX_DYNAMIC
@@ -303,6 +311,7 @@ is_executable(const char *fname, int fd,
 		*type = TYPE_AOUT;
 		return (1);
 	}
+#endif
 
 #if __ELF_WORD_SIZE > 32 && defined(ELF32_SUPPORTED)
 	if ((size_t)n >= sizeof(hdr.elf32) && IS_ELF(hdr.elf32) &&



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201503181359.t2IDx5MO086217>