This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: PE known sections having certain flags enforced
- From: Nick Clifton <nickc at redhat dot com>
- To: Jan Beulich <JBeulich at suse dot com>
- Cc: binutils at sourceware dot org
- Date: Mon, 9 Oct 2017 14:04:52 +0100
- Subject: Re: PE known sections having certain flags enforced
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=nickc at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C7A7D25791
- References: <59DB7F940200007800183E1C@prv-mh.provo.novell.com>
Hi Jan,
> back in 2003 you've changed bfd/peXXigen.c's
> _bfd_XXi_swap_scnhdr_out() to force certain flags for known
> sections. Considering the function this lives in, the change appears
> to make it impossible to create binaries with flags varying from the
> ones being enforced there, as even objcopy would come through
> that path.
Right - I think that this is a requirement of the PE format specification,
which is why it is being enforced here. See the "Special Sections" entry
in the "Microsoft Portable Executable and Common Object File Format Specification"
document for more details.
> we've found a need to produce .reloc sections without the
> discardable flag set,
> Do you have any suggestion how to achieve this without creating
> a custom tool to effect the change, and also without renaming the
> section (since, as sad as it is, it's likely not just binutils to imply
> section purpose from section name)?
Hmm, well the only solution I can think of would be to enhance the --set-section-flags
option of objcopy so that it could be used on PE binaries as well. This
would be a bit of a hack though, as we would need to create a way to tell
swap_scnhdr_out() that it should not override the flags that have been set.
Patches welcome... :-)
Cheers
Nick