This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PATCH: Check invalid x32 relocations.
>>> On 17.01.11 at 13:42, "H.J. Lu" <hjl.tools@gmail.com> wrote:
> On Mon, Jan 17, 2011 at 1:49 AM, Jan Beulich <JBeulich@novell.com> wrote:
>>>>> On 15.01.11 at 16:50, "H.J. Lu" <hongjiu.lu@intel.com> wrote:
>>> --- a/bfd/elf64-x86-64.c
>>> +++ b/bfd/elf64-x86-64.c
>>> @@ -1179,6 +1179,39 @@ elf_x86_64_check_relocs (bfd *abfd, struct
>>> bfd_link_info *info,
>>> h = (struct elf_link_hash_entry *) h->root.u.i.link;
>>> }
>>>
>>> + /* Check invalid x32 relocations. */
>>> + if (!ABI_64_P (abfd))
>>> + switch (r_type)
>>> + {
>>> + default:
>>> + break;
>>> +
>>> + case R_X86_64_64:
>>
>> While I buy that all the below ones are meaningless, excluding
>> the one above seems questionable (and exposes one further
>> reason why tying the ABI to object file format is bogus). An
>> obvious use case is to initialize a 64-bit variable with a constant
>> defined in another object.
>>
>
> Show me how to initialize a 64-bit variable with a constant
> defined in another object in x32 format in assembly code.
> I will check it as a testcase.
Source1:
.text
.global _start
_start:
ret
.data
var: .quad cnst
Source2:
.global cnst
.equ cnst, 0x12345678
Jan