summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2000-04-12 03:42:40 +0000
committerobrien <obrien@FreeBSD.org>2000-04-12 03:42:40 +0000
commit3139dfa2c28d99c5f769a2860e0d45fcb1ab54cc (patch)
treeb96a49f788e7c256ba33f95a837922c1fc344c77
parentd4a38fd2058b228d30ff80d49c58853f7a1a97c1 (diff)
downloadFreeBSD-src-3139dfa2c28d99c5f769a2860e0d45fcb1ab54cc.zip
FreeBSD-src-3139dfa2c28d99c5f769a2860e0d45fcb1ab54cc.tar.gz
Slightly cleaner branding code that may be more palatable to the Binutils
maintainers.
-rw-r--r--contrib/binutils/bfd/elf.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/contrib/binutils/bfd/elf.c b/contrib/binutils/bfd/elf.c
index 6f43e9e..90c27d5 100644
--- a/contrib/binutils/bfd/elf.c
+++ b/contrib/binutils/bfd/elf.c
@@ -17,6 +17,8 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+/* $FreeBSD$ */
+
/*
SECTION
@@ -38,6 +40,13 @@ SECTION
#define ARCH_SIZE 0
#include "elf-bfd.h"
+#define EI_BRAND_OFFSET 8 /* should be in binutils/include/elf/common.h */
+#if defined(__FreeBSD__)
+#define BRANDING "FreeBSD"
+#else
+#define BRANDING ""
+#endif
+
static INLINE struct elf_segment_map *make_mapping
PARAMS ((bfd *, asection **, unsigned int, unsigned int, boolean));
static boolean map_sections_to_segments PARAMS ((bfd *));
@@ -3000,10 +3009,10 @@ prep_headers (abfd)
i_ehdrp->e_version = bed->s->ev_current;
i_ehdrp->e_ehsize = bed->s->sizeof_ehdr;
-#ifdef __FreeBSD__
- /* Quick and dirty hack to brand the file as a FreeBSD ELF file. */
- strncpy((char *) &i_ehdrp->e_ident[8], "FreeBSD", EI_NIDENT-8);
-#endif
+ /* Some OS's brands all ELF binaries so the image loader knows what system
+ call set, etc. to use. */
+ strncpy((char *) &i_ehdrp->e_ident[EI_BRAND_OFFSET], BRANDING,
+ EI_NIDENT-EI_BRAND_OFFSET);
/* no program header, for now. */
i_ehdrp->e_phoff = 0;
OpenPOWER on IntegriCloud