This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [patches] x86_64 PIC fix
- To: Jan Hubicka <jh at suse dot cz>
- Subject: Re: [patches] x86_64 PIC fix
- From: Bo Thorsen <bo at sonofthor dot dk>
- Date: Wed, 7 Feb 2001 16:31:42 +0100 (CET)
- Cc: <binutils at sources dot redhat dot com>, <patches at x86-64 dot org>
On Wed, 7 Feb 2001, Jan Hubicka wrote:
>
> Hi
> This patch fixes name of GOTPCREL relocation in elf64 and makes gas to
> cope with this type of relocation.
> If no one will cry I will install it tomorrow (or day later) to the both
> release and mainline branches.
Not really a cry, just a small addition and a FIXME to tc-i386.c. Let me
know what you think.
Bo.
Index: tc-i386.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-i386.c,v
retrieving revision 1.83
diff -c -3 -p -r1.83 tc-i386.c
*** tc-i386.c 2001/01/17 23:41:35 1.83
--- tc-i386.c 2001/02/07 15:28:58
*************** tc_i386_fix_adjustable (fixP)
*** 1152,1157 ****
--- 1152,1158 ----
|| fixP->fx_r_type == BFD_RELOC_386_GOT32
|| fixP->fx_r_type == BFD_RELOC_X86_64_PLT32
|| fixP->fx_r_type == BFD_RELOC_X86_64_GOT32
+ || fixP->fx_r_type == BFD_RELOC_X86_64_GOTPCREL
|| fixP->fx_r_type == BFD_RELOC_VTABLE_INHERIT
|| fixP->fx_r_type == BFD_RELOC_VTABLE_ENTRY)
return 0;
*************** md_assemble (line)
*** 3066,3071 ****
--- 3067,3073 ----
== O_subtract))))
{
/* We don't support dynamic linking on x86-64 yet. */
+ /* FIXME: Yes we do, just not this one?? */
if (flag_code == CODE_64BIT)
abort ();
reloc_type = BFD_RELOC_386_GOTPC;
*************** i386_displacement (disp_start, disp_end)
*** 3436,3442 ****
assert (exp->X_op == O_symbol);
exp->X_op = O_subtract;
exp->X_op_symbol = GOT_symbol;
! i.disp_reloc[this_operand] = BFD_RELOC_32;
}
#endif
--- 3438,3447 ----
assert (exp->X_op == O_symbol);
exp->X_op = O_subtract;
exp->X_op_symbol = GOT_symbol;
! if (i.disp_reloc[this_operand] == BFD_RELOC_X86_64_GOTPCREL)
! i.disp_reloc[this_operand] = BFD_RELOC_32_PCREL;
! else
! i.disp_reloc[this_operand] = BFD_RELOC_32;
}
#endif
*************** i386_validate_fix (fixp)
*** 4600,4608 ****
if (fixp->fx_subsy && fixp->fx_subsy == GOT_symbol)
{
/* GOTOFF relocation are nonsense in 64bit mode. */
! if (flag_code == CODE_64BIT)
! abort ();
! fixp->fx_r_type = BFD_RELOC_386_GOTOFF;
fixp->fx_subsy = 0;
}
}
--- 4605,4622 ----
if (fixp->fx_subsy && fixp->fx_subsy == GOT_symbol)
{
/* GOTOFF relocation are nonsense in 64bit mode. */
! if (fixp->fx_r_type == BFD_RELOC_32_PCREL)
! {
! if (flag_code != CODE_64BIT)
! abort ();
! fixp->fx_r_type = BFD_RELOC_X86_64_GOTPCREL;
! }
! else
! {
! if (flag_code == CODE_64BIT)
! abort ();
! fixp->fx_r_type = BFD_RELOC_386_GOTOFF;
! }
fixp->fx_subsy = 0;
}
}
--
Bo Thorsen | Lahnsgade 31, st.
Free software developer | 5000 Odense C
SuSE Labs | Denmark