fix weak[BS] symbol bug in xcoff linker

This commit is contained in:
Wolfgang Thaller 2023-12-12 20:37:40 +01:00
parent c0d4e00b35
commit 6ac29f751a

View File

@ -1965,6 +1965,8 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
if (xcoff_link_add_symbols_to_hash_table (sym, aux)) if (xcoff_link_add_symbols_to_hash_table (sym, aux))
{ {
csect->flags |= SEC_IS_COMMON; csect->flags |= SEC_IS_COMMON;
// Retro68: see AutomatedTests/LocalStatic.cc
if (sym.n_sclass != C_AIX_WEAKEXT)
csect->size = 0; csect->size = 0;
section = csect; section = csect;
value = aux.x_csect.x_scnlen.l; value = aux.x_csect.x_scnlen.l;
@ -2172,8 +2174,12 @@ xcoff_link_add_symbols (bfd *abfd, struct bfd_link_info *info)
{ {
if ((*sym_hash)->root.type != bfd_link_hash_common if ((*sym_hash)->root.type != bfd_link_hash_common
|| (*sym_hash)->root.u.c.p->section != csect) || (*sym_hash)->root.u.c.p->section != csect)
{
// Retro68: see AutomatedTests/LocalStatic.cc
if ((*sym_hash)->root.type != bfd_link_hash_defweak)
/* We don't need the common csect we just created. */ /* We don't need the common csect we just created. */
csect->size = 0; csect->size = 0;
}
else else
(*sym_hash)->root.u.c.p->alignment_power (*sym_hash)->root.u.c.p->alignment_power
= csect->alignment_power; = csect->alignment_power;