Explain some reloc hackery
just changes a comment; it's not specific to __dso_handle, but general to all hidden defined symbols for shared libraries.
This commit is contained in:
parent
60eac659d4
commit
b117088a91
1 changed files with 3 additions and 1 deletions
4
tccelf.c
4
tccelf.c
|
@ -1048,7 +1048,9 @@ static int prepare_dynamic_rel(TCCState *s1, Section *sr)
|
||||||
{
|
{
|
||||||
ElfW(Sym) *sym = &((ElfW(Sym) *)symtab_section->data)[sym_index];
|
ElfW(Sym) *sym = &((ElfW(Sym) *)symtab_section->data)[sym_index];
|
||||||
|
|
||||||
/* support __dso_handle in atexit() */
|
/* Hidden defined symbols can and must be resolved locally.
|
||||||
|
We're misusing a PLT32 reloc for this, as that's always
|
||||||
|
resolved to its address even in shared libs. */
|
||||||
if (sym->st_shndx != SHN_UNDEF &&
|
if (sym->st_shndx != SHN_UNDEF &&
|
||||||
ELFW(ST_VISIBILITY)(sym->st_other) == STV_HIDDEN) {
|
ELFW(ST_VISIBILITY)(sym->st_other) == STV_HIDDEN) {
|
||||||
rel->r_info = ELFW(R_INFO)(sym_index, R_X86_64_PLT32);
|
rel->r_info = ELFW(R_INFO)(sym_index, R_X86_64_PLT32);
|
||||||
|
|
Loading…
Add table
Reference in a new issue