aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@mips.com>2018-07-18 17:51:54 +0100
committerMaciej W. Rozycki <macro@mips.com>2018-07-18 17:51:54 +0100
commitd3554ec1ed057f4ecfee35d4bec81f9d5a545cb1 (patch)
treefa739a4700b5ffe960f56bd741cb5288bc80b13d /bfd
parent972450a72cb9e75a5dda614d29b04bf738d38cb0 (diff)
downloadgdb-d3554ec1ed057f4ecfee35d4bec81f9d5a545cb1.zip
gdb-d3554ec1ed057f4ecfee35d4bec81f9d5a545cb1.tar.gz
gdb-d3554ec1ed057f4ecfee35d4bec81f9d5a545cb1.tar.bz2
BFD/XCOFF: Fix storage class setting for weak defined symbols
Fix an issue with commit 8602d4fea60d ("Add AIX weak support"), <https://sourceware.org/ml/binutils/2009-03/msg00189.html>, and use the correct condition to set the storage class for weak defined symbols. The context here is as follows: else if ((h->root.type == bfd_link_hash_defined || h->root.type == bfd_link_hash_defweak) && h->smclas == XMC_XO) { BFD_ASSERT (bfd_is_abs_section (h->root.u.def.section)); isym.n_value = h->root.u.def.value; isym.n_scnum = N_UNDEF; if (h->root.type == bfd_link_hash_undefweak && C_WEAKEXT == C_AIX_WEAKEXT) isym.n_sclass = C_WEAKEXT; else isym.n_sclass = C_EXT; aux.x_csect.x_smtyp = XTY_ER; } so clearly the inner condition can never be true. Correct the condition then to check for the `bfd_link_hash_defweak' symbol type instead here, and in a similar place a little further down in the same function. bfd/ * xcofflink.c (xcoff_write_global_symbol): Fix symbol type checks for defined weak symbols.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/xcofflink.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 8dce930..c5960e6 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-18 Maciej W. Rozycki <macro@mips.com>
+
+ * xcofflink.c (xcoff_write_global_symbol): Fix symbol type
+ checks for defined weak symbols.
+
2018-07-17 Maciej W. Rozycki <macro@mips.com>
* elf32-nds32.c (nds32_elf_relax_loadstore): Use
diff --git a/bfd/xcofflink.c b/bfd/xcofflink.c
index b7a50de..9705d30 100644
--- a/bfd/xcofflink.c
+++ b/bfd/xcofflink.c
@@ -5589,7 +5589,7 @@ xcoff_write_global_symbol (struct bfd_hash_entry *bh, void * inf)
BFD_ASSERT (bfd_is_abs_symbol (&h->root));
isym.n_value = h->root.u.def.value;
isym.n_scnum = N_UNDEF;
- if (h->root.type == bfd_link_hash_undefweak
+ if (h->root.type == bfd_link_hash_defweak
&& C_WEAKEXT == C_AIX_WEAKEXT)
isym.n_sclass = C_WEAKEXT;
else
@@ -5655,7 +5655,7 @@ xcoff_write_global_symbol (struct bfd_hash_entry *bh, void * inf)
/* We just output an SD symbol. Now output an LD symbol. */
h->indx += 2;
- if (h->root.type == bfd_link_hash_undefweak
+ if (h->root.type == bfd_link_hash_defweak
&& C_WEAKEXT == C_AIX_WEAKEXT)
isym.n_sclass = C_WEAKEXT;
else