summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjake <jake@FreeBSD.org>2003-01-05 03:48:14 +0000
committerjake <jake@FreeBSD.org>2003-01-05 03:48:14 +0000
commit6243006062d2b36ba6967e44b6f1fd9fa00173e4 (patch)
treeaf77949ecd99c3d1c518e58905561cc4b241c19e
parent5b582a2ed13d6960e8221ba0a8df0e26e69adfcf (diff)
downloadFreeBSD-src-6243006062d2b36ba6967e44b6f1fd9fa00173e4.zip
FreeBSD-src-6243006062d2b36ba6967e44b6f1fd9fa00173e4.tar.gz
- Provide backwards compatibility for kern.fallback_elf_brand.
- Use the generic elf type macros in imgact_elf.h instead of ifdefing the entire contents of the header.
-rw-r--r--sys/kern/imgact_elf.c13
-rw-r--r--sys/kern/kern_mib.c9
-rw-r--r--sys/sys/imgact_elf.h72
3 files changed, 30 insertions, 64 deletions
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index 714ee15..f6b0cb2 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -67,9 +67,6 @@
#define OLD_EI_BRAND 8
-__ElfType(Brandinfo);
-__ElfType(Auxargs);
-
static int __elfN(check_header)(const Elf_Ehdr *hdr);
static Elf_Brandinfo *__elfN(get_brandinfo)(const Elf_Ehdr *hdr,
const char *interp);
@@ -84,12 +81,12 @@ static int __CONCAT(exec_, __elfN(imgact))(struct image_params *imgp);
SYSCTL_NODE(_kern, OID_AUTO, __CONCAT(elf, __ELF_WORD_SIZE), CTLFLAG_RW, 0,
"");
-static int fallback_brand = -1;
-SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO, fallback_brand,
- CTLFLAG_RW, &fallback_brand, 0,
+int __elfN(fallback_brand) = -1;
+SYSCTL_INT(__CONCAT(_kern_elf, __ELF_WORD_SIZE), OID_AUTO,
+ fallback_brand, CTLFLAG_RW, &__elfN(fallback_brand), 0,
__XSTRING(__CONCAT(ELF, __ELF_WORD_SIZE)) " brand of last resort");
TUNABLE_INT("kern.elf" __XSTRING(__ELF_WORD_SIZE) ".fallback_brand",
- &fallback_brand);
+ &__elfN(fallback_brand));
static int elf_trace = 0;
SYSCTL_INT(_debug, OID_AUTO, __elfN(trace), CTLFLAG_RW, &elf_trace, 0, "");
@@ -188,7 +185,7 @@ __elfN(get_brandinfo)(const Elf_Ehdr *hdr, const char *interp)
for (i = 0; i < MAX_BRANDS; i++) {
bi = elf_brand_list[i];
if (bi != NULL && hdr->e_machine == bi->machine &&
- fallback_brand == bi->brand)
+ __elfN(fallback_brand) == bi->brand)
return (bi);
}
return (NULL);
diff --git a/sys/kern/kern_mib.c b/sys/kern/kern_mib.c
index fd7dda5..f45aa9b 100644
--- a/sys/kern/kern_mib.c
+++ b/sys/kern/kern_mib.c
@@ -362,6 +362,9 @@ SYSCTL_INT(_debug_sizeof, OID_AUTO, buf, CTLFLAG_RD,
SYSCTL_INT(_debug_sizeof, OID_AUTO, kinfo_proc, CTLFLAG_RD,
0, sizeof(struct kinfo_proc), "sizeof(struct kinfo_proc)");
-SYSCTL_STRING(_kern, OID_AUTO, fallback_elf_brand, CTLFLAG_RD,
- "kern.fallback_elf_brand is deprecated, use kern.elf32.fallback_brand or "
- "kern.elf64.fallback_brand" , 0, "");
+/* XXX compatibility, remove for 6.0 */
+#include <sys/imgact.h>
+#include <sys/imgact_elf.h>
+SYSCTL_INT(_kern, OID_AUTO, fallback_elf_brand, CTLFLAG_RW,
+ &__elfN(fallback_brand), sizeof(__elfN(fallback_brand)),
+ "compatibility for kern.fallback_elf_brand");
diff --git a/sys/sys/imgact_elf.h b/sys/sys/imgact_elf.h
index 1cc3014..93974f3 100644
--- a/sys/sys/imgact_elf.h
+++ b/sys/sys/imgact_elf.h
@@ -39,23 +39,21 @@
struct thread;
-#if ELF_TARG_CLASS == ELFCLASS32
-
/*
* Structure used to pass infomation from the loader to the
* stack fixup routine.
*/
typedef struct {
- Elf32_Sword execfd;
- Elf32_Word phdr;
- Elf32_Word phent;
- Elf32_Word phnum;
- Elf32_Word pagesz;
- Elf32_Word base;
- Elf32_Word flags;
- Elf32_Word entry;
- Elf32_Word trace;
-} Elf32_Auxargs;
+ Elf_Sword execfd;
+ Elf_Word phdr;
+ Elf_Word phent;
+ Elf_Word phnum;
+ Elf_Word pagesz;
+ Elf_Word base;
+ Elf_Word flags;
+ Elf_Word entry;
+ Elf_Word trace;
+} __ElfN(Auxargs);
typedef struct {
int brand;
@@ -64,52 +62,20 @@ typedef struct {
const char *emul_path;
const char *interp_path;
struct sysentvec *sysvec;
-} Elf32_Brandinfo;
-
-#define MAX_BRANDS 8
-
-int elf32_brand_inuse(Elf32_Brandinfo *entry);
-int elf32_insert_brand_entry(Elf32_Brandinfo *entry);
-int elf32_remove_brand_entry(Elf32_Brandinfo *entry);
-int elf32_freebsd_fixup(register_t **, struct image_params *);
-int elf32_coredump(struct thread *, struct vnode *, off_t);
-
-#else /* !(ELF_TARG_CLASS == ELFCLASS32) */
-
-/*
- * Structure used to pass infomation from the loader to the
- * stack fixup routine.
- */
-typedef struct {
- Elf64_Sword execfd;
- Elf64_Addr phdr;
- Elf64_Word phent;
- Elf64_Word phnum;
- Elf64_Word pagesz;
- Elf64_Addr base;
- Elf64_Word flags;
- Elf64_Addr entry;
- Elf64_Word trace;
-} Elf64_Auxargs;
+} __ElfN(Brandinfo);
-typedef struct {
- int brand;
- int machine;
- 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;
+__ElfType(Auxargs);
+__ElfType(Brandinfo);
#define MAX_BRANDS 8
-int elf64_brand_inuse(Elf64_Brandinfo *entry);
-int elf64_insert_brand_entry(Elf64_Brandinfo *entry);
-int elf64_remove_brand_entry(Elf64_Brandinfo *entry);
-int elf64_freebsd_fixup(register_t **, struct image_params *);
-int elf64_coredump(struct thread *, struct vnode *, off_t);
+int __elfN(brand_inuse)(Elf_Brandinfo *entry);
+int __elfN(insert_brand_entry)(Elf_Brandinfo *entry);
+int __elfN(remove_brand_entry)(Elf_Brandinfo *entry);
+int __elfN(freebsd_fixup)(register_t **, struct image_params *);
+int __elfN(coredump)(struct thread *, struct vnode *, off_t);
-#endif /* ELF_TARG_CLASS == ELFCLASS32 */
+extern int __elfN(fallback_brand);
#endif /* _KERNEL */
OpenPOWER on IntegriCloud