off_t shstroff;
unsigned char *names;
unsigned int i;
+ int changed;
int *pfnret;
const char **pfnname;
/* Mark sections as preserved that are required by to be preserved
sections. */
- int changed;
do
{
changed = 0;
and __gnu_lto_slim which otherwise cause endless
LTO plugin invocation. */
if (st_shndx == SHN_COMMON)
- /* Setting st_name to "" seems to work to purge
- COMMON symbols (in addition to setting their
- size to zero). */
discard = 1;
/* We also need to remove symbols refering to sections
we'll eventually remove as with fat LTO objects
/* Make discarded symbols undefined and unnamed
in case it is local. */
int bind = ELF_ST_BIND (*st_info);
+ int other = STV_DEFAULT;
+ size_t st_name;
+
if (bind == STB_LOCAL)
- {
- ELF_SET_FIELD (type_functions, ei_class, Sym,
- ent, st_name, Elf_Word, 0);
- *st_other = STV_DEFAULT;
- }
+ ELF_SET_FIELD (type_functions, ei_class, Sym,
+ ent, st_name, Elf_Word, 0);
else
{
bind = STB_WEAK;
- *st_other = STV_HIDDEN;
+ st_name = ELF_FETCH_FIELD (type_functions, ei_class,
+ Sym, ent, st_name,
+ Elf_Word);
+ if (st_name < strsz)
+ {
+ char *p = strings + st_name;
+ if (p[0] == '_'
+ && p[1] == '_'
+ && strncmp (p + (p[2] == '_'),
+ "__gnu_lto_", 10) == 0)
+ other = STV_HIDDEN;
+ }
}
+ *st_other = other;
*st_info = ELF_ST_INFO (bind, STT_NOTYPE);
ELF_SET_FIELD (type_functions, ei_class, Sym,
ent, st_value, Elf_Addr, 0);