This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: RFC: [PATCH] Add output_type to bfd_link_info
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Alan Modra <amodra at gmail dot com>
- Cc: Binutils <binutils at sourceware dot org>
- Date: Tue, 18 Aug 2015 05:56:02 -0700
- Subject: Re: RFC: [PATCH] Add output_type to bfd_link_info
- Authentication-results: sourceware.org; auth=none
- References: <20150817154337 dot GA21275 at intel dot com> <20150818044847 dot GF4378 at bubble dot grove dot modra dot org>
On Mon, Aug 17, 2015 at 9:48 PM, Alan Modra <amodra@gmail.com> wrote:
> On Mon, Aug 17, 2015 at 08:43:38AM -0700, H.J. Lu wrote:
>> The "shared" field in bfd_link_info is set for both DSO and and PIE.
>> There are separate fields for executable and relocatable outputs. This
>> patch adds an "output_type" field:
>>
>> enum output_type
>> {
>> type_unknown = 0,
>> type_executable,
>> type_dll,
>> type_relocatable
>> };
>>
>> and a "pic" field to bfd_link_info to replace shared, executable and
>> relocatable fields so that we can use the "output_type" field to check
>> for output type and the "pic" field check if output is PIC. Macros:
>>
>> are provided to check for output features.
>>
>> Any comments, objections, feedbacks?
>
> Good! I started a patch like this a while ago, so you've saved me the
> trouble of finishing my work. :)
>
> Some comments on the patch itself:
>
> I think you can delete type_unknown, making type_executable the
> first enum (value 0) which happens to be the correct default.
>
> I'd like to see the macros used in ld/, eg. instead of
> "link_info.type != type_relocatable" write
> "!bfd_link_relocatable (&link_info)".
> The reason for that is consistency, so grep over bfd/ and ld/ can
> more easily pick up given output types, and to make it easy to
> change the underlying flag bits.
>
> I spotted a few places that can be optimised but rather than list them
> here I'll commit a followup patch.
Updated and checked in.
Thanks.
--
H.J.