diff options
author | Clément Chigot <clement.chigot@atos.net> | 2021-07-27 14:37:50 +0200 |
---|---|---|
committer | Clément Chigot <clement.chigot@atos.net> | 2021-07-29 10:55:22 +0200 |
commit | cd026728f3bcba878293f9c38f8760512755ed73 (patch) | |
tree | c4ae58abb4e2179b87a068f35b94b4afccf4f099 /gas/config/tc-ppc.c | |
parent | ad42014be254b402f7a44e578cc709fe9e30dc1d (diff) | |
download | gdb-cd026728f3bcba878293f9c38f8760512755ed73.zip gdb-cd026728f3bcba878293f9c38f8760512755ed73.tar.gz gdb-cd026728f3bcba878293f9c38f8760512755ed73.tar.bz2 |
gas: improve C_BSTAT and C_STSYM symbols handling on XCOFF
A C_BSTAT debug symbol specifies the beginning of a static block.
Its n_value is the index of the csect containing static symbols.
A C_STSYM debug symbol represents the stabstring of a statically
allocated symbol. Its n_value is the offset in the csect pointed
by the containing C_BSTAT.
These two special n_value were not correctly handled both when
generating object files with gas or when reading them with objdump.
This patch tries to improve that and, above all, to allow gas-generated
object files with such symbols to be accepted by AIX ld.
bfd/
* coff-bfd.c (bfd_coff_get_syment): Adjust n_value of symbols
having fix_value = 1 in order to be an index and not a memory
offset.
* coffgen.c (coff_get_symbol_info): Likewize.
(coff_print_symbol): Likewize.
gas/
* config/tc-ppc.c (ppc_frob_label): Don't change within if
already set.
(ppc_stabx): Remove workaround changing exp.X_add_symbol's
within.
* config/tc-ppc.h (struct ppc_tc_sy): Update comments.
* symbols.c (resolve_symbol_value): Remove symbol update
when final_val is 0 and it's an AIX debug symbol.
* testsuite/gas/ppc/aix.exp: Add new tests.
* testsuite/gas/ppc/xcoff-stsym-32.d: New test.
* testsuite/gas/ppc/xcoff-stsym-64.d: New test.
* testsuite/gas/ppc/xcoff-stsym.s: New test.
Diffstat (limited to 'gas/config/tc-ppc.c')
-rw-r--r-- | gas/config/tc-ppc.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 6eeb98c..8c3b0a8 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -2901,8 +2901,13 @@ ppc_frob_label (symbolS *sym) symbol_remove (sym, &symbol_rootP, &symbol_lastP); symbol_append (sym, symbol_get_tc (ppc_current_csect)->within, &symbol_rootP, &symbol_lastP); + /* Update last csect symbol. */ symbol_get_tc (ppc_current_csect)->within = sym; - symbol_get_tc (sym)->within = ppc_current_csect; + + /* Some labels like .bs are using within differently. + So avoid changing it, if it's already set. */ + if (symbol_get_tc (sym)->within == NULL) + symbol_get_tc (sym)->within = ppc_current_csect; } #endif @@ -5056,7 +5061,6 @@ ppc_stabx (int ignore ATTRIBUTE_UNUSED) as_bad (_(".stabx of storage class stsym must be within .bs/.es")); symbol_get_tc (sym)->within = ppc_current_block; - symbol_get_tc (exp.X_add_symbol)->within = ppc_current_block; } } |