This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: what is TC_RELOC_MANGLE?
- From: Christian Groessler <chris at groessler dot org>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: <binutils at sources dot redhat dot com>
- Date: Wed, 17 Aug 2005 21:30:40 +0200 (CEST)
- Subject: Re: what is TC_RELOC_MANGLE?
Hello Nick,
On Wed, 17 Aug 2005, Nick Clifton wrote:
> > $ find . -type f | xargs grep -i tc_reloc_mangle
>
> Just an aside here. Why do you do that rather than:
>
> grep -r -i tc_reloc_mangle .
>
> Is it faster ?
Probably not. It's just an old habit from times when grep didn't have a -r
switch.
> > It doesn't seem to be used anymore, and I wanted to provide a patch to
> > remove it, but in gas/config/tc-sh.c I find a snippet
> >
> > case BFD_RELOC_SH_USES:
> > /* Pass the value into sh_coff_reloc_mangle. */
> > fixP->fx_addnumber = val;
> > break;
> >
> > Don't know how to fix the comment for this :-)
>
> May I suggest:
>
> /* Pass the value into sh_reloc(). */
>
How about the attached patch?
regards,
chris
gas/ChangeLog:
2005-08-17 Christian Groessler <chris@groessler.org>
* config/tc-h8300.h: Remove TC_RELOC_MANGLE/tc_reloc_mangle.
* config/tc-mcore.h: Likewise.
* config/tc-z8k.h: Likewise.
* config/tc-z8k.c: Likewise.
* config/tc-sh.h: Remove TC_RELOC_MANGLE and
sh_coff_reloc_mangle declaration.
* config/tc-sh.c: (md_apply_fix): Fix comment for case
BFD_RELOC_SH_USES.
Index: config/tc-h8300.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-h8300.h,v
retrieving revision 1.19
diff -p -u -r1.19 tc-h8300.h
--- config/tc-h8300.h 11 Aug 2005 01:25:25 -0000 1.19
+++ config/tc-h8300.h 17 Aug 2005 19:19:10 -0000
@@ -44,8 +44,6 @@ struct internal_reloc;
#define IGNORE_NONSTANDARD_ESCAPES
#define tc_coff_symbol_emit_hook(a) ; /* not used */
-#define TC_RELOC_MANGLE(s,a,b,c) tc_reloc_mangle(a,b,c)
-extern void tc_reloc_mangle (struct fix *, struct internal_reloc *, bfd_vma);
/* No shared lib support, so we don't need to ensure externally
visible symbols can be overridden. */
Index: config/tc-mcore.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mcore.h,v
retrieving revision 1.19
diff -p -u -r1.19 tc-mcore.h
--- config/tc-mcore.h 11 Aug 2005 01:25:28 -0000 1.19
+++ config/tc-mcore.h 17 Aug 2005 19:19:10 -0000
@@ -29,8 +29,6 @@
#define IGNORE_NONSTANDARD_ESCAPES
-#define TC_RELOC_MANGLE(a,b,c) tc_reloc_mangle (a, b, c)
-
/* Some pseudo-op semantic extensions. */
#define PSEUDO_LCOMM_OPTIONAL_ALIGN
Index: config/tc-sh.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.c,v
retrieving revision 1.110
diff -p -u -r1.110 tc-sh.c
--- config/tc-sh.c 11 Aug 2005 01:25:28 -0000 1.110
+++ config/tc-sh.c 17 Aug 2005 19:19:14 -0000
@@ -3937,7 +3937,7 @@ md_apply_fix (fixS *fixP, valueT *valP,
break;
case BFD_RELOC_SH_USES:
- /* Pass the value into sh_coff_reloc_mangle. */
+ /* Pass the value into sh_reloc(). */
fixP->fx_addnumber = val;
break;
Index: config/tc-sh.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.h,v
retrieving revision 1.38
diff -p -u -r1.38 tc-sh.h
--- config/tc-sh.h 11 Aug 2005 01:25:28 -0000 1.38
+++ config/tc-sh.h 17 Aug 2005 19:19:14 -0000
@@ -120,12 +120,6 @@ extern void sh_frob_file (void);
#define COFF_MAGIC (!target_big_endian ? SH_ARCH_MAGIC_LITTLE : SH_ARCH_MAGIC_BIG)
-#define TC_RELOC_MANGLE(seg, fix, int, paddr) \
- sh_coff_reloc_mangle ((seg), (fix), (int), (paddr))
-extern void sh_coff_reloc_mangle
- (struct segment_info_struct *, struct fix *,
- struct internal_reloc *, unsigned int);
-
#define tc_coff_symbol_emit_hook(a) ; /* not used */
#define TC_KEEP_FX_OFFSET 1
Index: config/tc-z8k.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-z8k.c,v
retrieving revision 1.38
diff -p -u -r1.38 tc-z8k.c
--- config/tc-z8k.c 11 Aug 2005 01:25:28 -0000 1.38
+++ config/tc-z8k.c 17 Aug 2005 19:19:15 -0000
@@ -1540,60 +1540,3 @@ void
tc_coff_symbol_emit_hook (symbolS *s ATTRIBUTE_UNUSED)
{
}
-
-void
-tc_reloc_mangle (fixS *fix_ptr, struct internal_reloc *intr, bfd_vma base)
-{
- symbolS *symbol_ptr;
-
- if (fix_ptr->fx_addsy
- && fix_ptr->fx_subsy)
- {
- symbolS *add = fix_ptr->fx_addsy;
- symbolS *sub = fix_ptr->fx_subsy;
-
- if (S_GET_SEGMENT (add) != S_GET_SEGMENT (sub))
- as_bad (_("Can't subtract symbols in different sections %s %s"),
- S_GET_NAME (add), S_GET_NAME (sub));
- else
- {
- int diff = S_GET_VALUE (add) - S_GET_VALUE (sub);
-
- fix_ptr->fx_addsy = 0;
- fix_ptr->fx_subsy = 0;
- fix_ptr->fx_offset += diff;
- }
- }
- symbol_ptr = fix_ptr->fx_addsy;
-
- /* If this relocation is attached to a symbol then it's ok
- to output it. */
- if (fix_ptr->fx_r_type == 0)
- {
- /* cons likes to create reloc32's whatever the size of the reloc. */
- switch (fix_ptr->fx_size)
- {
- case 2:
- intr->r_type = R_IMM16;
- break;
- case 1:
- intr->r_type = R_IMM8;
- break;
- case 4:
- intr->r_type = R_IMM32;
- break;
- default:
- abort ();
- }
- }
- else
- intr->r_type = fix_ptr->fx_r_type;
-
- intr->r_vaddr = fix_ptr->fx_frag->fr_address + fix_ptr->fx_where + base;
- intr->r_offset = fix_ptr->fx_offset;
-
- if (symbol_ptr)
- intr->r_symndx = symbol_ptr->sy_number;
- else
- intr->r_symndx = -1;
-}
Index: config/tc-z8k.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-z8k.h,v
retrieving revision 1.11
diff -p -u -r1.11 tc-z8k.h
--- config/tc-z8k.h 11 Aug 2005 01:25:28 -0000 1.11
+++ config/tc-z8k.h 17 Aug 2005 19:19:15 -0000
@@ -31,10 +31,6 @@ struct internal_reloc;
#define IGNORE_NONSTANDARD_ESCAPES
#undef WARN_SIGNED_OVERFLOW_WORD
-#define TC_RELOC_MANGLE(s,a,b,c) tc_reloc_mangle(a,b,c)
-extern void tc_reloc_mangle
- PARAMS ((struct fix *, struct internal_reloc *, bfd_vma));
-
#define LISTING_HEADER "Zilog Z8000 GAS "
#define RELOC_32 1234