[PATCH, LD] Make import libraries relocatable objects

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH, LD] Make import libraries relocatable objects

Thomas Preudhomme
Hi,

For ELF targets --out-implib currently generates an executable file
(e_type is ET_EXEC) despite the file being expected to be linked against
some other object file to make an executable later. It seems therefore
more sensible to make the import library a relocatable object file
(e_type set to ET_REL).

Incidentally, as dicted by requirement 8 of
"ARM v8-M Security Extensions: Requirements on Development Tools"
(document ARM-ECM-0359818) version 1.0, import libraries generated when
using --cmse-implib *must* be relocatable object file so this commit
also adds an assert there in case the type of ELF import library is
changed again in the future.

ChangeLog entry is as follows:

*** bfd/ChangeLog ***

2017-04-25  Thomas Preud'homme  <[hidden email]>

        * elflink.c (elf_output_implib): Remove executable flag from import
        library bfd.
        * elf32-arm.c (elf32_arm_filter_implib_symbols): Assert that the import
        library is a relocatable object file.

*** ld/ChangeLog ***

2017-04-25  Thomas Preud'homme  <[hidden email]>

        * testsuite/ld-arm/arm-elf.exp
        (Secure gateway import library generation): Check e_type field
        of import library and executable produced.
        * testsuite/ld-arm/cmse-implib.type: Expectations for e_type field.

Testing: testsuite shows no regression when run for arm-none-eabi and
armeb-none-eabi.

Is this ok for master?

Best regards,

Thomas

relocatable_object_implib.patch (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, LD, ping] Make import libraries relocatable objects

Thomas Preudhomme
Ping?

Best regards,

Thomas

On 27/04/17 11:41, Thomas Preudhomme wrote:

> Hi,
>
> For ELF targets --out-implib currently generates an executable file
> (e_type is ET_EXEC) despite the file being expected to be linked against
> some other object file to make an executable later. It seems therefore
> more sensible to make the import library a relocatable object file
> (e_type set to ET_REL).
>
> Incidentally, as dicted by requirement 8 of
> "ARM v8-M Security Extensions: Requirements on Development Tools"
> (document ARM-ECM-0359818) version 1.0, import libraries generated when
> using --cmse-implib *must* be relocatable object file so this commit
> also adds an assert there in case the type of ELF import library is
> changed again in the future.
>
> ChangeLog entry is as follows:
>
> *** bfd/ChangeLog ***
>
> 2017-04-25  Thomas Preud'homme  <[hidden email]>
>
>     * elflink.c (elf_output_implib): Remove executable flag from import
>     library bfd.
>     * elf32-arm.c (elf32_arm_filter_implib_symbols): Assert that the import
>     library is a relocatable object file.
>
> *** ld/ChangeLog ***
>
> 2017-04-25  Thomas Preud'homme  <[hidden email]>
>
>     * testsuite/ld-arm/arm-elf.exp
>     (Secure gateway import library generation): Check e_type field
>     of import library and executable produced.
>     * testsuite/ld-arm/cmse-implib.type: Expectations for e_type field.
>
> Testing: testsuite shows no regression when run for arm-none-eabi and
> armeb-none-eabi.
>
> Is this ok for master?
>
> Best regards,
>
> Thomas

relocatable_object_implib.patch (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, LD, ping] Make import libraries relocatable objects

Nick Clifton
Hi Thomas,

> Ping?

Oops - sorry - I was assuming that one of the ARM maintainers would look at this.

>> *** bfd/ChangeLog ***
>>
>> 2017-04-25  Thomas Preud'homme  <[hidden email]>
>>
>>     * elflink.c (elf_output_implib): Remove executable flag from import
>>     library bfd.
>>     * elf32-arm.c (elf32_arm_filter_implib_symbols): Assert that the import
>>     library is a relocatable object file.
>>
>> *** ld/ChangeLog ***
>>
>> 2017-04-25  Thomas Preud'homme  <[hidden email]>
>>
>>     * testsuite/ld-arm/arm-elf.exp
>>     (Secure gateway import library generation): Check e_type field
>>     of import library and executable produced.
>>     * testsuite/ld-arm/cmse-implib.type: Expectations for e_type field.
>>
>> Testing: testsuite shows no regression when run for arm-none-eabi and
>> armeb-none-eabi.
>>
>> Is this ok for master?

Approved - please apply, but, please could you make one small change:

+  BFD_ASSERT (!(bfd_get_file_flags (info->out_implib_bfd) & EXEC_P));
 
