aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-10-29 16:37:24 +1030
committerAlan Modra <amodra@gmail.com>2018-10-29 18:20:48 +1030
commit8d1015a887c18c363d9bd707b13348daf4e5f556 (patch)
tree175c0d6aeaa6c53e718e0bf0bd5cadf8285660d7 /gas/config
parentc2e863866d9b206c387d8fdc0f1bfa9f246e4355 (diff)
downloadgdb-8d1015a887c18c363d9bd707b13348daf4e5f556.zip
gdb-8d1015a887c18c363d9bd707b13348daf4e5f556.tar.gz
gdb-8d1015a887c18c363d9bd707b13348daf4e5f556.tar.bz2
Move struc-symbol.h to symbols.c
This file was never supposed to be widely used. The fact that it has found its way into many gas files led to bugs, typically when code expecting a symbolS* to point at a struct symbol is presented with a struct local_symbol. Also, commit 158184ac9e changed these structs in 2012 but didn't catch all places where symbol bsym was being used to test for a local_symbol. * Makefile.am (HFILES): Delete struc-symbol.h. * doc/internals.texi: Delete struc-symbol.h reference and out of date local symbol description. * struc-symbol.h: Delete. Move contents to.. * symbols.c: ..here. (symbol_on_chain, symbol_symbolS): New functions. * symbols.h (symbol_on_chain, symbol_symbolS): Declare. * cgen.c: Don't #include struc-symbol.h. (gas_cgen_parse_operand): Don't test for local_symbol using bsym, instead call symbol_symbolS. Use symbol_get_bfdsym. (weak_operand_overflow_check, make_right_shifted_expr): Use symbol accessors. * config/obj-coff.c: Don't #include struc-symbol.h. (GET_FILENAME_STRING): Delete. * config/obj-elf.c: Don't #include struc-symbol.h. (elf_file_symbol): Use symbol accessors. (elf_adjust_symtab): Call symbol_on_chain. * config/obj-evax.c: Don't #include struc-symbol.h. * config/tc-nds32.c: Likewise. * config/tc-rl78.c: Likewise. * config/tc-rx.c: Likewise. * config/tc-alpha.c: Likewise. (add_to_link_pool, s_alpha_comm): Use symbol accessors. * config/tc-arc.c: Don't #include struc-symbol.h. (arc_check_relocs): Use symbol accessors, testing gas symbol section rather than bfd symbol section. * config/tc-avr.c: Don't #include struc-symbol.h. (avr_patch_gccisr_frag): Use symbol accessors. * config/tc-bfin.c: Don't #include struc-symbol.h. (bfin_loop_beginend): Use symbol accessors. * config/tc-csky.c: Don't #include struc-symbol.h. (v2_work_movih, v2_work_ori): Use symbol accessors. Check for absolute symbol as well as O_constant. * config/tc-riscv.c: Don't #include struc-symbol.h. (riscv_pre_output_hook): Use symbol accessors. * config/tc-s390.c: Don't #include struc-symbol.h. (s390_literals): Use symbol accessors. * config/tc-score.c (s3_build_la_pic, s3_build_lwst_pic): Use symbol accessors. (s3_relax_branch_inst16, s3_relax_cmpbranch_inst32): Don't test symbol bsym. * config/tc-score7.c: Don't #include struc-symbol.h. (s7_build_la_pic, s7_build_lwst_pic): Use symbol accessors. (s7_b32_relax_to_b16): Don't test symbol bsym. * config/tc-sh.c: Don't #include struc-symbol.h. (insert_loop_bounds): Use symbol accessors. (sh_frob_section): Remove bogus symbol canonicalization. * config/tc-tic54x.c: Don't #include struc-symbol.h. (tic54x_bss): Use symbol accessors. * config/tc-tilegx.c: Don't #include struc-symbol.h. (emit_tilegx_instruction, tilegx_parse_name): Use symbol accessors. * config/tc-tilepro.c: Don't #include struc-symbol.h. (emit_tilepro_instruction, tilepro_parse_name): Use accessors. * config/tc-xtensa.c: Don't #include struc-symbol.h. (xg_assemble_vliw_tokens): Use symbol accessors. (xg_order_trampoline_chain): Likewise. * ehopt.c: Don't #include struc-symbol.h. (check_eh_frame): Correct local symbol test. Use symbol accessors. * write.c: Don't #include struc-symbol.h. (create_note_reloc, maybe_generate_build_notes): Use symbol accessors. * Makefile.in: Regenerate. * po/POTFILES.in: Regenerate.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/obj-coff.c4
-rw-r--r--gas/config/obj-elf.c17
-rw-r--r--gas/config/obj-evax.c1
-rw-r--r--gas/config/tc-alpha.c7
-rw-r--r--gas/config/tc-arc.c3
-rw-r--r--gas/config/tc-avr.c4
-rw-r--r--gas/config/tc-bfin.c3
-rw-r--r--gas/config/tc-csky.c11
-rw-r--r--gas/config/tc-nds32.c1
-rw-r--r--gas/config/tc-riscv.c10
-rw-r--r--gas/config/tc-rl78.c1
-rw-r--r--gas/config/tc-rx.c1
-rw-r--r--gas/config/tc-s390.c5
-rw-r--r--gas/config/tc-score.c31
-rw-r--r--gas/config/tc-score7.c25
-rw-r--r--gas/config/tc-sh.c22
-rw-r--r--gas/config/tc-tic54x.c3
-rw-r--r--gas/config/tc-tilegx.c11
-rw-r--r--gas/config/tc-tilepro.c11
-rw-r--r--gas/config/tc-xtensa.c20
20 files changed, 75 insertions, 116 deletions
diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c
index e459324..945b4ec 100644
--- a/gas/config/obj-coff.c
+++ b/gas/config/obj-coff.c
@@ -23,7 +23,6 @@
#include "as.h"
#include "safe-ctype.h"
#include "subsegs.h"
-#include "struc-symbol.h"
#ifdef TE_PE
#include "coff/pe.h"
@@ -236,9 +235,6 @@ obj_coff_comm (int ignore ATTRIBUTE_UNUSED)
}
#endif /* TE_PE */
-#define GET_FILENAME_STRING(X) \
- ((char *) (&((X)->sy_symbol.ost_auxent->x_file.x_n.x_offset))[1])
-
/* @@ Ick. */
static segT
fetch_coff_debug_section (void)
diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c
index 3a7e39e..a674c1b 100644
--- a/gas/config/obj-elf.c
+++ b/gas/config/obj-elf.c
@@ -23,7 +23,6 @@
#include "safe-ctype.h"
#include "subsegs.h"
#include "obstack.h"
-#include "struc-symbol.h"
#include "dwarf2dbg.h"
#ifndef ECOFF_DEBUGGING
@@ -261,10 +260,12 @@ elf_sec_sym_ok_for_reloc (asection *sec)
void
elf_file_symbol (const char *s, int appfile)
{
+ asymbol *bsym;
+
if (!appfile
|| symbol_rootP == NULL
- || symbol_rootP->bsym == NULL
- || (symbol_rootP->bsym->flags & BSF_FILE) == 0)
+ || (bsym = symbol_get_bfdsym (symbol_rootP)) == NULL
+ || (bsym->flags & BSF_FILE) == 0)
{
symbolS *sym;
size_t name_length;
@@ -284,8 +285,8 @@ elf_file_symbol (const char *s, int appfile)
symbol_get_bfdsym (sym)->flags |= BSF_FILE;
if (symbol_rootP != sym
- && (symbol_rootP->bsym == NULL
- || !(symbol_rootP->bsym->flags & BSF_FILE)))
+ && ((bsym = symbol_get_bfdsym (symbol_rootP)) == NULL
+ || (bsym->flags & BSF_FILE) == 0))
{
symbol_remove (sym, &symbol_rootP, &symbol_lastP);
symbol_insert (sym, symbol_rootP, &symbol_rootP, &symbol_lastP);
@@ -2469,11 +2470,7 @@ elf_adjust_symtab (void)
/* Make sure that the signature symbol for the group has the
name of the group. */
sy = symbol_find_exact (group_name);
- if (!sy
- || (sy != symbol_lastP
- && (sy->sy_flags.sy_local_symbol
- || sy->sy_next == NULL
- || sy->sy_next->sy_previous != sy)))
+ if (!sy || !symbol_on_chain (sy, symbol_rootP, symbol_lastP))
{
/* Create the symbol now. */
sy = symbol_new (group_name, now_seg, (valueT) 0, frag_now);
diff --git a/gas/config/obj-evax.c b/gas/config/obj-evax.c
index 07a7067..f30db8c 100644
--- a/gas/config/obj-evax.c
+++ b/gas/config/obj-evax.c
@@ -27,7 +27,6 @@
#include "bfd.h"
#include "vms.h"
#include "subsegs.h"
-#include "struc-symbol.h"
#include "safe-ctype.h"
static void s_evax_weak (int);
diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c
index 7791811..25ba86a 100644
--- a/gas/config/tc-alpha.c
+++ b/gas/config/tc-alpha.c
@@ -49,7 +49,6 @@
#include "as.h"
#include "subsegs.h"
-#include "struc-symbol.h"
#include "ecoff.h"
#include "opcode/alpha.h"
@@ -3400,7 +3399,9 @@ add_to_link_pool (symbolS *sym, offsetT addend)
&& fixp->fx_offset == (valueT)addend
&& fixp->tc_fix_data.info
&& fixp->tc_fix_data.info->sym
- && fixp->tc_fix_data.info->sym->sy_value.X_op_symbol == basesym)
+ && symbol_symbolS (fixp->tc_fix_data.info->sym)
+ && (symbol_get_value_expression (fixp->tc_fix_data.info->sym)
+ ->X_op_symbol == basesym))
return fixp->tc_fix_data.info->sym;
}
@@ -3628,7 +3629,7 @@ s_alpha_comm (int ignore ATTRIBUTE_UNUSED)
}
#ifndef OBJ_EVAX
- know (symbolP->sy_frag == &zero_address_frag);
+ know (symbol_get_frag (symbolP) == &zero_address_frag);
#endif
demand_empty_rest_of_line ();
}
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index a9b3f1a..fa5fa93 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -22,7 +22,6 @@
#include "as.h"
#include "subsegs.h"
-#include "struc-symbol.h"
#include "dwarf2dbg.h"
#include "dw2gencfi.h"
#include "safe-ctype.h"
@@ -4211,7 +4210,7 @@ arc_check_reloc (expressionS *exp,
if (*r_type_p == BFD_RELOC_32
&& exp->X_op == O_subtract
&& exp->X_op_symbol != NULL
- && exp->X_op_symbol->bsym->section == now_seg)
+ && S_GET_SEGMENT (exp->X_op_symbol) == now_seg)
*r_type_p = BFD_RELOC_ARC_32_PCREL;
}
diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c
index d628c95..e3dc31a 100644
--- a/gas/config/tc-avr.c
+++ b/gas/config/tc-avr.c
@@ -23,7 +23,6 @@
#include "as.h"
#include "safe-ctype.h"
#include "subsegs.h"
-#include "struc-symbol.h"
#include "dwarf2dbg.h"
#include "dw2gencfi.h"
#include "elf/avr.h"
@@ -2628,8 +2627,7 @@ avr_patch_gccisr_frag (fragS *fr, int reg)
symbolS *sy = avr_isr.sym_n_pushed;
/* Turn magic `__gcc_isr.n_pushed' into its now known value. */
- sy->sy_value.X_op = O_constant;
- sy->sy_value.X_add_number = n_pushed;
+ S_SET_VALUE (sy, n_pushed);
S_SET_SEGMENT (sy, expr_section);
avr_isr.sym_n_pushed = NULL;
}
diff --git a/gas/config/tc-bfin.c b/gas/config/tc-bfin.c
index 56de14f..e6cb663 100644
--- a/gas/config/tc-bfin.c
+++ b/gas/config/tc-bfin.c
@@ -19,7 +19,6 @@
02110-1301, USA. */
#include "as.h"
-#include "struc-symbol.h"
#include "bfin-defs.h"
#include "obstack.h"
#include "safe-ctype.h"
@@ -1930,7 +1929,7 @@ bfin_loop_beginend (Expr_Node *exp, int begin)
/* LOOP_END follows the last instruction in the loop.
Adjust label address. */
if (!begin)
- ((struct local_symbol *) linelabel)->lsy_value -= last_insn_size;
+ *symbol_X_add_number (linelabel) -= last_insn_size;
}
bfd_boolean
diff --git a/gas/config/tc-csky.c b/gas/config/tc-csky.c
index 1c4b44b..3ef9860 100644
--- a/gas/config/tc-csky.c
+++ b/gas/config/tc-csky.c
@@ -29,7 +29,6 @@
#include "subsegs.h"
#include "obstack.h"
#include "libiberty.h"
-#include "struc-symbol.h"
#ifdef OBJ_ELF
#include "elf/csky.h"
@@ -6783,8 +6782,9 @@ v2_work_movih (void)
|| (csky_insn.e1.X_op == O_symbol && insn_reloc != BFD_RELOC_NONE))
{
if (csky_insn.e1.X_op_symbol != 0
- && csky_insn.e1.X_op_symbol->sy_value.X_op == O_constant
- && 16 == csky_insn.e1.X_op_symbol->sy_value.X_add_number)
+ && symbol_constant_p (csky_insn.e1.X_op_symbol)
+ && S_GET_SEGMENT (csky_insn.e1.X_op_symbol) == absolute_section
+ && 16 == S_GET_VALUE (csky_insn.e1.X_op_symbol))
{
csky_insn.e1.X_op = O_symbol;
if (insn_reloc == BFD_RELOC_CKCORE_GOT32)
@@ -6833,8 +6833,9 @@ v2_work_ori (void)
}
else if (csky_insn.e1.X_op == O_bit_and)
{
- if (csky_insn.e1.X_op_symbol->sy_value.X_op == O_constant
- && 0xffff == csky_insn.e1.X_op_symbol->sy_value.X_add_number)
+ if (symbol_constant_p (csky_insn.e1.X_op_symbol)
+ && S_GET_SEGMENT (csky_insn.e1.X_op_symbol) == absolute_section
+ && 0xffff == S_GET_VALUE (csky_insn.e1.X_op_symbol))
{
csky_insn.e1.X_op = O_symbol;
if (insn_reloc == BFD_RELOC_CKCORE_GOT32)
diff --git a/gas/config/tc-nds32.c b/gas/config/tc-nds32.c
index 24dc390..e85316d 100644
--- a/gas/config/tc-nds32.c
+++ b/gas/config/tc-nds32.c
@@ -31,7 +31,6 @@
#include "hash.h"
#include "sb.h"
#include "macro.h"
-#include "struc-symbol.h"
#include "opcode/nds32.h"
#include <stdio.h>
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 91b82ed..987377a 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -28,7 +28,6 @@
#include "itbl-ops.h"
#include "dwarf2dbg.h"
#include "dw2gencfi.h"
-#include "struc-symbol.h"
#include "elf/riscv.h"
#include "opcode/riscv.h"
@@ -2620,14 +2619,13 @@ riscv_pre_output_hook (void)
if (frag->fr_type == rs_cfa)
{
expressionS exp;
+ expressionS *symval;
- symbolS *add_symbol = frag->fr_symbol->sy_value.X_add_symbol;
- symbolS *op_symbol = frag->fr_symbol->sy_value.X_op_symbol;
-
+ symval = symbol_get_value_expression (frag->fr_symbol);
exp.X_op = O_subtract;
- exp.X_add_symbol = add_symbol;
+ exp.X_add_symbol = symval->X_add_symbol;
exp.X_add_number = 0;
- exp.X_op_symbol = op_symbol;
+ exp.X_op_symbol = symval->X_op_symbol;
fix_new_exp (frag, (int) frag->fr_offset, 1, &exp, 0,
BFD_RELOC_RISCV_CFA);
diff --git a/gas/config/tc-rl78.c b/gas/config/tc-rl78.c
index 4e1c335..c8de931 100644
--- a/gas/config/tc-rl78.c
+++ b/gas/config/tc-rl78.c
@@ -19,7 +19,6 @@
02110-1301, USA. */
#include "as.h"
-#include "struc-symbol.h"
#include "safe-ctype.h"
#include "dwarf2dbg.h"
#include "elf/common.h"
diff --git a/gas/config/tc-rx.c b/gas/config/tc-rx.c
index 6c8befe..942fd35 100644
--- a/gas/config/tc-rx.c
+++ b/gas/config/tc-rx.c
@@ -19,7 +19,6 @@
02110-1301, USA. */
#include "as.h"
-#include "struc-symbol.h"
#include "safe-ctype.h"
#include "dwarf2dbg.h"
#include "elf/common.h"
diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c
index 5a485e0..6b58c4c 100644
--- a/gas/config/tc-s390.c
+++ b/gas/config/tc-s390.c
@@ -22,7 +22,6 @@
#include "as.h"
#include "safe-ctype.h"
#include "subsegs.h"
-#include "struc-symbol.h"
#include "dwarf2dbg.h"
#include "dw2gencfi.h"
@@ -1858,7 +1857,7 @@ s390_literals (int ignore ATTRIBUTE_UNUSED)
/* Emit symbol for start of literal pool. */
S_SET_SEGMENT (lp_sym, now_seg);
S_SET_VALUE (lp_sym, (valueT) frag_now_fix ());
- lp_sym->sy_frag = frag_now;
+ symbol_set_frag (lp_sym, frag_now);
while (lpe_list)
{
@@ -1866,7 +1865,7 @@ s390_literals (int ignore ATTRIBUTE_UNUSED)
lpe_list = lpe_list->next;
S_SET_SEGMENT (lpe->sym, now_seg);
S_SET_VALUE (lpe->sym, (valueT) frag_now_fix ());
- lpe->sym->sy_frag = frag_now;
+ symbol_set_frag (lpe->sym, frag_now);
/* Emit literal pool entry. */
if (lpe->reloc != BFD_RELOC_UNUSED)
diff --git a/gas/config/tc-score.c b/gas/config/tc-score.c
index c4e5ed9..fb066e3 100644
--- a/gas/config/tc-score.c
+++ b/gas/config/tc-score.c
@@ -4096,7 +4096,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
/* Fix part
For an external symbol: lw rD, <sym>($gp)
(BFD_RELOC_SCORE_GOT15 or BFD_RELOC_SCORE_CALL15) */
- sprintf (tmp, "lw_pic r%d, %s", reg_rd, add_symbol->bsym->name);
+ sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
return;
@@ -4110,7 +4110,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
addi rD, <sym> (BFD_RELOC_GOT_LO16) */
s3_inst.reloc.type = BFD_RELOC_SCORE_GOT15;
memcpy (&var_insts[0], &s3_inst, sizeof (struct s3_score_it));
- sprintf (tmp, "addi_s_pic r%d, %s", reg_rd, add_symbol->bsym->name);
+ sprintf (tmp, "addi_s_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
return;
@@ -4120,7 +4120,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
else if (add_number >= -0x8000 && add_number <= 0x7fff)
{
/* Insn 1: lw rD, <sym>($gp) (BFD_RELOC_SCORE_GOT15) */
- sprintf (tmp, "lw_pic r%d, %s", reg_rd, add_symbol->bsym->name);
+ sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
if (s3_append_insn (tmp, TRUE) == (int) s3_FAIL)
return;
@@ -4137,7 +4137,8 @@ s3_build_la_pic (int reg_rd, expressionS exp)
/* Var part
For a local symbol: addi rD, <sym>+<constant> (BFD_RELOC_GOT_LO16) */
- sprintf (tmp, "addi_s_pic r%d, %s + %d", reg_rd, add_symbol->bsym->name, (int)add_number);
+ sprintf (tmp, "addi_s_pic r%d, %s + %d", reg_rd,
+ S_GET_NAME (add_symbol), (int) add_number);
if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
return;
@@ -4150,7 +4151,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
int lo = add_number & 0x0000FFFF;
/* Insn 1: lw rD, <sym>($gp) (BFD_RELOC_SCORE_GOT15) */
- sprintf (tmp, "lw_pic r%d, %s", reg_rd, add_symbol->bsym->name);
+ sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
if (s3_append_insn (tmp, TRUE) == (int) s3_FAIL)
return;
@@ -4192,7 +4193,7 @@ s3_build_la_pic (int reg_rd, expressionS exp)
/* Var part
For a local symbol: addi r1, <sym>+LO%<constant> (BFD_RELOC_GOT_LO16) */
- sprintf (tmp, "addi_u_pic r1, %s + %d", add_symbol->bsym->name, lo);
+ sprintf (tmp, "addi_u_pic r1, %s + %d", S_GET_NAME (add_symbol), lo);
if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
return;
@@ -4860,7 +4861,7 @@ s3_build_lwst_pic (int reg_rd, expressionS exp, const char *insn_name)
/* Fix part
For an external symbol: lw rD, <sym>($gp)
(BFD_RELOC_SCORE_GOT15) */
- sprintf (tmp, "lw_pic r1, %s", add_symbol->bsym->name);
+ sprintf (tmp, "lw_pic r1, %s", S_GET_NAME (add_symbol));
if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
return;
@@ -4872,7 +4873,7 @@ s3_build_lwst_pic (int reg_rd, expressionS exp, const char *insn_name)
addi rD, <sym> (BFD_RELOC_GOT_LO16) */
s3_inst.reloc.type = BFD_RELOC_SCORE_GOT15;
memcpy (&var_insts[0], &s3_inst, sizeof (struct s3_score_it));
- sprintf (tmp, "addi_s_pic r1, %s", add_symbol->bsym->name);
+ sprintf (tmp, "addi_s_pic r1, %s", S_GET_NAME (add_symbol));
if (s3_append_insn (tmp, FALSE) == (int) s3_FAIL)
return;
@@ -6847,10 +6848,7 @@ s3_relax_branch_inst16 (fragS * fragp)
if (s == NULL)
frag_addr = 0;
else
- {
- if (s->bsym != NULL)
- symbol_address = (addressT) symbol_get_frag (s)->fr_address;
- }
+ symbol_address = (addressT) symbol_get_frag (s)->fr_address;
inst_value = s3_md_chars_to_number (fragp->fr_literal, s3_INSN16_SIZE);
offset = (inst_value & 0x1ff) << 1;
@@ -6862,7 +6860,6 @@ s3_relax_branch_inst16 (fragS * fragp)
if (relaxable_p
&& (!((value & 0xfffffe00) == 0 || (value & 0xfffffe00) == 0xfffffe00))
&& fragp->fr_fix == 2
- && (s->bsym != NULL)
&& (S_IS_DEFINED (s)
&& !S_IS_COMMON (s)
&& !S_IS_EXTERNAL (s)))
@@ -6894,10 +6891,7 @@ s3_relax_cmpbranch_inst32 (fragS * fragp)
if (s == NULL)
frag_addr = 0;
else
- {
- if (s->bsym != NULL)
- symbol_address = (addressT) symbol_get_frag (s)->fr_address;
- }
+ symbol_address = (addressT) symbol_get_frag (s)->fr_address;
inst_value = s3_md_chars_to_number (fragp->fr_literal, s3_INSN_SIZE);
offset = (inst_value & 0x1)
@@ -6921,8 +6915,7 @@ s3_relax_cmpbranch_inst32 (fragS * fragp)
/* need to translate when extern or not defined or common symbol */
else if ((relaxable_p
&& (!((value & 0xfffffe00) == 0 || (value & 0xfffffe00) == 0xfffffe00))
- && fragp->fr_fix == 4
- && (s->bsym != NULL))
+ && fragp->fr_fix == 4)
|| !S_IS_DEFINED (s)
||S_IS_COMMON (s)
||S_IS_EXTERNAL (s))
diff --git a/gas/config/tc-score7.c b/gas/config/tc-score7.c
index 12271a3..367d09c 100644
--- a/gas/config/tc-score7.c
+++ b/gas/config/tc-score7.c
@@ -27,7 +27,6 @@
#include "subsegs.h"
#include "safe-ctype.h"
#include "opcode/score-inst.h"
-#include "struc-symbol.h"
#include "libiberty.h"
#ifdef OBJ_ELF
@@ -4200,7 +4199,7 @@ s7_build_la_pic (int reg_rd, expressionS exp)
/* Fix part
For an external symbol: lw rD, <sym>($gp)
(BFD_RELOC_SCORE_GOT15 or BFD_RELOC_SCORE_CALL15) */
- sprintf (tmp, "lw_pic r%d, %s", reg_rd, add_symbol->bsym->name);
+ sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
if (s7_append_insn (tmp, FALSE) == (int) s7_FAIL)
return;
@@ -4214,7 +4213,7 @@ s7_build_la_pic (int reg_rd, expressionS exp)
addi rD, <sym> (BFD_RELOC_GOT_LO16) */
s7_inst.reloc.type = BFD_RELOC_SCORE_GOT15;
memcpy (&var_insts[0], &s7_inst, sizeof (struct s7_score_it));
- sprintf (tmp, "addi_s_pic r%d, %s", reg_rd, add_symbol->bsym->name);
+ sprintf (tmp, "addi_s_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
if (s7_append_insn (tmp, FALSE) == (int) s7_FAIL)
return;
@@ -4224,7 +4223,7 @@ s7_build_la_pic (int reg_rd, expressionS exp)
else if (add_number >= -0x8000 && add_number <= 0x7fff)
{
/* Insn 1: lw rD, <sym>($gp) (BFD_RELOC_SCORE_GOT15) */
- sprintf (tmp, "lw_pic r%d, %s", reg_rd, add_symbol->bsym->name);
+ sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
if (s7_append_insn (tmp, TRUE) == (int) s7_FAIL)
return;
@@ -4241,7 +4240,8 @@ s7_build_la_pic (int reg_rd, expressionS exp)
/* Var part
For a local symbol: addi rD, <sym>+<constant> (BFD_RELOC_GOT_LO16) */
- sprintf (tmp, "addi_s_pic r%d, %s + %d", reg_rd, add_symbol->bsym->name, (int) add_number);
+ sprintf (tmp, "addi_s_pic r%d, %s + %d", reg_rd,
+ S_GET_NAME (add_symbol), (int) add_number);
if (s7_append_insn (tmp, FALSE) == (int) s7_FAIL)
return;
@@ -4254,7 +4254,7 @@ s7_build_la_pic (int reg_rd, expressionS exp)
int lo = add_number & 0x0000FFFF;
/* Insn 1: lw rD, <sym>($gp) (BFD_RELOC_SCORE_GOT15) */
- sprintf (tmp, "lw_pic r%d, %s", reg_rd, add_symbol->bsym->name);
+ sprintf (tmp, "lw_pic r%d, %s", reg_rd, S_GET_NAME (add_symbol));
if (s7_append_insn (tmp, TRUE) == (int) s7_FAIL)
return;
@@ -4296,7 +4296,7 @@ s7_build_la_pic (int reg_rd, expressionS exp)
/* Var part
For a local symbol: addi r1, <sym>+LO%<constant> (BFD_RELOC_GOT_LO16) */
- sprintf (tmp, "addi_u_pic r1, %s + %d", add_symbol->bsym->name, lo);
+ sprintf (tmp, "addi_u_pic r1, %s + %d", S_GET_NAME (add_symbol), lo);
if (s7_append_insn (tmp, FALSE) == (int) s7_FAIL)
return;
@@ -4661,7 +4661,7 @@ s7_build_lwst_pic (int reg_rd, expressionS exp, const char *insn_name)
/* Fix part
For an external symbol: lw rD, <sym>($gp)
(BFD_RELOC_SCORE_GOT15) */
- sprintf (tmp, "lw_pic r1, %s", add_symbol->bsym->name);
+ sprintf (tmp, "lw_pic r1, %s", S_GET_NAME (add_symbol));
if (s7_append_insn (tmp, FALSE) == (int) s7_FAIL)
return;
@@ -4673,7 +4673,7 @@ s7_build_lwst_pic (int reg_rd, expressionS exp, const char *insn_name)
addi rD, <sym> (BFD_RELOC_GOT_LO16) */
s7_inst.reloc.type = BFD_RELOC_SCORE_GOT15;
memcpy (&var_insts[0], &s7_inst, sizeof (struct s7_score_it));
- sprintf (tmp, "addi_s_pic r1, %s", add_symbol->bsym->name);
+ sprintf (tmp, "addi_s_pic r1, %s", S_GET_NAME (add_symbol));
if (s7_append_insn (tmp, FALSE) == (int) s7_FAIL)
return;
@@ -5263,10 +5263,7 @@ s7_b32_relax_to_b16 (fragS * fragp)
if (s == NULL)
frag_addr = 0;
else
- {
- if (s->bsym != NULL)
- symbol_address = (addressT) symbol_get_frag (s)->fr_address;
- }
+ symbol_address = (addressT) symbol_get_frag (s)->fr_address;
value = s7_md_chars_to_number (fragp->fr_literal, s7_INSN_SIZE);
@@ -5280,7 +5277,7 @@ s7_b32_relax_to_b16 (fragS * fragp)
abs_value = 0xffffffff - abs_value + 1;
/* Relax branch 32 to branch 16. */
- if (relaxable_p && (s->bsym != NULL) && ((abs_value & 0xffffff00) == 0)
+ if (relaxable_p && ((abs_value & 0xffffff00) == 0)
&& (S_IS_DEFINED (s) && !S_IS_COMMON (s) && !S_IS_EXTERNAL (s)))
{
/* do nothing. */
diff --git a/gas/config/tc-sh.c b/gas/config/tc-sh.c
index 9b58db3..ca8fb5d 100644
--- a/gas/config/tc-sh.c
+++ b/gas/config/tc-sh.c
@@ -25,7 +25,6 @@
#define DEFINE_TABLE
#include "opcodes/sh-opc.h"
#include "safe-ctype.h"
-#include "struc-symbol.h"
#ifdef OBJ_ELF
#include "elf/sh.h"
@@ -1911,6 +1910,7 @@ insert_loop_bounds (char *output, sh_operand_info *operand)
{
static int count = 0;
char name[11];
+ expressionS *symval;
/* If the last loop insn is a two-byte-insn, it is in danger of being
swapped with the insn after it. To prevent this, create a new
@@ -1926,8 +1926,9 @@ insert_loop_bounds (char *output, sh_operand_info *operand)
SF_SET_LOCAL (end_sym);
#endif /* OBJ_COFF */
symbol_table_insert (end_sym);
- end_sym->sy_value = operand[1].immediate;
- end_sym->sy_value.X_add_number += 2;
+ symval = symbol_get_value_expression (end_sym);
+ *symval = operand[1].immediate;
+ symval->X_add_number += 2;
fix_new (frag_now, frag_now_fix (), 2, end_sym, 0, 1, BFD_RELOC_SH_LABEL);
}
@@ -2926,21 +2927,6 @@ sh_frob_section (bfd *abfd ATTRIBUTE_UNUSED, segT sec,
for (fix = seginfo->fix_root; fix != NULL; fix = fix->fx_next)
{
symbolS *sym;
-
- sym = fix->fx_addsy;
- /* Check for a local_symbol. */
- if (sym && sym->bsym == NULL)
- {
- struct local_symbol *ls = (struct local_symbol *)sym;
- /* See if it's been converted. If so, canonicalize. */
- if (local_symbol_converted_p (ls))
- fix->fx_addsy = local_symbol_get_real_symbol (ls);
- }
- }
-
- for (fix = seginfo->fix_root; fix != NULL; fix = fix->fx_next)
- {
- symbolS *sym;
bfd_vma val;
fixS *fscan;
struct sh_count_relocs info;
diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c
index 49a163d..0e2b811 100644
--- a/gas/config/tc-tic54x.c
+++ b/gas/config/tc-tic54x.c
@@ -50,7 +50,6 @@
#include "sb.h"
#include "macro.h"
#include "subsegs.h"
-#include "struc-symbol.h"
#include "opcode/tic54x.h"
#include "obj-coff.h"
#include <math.h>
@@ -506,7 +505,7 @@ tic54x_bss (int x ATTRIBUTE_UNUSED)
symbolP = symbol_find_or_make (name);
if (S_GET_SEGMENT (symbolP) == bss_section)
- symbolP->sy_frag->fr_symbol = (symbolS *) NULL;
+ symbol_get_frag (symbolP)->fr_symbol = (symbolS *) NULL;
symbol_set_frag (symbolP, frag_now);
p = frag_var (rs_org, 1, 1, (relax_substateT) 0, symbolP,
diff --git a/gas/config/tc-tilegx.c b/gas/config/tc-tilegx.c
index 8ee95e7..49e05b1 100644
--- a/gas/config/tc-tilegx.c
+++ b/gas/config/tc-tilegx.c
@@ -19,7 +19,6 @@
MA 02110-1301, USA. */
#include "as.h"
-#include "struc-symbol.h"
#include "subsegs.h"
#include "elf/tilegx.h"
@@ -737,16 +736,18 @@ emit_tilegx_instruction (tilegx_bundle_bits bits,
}
else if (use_subexp)
{
+ expressionS *sval = NULL;
/* Now that we've changed the reloc, change ha16(x) into x,
etc. */
- if (!operand_exp->X_add_symbol->sy_flags.sy_local_symbol
- && operand_exp->X_add_symbol->sy_value.X_md)
+ if (symbol_symbolS (operand_exp->X_add_symbol))
+ sval = symbol_get_value_expression (operand_exp->X_add_symbol);
+ if (sval && sval->X_md)
{
/* HACK: We used X_md to mark this symbol as a fake wrapper
around a real expression. To unwrap it, we just grab its
value here. */
- operand_exp = &operand_exp->X_add_symbol->sy_value;
+ operand_exp = sval;
if (require_symbol)
{
@@ -1067,7 +1068,7 @@ tilegx_parse_name (char *name, expressionS *e, char *nextcharP)
/* HACK: mark this symbol as a temporary wrapper around a proper
expression, so we can unwrap it later once we have communicated
the relocation type. */
- sym->sy_value.X_md = 1;
+ symbol_get_value_expression (sym)->X_md = 1;
}
memset (e, 0, sizeof *e);
diff --git a/gas/config/tc-tilepro.c b/gas/config/tc-tilepro.c
index 12bde37..7f1c905 100644
--- a/gas/config/tc-tilepro.c
+++ b/gas/config/tc-tilepro.c
@@ -19,7 +19,6 @@
MA 02110-1301, USA. */
#include "as.h"
-#include "struc-symbol.h"
#include "subsegs.h"
#include "elf/tilepro.h"
@@ -628,16 +627,18 @@ emit_tilepro_instruction (tilepro_bundle_bits bits,
}
else if (use_subexp)
{
+ expressionS *sval = NULL;
/* Now that we've changed the reloc, change ha16(x) into x,
etc. */
- if (!operand_exp->X_add_symbol->sy_flags.sy_local_symbol
- && operand_exp->X_add_symbol->sy_value.X_md)
+ if (symbol_symbolS (operand_exp->X_add_symbol))
+ sval = symbol_get_value_expression (operand_exp->X_add_symbol);
+ if (sval && sval->X_md)
{
/* HACK: We used X_md to mark this symbol as a fake wrapper
around a real expression. To unwrap it, we just grab its
value here. */
- operand_exp = &operand_exp->X_add_symbol->sy_value;
+ operand_exp = sval;
if (require_symbol)
{
@@ -958,7 +959,7 @@ tilepro_parse_name (char *name, expressionS *e, char *nextcharP)
/* HACK: mark this symbol as a temporary wrapper around a proper
expression, so we can unwrap it later once we have communicated
the relocation type. */
- sym->sy_value.X_md = 1;
+ symbol_get_value_expression (sym)->X_md = 1;
}
memset (e, 0, sizeof *e);
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index d3a2f8e..b74fb68 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -27,7 +27,6 @@
#include "xtensa-relax.h"
#include "dwarf2dbg.h"
#include "xtensa-istack.h"
-#include "struc-symbol.h"
#include "xtensa-config.h"
#include "elf/xtensa.h"
@@ -7215,10 +7214,8 @@ xg_assemble_vliw_tokens (vliw_insn *vinsn)
frag_now->tc_frag_data.slot_offsets[slot] = tinsn->offset;
frag_now->tc_frag_data.literal_frags[slot] = tinsn->literal_frag;
if (tinsn->opcode == xtensa_l32r_opcode)
- {
- frag_now->tc_frag_data.literal_frags[slot] =
- tinsn->tok[1].X_add_symbol->sy_frag;
- }
+ frag_now->tc_frag_data.literal_frags[slot]
+ = symbol_get_frag (tinsn->tok[1].X_add_symbol);
if (tinsn->literal_space != 0)
xg_assemble_literal_space (tinsn->literal_space, slot);
frag_now->tc_frag_data.free_reg[slot] = tinsn->extra_arg;
@@ -7683,14 +7680,15 @@ static int xg_order_trampoline_chain (const void *a, const void *b)
const struct trampoline_chain_entry *pb = &_pb->target;
symbolS *s1 = pa->sym;
symbolS *s2 = pb->sym;
+ symbolS *tmp;
- if (s1->sy_flags.sy_local_symbol
- && local_symbol_converted_p ((struct local_symbol *) s1))
- s1 = local_symbol_get_real_symbol ((struct local_symbol *) s1);
+ tmp = symbol_symbolS (s1);
+ if (tmp)
+ s1 = tmp;
- if (s2->sy_flags.sy_local_symbol
- && local_symbol_converted_p ((struct local_symbol *) s2))
- s2 = local_symbol_get_real_symbol ((struct local_symbol *) s2);
+ tmp = symbol_symbolS (s2);
+ if (tmp)
+ s2 = tmp;
if (s1 == s2)
if (pa->offset == pb->offset)