* 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.
This commit is contained in:
Alan Modra 2002-08-10 14:49:48 +00:00
parent 2548cbcc14
commit 31312f958e
2 changed files with 36 additions and 16 deletions

View file

@ -1,3 +1,13 @@
2002-08-10 Alan Modra <amodra@bigpond.net.au>
* 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.
2002-08-09 Graeme Peterson <gp@qnx.com> 2002-08-09 Graeme Peterson <gp@qnx.com>
* configure.in: Add support for ppc-*-nto* target. * configure.in: Add support for ppc-*-nto* target.

View file

@ -1207,9 +1207,12 @@ reloc (size, pcrel, sign, other)
int int
tc_i386_fix_adjustable (fixP) tc_i386_fix_adjustable (fixP)
fixS *fixP; fixS *fixP ATTRIBUTE_UNUSED;
{ {
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) #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 /* Prevent all adjustments to global symbols, or else dynamic
linking will not work correctly. */ linking will not work correctly. */
if (S_IS_EXTERNAL (fixP->fx_addsy) 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 && (S_GET_SEGMENT (fixP->fx_addsy)->flags & SEC_MERGE) != 0
&& fixP->fx_pcrel)) && fixP->fx_pcrel))
return 0; return 0;
#endif
/* adjust_reloc_syms doesn't know about the GOT. */ /* adjust_reloc_syms doesn't know about the GOT. */
if (fixP->fx_r_type == BFD_RELOC_386_GOTOFF if (fixP->fx_r_type == BFD_RELOC_386_GOTOFF
|| fixP->fx_r_type == BFD_RELOC_386_PLT32 || 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_INHERIT
|| fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY) || fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
return 0; return 0;
#endif
return 1; return 1;
} }
#else #else
@ -3668,6 +3672,7 @@ i386_immediate (imm_start)
#ifdef BFD_ASSEMBLER #ifdef BFD_ASSEMBLER
&& OUTPUT_FLAVOR == bfd_target_aout_flavour && OUTPUT_FLAVOR == bfd_target_aout_flavour
#endif #endif
&& exp_seg != absolute_section
&& exp_seg != text_section && exp_seg != text_section
&& exp_seg != data_section && exp_seg != data_section
&& exp_seg != bss_section && exp_seg != bss_section
@ -3882,10 +3887,15 @@ i386_displacement (disp_start, disp_end)
#ifdef BFD_ASSEMBLER #ifdef BFD_ASSEMBLER
&& OUTPUT_FLAVOR == bfd_target_aout_flavour && OUTPUT_FLAVOR == bfd_target_aout_flavour
#endif #endif
&& exp_seg != absolute_section
&& exp_seg != text_section && exp_seg != text_section
&& exp_seg != data_section && exp_seg != data_section
&& exp_seg != bss_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 #ifdef BFD_ASSEMBLER
as_bad (_("unimplemented segment %s in operand"), exp_seg->name); as_bad (_("unimplemented segment %s in operand"), exp_seg->name);
@ -4311,8 +4321,9 @@ md_estimate_size_before_relax (fragP, segment)
shared library. */ shared library. */
if (S_GET_SEGMENT (fragP->fr_symbol) != segment if (S_GET_SEGMENT (fragP->fr_symbol) != segment
#if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF) #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
|| S_IS_EXTERNAL (fragP->fr_symbol) || (OUTPUT_FLAVOR == bfd_target_elf_flavour
|| S_IS_WEAK (fragP->fr_symbol) && (S_IS_EXTERNAL (fragP->fr_symbol)
|| S_IS_WEAK (fragP->fr_symbol)))
#endif #endif
) )
{ {
@ -4586,15 +4597,16 @@ md_apply_fix3 (fixP, valP, seg)
} }
} }
/* This is a hack. There should be a better way to handle this. if (fixP->fx_pcrel
This covers for the fact that bfd_install_relocation will && (fixP->fx_r_type == BFD_RELOC_32_PCREL
subtract the current location (for partial_inplace, PC relative || fixP->fx_r_type == BFD_RELOC_16_PCREL
relocations); see more below. */ || fixP->fx_r_type == BFD_RELOC_8_PCREL)
if ((fixP->fx_r_type == BFD_RELOC_32_PCREL && !use_rela_relocations)
|| fixP->fx_r_type == BFD_RELOC_16_PCREL
|| fixP->fx_r_type == BFD_RELOC_8_PCREL)
&& fixP->fx_addsy && !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 #ifndef OBJ_AOUT
if (OUTPUT_FLAVOR == bfd_target_elf_flavour if (OUTPUT_FLAVOR == bfd_target_elf_flavour
#ifdef TE_PE #ifdef TE_PE
@ -4645,6 +4657,7 @@ md_apply_fix3 (fixP, valP, seg)
runtime we merely add the offset to the actual PLT entry. */ runtime we merely add the offset to the actual PLT entry. */
value = -4; value = -4;
break; break;
case BFD_RELOC_386_GOT32: case BFD_RELOC_386_GOT32:
case BFD_RELOC_386_TLS_GD: case BFD_RELOC_386_TLS_GD:
case BFD_RELOC_386_TLS_LDM: case BFD_RELOC_386_TLS_LDM:
@ -4655,9 +4668,6 @@ md_apply_fix3 (fixP, valP, seg)
case BFD_RELOC_X86_64_GOT32: case BFD_RELOC_X86_64_GOT32:
value = 0; /* Fully resolved at runtime. No addend. */ value = 0; /* Fully resolved at runtime. No addend. */
break; break;
case BFD_RELOC_386_GOTOFF:
case BFD_RELOC_X86_64_GOTPCREL:
break;
case BFD_RELOC_VTABLE_INHERIT: case BFD_RELOC_VTABLE_INHERIT:
case BFD_RELOC_VTABLE_ENTRY: case BFD_RELOC_VTABLE_ENTRY: