[GOLD][PATCH] Set ARM ABI information in ELF file header.

Doug Kwan (關振德) dougkwan@google.com
Fri Oct 30 16:34:00 GMT 2009


Hi,

2009/10/30 Ian Lance Taylor <iant@google.com>:


> This looks like you are going to set the processor specific flags for
> the output even if the input doesn't have any.  That doesn't seem
> right.  If input doesn't have any flags, don't set the output flags.
>

The flags is initialized to 0.  So this preserve the existing
behaviour, which is setting the flags to zero on all target.

>> +// Adjust ELF file header.
>> +template<bool big_endian>
>> +void
>> +Target_arm<big_endian>::do_adjust_elf_header(
>> +    unsigned char* view,
>> +    int len) const
>> +{
>> +  gold_assert(len == elfcpp::Elf_sizes<32>::ehdr_size);
>> +
>> +  elfcpp::Ehdr<32, big_endian> ehdr(view);
>> +  unsigned char e_ident[elfcpp::EI_NIDENT];
>> +  memcpy(e_ident, ehdr.get_e_ident(), elfcpp::EI_NIDENT);
>> +
>> +  if (elfcpp::arm_eabi_version(this->processor_specific_flags())
>> +      == elfcpp::EF_ARM_EABI_UNKNOWN)
>> +    e_ident[elfcpp::EI_OSABI] = elfcpp::ELFOSABI_ARM;
>> +  else
>> +    e_ident[elfcpp::EI_OSABI] = 0;
>> +  e_ident[elfcpp::EI_ABIVERSION] = 0;
>> +
>> +  // FIXME: Do EF_ARM_BE8 adjustment.
>> +
>> +  elfcpp::Ehdr_write<32, big_endian> oehdr(view);
>> +  oehdr.put_e_ident(e_ident);
>> +}
>
> Aren't you supposed to call set_e_flags here?
>
> Oh, I see, that should be done in output.cc, but you didn't include
> output.cc in this version of the patch.

Yes, I forgot to include output.cc.  This patch was created by copying
parts of a big patch.

> This patch is OK with the above changes if output.cc just calls the
> target to get the value to store in e_flags.
>
> Thanks.
>
> Ian
>



More information about the Binutils mailing list