1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

- Consistently abbreviate the names of the relocations.

- End sentences with dots.
- Fix whitespace.
This commit is contained in:
Marius Strobl 2011-03-06 13:25:46 +00:00
parent 20359f8025
commit d374d11285
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=219339
2 changed files with 56 additions and 51 deletions

View File

@ -161,29 +161,36 @@ static const char *reloc_names[] = {
static const long reloc_target_bitmask[] = { static const long reloc_target_bitmask[] = {
#define _BM(x) (~(-(1ULL << (x)))) #define _BM(x) (~(-(1ULL << (x))))
0, /* NONE */ 0, /* NONE */
_BM(8), _BM(16), _BM(32), /* RELOC_8, _16, _32 */ _BM(8), _BM(16), _BM(32), /* RELOC_8, 16, 32 */
_BM(8), _BM(16), _BM(32), /* DISP8, DISP16, DISP32 */ _BM(8), _BM(16), _BM(32), /* DISP8, DISP16, DISP32 */
_BM(30), _BM(22), /* WDISP30, WDISP22 */ _BM(30), _BM(22), /* WDISP30, WDISP22 */
_BM(22), _BM(22), /* HI22, _22 */ _BM(22), _BM(22), /* HI22, 22 */
_BM(13), _BM(10), /* RELOC_13, _LO10 */ _BM(13), _BM(10), /* RELOC_13, LO10 */
_BM(10), _BM(13), _BM(22), /* GOT10, GOT13, GOT22 */ _BM(10), _BM(13), _BM(22), /* GOT10, GOT13, GOT22 */
_BM(10), _BM(22), /* _PC10, _PC22 */ _BM(10), _BM(22), /* PC10, PC22 */
_BM(30), 0, /* _WPLT30, _COPY */ _BM(30), 0, /* WPLT30, COPY */
_BM(32), _BM(32), _BM(32), /* _GLOB_DAT, JMP_SLOT, _RELATIVE */ _BM(32), _BM(32), _BM(32), /* GLOB_DAT, JMP_SLOT, RELATIVE */
_BM(32), _BM(32), /* _UA32, PLT32 */ _BM(32), _BM(32), /* UA32, PLT32 */
_BM(22), _BM(10), /* _HIPLT22, LOPLT10 */ _BM(22), _BM(10), /* HIPLT22, LOPLT10 */
_BM(32), _BM(22), _BM(10), /* _PCPLT32, _PCPLT22, _PCPLT10 */ _BM(32), _BM(22), _BM(10), /* PCPLT32, PCPLT22, PCPLT10 */
_BM(10), _BM(11), -1, /* _10, _11, _64 */ _BM(10), _BM(11), -1, /* 10, 11, 64 */
_BM(13), _BM(22), /* _OLO10, _HH22 */ _BM(13), _BM(22), /* OLO10, HH22 */
_BM(10), _BM(22), /* _HM10, _LM22 */ _BM(10), _BM(22), /* HM10, LM22 */
_BM(22), _BM(10), _BM(22), /* _PC_HH22, _PC_HM10, _PC_LM22 */ _BM(22), _BM(10), _BM(22), /* PC_HH22, PC_HM10, PC_LM22 */
_BM(16), _BM(19), /* _WDISP16, _WDISP19 */ _BM(16), _BM(19), /* WDISP16, WDISP19 */
-1, /* GLOB_JMP */ -1, /* GLOB_JMP */
_BM(7), _BM(5), _BM(6), /* _7, _5, _6 */ _BM(7), _BM(5), _BM(6), /* 7, 5, 6 */
-1, -1, /* DISP64, PLT64 */ -1, -1, /* DISP64, PLT64 */
_BM(22), _BM(13), /* HIX22, LOX10 */ _BM(22), _BM(13), /* HIX22, LOX10 */
_BM(22), _BM(10), _BM(13), /* H44, M44, L44 */ _BM(22), _BM(10), _BM(13), /* H44, M44, L44 */
-1, -1, _BM(16), /* REGISTER, UA64, UA16 */ -1, -1, _BM(16), /* REGISTER, UA64, UA16 */
_BM(22), _BM(10), 0, _BM(30), /* GD_HI22, GD_LO10, GD_ADD, GD_CALL */
_BM(22), _BM(10), 0, /* LDM_HI22, LDMO10, LDM_ADD */
_BM(30), /* LDM_CALL */
_BM(22), _BM(10), 0, /* LDO_HIX22, LDO_LOX10, LDO_ADD */
_BM(22), _BM(10), 0, 0, /* IE_HI22, IE_LO10, IE_LD, IE_LDX */
0, /* IE_ADD */
_BM(22), _BM(13), /* LE_HIX22, LE_LOX10 */
#undef _BM #undef _BM
}; };
#define RELOC_VALUE_BITMASK(t) (reloc_target_bitmask[t]) #define RELOC_VALUE_BITMASK(t) (reloc_target_bitmask[t])
@ -228,7 +235,7 @@ do_copy_relocations(Obj_Entry *dstobj)
ELF_R_SYM(rela->r_info)); ELF_R_SYM(rela->r_info));
for (srcobj = dstobj->next; srcobj != NULL; for (srcobj = dstobj->next; srcobj != NULL;
srcobj = srcobj->next) { srcobj = srcobj->next) {
res = symlook_obj(&req, srcobj); res = symlook_obj(&req, srcobj);
if (res == 0) { if (res == 0) {
srcsym = req.sym_out; srcsym = req.sym_out;
@ -303,11 +310,11 @@ reloc_nonplt_object(Obj_Entry *obj, const Elf_Rela *rela, SymCache *cache,
if (type == R_SPARC_NONE) if (type == R_SPARC_NONE)
return (0); return (0);
/* We do JMP_SLOTs below */ /* We do JMP_SLOTs below. */
if (type == R_SPARC_JMP_SLOT) if (type == R_SPARC_JMP_SLOT)
return (0); return (0);
/* COPY relocs are also handled elsewhere */ /* COPY relocs are also handled elsewhere. */
if (type == R_SPARC_COPY) if (type == R_SPARC_COPY)
return (0); return (0);
@ -321,11 +328,11 @@ reloc_nonplt_object(Obj_Entry *obj, const Elf_Rela *rela, SymCache *cache,
value = rela->r_addend; value = rela->r_addend;
/* /*
* Handle relative relocs here, because we might not * Handle relative relocs here, because we might not be able to access
* be able to access globals yet. * globals yet.
*/ */
if (type == R_SPARC_RELATIVE) { if (type == R_SPARC_RELATIVE) {
/* XXXX -- apparently we ignore the preexisting value */ /* XXXX -- apparently we ignore the preexisting value. */
*where = (Elf_Addr)(obj->relocbase + value); *where = (Elf_Addr)(obj->relocbase + value);
return (0); return (0);
} }
@ -335,14 +342,13 @@ reloc_nonplt_object(Obj_Entry *obj, const Elf_Rela *rela, SymCache *cache,
* a non-local variable is accessed. * a non-local variable is accessed.
*/ */
if (RELOC_RESOLVE_SYMBOL(type)) { if (RELOC_RESOLVE_SYMBOL(type)) {
/* Find the symbol. */
/* Find the symbol */
def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj,
false, cache, lockstate); false, cache, lockstate);
if (def == NULL) if (def == NULL)
return (-1); return (-1);
/* Add in the symbol's absolute address */ /* Add in the symbol's absolute address. */
value += (Elf_Addr)(defobj->relocbase + def->st_value); value += (Elf_Addr)(defobj->relocbase + def->st_value);
} }
@ -445,7 +451,6 @@ reloc_plt(Obj_Entry *obj)
#define SETHIG5 0x0b000000 /* sethi %hi(0), %g5 */ #define SETHIG5 0x0b000000 /* sethi %hi(0), %g5 */
#define ORG5 0x82804005 /* or %g1, %g5, %g1 */ #define ORG5 0x82804005 /* or %g1, %g5, %g1 */
/* %hi(v) with variable shift */ /* %hi(v) with variable shift */
#define HIVAL(v, s) (((v) >> (s)) & 0x003fffff) #define HIVAL(v, s) (((v) >> (s)) & 0x003fffff)
#define LOVAL(v) ((v) & 0x000003ff) #define LOVAL(v) ((v) & 0x000003ff)
@ -477,7 +482,7 @@ reloc_jmpslots(Obj_Entry *obj, RtldLockState *lockstate)
Elf_Addr Elf_Addr
reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *obj, reloc_jmpslot(Elf_Addr *wherep, Elf_Addr target, const Obj_Entry *obj,
const Obj_Entry *refobj, const Elf_Rel *rel) const Obj_Entry *refobj, const Elf_Rel *rel)
{ {
const Elf_Rela *rela = (const Elf_Rela *)rel; const Elf_Rela *rela = (const Elf_Rela *)rel;
Elf_Addr offset; Elf_Addr offset;
@ -734,21 +739,21 @@ install_plt(Elf_Word *pltgot, Elf_Addr proc)
void void
allocate_initial_tls(Obj_Entry *objs) allocate_initial_tls(Obj_Entry *objs)
{ {
Elf_Addr* tpval; Elf_Addr* tpval;
/* /*
* Fix the size of the static TLS block by using the maximum * Fix the size of the static TLS block by using the maximum offset
* offset allocated so far and adding a bit for dynamic modules to * allocated so far and adding a bit for dynamic modules to use.
* use. */
*/ tls_static_space = tls_last_offset + RTLD_STATIC_TLS_EXTRA;
tls_static_space = tls_last_offset + RTLD_STATIC_TLS_EXTRA; tpval = allocate_tls(objs, NULL, 3 * sizeof(Elf_Addr),
tpval = allocate_tls(objs, NULL, 3*sizeof(Elf_Addr), sizeof(Elf_Addr)); sizeof(Elf_Addr));
__asm __volatile("mov %0, %%g7" : : "r" (tpval)); __asm __volatile("mov %0, %%g7" : : "r" (tpval));
} }
void *__tls_get_addr(tls_index *ti) void *__tls_get_addr(tls_index *ti)
{ {
register Elf_Addr** tp __asm__("%g7"); register Elf_Addr** tp __asm__("%g7");
return tls_get_addr_common(tp, ti->ti_module, ti->ti_offset); return (tls_get_addr_common(tp, ti->ti_module, ti->ti_offset));
} }

View File

@ -227,9 +227,9 @@ static const char *const reloc_names[] = {
"GLOB_DAT", "JMP_SLOT", "RELATIVE", "UA_32", "PLT32", "GLOB_DAT", "JMP_SLOT", "RELATIVE", "UA_32", "PLT32",
"HIPLT22", "LOPLT10", "LOPLT10", "PCPLT22", "PCPLT32", "HIPLT22", "LOPLT10", "LOPLT10", "PCPLT22", "PCPLT32",
"10", "11", "64", "OLO10", "HH22", "10", "11", "64", "OLO10", "HH22",
"HM10", "LM22", "PC_HH22", "PC_HM10", "PC_LM22", "HM10", "LM22", "PC_HH22", "PC_HM10", "PC_LM22",
"WDISP16", "WDISP19", "GLOB_JMP", "7", "5", "6", "WDISP16", "WDISP19", "GLOB_JMP", "7", "5", "6",
"DISP64", "PLT64", "HIX22", "LOX10", "H44", "M44", "DISP64", "PLT64", "HIX22", "LOX10", "H44", "M44",
"L44", "REGISTER", "UA64", "UA16" "L44", "REGISTER", "UA64", "UA16"
}; };
#endif #endif
@ -252,19 +252,19 @@ static const long reloc_target_bitmask[] = {
_BM(22), _BM(22), /* HI22, _22 */ _BM(22), _BM(22), /* HI22, _22 */
_BM(13), _BM(10), /* RELOC_13, _LO10 */ _BM(13), _BM(10), /* RELOC_13, _LO10 */
_BM(10), _BM(13), _BM(22), /* GOT10, GOT13, GOT22 */ _BM(10), _BM(13), _BM(22), /* GOT10, GOT13, GOT22 */
_BM(10), _BM(22), /* _PC10, _PC22 */ _BM(10), _BM(22), /* PC10, PC22 */
_BM(30), 0, /* _WPLT30, _COPY */ _BM(30), 0, /* WPLT30, COPY */
_BM(32), _BM(32), _BM(32), /* _GLOB_DAT, JMP_SLOT, _RELATIVE */ _BM(32), _BM(32), _BM(32), /* GLOB_DAT, JMP_SLOT, RELATIVE */
_BM(32), _BM(32), /* _UA32, PLT32 */ _BM(32), _BM(32), /* UA32, PLT32 */
_BM(22), _BM(10), /* _HIPLT22, LOPLT10 */ _BM(22), _BM(10), /* HIPLT22, LOPLT10 */
_BM(32), _BM(22), _BM(10), /* _PCPLT32, _PCPLT22, _PCPLT10 */ _BM(32), _BM(22), _BM(10), /* PCPLT32, _PCPLT22, _PCPLT10 */
_BM(10), _BM(11), -1, /* _10, _11, _64 */ _BM(10), _BM(11), -1, /* 10, 11, 64 */
_BM(13), _BM(22), /* _OLO10, _HH22 */ _BM(13), _BM(22), /* OLO10, HH22 */
_BM(10), _BM(22), /* _HM10, _LM22 */ _BM(10), _BM(22), /* HM10, LM22 */
_BM(22), _BM(10), _BM(22), /* _PC_HH22, _PC_HM10, _PC_LM22 */ _BM(22), _BM(10), _BM(22), /* PC_HH22, PC_HM10, PC_LM22 */
_BM(16), _BM(19), /* _WDISP16, _WDISP19 */ _BM(16), _BM(19), /* WDISP16, WDISP19 */
-1, /* GLOB_JMP */ -1, /* GLOB_JMP */
_BM(7), _BM(5), _BM(6) /* _7, _5, _6 */ _BM(7), _BM(5), _BM(6) /* 7, 5, 6 */
-1, -1, /* DISP64, PLT64 */ -1, -1, /* DISP64, PLT64 */
_BM(22), _BM(13), /* HIX22, LOX10 */ _BM(22), _BM(13), /* HIX22, LOX10 */
_BM(22), _BM(10), _BM(13), /* H44, M44, L44 */ _BM(22), _BM(10), _BM(13), /* H44, M44, L44 */