aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-ppc.c
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2011-03-30 12:43:35 +0000
committerTristan Gingold <gingold@adacore.com>2011-03-30 12:43:35 +0000
commitc734e7e3836935c1dab4e13e79b250bcd044a7fa (patch)
tree3ae1413ae4b01e250078a77f03bacd526a51ea17 /gas/config/tc-ppc.c
parent311e6ab30022fff4f28ded704a180e743f24aa1a (diff)
downloadgdb-c734e7e3836935c1dab4e13e79b250bcd044a7fa.zip
gdb-c734e7e3836935c1dab4e13e79b250bcd044a7fa.tar.gz
gdb-c734e7e3836935c1dab4e13e79b250bcd044a7fa.tar.bz2
2011-03-30 Tristan Gingold <gingold@adacore.com>
* config/tc-ppc.c (ppc_frob_symbol): Convert stsym symbols value to offset only if within is set. (ppc_stabx): Reformat. For stsym stabs, add a check and set within only for symbols.
Diffstat (limited to 'gas/config/tc-ppc.c')
-rw-r--r--gas/config/tc-ppc.c55
1 files changed, 33 insertions, 22 deletions
diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c
index 4396e14..045a8aa 100644
--- a/gas/config/tc-ppc.c
+++ b/gas/config/tc-ppc.c
@@ -3747,28 +3747,30 @@ ppc_stabx (int ignore ATTRIBUTE_UNUSED)
symbol_get_tc (sym)->output = 1;
- if (S_GET_STORAGE_CLASS (sym) == C_STSYM) {
-
- symbol_get_tc (sym)->within = ppc_current_block;
+ if (S_GET_STORAGE_CLASS (sym) == C_STSYM)
+ {
+ /* In this case :
- /* In this case :
+ .bs name
+ .stabx "z",arrays_,133,0
+ .es
- .bs name
- .stabx "z",arrays_,133,0
- .es
+ .comm arrays_,13768,3
- .comm arrays_,13768,3
+ resolve_symbol_value will copy the exp's "within" into sym's when the
+ offset is 0. Since this seems to be corner case problem,
+ only do the correction for storage class C_STSYM. A better solution
+ would be to have the tc field updated in ppc_symbol_new_hook. */
- resolve_symbol_value will copy the exp's "within" into sym's when the
- offset is 0. Since this seems to be corner case problem,
- only do the correction for storage class C_STSYM. A better solution
- would be to have the tc field updated in ppc_symbol_new_hook. */
+ if (exp.X_op == O_symbol)
+ {
+ if (ppc_current_block == NULL)
+ as_bad (_(".stabx of storage class stsym must be within .bs/.es"));
- if (exp.X_op == O_symbol)
- {
- symbol_get_tc (exp.X_add_symbol)->within = ppc_current_block;
- }
- }
+ symbol_get_tc (sym)->within = ppc_current_block;
+ symbol_get_tc (exp.X_add_symbol)->within = ppc_current_block;
+ }
+ }
if (exp.X_op != O_symbol
|| ! S_IS_EXTERNAL (exp.X_add_symbol)
@@ -5401,13 +5403,22 @@ ppc_frob_symbol (symbolS *sym)
else if (S_GET_STORAGE_CLASS (sym) == C_STSYM)
{
symbolS *block;
- symbolS *csect;
+ valueT base;
- /* The value is the offset from the enclosing csect. */
block = symbol_get_tc (sym)->within;
- csect = symbol_get_tc (block)->within;
- resolve_symbol_value (csect);
- S_SET_VALUE (sym, S_GET_VALUE (sym) - S_GET_VALUE (csect));
+ if (block)
+ {
+ /* The value is the offset from the enclosing csect. */
+ symbolS *csect;
+
+ csect = symbol_get_tc (block)->within;
+ resolve_symbol_value (csect);
+ base = S_GET_VALUE (csect);
+ }
+ else
+ base = 0;
+
+ S_SET_VALUE (sym, S_GET_VALUE (sym) - base);
}
else if (S_GET_STORAGE_CLASS (sym) == C_BINCL
|| S_GET_STORAGE_CLASS (sym) == C_EINCL)