mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 09:08:59 +00:00
objcopy: Allow making symbol global and weak on same invocation
Previously objcopy had to be run twice in order to make a local symbol weak, first once to globalize it, and once again to mark it as weak. * objcopy.c (filter_symbols): Weaken symbols after making local/global changes. * testsuite/binutils-all/symbols-5.d, * testsuite/binutils-all/symbols-5.s: New test.
This commit is contained in:
committed by
Alan Modra
parent
01a8854406
commit
ebe3f6d0f1
@@ -1730,14 +1730,6 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
|
||||
|
||||
if (keep)
|
||||
{
|
||||
if (((flags & (BSF_GLOBAL | BSF_GNU_UNIQUE))
|
||||
|| undefined)
|
||||
&& (weaken || is_specified_symbol (name, weaken_specific_htab)))
|
||||
{
|
||||
sym->flags &= ~ (BSF_GLOBAL | BSF_GNU_UNIQUE);
|
||||
sym->flags |= BSF_WEAK;
|
||||
}
|
||||
|
||||
if (!undefined
|
||||
&& (flags & (BSF_GLOBAL | BSF_WEAK))
|
||||
&& (is_specified_symbol (name, localize_specific_htab)
|
||||
@@ -1745,18 +1737,27 @@ filter_symbols (bfd *abfd, bfd *obfd, asymbol **osyms,
|
||||
&& ! is_specified_symbol (name, keepglobal_specific_htab))
|
||||
|| (localize_hidden && is_hidden_symbol (sym))))
|
||||
{
|
||||
sym->flags &= ~ (BSF_GLOBAL | BSF_WEAK);
|
||||
sym->flags |= BSF_LOCAL;
|
||||
flags &= ~(BSF_GLOBAL | BSF_WEAK);
|
||||
flags |= BSF_LOCAL;
|
||||
}
|
||||
|
||||
if (!undefined
|
||||
&& (flags & BSF_LOCAL)
|
||||
&& is_specified_symbol (name, globalize_specific_htab))
|
||||
else if (!undefined
|
||||
&& (flags & BSF_LOCAL)
|
||||
&& is_specified_symbol (name, globalize_specific_htab))
|
||||
{
|
||||
sym->flags &= ~ BSF_LOCAL;
|
||||
sym->flags |= BSF_GLOBAL;
|
||||
flags &= ~BSF_LOCAL;
|
||||
flags |= BSF_GLOBAL;
|
||||
}
|
||||
|
||||
if (((flags & (BSF_GLOBAL | BSF_GNU_UNIQUE))
|
||||
|| undefined)
|
||||
&& (weaken || is_specified_symbol (name, weaken_specific_htab)))
|
||||
{
|
||||
flags &= ~(BSF_GLOBAL | BSF_GNU_UNIQUE);
|
||||
flags |= BSF_WEAK;
|
||||
}
|
||||
|
||||
sym->flags = flags;
|
||||
to[dst_count++] = sym;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user