This is the mail archive of the 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: RFC: [PATCH] Add output_type to bfd_link_info

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.

Alan Modra
Australia Development Lab, IBM

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