Please could you add a comment above this assert referencing the ARM ECM
document and explaining why the check is here ?

Cheers
  Nick
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, LD, ping] Make import libraries relocatable objects

Thomas Preudhomme


On 05/05/17 10:14, Nick Clifton wrote:
> Hi Thomas,
>
>> Ping?
>
> Oops - sorry - I was assuming that one of the ARM maintainers would look at this.

Actually this specific patch also needs a global reviewer because it changes the
behavior of the target-independent --out-implib feature as well which is why I
didn't add the ARM tag in the subject.

>
>>> *** bfd/ChangeLog ***
>>>
>>> 2017-04-25  Thomas Preud'homme  <[hidden email]>
>>>
>>>     * elflink.c (elf_output_implib): Remove executable flag from import
>>>     library bfd.
>>>     * elf32-arm.c (elf32_arm_filter_implib_symbols): Assert that the import
>>>     library is a relocatable object file.
>>>
>>> *** ld/ChangeLog ***
>>>
>>> 2017-04-25  Thomas Preud'homme  <[hidden email]>
>>>
>>>     * testsuite/ld-arm/arm-elf.exp
>>>     (Secure gateway import library generation): Check e_type field
>>>     of import library and executable produced.
>>>     * testsuite/ld-arm/cmse-implib.type: Expectations for e_type field.
>>>
>>> Testing: testsuite shows no regression when run for arm-none-eabi and
>>> armeb-none-eabi.
>>>
>>> Is this ok for master?
>
> Approved - please apply, but, please could you make one small change:
>
> +  BFD_ASSERT (!(bfd_get_file_flags (info->out_implib_bfd) & EXEC_P));
>
> Please could you add a comment above this assert referencing the ARM ECM
> document and explaining why the check is here ?

Will do. Can you confirm you are happy with the target-independent change as well?

Best regards,

Thomas
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, LD, ping] Make import libraries relocatable objects

Sourceware - binutils list mailing list
Hi Thomas,

> Will do. Can you confirm you are happy with the target-independent change as well?

I am.

As far as I know only the ARM target is actually using ELF based import libraries at the moment.

Cheers
  Nick


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, LD, ping] Make import libraries relocatable objects

Thomas Preudhomme
Great then. Committed the attached updated patch as per your comments.

Best regards,

Thomas

On 08/05/17 09:51, Nick Clifton wrote:

> Hi Thomas,
>
>> Will do. Can you confirm you are happy with the target-independent change as well?
>
> I am.
>
> As far as I know only the ARM target is actually using ELF based import libraries at the moment.
>
> Cheers
>   Nick
>
>

relocatable_object_implib.patch (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, LD, ping] Make import libraries relocatable objects

Thomas Preudhomme
Hi Tristan,

Is this ok to be backported to binutils 2.28?

It applies cleanly on binutils-2_28-branch and testsuite shows no regression.

Best regards,

Thomas

On 08/05/17 15:29, Thomas Preudhomme wrote:

> Great then. Committed the attached updated patch as per your comments.
>
> Best regards,
>
> Thomas
>
> On 08/05/17 09:51, Nick Clifton wrote:
>> Hi Thomas,
>>
>>> Will do. Can you confirm you are happy with the target-independent change as
>>> well?
>>
>> I am.
>>
>> As far as I know only the ARM target is actually using ELF based import
>> libraries at the moment.
>>
>> Cheers
>>   Nick
>>
>>
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH, LD, ping] Make import libraries relocatable objects

Tristan Gingold-2
On 20/06/2017 11:53, Thomas Preudhomme wrote:
> Hi Tristan,
>
> Is this ok to be backported to binutils 2.28?

Yes, that's ok.

>
> It applies cleanly on binutils-2_28-branch and testsuite shows no
> regression.
>
> Best regards,
>
> Thomas
>
> On 08/05/17 15:29, Thomas Preudhomme wrote:
>> Great then. Committed the attached updated patch as per your comments.
>>
>> Best regards,
>>
>> Thomas
>>
>> On 08/05/17 09:51, Nick Clifton wrote:
>>> Hi Thomas,
>>>
>>>> Will do. Can you confirm you are happy with the target-independent
>>>> change as
>>>> well?
>>>
>>> I am.
>>>
>>> As far as I know only the ARM target is actually using ELF based import
>>> libraries at the moment.
>>>
>>> Cheers
>>>   Nick
>>>
>>>