This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Hi,

   This is the third version.  I believe it is MT-safe.   The
processor-specific flags are not read during do_read_symbols and are
merged in Target_arm::do_finalize_sections.

-Doug

2009-10-29  Doug Kwan  <dougkwan@google.com>

elfcpp/ChangeLog:
        * arm.h (EF_ARM_BE8, EF_ARM_EABIMASK, EF_ARM_EABI_UNKNOWN,
        EF_ARM_EABI_VER1, EF_ARM_EABI_VER2, EF_ARM_EABI_VER3,
        EF_ARM_EABI_VER4, EF_ARM_EABI_VER5): New enums for processor-specific
        flags.
        (arm_eabi_version): New inline function.
        * elfcpp.h: Add a comment about DT_ENCODING.

gold/ChangeLog:
        * arm.cc (Arm_relobj::processor_specific_flags): New method
        definition.
        (Arm_relobj::do_read_symbols): New method declaration.
        (Arm_relobj::processor_specific_flags_): New data member declaration.
        (Arm_dynobj): New class definition.
        (Target_arm::do_finalize_sections): Add input_objects parameter.
        (Target_arm::do_adjust_elf_header): New method declaration.
        (Target_arm::are_eabi_versions_compatible,
        (Target_arm::merge_processor_specific_flags): New method declaration.
        (Target_arm::do_make_elf_object): New overloaded method definitions
        and declaration.
        (Arm_relobj::do_read_symbols): New method definition.
        (Arm_dynobj::do_read_symbols): Ditto.
        (Target_arm::do_finalize_sections): Add input_objects parameters.
        Merge processor-specific flags from all input objects.
        (Target_arm::are_eabi_versions_compatible,
        Target_arm::merge_processor_specific_flags,
        Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
        New method definitions.
        * i386.cc (Target_i386::do_finalize_sections): Add unnamed
        Input_objects pointer type parameter.
        * layout.cc (Layout::finalize): Pass input objects to target's.
        finalize_sections function.
        * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
        Input_objects pointer type parameter.
        * sparc.cc (Target_sparc::do_finalize_sections): Same.
        * target.h (Input_objects): New forward class declaration.
        (Target::processor_specific_flags,
        Target::are_processor_specific_flags_sect): New method definitions.
        (Target::finalize_sections): Add input_objects parameter.
        (Target::Target): Initialize processor_specific_flags_ and
        are_processor_specific_flags_set_.
        (Target::do_finalize_sections): Add unnamed Input_objects pointer type
        parameter.
        (Target::set_processor_specific_flags): New method definition.
        (Target::processor_specific_flags_,
        Target::are_processor_specific_flags_set_): New data member
        declarations.
        * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
        Input_objects pointer type parameter.


2009/10/28 Doug Kwan (關振德) <dougkwan@google.com>:
> This is not MT-safe.  Afrer a discussion with Ian, I know how to fix
> this.  Will submit a new patch.
>
> -Doug
>
> 2009/10/27 Doug Kwan (關振德) <dougkwan@google.com>:
>> Hi Ian,
>>
>>    This is and updated patch.  I removed all code related to obsolete
>> processor-specific flags.  I checked the ARM ELF specs and it said
>> only EF_ARM_BE8 and the EABI version flag are supported.   Bit used by
>> previously defined flags are now reserved.
>>
>> -Doug
>>
>> elfcpp/ChangeLog:
>>
>>        * arm.h (EF_ARM_BE8, EF_ARM_EABI_UNKNOWN, EF_ARM_EABI_VER1,
>>        EF_ARM_EABI_VER2, EF_ARM_EABI_VER3, EF_ARM_EABI_VER4,
>>        EF_ARM_EABI_VER5): New enums for processor-specific flags in ELF
>>        file header.
>>        (arm_eabi_version): New inline function.
>>
>> gold/ChangeLog:
>>        * arm.cc (Target_arm::do_adjust_elf_header): New method declaration.
>>        (Target_arm::are_eabi_versions_compatible): Same.
>>        (Target_arm::do_make_elf_object): New overloaded method declaration
>>        and definitions.
>>        (Target_arm::are_eabi_versions_compatible,
>>        Target_arm::merge_processor_specific_flags,
>>        Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
>>        New method definitions.
>>        * output.cc (Output_file_header::do_sized_write): Set e_flags using
>>        values from target.
>>        * target.h (Target::processor_specific_flags,
>>        Target::are_processor_specific_flags_set): New method definitions.
>>        (Target::Target): Initialize processor_specific_flags_ and
>>        are_processor_specific_flags_set_.
>>        (set_processor_specific_flags): New method definition.
>>        (processor_specific_flags_, are_processor_specific_flags_set_):
>>        New data member declarations.
>>
>>
>> 2009/10/27 Doug Kwan (關振德) <dougkwan@google.com>:
>>> Yes, that's what I told you about having partially working code in the
>>> another thread.
>>>
>>> -Doug
>>>
>>> 2009/10/27 Viktor Kutuzov <vkutuzov@accesssoftek.com>:
>>>> Good work, Doug!
>>>> Are you going to parse input objects ".ARM.attributes" section as well?
>>>>
>>>> -Viktor
>>>>
>>>> ----- Original Message ----- From: "Doug Kwan (關振德)" <dougkwan@google.com>
>>>> To: "Joseph S. Myers" <joseph@codesourcery.com>
>>>> Cc: "Ian Lance Taylor" <iant@google.com>; "binutils"
>>>> <binutils@sourceware.org>; "Viktor Kutuzov" <vkutuzov@accesssoftek.com>
>>>> Sent: Tuesday, October 27, 2009 9:12 AM
>>>> Subject: Re: [GOLD][PATCH] Set ARM ABI information in ELF file header.
>>>>
>>>>
>>>>> Wow.  This makes gold bug-compatible with ld :).  I can remove that.
>>>>> Thanks for catching it.
>>>>>
>>>>> -Doug
>>>>>
>>>>> 2009/10/27 Joseph S. Myers <joseph@codesourcery.com>:
>>>>>>
>>>>>> On Mon, 26 Oct 2009, Doug Kwan (關振德) wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>>    This patch adds code to set proper flags in the processor-specific
>>>>>>> flags in the ELF file header.  Previously we always set e_flags to 0
>>>>>>> on all target.  This patch add methods processor_specific_flags and
>>>>>>> set_processor_specific_flags in Target so that Output_file_header can
>>>>>>> get the flags.   For targets that merge processor-specific flags from
>>>>>>> input objects,  we also track whether the flags have been set at least
>>>>>>> once.  Currently only the ARM target sets the flags correctly.
>>>>>>
>>>>>> It looks like this patch is replicating the GNU ld bug whereby
>>>>>> EF_ARM_HASENTRY is set on EABI objects.  There is no such flag in AAELF
>>>>>> and so it is a bug to set it on such objects.
>>>>>>
>>>>>> --
>>>>>> Joseph S. Myers
>>>>>> joseph@codesourcery.com
>>>>>
>>>>
>>>>
>>>
>>
>

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]