This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
assorted x86 fixes
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sources dot redhat dot com
- Date: Sun, 11 Aug 2002 00:17:32 +0930
- Subject: assorted x86 fixes
Two fixes and a tweak.
Fix 1: Missing OUTPUT_FLAVOR check meant that an assembler built for
ELF, COFF and aout, would emit relocs in COFF or aout mode that
weren't needed and wouldn't be emitted with a standalone COFF or aout
assembler.
Fix 2: Allowing absolute_section expressions for aout means we can
have the difference of two symbols in the same section, even when in
different frags. The expression will later resolve to a constant.
Tweak: fx_pcrel vs fx_addsy in md_apply_fix3 doesn't really make any
difference in this particular case. It's actually a stronger test
as fx_pcrel => fx_addsy (see fixup_segment), and I reckon it's clearer.
gas/ChangeLog
* config/tc-i386.c (tc_i386_fix_adjustable): Test OUTPUT_FLAVOR
for ELF, and don't bother checking ELF relocs when non-ELF.
(i386_immediate): Allow absolute_section expressions for aout.
(i386_displacement): Likewise. Also test bfd_is_com_section.
(md_estimate_size_before_relax): Test OUTPUT_FLAVOR for ELF.
(md_apply_fix3): Hack for bfd_install_relocation when fx_pcrel,
not when fx_addsy. Remove dead code.
Index: gas/config/tc-i386.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.c,v
retrieving revision 1.125
diff -u -p -r1.125 tc-i386.c
--- gas/config/tc-i386.c 9 Aug 2002 00:09:51 -0000 1.125
+++ gas/config/tc-i386.c 10 Aug 2002 13:17:29 -0000
@@ -1207,9 +1207,12 @@ reloc (size, pcrel, sign, other)
int
tc_i386_fix_adjustable (fixP)
- fixS *fixP;
+ fixS *fixP ATTRIBUTE_UNUSED;
{
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
+ if (OUTPUT_FLAVOR != bfd_target_elf_flavour)
+ return 1;
+
/* Prevent all adjustments to global symbols, or else dynamic
linking will not work correctly. */
if (S_IS_EXTERNAL (fixP->fx_addsy)
@@ -1220,7 +1223,7 @@ tc_i386_fix_adjustable (fixP)
&& (S_GET_SEGMENT (fixP->fx_addsy)->flags & SEC_MERGE) != 0
&& fixP->fx_pcrel))
return 0;
-#endif
+
/* adjust_reloc_syms doesn't know about the GOT. */
if (fixP->fx_r_type == BFD_RELOC_386_GOTOFF
|| fixP->fx_r_type == BFD_RELOC_386_PLT32
@@ -1237,6 +1240,7 @@ tc_i386_fix_adjustable (fixP)
|| fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
|| fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
return 0;
+#endif
return 1;
}
#else
@@ -3668,6 +3672,7 @@ i386_immediate (imm_start)
#ifdef BFD_ASSEMBLER
&& OUTPUT_FLAVOR == bfd_target_aout_flavour
#endif
+ && exp_seg != absolute_section
&& exp_seg != text_section
&& exp_seg != data_section
&& exp_seg != bss_section
@@ -3882,10 +3887,15 @@ i386_displacement (disp_start, disp_end)
#ifdef BFD_ASSEMBLER
&& OUTPUT_FLAVOR == bfd_target_aout_flavour
#endif
+ && exp_seg != absolute_section
&& exp_seg != text_section
&& exp_seg != data_section
&& exp_seg != bss_section
- && exp_seg != undefined_section)
+ && exp_seg != undefined_section
+#ifdef BFD_ASSEMBLER
+ && !bfd_is_com_section (exp_seg)
+#endif
+ )
{
#ifdef BFD_ASSEMBLER
as_bad (_("unimplemented segment %s in operand"), exp_seg->name);
@@ -4311,8 +4321,9 @@ md_estimate_size_before_relax (fragP, se
shared library. */
if (S_GET_SEGMENT (fragP->fr_symbol) != segment
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
- || S_IS_EXTERNAL (fragP->fr_symbol)
- || S_IS_WEAK (fragP->fr_symbol)
+ || (OUTPUT_FLAVOR == bfd_target_elf_flavour
+ && (S_IS_EXTERNAL (fragP->fr_symbol)
+ || S_IS_WEAK (fragP->fr_symbol)))
#endif
)
{
@@ -4586,15 +4597,16 @@ md_apply_fix3 (fixP, valP, seg)
}
}
- /* This is a hack. There should be a better way to handle this.
- This covers for the fact that bfd_install_relocation will
- subtract the current location (for partial_inplace, PC relative
- relocations); see more below. */
- if ((fixP->fx_r_type == BFD_RELOC_32_PCREL
- || fixP->fx_r_type == BFD_RELOC_16_PCREL
- || fixP->fx_r_type == BFD_RELOC_8_PCREL)
- && fixP->fx_addsy && !use_rela_relocations)
- {
+ if (fixP->fx_pcrel
+ && (fixP->fx_r_type == BFD_RELOC_32_PCREL
+ || fixP->fx_r_type == BFD_RELOC_16_PCREL
+ || fixP->fx_r_type == BFD_RELOC_8_PCREL)
+ && !use_rela_relocations)
+ {
+ /* This is a hack. There should be a better way to handle this.
+ This covers for the fact that bfd_install_relocation will
+ subtract the current location (for partial_inplace, PC relative
+ relocations); see more below. */
#ifndef OBJ_AOUT
if (OUTPUT_FLAVOR == bfd_target_elf_flavour
#ifdef TE_PE
@@ -4645,6 +4657,7 @@ md_apply_fix3 (fixP, valP, seg)
runtime we merely add the offset to the actual PLT entry. */
value = -4;
break;
+
case BFD_RELOC_386_GOT32:
case BFD_RELOC_386_TLS_GD:
case BFD_RELOC_386_TLS_LDM:
@@ -4654,9 +4667,6 @@ md_apply_fix3 (fixP, valP, seg)
case BFD_RELOC_386_TLS_LE:
case BFD_RELOC_X86_64_GOT32:
value = 0; /* Fully resolved at runtime. No addend. */
- break;
- case BFD_RELOC_386_GOTOFF:
- case BFD_RELOC_X86_64_GOTPCREL:
break;
case BFD_RELOC_VTABLE_INHERIT:
Index: gas/config/tc-i386.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.h,v
retrieving revision 1.33
diff -u -p -r1.33 tc-i386.h
--- gas/config/tc-i386.h 9 Aug 2002 12:37:41 -0000 1.33
+++ gas/config/tc-i386.h 10 Aug 2002 13:17:30 -0000
@@ -465,39 +465,31 @@ void i386_validate_fix PARAMS ((struct f
#define tc_fix_adjustable(X) tc_i386_fix_adjustable(X)
extern int tc_i386_fix_adjustable PARAMS ((struct fix *));
-#if (defined (OBJ_MAYBE_ELF) || defined (OBJ_ELF) || defined (OBJ_MAYBE_COFF) || defined (OBJ_COFF)) && !defined (TE_PE)
-/* This arranges for gas/write.c to not apply a relocation if
- tc_fix_adjustable() says it is not adjustable.
- The "! symbol_used_in_reloc_p" test is there specifically to cover
- the case of non-global symbols in linkonce sections. It's the
- generally correct thing to do though; If a reloc is going to be
- emitted against a symbol then we don't want to adjust the fixup by
- applying the reloc during assembly. The reloc will be applied by
- the linker during final link. */
-#define TC_FIX_ADJUSTABLE(fixP) \
- (! symbol_used_in_reloc_p ((fixP)->fx_addsy) && tc_fix_adjustable (fixP))
+#ifndef TE_PE
+/* This arranges for gas/write.c to not apply a relocation if a reloc
+ is going to be emitted against a symbol. In that case, we don't
+ want to adjust the fixup by applying the reloc during assembly.
+ The reloc will be applied by the linker during final link. */
+#define TC_FIX_ADJUSTABLE(fixP) (!symbol_used_in_reloc_p ((fixP)->fx_addsy))
#endif
#define TC_FORCE_RELOCATION(FIXP) \
((FIXP)->fx_r_type == BFD_RELOC_VTABLE_INHERIT \
|| (FIXP)->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
-/* This expression evaluates to false if the relocation is for a local object
- for which we still want to do the relocation at runtime. True if we
+/* This expression evaluates to true if the relocation is for a local object
+ for which we still want to do the relocation at runtime. False if we
are willing to perform this relocation while building the .o file.
This is only used for pcrel relocations, so GOTOFF does not need to be
checked here. I am not sure if some of the others are ever used with
pcrel, but it is easier to be safe than sorry. */
-#define TC_RELOC_RTSYM_LOC_FIXUP(FIX) \
- ((FIX)->fx_r_type != BFD_RELOC_386_PLT32 \
- && (FIX)->fx_r_type != BFD_RELOC_386_GOT32 \
- && (FIX)->fx_r_type != BFD_RELOC_386_GOTPC \
- && ((FIX)->fx_addsy == NULL \
- || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
- && ! S_IS_WEAK ((FIX)->fx_addsy) \
- && S_IS_DEFINED ((FIX)->fx_addsy) \
- && ! S_IS_COMMON ((FIX)->fx_addsy))))
+#define TC_FORCE_RELOCATION_LOCAL(FIXP) \
+ ((FIXP)->fx_r_type == BFD_RELOC_386_PLT32 \
+ || (FIXP)->fx_r_type == BFD_RELOC_386_GOT32 \
+ || (FIXP)->fx_r_type == BFD_RELOC_386_GOTPC \
+ || TC_FORCE_RELOCATION (FIXP) \
+ || S_IS_EXTERNAL ((FIXP)->fx_addsy))
#else /* ! BFD_ASSEMBLER */
Index: gas/config/tc-i960.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i960.c,v
retrieving revision 1.13
diff -u -p -r1.13 tc-i960.c
--- gas/config/tc-i960.c 8 Jun 2002 07:37:15 -0000 1.13
+++ gas/config/tc-i960.c 10 Aug 2002 13:17:33 -0000
@@ -152,7 +152,6 @@ static void parse_memop (); /* Parse a m
static void parse_po (); /* Parse machine-dependent pseudo-op */
static void parse_regop (); /* Parse a register operand */
static void reg_fmt (); /* Generate a REG format instruction */
-void reloc_callj (); /* Relocate a 'callj' instruction */
static void relax_cobr (); /* "De-optimize" cobr into compare/branch */
static void s_leafproc (); /* Process '.leafproc' pseudo-op */
static void s_sysproc (); /* Process '.sysproc' pseudo-op */
@@ -2501,7 +2500,7 @@ relax_cobr (fragP)
passed fixup structure.
*************************************************************************** */
-void
+boolean
reloc_callj (fixP)
/* Relocation that can be done at assembly time */
fixS *fixP;
@@ -2512,7 +2511,7 @@ reloc_callj (fixP)
if (!fixP->fx_tcbit)
{
/* This wasn't a callj instruction in the first place */
- return;
+ return false;
}
where = fixP->fx_frag->fr_literal + fixP->fx_where;
@@ -2526,7 +2525,6 @@ reloc_callj (fixP)
/* Nothing else needs to be done for this instruction. Make
sure 'md_number_to_field()' will perform a no-op. */
fixP->fx_bit_fixP = (bit_fixS *) 1;
-
}
else if (TC_S_IS_CALLNAME (fixP->fx_addsy))
{
@@ -2546,6 +2544,7 @@ reloc_callj (fixP)
} /* switch on proc type */
/* else Symbol is neither a sysproc nor a leafproc */
+ return false;
}
/*****************************************************************************
@@ -2829,10 +2828,22 @@ md_apply_fix3 (fixP, valP, seg)
md_number_to_imm (place, val, fixP->fx_size, fixP);
}
+ else if ((int) fixP->fx_bit_fixP == 13
+ && fixP->fx_addsy != NULL
+ && S_GET_SEGMENT (fixP->fx_addsy) == undefined_section)
+ {
+ /* This is a COBR instruction. They have only a
+ 13-bit displacement and are only to be used
+ for local branches: flag as error, don't generate
+ relocation. */
+ as_bad_where (fixP->fx_file, fixP->fx_line,
+ _("can't use COBR format with external label"));
+ fixP->fx_addsy = NULL;
+ }
else
md_number_to_field (place, val, fixP->fx_bit_fixP);
- if (fixP->fx_addsy == NULL && fixP->fx_pcrel == 0)
+ if (fixP->fx_addsy == NULL)
fixP->fx_done = 1;
}
@@ -3191,24 +3202,22 @@ i960_handle_align (fragp)
}
int
-i960_validate_fix (fixP, this_segment_type, add_symbolPP)
+i960_validate_fix (fixP, this_segment_type)
fixS *fixP;
segT this_segment_type;
- symbolS **add_symbolPP;
{
-#define add_symbolP (*add_symbolPP)
- if (fixP->fx_tcbit && TC_S_IS_CALLNAME (add_symbolP))
+ if (fixP->fx_tcbit && TC_S_IS_CALLNAME (fixP->fx_addsy))
{
/* Relocation should be done via the associated 'bal'
entry point symbol. */
- if (!TC_S_IS_BALNAME (tc_get_bal_of_call (add_symbolP)))
+ if (!TC_S_IS_BALNAME (tc_get_bal_of_call (fixP->fx_addsy)))
{
as_bad (_("No 'bal' entry point for leafproc %s"),
- S_GET_NAME (add_symbolP));
+ S_GET_NAME (fixP->fx_addsy));
return 1;
}
- fixP->fx_addsy = add_symbolP = tc_get_bal_of_call (add_symbolP);
+ fixP->fx_addsy = fixP->fx_addsy = tc_get_bal_of_call (fixP->fx_addsy);
}
#if 0
/* Still have to work out other conditions for these tests. */
@@ -3230,7 +3239,6 @@ i960_validate_fix (fixP, this_segment_ty
}
}
#endif
-#undef add_symbolP
return 0;
}
Index: gas/config/tc-i960.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i960.h,v
retrieving revision 1.8
diff -u -p -r1.8 tc-i960.h
--- gas/config/tc-i960.h 23 Jul 2001 14:02:12 -0000 1.8
+++ gas/config/tc-i960.h 10 Aug 2002 13:17:33 -0000
@@ -1,6 +1,6 @@
/* tc-i960.h - Basic 80960 instruction formats.
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1997, 1998, 1999,
- 2000
+ 2000, 2002
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -65,10 +65,8 @@
#define TC_COUNT_RELOC(FIXP) (!(FIXP)->fx_done)
#define TC_COFF_FIX2RTYPE(FIXP) tc_coff_fix2rtype (FIXP)
#define TC_COFF_SIZEMACHDEP(FRAGP) tc_coff_sizemachdep (FRAGP)
-#define TC_COFF_SET_MACHINE(HDRS) tc_headers_hook (HDRS)
-extern void tc_headers_hook ();
-extern short tc_coff_fix2rtype ();
-extern int tc_coff_sizemachdep ();
+#define TC_COFF_SET_MACHINE(HDRS) tc_headers_hook ((PTR) HDRS)
+extern int tc_coff_sizemachdep PARAMS ((struct frag *));
/* MEANING OF 'n_other' in the symbol record.
*
@@ -128,6 +126,20 @@ struct relocation_info
nuthin:1; /* Unused */
};
+/* Makes no sense to use the difference of 2 arbitrary symbols
+ as the target of a call instruction. */
+#define TC_FORCE_RELOCATION_SUB(FIXP) \
+ ((FIXP)->fx_tcbit \
+ ? as_bad_where (fixP->fx_file, fixP->fx_line, \
+ _("callj to difference of two symbols")), 1 \
+ : 0)
+
+/* reloc_callj() may replace a 'call' with a 'calls' or a
+ 'bal', in which cases it modifies *fixP as appropriate.
+ In the case of a 'calls', no further work is required. */
+#define TC_FORCE_RELOCATION_ABS(FIXP) reloc_callj (FIXP)
+extern boolean reloc_callj PARAMS ((struct fix *));
+
#ifdef OBJ_COFF
/* We store the bal information in the sy_tc field. */
@@ -141,17 +153,17 @@ struct relocation_info
}
#endif
-extern int i960_validate_fix PARAMS ((struct fix *, segT, symbolS **));
+extern int i960_validate_fix PARAMS ((struct fix *, segT));
#define TC_VALIDATE_FIX(FIXP,SEGTYPE,LABEL) \
- if (i960_validate_fix (FIXP, SEGTYPE, &add_symbolP) != 0) goto LABEL
+ if (i960_validate_fix (FIXP, SEGTYPE) != 0) goto LABEL
-#ifdef OBJ_ELF
-#define TC_RELOC_RTSYM_LOC_FIXUP(FIX) \
- ((FIX)->fx_addsy == NULL \
- || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
- && ! S_IS_WEAK ((FIX)->fx_addsy) \
- && S_IS_DEFINED ((FIX)->fx_addsy) \
- && ! S_IS_COMMON ((FIX)->fx_addsy)))
+#ifndef OBJ_ELF
+#define TC_FORCE_RELOCATION_LOCAL(FIXP) TC_FORCE_RELOCATION_ABS (FIXP)
+#else
+#define TC_FORCE_RELOCATION_LOCAL(FIXP) \
+ (TC_FORCE_RELOCATION (FIXP) \
+ || S_IS_EXTERNAL ((FIXP)->fx_addsy) \
+ || reloc_callj (FIXP))
#endif
#ifndef OBJ_ELF
@@ -169,13 +181,11 @@ extern int i960_validate_fix PARAMS ((st
extern void brtab_emit PARAMS ((void));
#define md_end() brtab_emit ()
-extern void reloc_callj ();
-
extern void tc_set_bal_of_call PARAMS ((symbolS *, symbolS *));
extern struct symbol *tc_get_bal_of_call PARAMS ((symbolS *));
-extern void i960_handle_align ();
+extern void i960_handle_align PARAMS ((struct frag *));
#define HANDLE_ALIGN(FRAG) i960_handle_align (FRAG)
#define NEED_FX_R_TYPE
#define NO_RELOC -1
Index: gas/config/tc-ia64.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ia64.h,v
retrieving revision 1.20
diff -u -p -r1.20 tc-ia64.h
--- gas/config/tc-ia64.h 25 May 2002 12:53:29 -0000 1.20
+++ gas/config/tc-ia64.h 10 Aug 2002 13:17:33 -0000
@@ -249,18 +249,15 @@ typedef struct unwind_record
} record;
} unwind_record;
-/* This expression evaluates to false if the relocation is for a local
+/* This expression evaluates to true if the relocation is for a local
object for which we still want to do the relocation at runtime.
- True if we are willing to perform this relocation while building
+ False if we are willing to perform this relocation while building
the .o file. This is only used for pcrel relocations. */
/* If the reloc type is BFD_RELOC_UNUSED, then this is for a TAG13/TAG13b field
which has no external reloc, so we must resolve the value now. */
-#define TC_RELOC_RTSYM_LOC_FIXUP(FIX) \
- ((FIX)->fx_addsy == NULL \
- || (FIX)->fx_r_type == BFD_RELOC_UNUSED \
- || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
- && ! S_IS_WEAK ((FIX)->fx_addsy) \
- && S_IS_DEFINED ((FIX)->fx_addsy) \
- && ! S_IS_COMMON ((FIX)->fx_addsy)))
+#define TC_FORCE_RELOCATION_LOCAL(FIXP) \
+ ((FIXP)->fx_r_type != BFD_RELOC_UNUSED \
+ && (TC_FORCE_RELOCATION (FIXP) \
+ || S_IS_EXTERNAL ((FIXP)->fx_addsy)))
Index: gas/config/tc-m68k.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-m68k.h,v
retrieving revision 1.11
diff -u -p -r1.11 tc-m68k.h
--- gas/config/tc-m68k.h 6 Jan 2002 12:15:45 -0000 1.11
+++ gas/config/tc-m68k.h 10 Aug 2002 13:17:34 -0000
@@ -1,6 +1,6 @@
/* This file is tc-m68k.h
Copyright 1987, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
- 1998, 1999, 2000
+ 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -167,18 +167,15 @@ while (0)
#ifdef OBJ_ELF
-/* This expression evaluates to false if the relocation is for a local object
- for which we still want to do the relocation at runtime. True if we
+/* This expression evaluates to true if the relocation is for a local object
+ for which we still want to do the relocation at runtime. False if we
are willing to perform this relocation while building the .o file. If
the reloc is against an externally visible symbol, then the assembler
should never do the relocation. */
-#define TC_RELOC_RTSYM_LOC_FIXUP(FIX) \
- ((FIX)->fx_addsy == NULL \
- || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
- && ! S_IS_WEAK ((FIX)->fx_addsy) \
- && S_IS_DEFINED ((FIX)->fx_addsy) \
- && ! S_IS_COMMON ((FIX)->fx_addsy)))
+#define TC_FORCE_RELOCATION_LOCAL(FIXP) \
+ (TC_FORCE_RELOCATION (FIXP) \
+ || S_IS_EXTERNAL ((FIXP)->fx_addsy))
#define tc_fix_adjustable(X) tc_m68k_fix_adjustable(X)
extern int tc_m68k_fix_adjustable PARAMS ((struct fix *));
Index: gas/config/tc-ppc.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ppc.c,v
retrieving revision 1.53
diff -u -p -r1.53 tc-ppc.c
--- gas/config/tc-ppc.c 6 Aug 2002 02:30:06 -0000 1.53
+++ gas/config/tc-ppc.c 10 Aug 2002 13:17:37 -0000
@@ -5102,24 +5102,16 @@ ppc_fix_adjustable (fix)
fixup. */
void
-md_apply_fix3 (fixP, valP, seg)
+md_apply_fix3 (fixP, valuep, seg)
fixS *fixP;
- valueT * valP;
+ valueT *valuep;
segT seg ATTRIBUTE_UNUSED;
{
- valueT value = * valP;
+ valueT value = *valuep;
#ifdef OBJ_ELF
if (fixP->fx_addsy != NULL)
{
- /* `*valuep' may contain the value of the symbol on which the reloc
- will be based; we have to remove it. */
- if (symbol_used_in_reloc_p (fixP->fx_addsy)
- && S_GET_SEGMENT (fixP->fx_addsy) != absolute_section
- && S_GET_SEGMENT (fixP->fx_addsy) != undefined_section
- && ! bfd_is_com_section (S_GET_SEGMENT (fixP->fx_addsy)))
- value -= S_GET_VALUE (fixP->fx_addsy);
-
/* FIXME: Why '+'? Better yet, what exactly is '*valuep'
supposed to be? I think this is related to various similar
FIXMEs in tc-i386.c and tc-sparc.c. */
@@ -5146,21 +5138,14 @@ md_apply_fix3 (fixP, valP, seg)
;
else
+ value = fixP->fx_offset;
+#endif
+
+ if (fixP->fx_subsy != (symbolS *) NULL)
{
- value = fixP->fx_offset;
- if (fixP->fx_subsy != (symbolS *) NULL)
- {
- if (S_GET_SEGMENT (fixP->fx_subsy) == absolute_section)
- value -= S_GET_VALUE (fixP->fx_subsy);
- else
- {
- /* We can't actually support subtracting a symbol. */
- as_bad_where (fixP->fx_file, fixP->fx_line,
- _("expression too complex"));
- }
- }
+ /* We can't actually support subtracting a symbol. */
+ as_bad_where (fixP->fx_file, fixP->fx_line, _("expression too complex"));
}
-#endif
if ((int) fixP->fx_r_type >= (int) BFD_RELOC_UNUSED)
{
Index: gas/config/tc-ppc.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ppc.h,v
retrieving revision 1.18
diff -u -p -r1.18 tc-ppc.h
--- gas/config/tc-ppc.h 11 Jul 2002 01:07:49 -0000 1.18
+++ gas/config/tc-ppc.h 10 Aug 2002 13:17:38 -0000
@@ -223,11 +223,6 @@ do { \
|| (FIXP)->fx_r_type == BFD_RELOC_VTABLE_INHERIT \
|| (FIXP)->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
-#define TC_FORCE_RELOCATION_SECTION(FIXP,SEC) \
-(TC_FORCE_RELOCATION (FIXP) \
- || ((FIXP)->fx_addsy && !(FIXP)->fx_subsy \
- && S_GET_SEGMENT ((FIXP)->fx_addsy) != SEC))
-
/* Support for SHF_EXCLUDE and SHT_ORDERED */
extern int ppc_section_letter PARAMS ((int, char **));
extern int ppc_section_type PARAMS ((char *, size_t));
@@ -261,15 +256,18 @@ extern const char *ppc_comment_chars;
#define tc_fix_adjustable(fixp) ppc_fix_adjustable (fixp)
extern int ppc_fix_adjustable PARAMS ((struct fix *));
+/* This arranges for gas/write.c to not apply a relocation if a reloc
+ is going to be emitted against a symbol. In that case, we don't
+ want to adjust the fixup by applying the reloc during assembly.
+ The reloc will be applied by the linker during final link. */
+#define TC_FIX_ADJUSTABLE(fixP) (!symbol_used_in_reloc_p ((fixP)->fx_addsy))
+
/* We must never ever try to resolve references to externally visible
symbols in the assembler, because the .o file might go into a shared
library, and some other shared library might override that symbol. */
-#define TC_RELOC_RTSYM_LOC_FIXUP(FIX) \
- ((FIX)->fx_addsy == NULL \
- || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
- && ! S_IS_WEAK ((FIX)->fx_addsy) \
- && S_IS_DEFINED ((FIX)->fx_addsy) \
- && ! S_IS_COMMON ((FIX)->fx_addsy)))
+#define TC_FORCE_RELOCATION_LOCAL(FIXP) \
+ (TC_FORCE_RELOCATION (FIXP) \
+ || S_IS_EXTERNAL ((FIXP)->fx_addsy))
#define tc_frob_file_before_adjust ppc_frob_file_before_adjust
extern void ppc_frob_file_before_adjust PARAMS ((void));
Index: gas/config/tc-s390.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-s390.c,v
retrieving revision 1.20
diff -u -p -r1.20 tc-s390.c
--- gas/config/tc-s390.c 2 Jul 2002 09:04:43 -0000 1.20
+++ gas/config/tc-s390.c 10 Aug 2002 13:17:40 -0000
@@ -1725,7 +1725,7 @@ md_apply_fix3 (fixP, valP, seg)
&& S_GET_SEGMENT (fixP->fx_addsy) == S_GET_SEGMENT (fixP->fx_subsy)
&& SEG_NORMAL (S_GET_SEGMENT (fixP->fx_addsy)))
|| (S_GET_SEGMENT (fixP->fx_addsy) == seg
- && fixP->fx_pcrel && TC_RELOC_RTSYM_LOC_FIXUP (fixP))
+ && fixP->fx_pcrel && !TC_FORCE_RELOCATION_LOCAL (fixP))
|| (!fixP->fx_pcrel
&& S_GET_SEGMENT (fixP->fx_addsy) == absolute_section)
|| (S_GET_SEGMENT (fixP->fx_addsy) != undefined_section
Index: gas/config/tc-s390.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-s390.h,v
retrieving revision 1.8
diff -u -p -r1.8 tc-s390.h
--- gas/config/tc-s390.h 4 May 2002 17:38:00 -0000 1.8
+++ gas/config/tc-s390.h 10 Aug 2002 13:17:40 -0000
@@ -29,20 +29,13 @@ struct fix;
#error S390 support requires BFD_ASSEMBLER
#endif
-/* This expression evaluates to false if the relocation is for a local object
- for which we still want to do the relocation at runtime. True if we
+/* This expression evaluates to true if the relocation is for a local object
+ for which we still want to do the relocation at runtime. False if we
are willing to perform this relocation while building the .o file.
- This is only used for pcrel relocations, so GOTOFF does not need to be
- checked here. I am not sure if some of the others are ever used with
- pcrel, but it is easier to be safe than sorry. */
-
-#define TC_RELOC_RTSYM_LOC_FIXUP(FIX) \
- ((FIX)->fx_r_type != BFD_RELOC_390_GOTENT \
- && ((FIX)->fx_addsy == NULL \
- || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
- && ! S_IS_WEAK ((FIX)->fx_addsy) \
- && S_IS_DEFINED ((FIX)->fx_addsy) \
- && ! S_IS_COMMON ((FIX)->fx_addsy))))
+ This is only used for pcrel relocations. */
+#define TC_FORCE_RELOCATION_LOCAL(FIXP) \
+ (TC_FORCE_RELOCATION (FIXP) \
+ || S_IS_EXTERNAL ((FIXP)->fx_addsy))
#define TC_FORCE_RELOCATION(FIXP) tc_s390_force_relocation(FIXP)
extern int tc_s390_force_relocation PARAMS ((struct fix *));
@@ -50,8 +43,11 @@ extern int tc_s390_force_relocation PARA
#define tc_fix_adjustable(X) tc_s390_fix_adjustable(X)
extern int tc_s390_fix_adjustable PARAMS ((struct fix *));
-#define TC_FIX_ADJUSTABLE(fixP) \
- (! symbol_used_in_reloc_p ((fixP)->fx_addsy) && tc_fix_adjustable (fixP))
+/* This arranges for gas/write.c to not apply a relocation if a reloc
+ is going to be emitted against a symbol. In that case, we don't
+ want to adjust the fixup by applying the reloc during assembly.
+ The reloc will be applied by the linker during final link. */
+#define TC_FIX_ADJUSTABLE(fixP) (!symbol_used_in_reloc_p ((fixP)->fx_addsy))
/* The target BFD architecture. */
#define TARGET_ARCH bfd_arch_s390
Index: gas/config/tc-sh.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.c,v
retrieving revision 1.68
diff -u -p -r1.68 tc-sh.c
--- gas/config/tc-sh.c 19 Jun 2002 14:31:07 -0000 1.68
+++ gas/config/tc-sh.c 10 Aug 2002 13:17:42 -0000
@@ -3284,7 +3284,7 @@ sh_fix_adjustable (fixP)
|| fixP->fx_r_type == BFD_RELOC_SH_SWITCH32)
return 1;
- if (! TC_RELOC_RTSYM_LOC_FIXUP (fixP)
+ if (TC_FORCE_RELOCATION_LOCAL (fixP)
|| fixP->fx_r_type == BFD_RELOC_RVA)
return 0;
Index: gas/config/tc-sh.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh.h,v
retrieving revision 1.21
diff -u -p -r1.21 tc-sh.h
--- gas/config/tc-sh.h 23 May 2002 08:08:48 -0000 1.21
+++ gas/config/tc-sh.h 10 Aug 2002 13:17:43 -0000
@@ -62,18 +62,15 @@ struct fix;
extern int sh_force_relocation PARAMS ((struct fix *));
#ifdef OBJ_ELF
-#define obj_fix_adjustable(fixP) sh_fix_adjustable(fixP)
+#define tc_fix_adjustable(fixP) sh_fix_adjustable(fixP)
struct fix;
extern boolean sh_fix_adjustable PARAMS ((struct fix *));
-/* This arranges for gas/write.c to not apply a relocation if
- obj_fix_adjustable() says it is not adjustable. */
-/* ??? fixups with symbols in SEC_MERGE sections are marked with
- obj_fix_adjustable and have a non-section symbol, as in
- "vwxyz"+1 in execute/string-opt-6.c . Maybe the test of
- (symbol_used_in_reloc_p should be done in the machine-independent code. */
-#define TC_FIX_ADJUSTABLE(fixP) \
- (! symbol_used_in_reloc_p (fixP->fx_addsy) && obj_fix_adjustable (fixP))
+/* This arranges for gas/write.c to not apply a relocation if a reloc
+ is going to be emitted against a symbol. In that case, we don't
+ want to adjust the fixup by applying the reloc during assembly.
+ The reloc will be applied by the linker during final link. */
+#define TC_FIX_ADJUSTABLE(fixP) (!symbol_used_in_reloc_p ((fixP)->fx_addsy))
#endif
#define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC)
@@ -192,8 +189,8 @@ extern void sh_elf_final_processing PARA
the expression into something we can use. */
#define TC_RELOC_GLOBAL_OFFSET_TABLE BFD_RELOC_SH_GOTPC
-/* This expression evaluates to false if the relocation is for a local object
- for which we still want to do the relocation at runtime. True if we
+/* This expression evaluates to true if the relocation is for a local object
+ for which we still want to do the relocation at runtime. False if we
are willing to perform this relocation while building the .o file.
This is only used for pcrel relocations, so GOTOFF does not need to be
checked here. I am not sure if some of the others are ever used with
@@ -205,15 +202,12 @@ extern void sh_elf_final_processing PARA
assembler can't compute the appropriate reloc, since its location
can only be determined at link time. */
-#define TC_RELOC_RTSYM_LOC_FIXUP(FIX) \
- ((FIX)->fx_r_type != BFD_RELOC_32_PLT_PCREL \
- && (FIX)->fx_r_type != BFD_RELOC_32_GOT_PCREL \
- && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC \
- && ((FIX)->fx_addsy == NULL \
- || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
- && ! S_IS_WEAK ((FIX)->fx_addsy) \
- && S_IS_DEFINED ((FIX)->fx_addsy) \
- && ! S_IS_COMMON ((FIX)->fx_addsy))))
+#define TC_FORCE_RELOCATION_LOCAL(FIXP) \
+ ((FIXP)->fx_r_type == BFD_RELOC_32_PLT_PCREL \
+ || (FIXP)->fx_r_type == BFD_RELOC_32_GOT_PCREL \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_GOTPC \
+ || TC_FORCE_RELOCATION (FIXP) \
+ || S_IS_EXTERNAL ((FIXP)->fx_addsy))
#define md_parse_name(name, exprP, nextcharP) \
sh_parse_name ((name), (exprP), (nextcharP))
Index: gas/config/tc-sh64.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sh64.h,v
retrieving revision 1.2
diff -u -p -r1.2 tc-sh64.h
--- gas/config/tc-sh64.h 4 Jun 2002 02:45:51 -0000 1.2
+++ gas/config/tc-sh64.h 10 Aug 2002 13:17:43 -0000
@@ -1,5 +1,5 @@
/* This file is tc-sh64.h
- Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+ Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -75,37 +75,34 @@ extern const char *sh64_target_format PA
#define TARGET_MACH sh64_target_mach ()
extern int sh64_target_mach PARAMS ((void));
-#undef TC_RELOC_RTSYM_LOC_FIXUP
-#define TC_RELOC_RTSYM_LOC_FIXUP(FIX) \
- ((FIX)->fx_r_type != BFD_RELOC_32_PLT_PCREL \
- && (FIX)->fx_r_type != BFD_RELOC_SH_PLT_LOW16 \
- && (FIX)->fx_r_type != BFD_RELOC_SH_PLT_MEDLOW16 \
- && (FIX)->fx_r_type != BFD_RELOC_SH_PLT_MEDHI16 \
- && (FIX)->fx_r_type != BFD_RELOC_SH_PLT_HI16 \
- && (FIX)->fx_r_type != BFD_RELOC_32_GOT_PCREL \
- && (FIX)->fx_r_type != BFD_RELOC_SH_GOT_LOW16 \
- && (FIX)->fx_r_type != BFD_RELOC_SH_GOT_MEDLOW16 \
- && (FIX)->fx_r_type != BFD_RELOC_SH_GOT_MEDHI16 \
- && (FIX)->fx_r_type != BFD_RELOC_SH_GOT_HI16 \
- && (FIX)->fx_r_type != BFD_RELOC_SH_GOT10BY4 \
- && (FIX)->fx_r_type != BFD_RELOC_SH_GOT10BY8 \
- && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT32 \
- && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT_LOW16 \
- && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT_MEDLOW16 \
- && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT_MEDHI16 \
- && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT_HI16 \
- && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT10BY4 \
- && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPLT10BY8 \
- && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC \
- && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC_LOW16 \
- && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC_MEDLOW16 \
- && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC_MEDHI16 \
- && (FIX)->fx_r_type != BFD_RELOC_SH_GOTPC_HI16 \
- && ((FIX)->fx_addsy == NULL \
- || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
- && ! S_IS_WEAK ((FIX)->fx_addsy) \
- && S_IS_DEFINED ((FIX)->fx_addsy) \
- && ! S_IS_COMMON ((FIX)->fx_addsy))))
+#undef TC_FORCE_RELOCATION_LOCAL
+#define TC_FORCE_RELOCATION_LOCAL(FIXP) \
+ ((FIXP)->fx_r_type == BFD_RELOC_32_PLT_PCREL \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_PLT_LOW16 \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_PLT_MEDLOW16 \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_PLT_MEDHI16 \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_PLT_HI16 \
+ || (FIXP)->fx_r_type == BFD_RELOC_32_GOT_PCREL \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_GOT_LOW16 \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_GOT_MEDLOW16 \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_GOT_MEDHI16 \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_GOT_HI16 \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_GOT10BY4 \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_GOT10BY8 \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_GOTPLT32 \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_GOTPLT_LOW16 \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_GOTPLT_MEDLOW16 \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_GOTPLT_MEDHI16 \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_GOTPLT_HI16 \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_GOTPLT10BY4 \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_GOTPLT10BY8 \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_GOTPC \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_GOTPC_LOW16 \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_GOTPC_MEDLOW16 \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_GOTPC_MEDHI16 \
+ || (FIXP)->fx_r_type == BFD_RELOC_SH_GOTPC_HI16 \
+ || TC_FORCE_RELOCATION (FIXP) \
+ || S_IS_EXTERNAL ((FIXP)->fx_addsy))
/* Note the kludge: we want to put back C, and we also want to consume the
expression, since we have handled it ourselves. FIXME: What we really
Index: gas/config/tc-sparc.h
===================================================================
RCS file: /cvs/src/src/gas/config/tc-sparc.h,v
retrieving revision 1.15
diff -u -p -r1.15 tc-sparc.h
--- gas/config/tc-sparc.h 21 Dec 2001 22:35:24 -0000 1.15
+++ gas/config/tc-sparc.h 10 Aug 2002 13:17:44 -0000
@@ -1,6 +1,6 @@
/* tc-sparc.h - Macros and type defines for the sparc.
Copyright 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001 Free Software Foundation, Inc.
+ 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -71,9 +71,9 @@ extern void sparc_handle_align PARAMS ((
#if defined (OBJ_ELF) || defined (OBJ_AOUT)
-/* This expression evaluates to false if the relocation is for a local
+/* This expression evaluates to true if the relocation is for a local
object for which we still want to do the relocation at runtime.
- True if we are willing to perform this relocation while building
+ False if we are willing to perform this relocation while building
the .o file.
If the reloc is against an externally visible symbol, then the
@@ -86,13 +86,10 @@ extern void sparc_handle_align PARAMS ((
#define obj_relocate_extern (! sparc_pic_code)
#endif
-#define TC_RELOC_RTSYM_LOC_FIXUP(FIX) \
- (obj_relocate_extern \
- || (FIX)->fx_addsy == NULL \
- || (! S_IS_EXTERNAL ((FIX)->fx_addsy) \
- && ! S_IS_WEAK ((FIX)->fx_addsy) \
- && S_IS_DEFINED ((FIX)->fx_addsy) \
- && ! S_IS_COMMON ((FIX)->fx_addsy)))
+#define TC_FORCE_RELOCATION_LOCAL(FIXP) \
+ ((!obj_relocate_extern \
+ && S_IS_EXTERNAL ((FIXP)->fx_addsy)) \
+ || TC_FORCE_RELOCATION (FIXP))
#endif
/* I know that "call 0" fails in sparc-coff if this doesn't return 1. I
Index: gas/doc/Makefile.in
===================================================================
RCS file: /cvs/src/src/gas/doc/Makefile.in,v
retrieving revision 1.43
diff -u -p -r1.43 Makefile.in
--- gas/doc/Makefile.in 30 Jul 2002 17:32:30 -0000 1.43
+++ gas/doc/Makefile.in 10 Aug 2002 13:17:44 -0000
@@ -194,7 +194,7 @@ DIST_COMMON = Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-TAR = gtar
+TAR = tar
GZIP_ENV = --best
all: all-redirect
.SUFFIXES:
Index: gas/doc/internals.texi
===================================================================
RCS file: /cvs/src/src/gas/doc/internals.texi,v
retrieving revision 1.29
diff -u -p -r1.29 internals.texi
--- gas/doc/internals.texi 11 Apr 2002 11:11:35 -0000 1.29
+++ gas/doc/internals.texi 10 Aug 2002 13:17:46 -0000
@@ -1250,18 +1250,67 @@ information removed. Depending upon the
@code{md_convert_frag} the frag information may or may not be necessary, as may
the resolved values of the symbols. The default value is 1.
-@item md_apply_fix3
+@item md_apply_fix3 (@var{fixP}, @var{valP}, @var{seg})
@cindex md_apply_fix3
GAS will call this for each fixup. It should store the correct value in the
-object file. @code{fixup_segment} performs a generic overflow check on the
-@code{valueT *val} argument after @code{md_apply_fix3} returns. If the overflow
-check is relevant for the target machine, then @code{md_apply_fix3} should
-modify @code{valueT *val}, typically to the value stored in the object file.
+object file. @code{struct fix *@var{fixP}} is the fixup @code{md_apply_fix3}
+is operating on. @code{valueT *@var{valP}} is the value to store into the
+object files, or at least is the generic code's best guess! Specifically,
+*@var{valP} is the value of the fixup symbol, perhaps modified by
+@samp{TC_FIX_ADJUSTABLE}, plus @code{@var{fixP}->fx_offset} (symbol addend),
+less MD_PCREL_FROM_SECTION for pc-relative fixups. @code{segT @var{seg}} is
+the section the fix is in.
+@code{fixup_segment} performs a generic overflow check on *@var{valP} after
+@code{md_apply_fix3} returns. If the overflow check is relevant for the target
+machine, then @code{md_apply_fix3} should modify *@var{valP}, typically to the
+value stored in the object file.
@item TC_HANDLES_FX_DONE
@cindex TC_HANDLES_FX_DONE
If this macro is defined, it means that @code{md_apply_fix3} correctly sets the
@code{fx_done} field in the fixup.
+
+@item TC_FORCE_RELOCATION (@var{fixP})
+@cindex TC_FORCE_RELOCATION
+@code{fixup_segment} tries to reduce the number of relocation emitted.
+For example, a fixup expression involving the difference of two symbols in one
+section, or a fixup against an absolute symbol, will normally not require a
+reloc. This macro allows a target machine to override the default behaviour.
+
+@item TC_FORCE_RELOCATION_ABS (@var{fixP})
+@cindex TC_FORCE_RELOCATION_ABS
+Like TC_FORCE_RELOCATION, but used only for fixup expressions against an
+absolute symbol. If undefined, TC_FORCE_RELOCATION will be used instead.
+
+@item TC_FORCE_RELOCATION_LOCAL (@var{fixP})
+@cindex TC_FORCE_RELOCATION_LOCAL
+Like TC_FORCE_RELOCATION, but used only for pc-relative, non-plt fixup
+expressions against a symbol in the current section. If undefined,
+TC_FORCE_RELOCATION will be used instead.
+
+@item TC_FORCE_RELOCATION_SUB_SAME (@var{fixP})
+@cindex TC_FORCE_RELOCATION_SUB
+Like TC_FORCE_RELOCATION, but used only for fixup expressions involving the
+difference of two symbols in one section. If undefined, TC_FORCE_RELOCATION
+will be used instead.
+
+@item TC_FORCE_RELOCATION_SUB_ABS (@var{fixP})
+@cindex TC_FORCE_RELOCATION_SUB_ABS
+Like TC_FORCE_RELOCATION, but used only for fixup expressions involving the
+difference of two symbols, with the subtrahend an absolute symbol. If the
+macro is undefined or returns zero, the subtrahend will be resolved.
+
+@item TC_FORCE_RELOCATION_SUB_LOCAL (@var{fixP})
+@cindex TC_FORCE_RELOCATION_SUB_LOCAL
+Like TC_FORCE_RELOCATION_SUB_ABS, but the subtrahend is a symbol in the same
+section as the fixup.
+
+@item TC_FIX_ADJUSTABLE (@var{fixP})
+@cindex TC_FIX_ADJUSTABLE
+This macro controls whether the symbol value becomes part of the value passed
+to @code{md_apply_fix3}. If the macro is undefined, or returns non-zero, the
+symbol value will be included. For ELF, a suitable definition might be
+@code{@w{!symbol_used_in_reloc_p ((@var{fixP})->fx_addsy)}}.
@item tc_gen_reloc
@cindex tc_gen_reloc
Index: gas/testsuite/gas/i386/absrel.d
===================================================================
RCS file: gas/testsuite/gas/i386/absrel.d
diff -N gas/testsuite/gas/i386/absrel.d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/i386/absrel.d 10 Aug 2002 13:17:48 -0000
@@ -0,0 +1,49 @@
+#objdump: -drw
+#name: i386 abs reloc
+
+.*: +file format .*i386.*
+
+Disassembly of section \.text:
+
+0+000 <loc>:
+ 0: a1 34 12 00 00[ ]*mov 0x1234,%eax
+
+0+005 <glob>:
+ 5: a1 00 00 00 00[ ]*mov 0x0,%eax 6: (R_386_)?(dir)?32 ext
+ a: a1 00 00 00 00[ ]*mov 0x0,%eax b: (R_386_)?(dir)?32 weak
+ f: (a1 00 00 00 00[ ]*mov 0x0,%eax 10: (R_386_)?32 comm)?(a1 04 00 00 00[ ]*mov 0x4,%eax 10: dir32 comm.*)?
+ 14: a1 00 00 00 00[ ]*mov 0x0,%eax 15: (R_386_)?(dir)?32 \.text
+ 19: (a1 00 00 00 00[ ]*mov 0x0,%eax 1a: R_386_32 glob)?(a1 05 00 00 00[ ]*mov 0x5,%eax 1a: (dir)?32 \.text)?
+ 1e: a1 76 98 00 00[ ]*mov 0x9876,%eax
+ 23: a1 00 01 00 00[ ]*mov 0x100,%eax 24: (R_386_)?(dir)?32 \.text
+ 28: (a1 00 00 00 00[ ]*mov 0x0,%eax 29: R_386_32 glob2)?(a1 05 01 00 00[ ]*mov 0x105,%eax 29: (dir)?32 \.text)?
+ 2d: (a1 00 00 00 00[ ]*mov 0x0,%eax 2e: R_386_32 \.data)?(a1 00 01 00 00[ ]*mov 0x100,%eax 2e: (dir)?32 \.data.*)?
+ 32: (a1 04 00 00 00[ ]*mov 0x4,%eax 33: R_386_32 \.data)?(a1 04 01 00 00[ ]*mov 0x104,%eax 33: (dir)?32 \.data.*)?
+ 37: a1 00 00 00 00[ ]*mov 0x0,%eax
+ 3c: a1 cc ed ff ff[ ]*mov 0xffffedcc,%eax 3d: (R_386_)?(dir)?32 ext
+ 41: a1 cc ed ff ff[ ]*mov 0xffffedcc,%eax 42: (R_386_)?(dir)?32 weak
+ 46: (a1 cc ed ff ff[ ]*mov 0xffffedcc,%eax 47: (R_386_)?32 comm)?(a1 d0 ed ff ff[ ]*mov 0xffffedd0,%eax 47: dir32 comm.*)?
+ 4b: a1 cc ed ff ff[ ]*mov 0xffffedcc,%eax 4c: (R_386_)?(dir)?32 \.text
+ 50: (a1 cc ed ff ff[ ]*mov 0xffffedcc,%eax 51: R_386_32 glob)?(a1 d1 ed ff ff[ ]*mov 0xffffedd1,%eax 51: (dir)?32 \.text)?
+ 55: a1 42 86 00 00[ ]*mov 0x8642,%eax
+ 5a: a1 cc ee ff ff[ ]*mov 0xffffeecc,%eax 5b: (R_386_)?(dir)?32 \.text
+ 5f: (a1 cc ed ff ff[ ]*mov 0xffffedcc,%eax 60: R_386_32 glob2)?(a1 d1 ee ff ff[ ]*mov 0xffffeed1,%eax 60: (dir)?32 \.text)?
+ 64: (a1 cc ed ff ff[ ]*mov 0xffffedcc,%eax 65: R_386_32 \.data)?(a1 cc ee ff ff[ ]*mov 0xffffeecc,%eax 65: (dir)?32 \.data.*)?
+ 69: (a1 d0 ed ff ff[ ]*mov 0xffffedd0,%eax 6a: R_386_32 \.data)?(a1 d0 ee ff ff[ ]*mov 0xffffeed0,%eax 6a: (dir)?32 \.data.*)?
+ 6e: a1 be 79 ff ff[ ]*mov 0xffff79be,%eax
+ 73: a1 8a 67 ff ff[ ]*mov 0xffff678a,%eax 74: (R_386_)?(dir)?32 ext
+ 78: a1 8a 67 ff ff[ ]*mov 0xffff678a,%eax 79: (R_386_)?(dir)?32 weak
+ 7d: (a1 8a 67 ff ff[ ]*mov 0xffff678a,%eax 7e: (R_386_)?32 comm)?(a1 8e 67 ff ff[ ]*mov 0xffff678e,%eax 7e: dir32 comm.*)?
+ 82: a1 8a 67 ff ff[ ]*mov 0xffff678a,%eax 83: (R_386_)?(dir)?32 \.text
+ 87: (a1 8a 67 ff ff[ ]*mov 0xffff678a,%eax 88: R_386_32 glob)?(a1 8f 67 ff ff[ ]*mov 0xffff678f,%eax 88: (dir)?32 \.text)?
+ 8c: a1 00 00 00 00[ ]*mov 0x0,%eax
+ 91: a1 8a 68 ff ff[ ]*mov 0xffff688a,%eax 92: (R_386_)?(dir)?32 \.text
+ 96: (a1 8a 67 ff ff[ ]*mov 0xffff678a,%eax 97: R_386_32 glob2)?(a1 8f 68 ff ff[ ]*mov 0xffff688f,%eax 97: (dir)?32 \.text)?
+ 9b: (a1 8a 67 ff ff[ ]*mov 0xffff678a,%eax 9c: R_386_32 \.data)?(a1 8a 68 ff ff[ ]*mov 0xffff688a,%eax 9c: (dir)?32 \.data.*)?
+ a0: (a1 8e 67 ff ff[ ]*mov 0xffff678e,%eax a1: R_386_32 \.data)?(a1 8e 68 ff ff[ ]*mov 0xffff688e,%eax a1: (dir)?32 \.data.*)?
+ a5: a1 00 01 00 00[ ]*mov 0x100,%eax
+ aa: a1 05 00 00 00[ ]*mov 0x5,%eax
+ af: a1 05 ff ff ff[ ]*mov 0xffffff05,%eax
+ b4: a1 05 01 00 00[ ]*mov 0x105,%eax
+ b9: a1 05 00 00 00[ ]*mov 0x5,%eax
+ \.\.\.
Index: gas/testsuite/gas/i386/absrel.s
===================================================================
RCS file: gas/testsuite/gas/i386/absrel.s
diff -N gas/testsuite/gas/i386/absrel.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/i386/absrel.s 10 Aug 2002 13:17:48 -0000
@@ -0,0 +1,62 @@
+abs = 0x1234
+ .extern ext
+ .weak weak
+ .comm comm,4
+ .global glob
+
+ .data
+data: .long 0
+
+ .text
+loc:
+ mov abs, %eax
+glob:
+ mov ext, %eax
+ mov weak, %eax
+ mov comm, %eax
+ mov loc, %eax
+ mov glob, %eax
+ mov abs2, %eax
+ mov loc2, %eax
+ mov glob2,%eax
+ mov data, %eax
+ mov data2,%eax
+ mov abs - abs, %eax
+ mov ext - abs, %eax
+ mov weak - abs, %eax
+ mov comm - abs, %eax
+ mov loc - abs, %eax
+ mov glob - abs, %eax
+ mov abs2 - abs, %eax
+ mov loc2 - abs, %eax
+ mov glob2 - abs, %eax
+ mov data - abs, %eax
+ mov data2 - abs, %eax
+ mov abs - abs2,%eax
+ mov ext - abs2,%eax
+ mov weak - abs2,%eax
+ mov comm - abs2,%eax
+ mov loc - abs2,%eax
+ mov glob - abs2,%eax
+ mov abs2 - abs2,%eax
+ mov loc2 - abs2,%eax
+ mov glob2 - abs2,%eax
+ mov data - abs2,%eax
+ mov data2 - abs2,%eax
+ mov loc2 - loc, %eax
+# It could be argued that the next four ought to emit pc-relative
+# relocations against glob and glob2. However, pic code generation
+# requires that they be resolved locally.
+ mov glob - loc, %eax
+ mov glob - loc2,%eax
+ mov glob2 - loc, %eax
+ mov glob2 - loc2,%eax
+
+ .org 0x100
+loc2:
+ .global glob2
+glob2 = loc2 + 5
+abs2 = 0x9876
+
+ .data
+data2: .long 0
Index: gas/testsuite/gas/i386/i386.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/i386/i386.exp,v
retrieving revision 1.16
diff -u -p -r1.16 i386.exp
--- gas/testsuite/gas/i386/i386.exp 9 Aug 2002 00:09:51 -0000 1.16
+++ gas/testsuite/gas/i386/i386.exp 10 Aug 2002 13:17:48 -0000
@@ -53,6 +53,8 @@ if [expr ([istarget "i*86-*-*"] || [ist
run_dump_test "jump"
run_dump_test "ssemmx2"
run_dump_test "sse2"
+ run_dump_test "absrel"
+ run_dump_test "pcrel"
# PIC is only supported on ELF targets.
if { ([istarget "*-*-elf*"] || [istarget "*-*-linux*"] )
Index: gas/testsuite/gas/i386/pcrel.d
===================================================================
RCS file: gas/testsuite/gas/i386/pcrel.d
diff -N gas/testsuite/gas/i386/pcrel.d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/i386/pcrel.d 10 Aug 2002 13:17:48 -0000
@@ -0,0 +1,49 @@
+#objdump: -drw
+#name: i386 pcrel reloc
+
+.*: +file format .*i386.*
+
+Disassembly of section \.text:
+
+0+000 <loc>:
+ ( 0: e9 30 12 00 00[ ]*jmp 1235 .*1: R_386_PC32 \*ABS\*)?( 0: e9 2f 12 00 00[ ]*jmp 1234 .*1: DISP32 \*ABS\*)?
+
+0+005 <glob>:
+ ( 5: e9 fc ff ff ff[ ]*jmp 6 .*6: R_386_PC32 ext)?( 5: e9 f6 ff ff ff[ ]*jmp 0 .*6: DISP32 ext)?
+ ( a: e9 fc ff ff ff[ ]*jmp b .*b: R_386_PC32 weak)?( a: e9 f1 ff ff ff[ ]*jmp 0 .*b: DISP32 weak)?
+ ( f: e9 fc ff ff ff[ ]*jmp 10 .*10: R_386_PC32 comm)?( f: e9 ec ff ff ff[ ]*jmp 0 .*10: DISP32 comm)?
+ (14: eb ea [ ]*jmp 0 .*)?(14: eb ea[ ]*jmp 0 .*)?
+ (16: e9 fc ff ff ff[ ]*jmp 17 .*17: R_386_PC32 glob)?(16: eb ed[ ]*jmp 5 .*)?
+ (1b: e9 72 98 00 00[ ]*jmp 9892 .*1c: R_386_PC32 \*ABS\*)?(18: e9 59 98 00 00[ ]*jmp 9876 .*19: DISP32 \*ABS\*)?
+ (20: e9 db 00 00 00[ ]*jmp 100 .*)?(1d: e9 de 00 00 00[ ]*jmp 100 .*)?
+ (25: e9 fc ff ff ff[ ]*jmp 26 .*26: R_386_PC32 glob2)?(22: e9 de 00 00 00[ ]*jmp 105 .*)?
+ (2a: e9 fc ff ff ff[ ]*jmp 2b .*2b: R_386_PC32 \.data)?(27: e9 d4 00 00 00[ ]*jmp 100 .*28: DISP32 .data\+0xffffff00)?
+ (2f: e9 00 00 00 00[ ]*jmp 34 .*30: R_386_PC32 \.data)?(2c: e9 d3 00 00 00[ ]*jmp 104 .*2d: DISP32 .data\+0xffffff00)?
+ (34: e9 fc ff ff ff[ ]*jmp 35 .*35: R_386_PC32 \*ABS\*)?(31: e9 ca ff ff ff[ ]*jmp 0 .*32: DISP32 \*ABS\*)?
+ (39: e9 c8 ed ff ff[ ]*jmp ffffee06 .*3a: R_386_PC32 ext)?(36: e9 91 ed ff ff[ ]*jmp ffffedcc .*37: DISP32 ext)?
+ (3e: e9 c8 ed ff ff[ ]*jmp ffffee0b .*3f: R_386_PC32 weak)?(3b: e9 8c ed ff ff[ ]*jmp ffffedcc .*3c: DISP32 weak)?
+ (43: e9 c8 ed ff ff[ ]*jmp ffffee10 .*44: R_386_PC32 comm)?(40: e9 87 ed ff ff[ ]*jmp ffffedcc .*41: DISP32 comm)?
+ (48: e9 7f ed ff ff[ ]*jmp ffffedcc .*)?(45: e9 82 ed ff ff[ ]*jmp ffffedcc .*)?
+ (4d: e9 c8 ed ff ff[ ]*jmp ffffee1a .*4e: R_386_PC32 glob)?(4a: e9 82 ed ff ff[ ]*jmp ffffedd1 .*)?
+ (52: e9 3e 86 00 00[ ]*jmp 8695 .*53: R_386_PC32 \*ABS\*)?(4f: e9 ee 85 00 00[ ]*jmp 8642 .*50: DISP32 \*ABS\*)?
+ (57: e9 70 ee ff ff[ ]*jmp ffffeecc .*)?(54: e9 73 ee ff ff[ ]*jmp ffffeecc .*)?
+ (5c: e9 c8 ed ff ff[ ]*jmp ffffee29 .*5d: R_386_PC32 glob2)?(59: e9 73 ee ff ff[ ]*jmp ffffeed1 .*)?
+ (61: e9 c8 ed ff ff[ ]*jmp ffffee2e .*62: R_386_PC32 \.data)?(5e: e9 69 ee ff ff[ ]*jmp ffffeecc .*5f: DISP32 .data\+0xffffff00)?
+ (66: e9 cc ed ff ff[ ]*jmp ffffee37 .*67: R_386_PC32 \.data)?(63: e9 68 ee ff ff[ ]*jmp ffffeed0 .*64: DISP32 .data\+0xffffff00)?
+ (6b: e9 ba 79 ff ff[ ]*jmp ffff7a2a .*6c: R_386_PC32 \*ABS\*)?(68: e9 51 79 ff ff[ ]*jmp ffff79be .*69: DISP32 \*ABS\*)?
+ (70: e9 86 67 ff ff[ ]*jmp ffff67fb .*71: R_386_PC32 ext)?(6d: e9 18 67 ff ff[ ]*jmp ffff678a .*6e: DISP32 ext)?
+ (75: e9 86 67 ff ff[ ]*jmp ffff6800 .*76: R_386_PC32 weak)?(72: e9 13 67 ff ff[ ]*jmp ffff678a .*73: DISP32 weak)?
+ (7a: e9 86 67 ff ff[ ]*jmp ffff6805 .*7b: R_386_PC32 comm)?(77: e9 0e 67 ff ff[ ]*jmp ffff678a .*78: DISP32 comm)?
+ (7f: e9 06 67 ff ff[ ]*jmp ffff678a .*)?(7c: e9 09 67 ff ff[ ]*jmp ffff678a .*)?
+ (84: e9 06 67 ff ff[ ]*jmp ffff678f .*)?(81: e9 09 67 ff ff[ ]*jmp ffff678f .*)?
+ (89: e9 fc ff ff ff[ ]*jmp 8a .*8a: R_386_PC32 \*ABS\*)?(86: e9 75 ff ff ff[ ]*jmp 0 .*87: DISP32 \*ABS\*)?
+ (8e: e9 f7 67 ff ff[ ]*jmp ffff688a .*)?(8b: e9 fa 67 ff ff[ ]*jmp ffff688a .*)?
+ (93: e9 f7 67 ff ff[ ]*jmp ffff688f .*)?(90: e9 fa 67 ff ff[ ]*jmp ffff688f .*)?
+ (98: e9 86 67 ff ff[ ]*jmp ffff6823 .*99: R_386_PC32 \.data)?(95: e9 f0 67 ff ff[ ]*jmp ffff688a .*96: DISP32 .data\+0xffffff00)?
+ (9d: e9 8a 67 ff ff[ ]*jmp ffff682c .*9e: R_386_PC32 \.data)?(9a: e9 ef 67 ff ff[ ]*jmp ffff688e .*9b: DISP32 .data\+0xffffff00)?
+ (a2: e9 fc 00 00 00[ ]*jmp 1a3 .*a3: R_386_PC32 \*ABS\*)?(9f: e9 5c 00 00 00[ ]*jmp 100 .*a0: DISP32 \*ABS\*)?
+ (a7: e9 01 00 00 00[ ]*jmp ad .*a8: R_386_PC32 \*ABS\*)?(a4: e9 5c ff ff ff[ ]*jmp 5 .*a5: DISP32 \*ABS\*)?
+ (ac: e9 01 ff ff ff[ ]*jmp ffffffb2 .*ad: R_386_PC32 \*ABS\*)?(a9: e9 57 fe ff ff[ ]*jmp ffffff05 .*aa: DISP32 \*ABS\*)?
+ (b1: e9 01 01 00 00[ ]*jmp 1b7 .*b2: R_386_PC32 \*ABS\*)?(ae: e9 52 00 00 00[ ]*jmp 105 .*af: DISP32 \*ABS\*)?
+ (b6: e9 01 00 00 00[ ]*jmp bc .*b7: R_386_PC32 \*ABS\*)?(b3: e9 4d ff ff ff[ ]*jmp 5 .*b4: DISP32 \*ABS\*)?
+ \.\.\.
Index: gas/testsuite/gas/i386/pcrel.s
===================================================================
RCS file: gas/testsuite/gas/i386/pcrel.s
diff -N gas/testsuite/gas/i386/pcrel.s
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/i386/pcrel.s 10 Aug 2002 13:17:48 -0000
@@ -0,0 +1,60 @@
+abs = 0x1234
+ .extern ext
+ .weak weak
+ .comm comm,4
+ .global glob
+
+ .data
+data: .long 0
+
+ .text
+loc:
+ jmp abs
+glob:
+ jmp ext
+ jmp weak
+ jmp comm
+ jmp loc
+ jmp glob
+ jmp abs2
+ jmp loc2
+ jmp glob2
+ jmp data
+ jmp data2
+ jmp abs - abs
+ jmp ext - abs
+ jmp weak - abs
+ jmp comm - abs
+ jmp loc - abs
+ jmp glob - abs
+ jmp abs2 - abs
+ jmp loc2 - abs
+ jmp glob2 - abs
+ jmp data - abs
+ jmp data2 - abs
+ jmp abs - abs2
+ jmp ext - abs2
+ jmp weak - abs2
+ jmp comm - abs2
+ jmp loc - abs2
+ jmp glob - abs2
+ jmp abs2 - abs2
+ jmp loc2 - abs2
+ jmp glob2 - abs2
+ jmp data - abs2
+ jmp data2 - abs2
+ jmp loc2 - loc
+#The next four are currently treated wrongly. They ought to be errors.
+ jmp glob - loc
+ jmp glob - loc2
+ jmp glob2 - loc
+ jmp glob2 - loc2
+
+ .org 0x100
+loc2:
+ .global glob2
+glob2 = loc2 + 5
+abs2 = 0x9876
+
+ .data
+data2: .long 0
Index: gas/testsuite/gas/ppc/astest.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/ppc/astest.d,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 astest.d
--- gas/testsuite/gas/ppc/astest.d 3 May 1999 07:28:52 -0000 1.1.1.1
+++ gas/testsuite/gas/ppc/astest.d 10 Aug 2002 13:17:49 -0000
@@ -17,8 +17,8 @@ Disassembly of section \.text:
10: 48 00 00 08 b 18 <apfour\+0x8>
14: 48 00 00 00 b 14 <apfour\+0x4>
14: R_PPC_REL24 x
- 18: 48 00 00 04 b 1c <apfour\+0xc>
- 18: R_PPC_REL24 \.data\+0x4
+ 18: 48 00 00 00 b 18 <apfour\+0x8>
+ 18: R_PPC_REL24 y
1c: 48 00 00 00 b 1c <apfour\+0xc>
1c: R_PPC_REL24 z
20: 48 00 00 14 b 34 <apfour\+0x24>
Index: gas/testsuite/gas/ppc/astest2.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/ppc/astest2.d,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 astest2.d
--- gas/testsuite/gas/ppc/astest2.d 3 May 1999 07:28:52 -0000 1.1.1.1
+++ gas/testsuite/gas/ppc/astest2.d 10 Aug 2002 13:17:49 -0000
@@ -13,8 +13,8 @@ Disassembly of section .text:
10: 48 00 00 08 b 18 <foo\+0x18>
14: 48 00 00 00 b 14 <foo\+0x14>
14: R_PPC_REL24 x
- 18: 48 00 00 04 b 1c <foo\+0x1c>
- 18: R_PPC_REL24 .data\+0x4
+ 18: 48 00 00 00 b 18 <foo\+0x18>
+ 18: R_PPC_REL24 y
1c: 48 00 00 00 b 1c <foo\+0x1c>
1c: R_PPC_REL24 z
20: 48 00 00 14 b 34 <foo\+0x34>
Index: gas/testsuite/gas/ppc/astest2_64.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/ppc/astest2_64.d,v
retrieving revision 1.1
diff -u -p -r1.1 astest2_64.d
--- gas/testsuite/gas/ppc/astest2_64.d 27 Aug 2001 10:51:19 -0000 1.1
+++ gas/testsuite/gas/ppc/astest2_64.d 10 Aug 2002 13:17:49 -0000
@@ -13,8 +13,8 @@ Disassembly of section \.text:
10: 48 00 00 08 b 18 <foo\+0x18>
14: 48 00 00 00 b 14 <foo\+0x14>
14: R_PPC64_REL24 x
- 18: 48 00 00 04 b 1c <foo\+0x1c>
- 18: R_PPC64_REL24 \.data\+0x4
+ 18: 48 00 00 00 b 18 <foo\+0x18>
+ 18: R_PPC64_REL24 y
1c: 48 00 00 00 b 1c <foo\+0x1c>
1c: R_PPC64_REL24 z
20: 48 00 00 14 b 34 <foo\+0x34>
Index: gas/testsuite/gas/ppc/astest64.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/ppc/astest64.d,v
retrieving revision 1.1
diff -u -p -r1.1 astest64.d
--- gas/testsuite/gas/ppc/astest64.d 27 Aug 2001 10:51:19 -0000 1.1
+++ gas/testsuite/gas/ppc/astest64.d 10 Aug 2002 13:17:49 -0000
@@ -17,8 +17,8 @@ Disassembly of section \.text:
10: 48 00 00 08 b 18 <apfour\+0x8>
14: 48 00 00 00 b 14 <apfour\+0x4>
14: R_PPC64_REL24 x
- 18: 48 00 00 04 b 1c <apfour\+0xc>
- 18: R_PPC64_REL24 \.data\+0x4
+ 18: 48 00 00 00 b 18 <apfour\+0x8>
+ 18: R_PPC64_REL24 y
1c: 48 00 00 00 b 1c <apfour\+0xc>
1c: R_PPC64_REL24 z
20: 48 00 00 14 b 34 <apfour\+0x24>
--
Alan Modra
IBM OzLabs - Linux Technology Centre