PATCH: Check invalid x32 relocations.

H.J. Lu hjl.tools@gmail.com
Mon Jan 17 12:42:00 GMT 2011


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.

Thanks.

-- 
H.J.



More information about the Binutils mailing list