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: [Patch] Fix PE dll -auto-import breakage from enforcing PEspecs for section flags

Hi Danny,

> 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:

  + #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).

I think that maybe we need a run-time switch which will do the same
thing as STRICT_PE_FORMAT (or rather do the same thing as its
inverse).  What do you think ?

> Should all of the -auto-import code in pe-dll.c and pe.em also be
> guarded with this (or something similar)?

If we do have a run-time switch, then yes, I think that the code
should be similarly protected.


PS.  Why is that your name appears first in the author-sorted list on
the binutils mail archive web site ?

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