PR82575, lto debugobj references __gnu_lto_slim, ld test liblto-17 fails
If __gnu_lto_slim is global, undefined, default visibility in the early debug object, then it finds its way into .dynsym when creating shared libraries. __gnu_lto_slim in a symbol table (.dynsym or .symtab) signals nm and other binutils that the object is an LTO object needing a plugin, but that isn't the case for the ld liblti-17 tests. So, make __gnu_lto_slim hidden to prevent it becoming dynamic. Further, make it weak because some linkers may warn on finding an undefined global non-default visibility symbol. PR lto/82575 * simple-object-elf.c (simple_object_elf_copy_lto_debug_sections): Make discarded non-local symbols weak and hidden. From-SVN: r253914
This commit is contained in:
parent
ef9eec0b59
commit
ebd208bf7b
@ -1,3 +1,9 @@
|
||||
2017-10-20 Alan Modra <amodra@gmail.com>
|
||||
|
||||
PR lto/82575
|
||||
* simple-object-elf.c (simple_object_elf_copy_lto_debug_sections):
|
||||
Make discarded non-local symbols weak and hidden.
|
||||
|
||||
2017-10-18 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR lto/82598
|
||||
|
@ -236,8 +236,10 @@ typedef struct
|
||||
|
||||
#define STB_LOCAL 0 /* Local symbol */
|
||||
#define STB_GLOBAL 1 /* Global symbol */
|
||||
#define STB_WEAK 2 /* Weak global */
|
||||
|
||||
#define STV_DEFAULT 0 /* Visibility is specified by binding type */
|
||||
#define STV_HIDDEN 2 /* Can only be seen inside currect component */
|
||||
|
||||
/* Functions to fetch and store different ELF types, depending on the
|
||||
endianness and size. */
|
||||
@ -1365,18 +1367,25 @@ simple_object_elf_copy_lto_debug_sections (simple_object_read *sobj,
|
||||
{
|
||||
/* Make discarded symbols undefined and unnamed
|
||||
in case it is local. */
|
||||
if (ELF_ST_BIND (*st_info) == STB_LOCAL)
|
||||
ELF_SET_FIELD (type_functions, ei_class, Sym,
|
||||
ent, st_name, Elf_Word, 0);
|
||||
int bind = ELF_ST_BIND (*st_info);
|
||||
if (bind == STB_LOCAL)
|
||||
{
|
||||
ELF_SET_FIELD (type_functions, ei_class, Sym,
|
||||
ent, st_name, Elf_Word, 0);
|
||||
*st_other = STV_DEFAULT;
|
||||
}
|
||||
else
|
||||
{
|
||||
bind = STB_WEAK;
|
||||
*st_other = STV_HIDDEN;
|
||||
}
|
||||
*st_info = ELF_ST_INFO (bind, STT_NOTYPE);
|
||||
ELF_SET_FIELD (type_functions, ei_class, Sym,
|
||||
ent, st_value, Elf_Addr, 0);
|
||||
ELF_SET_FIELD (type_functions, ei_class, Sym,
|
||||
ent, st_size, Elf_Word, 0);
|
||||
ELF_SET_FIELD (type_functions, ei_class, Sym,
|
||||
ent, st_shndx, Elf_Half, SHN_UNDEF);
|
||||
*st_info = ELF_ST_INFO (ELF_ST_BIND (*st_info),
|
||||
STT_NOTYPE);
|
||||
*st_other = STV_DEFAULT;
|
||||
}
|
||||
}
|
||||
XDELETEVEC (strings);
|
||||
|
Loading…
Reference in New Issue
Block a user