This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: [Patch] Fix PE dll -auto-import breakage from enforcing PE specs for section flags
- From: Ralf Habacker <ralf dot habacker at freenet dot de>
- To: Nick Clifton <nickc at redhat dot com>, Danny Smith <danny_r_smith_2001 at yahoo dot co dot nz>
- Cc: binutils <binutils at sources dot redhat dot com>
- Date: Wed, 14 Jan 2004 09:03:27 +0100
- Subject: Re: [Patch] Fix PE dll -auto-import breakage from enforcing PE specs for section flags
- References: <20040108230755.63910.qmail@web60809.mail.yahoo.com> <m3d69p6uzf.fsf@redhat.com>
On Monday 12 January 2004 16:35, Nick Clifton wrote:
> > The problem is that -auto-import wants object with writeable .text
> > section (see pe_create_import_fixup() in ld/pe-dll.c) but
> > _bfd_XXi_swap_scnhdr_out unsets IMAGE_SCN_MEM_WRITE
> >
> > The following patch works around the problem. I have used
> > STRICT_PE_FORMAT as a guard.
>
> Hmm, wouldn't it be better to make sure that the CODE and EXECUTE bits
> are still set, as in:
>
> + #ifdef STRICT_PE_FORMAT
> { ".text" , IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_CODE |
> IMAGE_SCN_MEM_EXECUTE }, + #else
> + /* When using -auto-import, .text is made writable!
> + See ld/pe-dll.c (pe_create_import_fixup). */
> { ".text" , IMAGE_SCN_CNT_CODE |
> IMAGE_SCN_MEM_EXECUTE }, + #endif
>
> Also, it seems to me that this change (either version) will defeat the
> purpose of the Dmitry's original patch, which was to make a PE
> targeted toolchains output conform to Microsoft's PE spec. (Since
> STRICT_PE_FORMAT is only defined for one, slightly obscure, target).
> If we do have a run-time switch, then yes, I think that the code
> should be similarly protected.
If this is such an obscure target, makes it really sense to add a runtime
switch ?
Ralf