mirror of
https://github.com/opnsense/src.git
synced 2026-06-12 10:10:24 -04:00
rtld: Move powerpc specific code to powerpc files
There are two variables set by dynamic tags in the powerpc runtime linker. Now we have a way to split out architecture-specific dynamic tags use it to handle these. Reviewed by: kib, jhibbits Obtained from: jhibbits (earlier version) Sponsored by: Arm Ltd Differential Revision: https://reviews.freebsd.org/D45182
This commit is contained in:
parent
9e48c30e25
commit
1cd90a2c16
6 changed files with 28 additions and 25 deletions
|
|
@ -57,6 +57,17 @@
|
|||
|
||||
void _rtld_bind_secureplt_start(void);
|
||||
|
||||
bool
|
||||
arch_digest_dynamic(struct Struct_Obj_Entry *obj, const Elf_Dyn *dynp)
|
||||
{
|
||||
if (dynp->d_tag == DT_PPC_GOT) {
|
||||
obj->gotptr = (Elf_Addr *)(obj->relocbase + dynp->d_un.d_ptr);
|
||||
return (true);
|
||||
}
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
/*
|
||||
* Process the R_PPC_COPY relocations
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -35,13 +35,13 @@
|
|||
|
||||
struct Struct_Obj_Entry;
|
||||
|
||||
#define MD_OBJ_ENTRY
|
||||
#define MD_OBJ_ENTRY \
|
||||
Elf_Addr *gotptr; /* GOT pointer (secure-plt only) */
|
||||
|
||||
/* Return the address of the .dynamic section in the dynamic linker. */
|
||||
#define rtld_dynamic(obj) (&_DYNAMIC)
|
||||
|
||||
/* No arch-specific dynamic tags */
|
||||
#define arch_digest_dynamic(obj, dynp) false
|
||||
bool arch_digest_dynamic(struct Struct_Obj_Entry *, const Elf_Dyn *);
|
||||
|
||||
/* No architecture specific notes */
|
||||
#define arch_digest_note(obj, note) false
|
||||
|
|
|
|||
|
|
@ -52,6 +52,17 @@ struct funcdesc {
|
|||
};
|
||||
#endif
|
||||
|
||||
bool
|
||||
arch_digest_dynamic(struct Struct_Obj_Entry *obj, const Elf_Dyn *dynp)
|
||||
{
|
||||
if (dynp->d_tag == DT_PPC64_GLINK) {
|
||||
obj->glink = (Elf_Addr)(obj->relocbase + dynp->d_un.d_ptr);
|
||||
return (true);
|
||||
}
|
||||
|
||||
return (false);
|
||||
}
|
||||
|
||||
/*
|
||||
* Process the R_PPC_COPY relocations
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -35,13 +35,13 @@
|
|||
|
||||
struct Struct_Obj_Entry;
|
||||
|
||||
#define MD_OBJ_ENTRY
|
||||
#define MD_OBJ_ENTRY \
|
||||
Elf_Addr glink; /* GLINK PLT call stub section */
|
||||
|
||||
/* Return the address of the .dynamic section in the dynamic linker. */
|
||||
#define rtld_dynamic(obj) (&_DYNAMIC)
|
||||
|
||||
/* No arch-specific dynamic tags */
|
||||
#define arch_digest_dynamic(obj, dynp) false
|
||||
bool arch_digest_dynamic(struct Struct_Obj_Entry *, const Elf_Dyn *);
|
||||
|
||||
/* No architecture specific notes */
|
||||
#define arch_digest_note(obj, note) false
|
||||
|
|
|
|||
|
|
@ -1520,18 +1520,6 @@ digest_dynamic1(Obj_Entry *obj, int early, const Elf_Dyn **dyn_rpath,
|
|||
obj->static_tls = true;
|
||||
break;
|
||||
|
||||
#ifdef __powerpc__
|
||||
#ifdef __powerpc64__
|
||||
case DT_PPC64_GLINK:
|
||||
obj->glink = (Elf_Addr)(obj->relocbase + dynp->d_un.d_ptr);
|
||||
break;
|
||||
#else
|
||||
case DT_PPC_GOT:
|
||||
obj->gotptr = (Elf_Addr *)(obj->relocbase + dynp->d_un.d_ptr);
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
case DT_FLAGS_1:
|
||||
if (dynp->d_un.d_val & DF_1_NOOPEN)
|
||||
obj->z_noopen = true;
|
||||
|
|
|
|||
|
|
@ -183,13 +183,6 @@ typedef struct Struct_Obj_Entry {
|
|||
const Elf_Sym *symtab; /* Symbol table */
|
||||
const char *strtab; /* String table */
|
||||
unsigned long strsize; /* Size in bytes of string table */
|
||||
#ifdef __powerpc__
|
||||
#ifdef __powerpc64__
|
||||
Elf_Addr glink; /* GLINK PLT call stub section */
|
||||
#else
|
||||
Elf_Addr *gotptr; /* GOT pointer (secure-plt only) */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
const Elf_Verneed *verneed; /* Required versions. */
|
||||
Elf_Word verneednum; /* Number of entries in verneed table */
|
||||
|
|
|
|||
Loading…
Reference in a new issue