This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
gas tc_gen_reloc() patch
- To: binutils@sourceware.cygnus.com
- Subject: gas tc_gen_reloc() patch
- From: Jonathan Larmour <jlarmour@cygnus.co.uk>
- Date: Tue, 22 Jun 1999 19:52:16 +0000
- Organization: Cygnus Solutions
Some targets currently fail to build gas. It turns out that some changes to
symbols.h have been made so that you can't access symbolS members directly,
which requires changes in any targets that can use BFD_ASSEMBLER.
I discovered this when building mn10300, but there appear to be other
targets affected, so I thought I'd fix those as well. The patch isn't the
same for all targets since some only work with BFD_ASSEMBLER anyway.
So please put in this patch.
Thanks,
Jifl
1999-06-22 Jonathan Larmour <jlarmour@cygnus.co.uk>
* config/tc-arc.c (tc_gen_reloc): If BFD_ASSEMBLER, use
symbol_get_bfdsym(fixp->fx_addsy) to get at the symbol, rather than
just accessing the bsym member
* config/tc-d10v.c (tc_gen_reloc): Likewise
* config/tc-d30v.c (tc_gen_reloc): Likewise
* config/tc-mcore.c (tc_gen_reloc): Likewise
* config/tc-mn10200.c (tc_gen_reloc): Likewise
* config/tc-mn10300.c (tc_gen_reloc): Likewise
* config/tc-ns32k.c (tc_gen_reloc): Likewise
* config/tc-tic30.c (tc_gen_reloc): Likewise
* config/tc-v850.c (tc_gen_reloc): Likewise
--
Cygnus Solutions, 35 Cambridge Place, Cambridge, UK. Tel: +44 (1223) 728762
"I used to have an open mind but || Get yer free open source RTOS's here...
my brains kept falling out." || http://sourceware.cygnus.com/ecos
Help fight spam! http://spam.abuse.net/ These opinions are all my own fault
Index: gas/config/tc-arc.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/config/tc-arc.c,v
retrieving revision 1.1.1.1
diff -u -5 -p -r1.1.1.1 tc-arc.c
--- gas/config/tc-arc.c 1999/05/03 07:28:42 1.1.1.1
+++ gas/config/tc-arc.c 1999/06/22 19:45:57
@@ -1443,11 +1443,16 @@ tc_gen_reloc (section, fixP)
{
arelent *reloc;
reloc = (arelent *) xmalloc (sizeof (arelent));
+#ifdef BFD_ASSEMBLER
+ reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+ *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
+#else
reloc->sym_ptr_ptr = &fixP->fx_addsy->bsym;
+#endif
reloc->address = fixP->fx_frag->fr_address + fixP->fx_where;
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixP->fx_r_type);
if (reloc->howto == (reloc_howto_type *) NULL)
{
as_bad_where (fixP->fx_file, fixP->fx_line,
Index: gas/config/tc-d10v.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/config/tc-d10v.c,v
retrieving revision 1.3
diff -u -5 -p -r1.3 tc-d10v.c
--- gas/config/tc-d10v.c 1999/06/17 02:13:18 1.3
+++ gas/config/tc-d10v.c 1999/06/22 19:45:57
@@ -1392,11 +1392,12 @@ tc_gen_reloc (seg, fixp)
asection *seg;
fixS *fixp;
{
arelent *reloc;
reloc = (arelent *) xmalloc (sizeof (arelent));
- reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+ reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+ *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
if (reloc->howto == (reloc_howto_type *) NULL)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
Index: gas/config/tc-d30v.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/config/tc-d30v.c,v
retrieving revision 1.2
diff -u -5 -p -r1.2 tc-d30v.c
--- gas/config/tc-d30v.c 1999/06/03 00:29:25 1.2
+++ gas/config/tc-d30v.c 1999/06/22 19:45:58
@@ -1743,11 +1743,12 @@ tc_gen_reloc (seg, fixp)
asection *seg;
fixS *fixp;
{
arelent *reloc;
reloc = (arelent *) xmalloc (sizeof (arelent));
- reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+ reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+ *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
if (reloc->howto == (reloc_howto_type *) NULL)
{
as_bad_where (fixp->fx_file, fixp->fx_line,
Index: gas/config/tc-mcore.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/config/tc-mcore.c,v
retrieving revision 1.3
diff -u -5 -p -r1.3 tc-mcore.c
--- gas/config/tc-mcore.c 1999/06/03 00:29:34 1.3
+++ gas/config/tc-mcore.c 1999/06/22 19:45:58
@@ -2115,11 +2115,12 @@ tc_gen_reloc (section, fixp)
}
break;
}
rel = (arelent *) xmalloc (sizeof (arelent));
- rel->sym_ptr_ptr = & fixp->fx_addsy->bsym;
+ rel->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+ *rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
rel->address = fixp->fx_frag->fr_address + fixp->fx_where;
/* Always pass the addend along! */
rel->addend = fixp->fx_addnumber;
rel->howto = bfd_reloc_type_lookup (stdoutput, code);
Index: gas/config/tc-mn10200.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/config/tc-mn10200.c,v
retrieving revision 1.1.1.1
diff -u -5 -p -r1.1.1.1 tc-mn10200.c
--- gas/config/tc-mn10200.c 1999/05/03 07:28:43 1.1.1.1
+++ gas/config/tc-mn10200.c 1999/06/22 19:45:58
@@ -1250,11 +1250,12 @@ tc_gen_reloc (seg, fixp)
reloc->addend = (S_GET_VALUE (fixp->fx_addsy)
- S_GET_VALUE (fixp->fx_subsy) + fixp->fx_offset);
}
else
{
- reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+ reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+ *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->addend = fixp->fx_offset;
}
return reloc;
}
Index: gas/config/tc-mn10300.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/config/tc-mn10300.c,v
retrieving revision 1.1.1.1
diff -u -5 -p -r1.1.1.1 tc-mn10300.c
--- gas/config/tc-mn10300.c 1999/05/03 07:28:42 1.1.1.1
+++ gas/config/tc-mn10300.c 1999/06/22 19:45:59
@@ -1443,11 +1443,12 @@ tc_gen_reloc (seg, fixp)
reloc->addend = (S_GET_VALUE (fixp->fx_addsy)
- S_GET_VALUE (fixp->fx_subsy) + fixp->fx_offset);
}
else
{
- reloc->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+ reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof( asymbol *));
+ *reloc->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
reloc->addend = fixp->fx_offset;
}
return reloc;
}
Index: gas/config/tc-ns32k.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/config/tc-ns32k.c,v
retrieving revision 1.1.1.1
diff -u -5 -p -r1.1.1.1 tc-ns32k.c
--- gas/config/tc-ns32k.c 1999/05/03 07:28:43 1.1.1.1
+++ gas/config/tc-ns32k.c 1999/06/22 19:45:59
@@ -2262,11 +2262,12 @@ tc_gen_reloc (section, fixp)
bfd_reloc_code_real_type code;
code = reloc(fixp->fx_size, fixp->fx_pcrel, fix_im_disp(fixp));
rel = (arelent *) xmalloc (sizeof (arelent));
- rel->sym_ptr_ptr = &fixp->fx_addsy->bsym;
+ rel->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+ *rel->sym_ptr_ptr = symbol_get_bfdsym (fixp->fx_addsy);
rel->address = fixp->fx_frag->fr_address + fixp->fx_where;
if (fixp->fx_pcrel)
rel->addend = fixp->fx_addnumber;
else
rel->addend = 0;
Index: gas/config/tc-tic30.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/config/tc-tic30.c,v
retrieving revision 1.1.1.1
diff -u -5 -p -r1.1.1.1 tc-tic30.c
--- gas/config/tc-tic30.c 1999/05/03 07:28:43 1.1.1.1
+++ gas/config/tc-tic30.c 1999/06/22 19:46:00
@@ -1840,11 +1840,16 @@ tc_gen_reloc (section, fixP)
#undef MAP
#undef F
rel = (arelent *) xmalloc (sizeof (arelent));
assert (rel != 0);
+#ifdef BFD_ASSEMBLER
+ rel->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+ *rel->sym_ptr_ptr = symbol_get_bfdsym (fixP->fx_addsy);
+#else
rel->sym_ptr_ptr = &fixP->fx_addsy->bsym;
+#endif
rel->address = fixP->fx_frag->fr_address + fixP->fx_where;
if (fixP->fx_pcrel)
rel->addend = fixP->fx_addnumber;
else
rel->addend = 0;
Index: gas/config/tc-v850.c
===================================================================
RCS file: /cvs/binutils/binutils/gas/config/tc-v850.c,v
retrieving revision 1.1.1.1
diff -u -5 -p -r1.1.1.1 tc-v850.c
--- gas/config/tc-v850.c 1999/05/03 07:28:43 1.1.1.1
+++ gas/config/tc-v850.c 1999/06/22 19:46:00
@@ -2241,11 +2241,12 @@ tc_gen_reloc (seg, fixp)
fixS * fixp;
{
arelent * reloc;
reloc = (arelent *) xmalloc (sizeof (arelent));
- reloc->sym_ptr_ptr = & fixp->fx_addsy->bsym;
+ reloc->sym_ptr_ptr = (asymbol **) xmalloc (sizeof (asymbol *));
+ *reloc->sym_ptr_ptr= symbol_get_bfdsym (fixp->fx_addsy);
reloc->address = fixp->fx_frag->fr_address + fixp->fx_where;
reloc->howto = bfd_reloc_type_lookup (stdoutput, fixp->fx_r_type);
if (reloc->howto == (reloc_howto_type *) NULL)
{