Page MenuHomeFreeBSD

D53801.diff
No OneTemporary

D53801.diff

diff --git a/libexec/rtld-elf/amd64/rtld_machdep.h b/libexec/rtld-elf/amd64/rtld_machdep.h
--- a/libexec/rtld-elf/amd64/rtld_machdep.h
+++ b/libexec/rtld-elf/amd64/rtld_machdep.h
@@ -47,6 +47,8 @@
/* No architecture specific notes */
#define arch_digest_note(obj, note) false
+#define arch_fix_auxv(a, ai) do {} while (0)
+
Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target,
const struct Struct_Obj_Entry *obj, const struct Struct_Obj_Entry *refobj,
const Elf_Rel *rel);
diff --git a/libexec/rtld-elf/powerpc/reloc.c b/libexec/rtld-elf/powerpc/reloc.c
--- a/libexec/rtld-elf/powerpc/reloc.c
+++ b/libexec/rtld-elf/powerpc/reloc.c
@@ -840,3 +840,29 @@
return (tls_get_addr_common(_tcb_get(), ti->ti_module, ti->ti_offset +
TLS_DTV_OFFSET));
}
+
+void
+arch_fix_auxv(Elf_Auxinfo *aux, Elf_Auxinfo *aux_info[])
+{
+ Elf_Auxinfo *aux;
+ bool old_auxv_format;
+
+ old_auxv_format = true;
+ for (auxp = aux; auxp->a_type != AT_NULL; auxp++) {
+ if (auxp->a_type == 23) /* AT_STACKPROT */
+ return;
+ }
+
+ /* Remap from old-style auxv numbers. */
+ aux_info[23] = aux_info[21]; /* AT_STACKPROT */
+ aux_info[21] = aux_info[19]; /* AT_PAGESIZESLEN */
+ aux_info[19] = aux_info[17]; /* AT_NCPUS */
+ aux_info[17] = aux_info[15]; /* AT_CANARYLEN */
+ aux_info[15] = aux_info[13]; /* AT_EXECPATH */
+ aux_info[13] = NULL; /* AT_GID */
+
+ aux_info[20] = aux_info[18]; /* AT_PAGESIZES */
+ aux_info[18] = aux_info[16]; /* AT_OSRELDATE */
+ aux_info[16] = aux_info[14]; /* AT_CANARY */
+ aux_info[14] = NULL; /* AT_EGID */
+}
diff --git a/libexec/rtld-elf/powerpc/rtld_machdep.h b/libexec/rtld-elf/powerpc/rtld_machdep.h
--- a/libexec/rtld-elf/powerpc/rtld_machdep.h
+++ b/libexec/rtld-elf/powerpc/rtld_machdep.h
@@ -46,6 +46,8 @@
/* No architecture specific notes */
#define arch_digest_note(obj, note) false
+void arch_fix_auxv(Elf_Auxinfo *aux, Elf_Auxinfo *aux_info[]);
+
Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target,
const struct Struct_Obj_Entry *defobj, const struct Struct_Obj_Entry *obj,
const Elf_Rel *rel);
diff --git a/libexec/rtld-elf/powerpc64/reloc.c b/libexec/rtld-elf/powerpc64/reloc.c
--- a/libexec/rtld-elf/powerpc64/reloc.c
+++ b/libexec/rtld-elf/powerpc64/reloc.c
@@ -737,3 +737,29 @@
return (tls_get_addr_common(_tcb_get(), ti->ti_module, ti->ti_offset +
TLS_DTV_OFFSET));
}
+
+void
+arch_fix_auxv(Elf_Auxinfo *aux, Elf_Auxinfo *aux_info[])
+{
+ Elf_Auxinfo *aux;
+ bool old_auxv_format;
+
+ old_auxv_format = true;
+ for (auxp = aux; auxp->a_type != AT_NULL; auxp++) {
+ if (auxp->a_type == 23) /* AT_STACKPROT */
+ return;
+ }
+
+ /* Remap from old-style auxv numbers. */
+ aux_info[23] = aux_info[21]; /* AT_STACKPROT */
+ aux_info[21] = aux_info[19]; /* AT_PAGESIZESLEN */
+ aux_info[19] = aux_info[17]; /* AT_NCPUS */
+ aux_info[17] = aux_info[15]; /* AT_CANARYLEN */
+ aux_info[15] = aux_info[13]; /* AT_EXECPATH */
+ aux_info[13] = NULL; /* AT_GID */
+
+ aux_info[20] = aux_info[18]; /* AT_PAGESIZES */
+ aux_info[18] = aux_info[16]; /* AT_OSRELDATE */
+ aux_info[16] = aux_info[14]; /* AT_CANARY */
+ aux_info[14] = NULL; /* AT_EGID */
+}
diff --git a/libexec/rtld-elf/powerpc64/rtld_machdep.h b/libexec/rtld-elf/powerpc64/rtld_machdep.h
--- a/libexec/rtld-elf/powerpc64/rtld_machdep.h
+++ b/libexec/rtld-elf/powerpc64/rtld_machdep.h
@@ -46,6 +46,8 @@
/* No architecture specific notes */
#define arch_digest_note(obj, note) false
+void arch_fix_auxv(Elf_Auxinfo *aux, Elf_Auxinfo *aux_info[]);
+
Elf_Addr reloc_jmpslot(Elf_Addr *where, Elf_Addr target,
const struct Struct_Obj_Entry *defobj, const struct Struct_Obj_Entry *obj,
const Elf_Rel *rel);
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -521,9 +521,6 @@
char buf[MAXPATHLEN];
int argc, fd, i, mib[4], old_osrel, osrel, phnum, rtld_argc;
size_t sz;
-#ifdef __powerpc__
- int old_auxv_format = 1;
-#endif
bool dir_enable, dir_ignore, direct_exec, explicit_fd, search_in_path;
/*
@@ -549,28 +546,8 @@
for (auxp = aux; auxp->a_type != AT_NULL; auxp++) {
if (auxp->a_type < AT_COUNT)
aux_info[auxp->a_type] = auxp;
-#ifdef __powerpc__
- if (auxp->a_type == 23) /* AT_STACKPROT */
- old_auxv_format = 0;
-#endif
}
-
-#ifdef __powerpc__
- if (old_auxv_format) {
- /* Remap from old-style auxv numbers. */
- aux_info[23] = aux_info[21]; /* AT_STACKPROT */
- aux_info[21] = aux_info[19]; /* AT_PAGESIZESLEN */
- aux_info[19] = aux_info[17]; /* AT_NCPUS */
- aux_info[17] = aux_info[15]; /* AT_CANARYLEN */
- aux_info[15] = aux_info[13]; /* AT_EXECPATH */
- aux_info[13] = NULL; /* AT_GID */
-
- aux_info[20] = aux_info[18]; /* AT_PAGESIZES */
- aux_info[18] = aux_info[16]; /* AT_OSRELDATE */
- aux_info[16] = aux_info[14]; /* AT_CANARY */
- aux_info[14] = NULL; /* AT_EGID */
- }
-#endif
+ arch_fix_auxv(aux, aux_info);
/* Initialize and relocate ourselves. */
assert(aux_info[AT_BASE] != NULL);

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 19, 5:57 PM (5 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25659343
Default Alt Text
D53801.diff (4 KB)

Event Timeline