[PATCH] New --pe-dll-characteristcs switch for PE ld.

Christopher Faylor cgf-use-the-mailinglist-please@sourceware.org
Fri Mar 6 05:47:00 GMT 2009


On Thu, Mar 05, 2009 at 12:58:39PM +0000, Dave Korn wrote:
>The PE header in executables contains a field called
>"DllCharacteristics", which contains various flags that inform the OS
>dynamic loader about the status of the executable w.r.t.  runtime
>factors such as NX/DEP, ASLR, dynamic rebasing, etc.  (Despite the
>name, it applies to executables of all kinds, not just DLLs, but that's
>what MS calls it so that's what I call it).

And, as I mentioned in the Cygwin mailing list, "despite the name", I
don't think the option should mention "dll".  The name of the option
doesn't have to mirror an internal define.

I wonder if the name "pe-" is even TMI for this option but at least
there is some precedent for that.

>The attached patch adds a new linker option to allow setting the value
>of this field.  As the default for this field is zero, and as there is
>no other source for these flags in any of the input BFDs, I haven't
>provided a mechanism to clear any of these flags; that would make a
>suitable follow-on patch for objcopy, but first things first.

I would like to see an objcopy option at some point.  I don't agree with
the prevailing cygwin opinion that you need a separate binary to deal
with this.  It seems silly to have objcopy able to do only some things
to a PE and, if objcopy can do this, then I don't see why you need an
extra program to manipulate this field.

But, I digress.

Other than the option name (and, if the option name is renamed a few
variables), I think this would be a fine addition to ld.

cgf



More information about the Binutils mailing list