summaryrefslogtreecommitdiffstats
path: root/sys/kern/imgact_elf.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2001-02-24 22:20:11 +0000
committerobrien <obrien@FreeBSD.org>2001-02-24 22:20:11 +0000
commit16ff3c2b54063851acd596584eefb8416181cd70 (patch)
treef3751e7d9ad2ce4dd03d6e0bd318a014e8ad054e /sys/kern/imgact_elf.c
parentde4709b84943a61e51dc53cb77bc87c4a93cc97e (diff)
downloadFreeBSD-src-16ff3c2b54063851acd596584eefb8416181cd70.zip
FreeBSD-src-16ff3c2b54063851acd596584eefb8416181cd70.tar.gz
MFS: bring the consistent `compat_3_brand' support into -CURRENT
(the work was first done in the RELENG_4 branch near a release during a MFC to make the code cleaner and more consistent)
Diffstat (limited to 'sys/kern/imgact_elf.c')
-rw-r--r--sys/kern/imgact_elf.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index b5fc907..553ef75 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -1,4 +1,5 @@
/*-
+ * Copyright (c) 2000 David O'Brien
* Copyright (c) 1995-1996 Søren Schmidt
* Copyright (c) 1996 Peter Wemm
* All rights reserved.
@@ -106,6 +107,7 @@ struct sysentvec elf_freebsd_sysvec = {
static Elf_Brandinfo freebsd_brand_info = {
ELFOSABI_FREEBSD,
+ "FreeBSD",
"",
"/usr/libexec/ld-elf.so.1",
&elf_freebsd_sysvec
@@ -562,21 +564,23 @@ exec_elf_imgact(struct image_params *imgp)
brand_info = NULL;
- /* XXX For now we look for the magic "FreeBSD" that we used to put
- * into the ELF header at the EI_ABIVERSION location. If found use
- * that information rather than figuring out the ABI from proper
- * branding. This should be removed for 5.0-RELEASE. The Linux caes
- * can be figured out from the `interp_path' field.
+ /* We support three types of branding -- (1) the ELF EI_OSABI field
+ * that SCO added to the ELF spec, (2) FreeBSD 3.x's traditional string
+ * branding w/in the ELF header, and (3) path of the `interp_path'
+ * field. We should also look for an ".note.ABI-tag" ELF section now
+ * in all Linux ELF binaries, FreeBSD 4.1+, and some NetBSD ones.
*/
- if (strcmp("FreeBSD", (const char *)&hdr->e_ident[OLD_EI_BRAND]) == 0)
- brand_info = &freebsd_brand_info;
/* If the executable has a brand, search for it in the brand list. */
if (brand_info == NULL) {
for (i = 0; i < MAX_BRANDS; i++) {
Elf_Brandinfo *bi = elf_brand_list[i];
- if (bi != NULL && hdr->e_ident[EI_OSABI] == bi->brand) {
+ if (bi != NULL &&
+ (hdr->e_ident[EI_OSABI] == bi->brand
+ || 0 ==
+ strncmp((const char *)&hdr->e_ident[OLD_EI_BRAND],
+ bi->compat_3_brand, strlen(bi->compat_3_brand)))) {
brand_info = bi;
break;
}
OpenPOWER on IntegriCloud