diff options
author | obrien <obrien@FreeBSD.org> | 2001-02-24 22:20:11 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2001-02-24 22:20:11 +0000 |
commit | 16ff3c2b54063851acd596584eefb8416181cd70 (patch) | |
tree | f3751e7d9ad2ce4dd03d6e0bd318a014e8ad054e /sys | |
parent | de4709b84943a61e51dc53cb77bc87c4a93cc97e (diff) | |
download | FreeBSD-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')
-rw-r--r-- | sys/compat/svr4/svr4_sysvec.c | 1 | ||||
-rw-r--r-- | sys/i386/linux/linux_sysvec.c | 2 | ||||
-rw-r--r-- | sys/kern/imgact_elf.c | 20 | ||||
-rw-r--r-- | sys/sys/imgact_elf.h | 6 |
4 files changed, 19 insertions, 10 deletions
diff --git a/sys/compat/svr4/svr4_sysvec.c b/sys/compat/svr4/svr4_sysvec.c index 05354d1..912cd2a 100644 --- a/sys/compat/svr4/svr4_sysvec.c +++ b/sys/compat/svr4/svr4_sysvec.c @@ -184,6 +184,7 @@ struct sysentvec svr4_sysvec = { Elf32_Brandinfo svr4_brand = { ELFOSABI_SOLARIS, /* XXX Or should we use ELFOSABI_SYSV here? */ + "SVR4", svr4_emul_path, "/lib/libc.so.1", &svr4_sysvec diff --git a/sys/i386/linux/linux_sysvec.c b/sys/i386/linux/linux_sysvec.c index 09b682f..0d0c6db 100644 --- a/sys/i386/linux/linux_sysvec.c +++ b/sys/i386/linux/linux_sysvec.c @@ -780,6 +780,7 @@ struct sysentvec elf_linux_sysvec = { static Elf32_Brandinfo linux_brand = { ELFOSABI_LINUX, + "Linux", "/compat/linux", "/lib/ld-linux.so.1", &elf_linux_sysvec @@ -787,6 +788,7 @@ static Elf32_Brandinfo linux_brand = { static Elf32_Brandinfo linux_glibc2brand = { ELFOSABI_LINUX, + "Linux", "/compat/linux", "/lib/ld-linux.so.2", &elf_linux_sysvec 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; } diff --git a/sys/sys/imgact_elf.h b/sys/sys/imgact_elf.h index 4d87bed..0753122 100644 --- a/sys/sys/imgact_elf.h +++ b/sys/sys/imgact_elf.h @@ -57,6 +57,7 @@ typedef struct { typedef struct { int brand; + const char *compat_3_brand; /* pre Binutils 2.10 method (FBSD 3) */ const char *emul_path; const char *interp_path; struct sysentvec *sysvec; @@ -88,8 +89,9 @@ typedef struct { typedef struct { int brand; - char *emul_path; - char *interp_path; + const char *compat_3_brand; /* pre Binutils 2.10 method (FBSD 3) */ + const char *emul_path; + const char *interp_path; struct sysentvec *sysvec; } Elf64_Brandinfo; |