[PATCH] Support aligned common symbols on PE.

Dave Korn dave.korn.cygwin@googlemail.com
Sat May 16 17:16:00 GMT 2009


    Hi everyone,

  The attached patch implements aligned commons on PE targets, using
meta-information in the .drectve section to convey the alignment info, as
discussed previously on this list(*).

  As it only touches PE/COFF code, I could probably check this in on my own
recognizance these days.  But it's quite a big one, and the tests still have
24 hours or so to run, so I'd appreciate any review offered, particularly of
the texinfo markup.  It also touches the common GAS testsuite machinery,
although only trivially to add a function copied from LD's testsuite library,
but someone should still eyeball it.

  Note that at present, this patch uses default section flags if it creates
the .drectve section.  That's because GCC currently emits a plain ".section
.drectve" in the generated assembly.  By the time I've got the GCC end of this
ready, we should have Kai's NOREAD patch in, and then I'll update GCC and
binutils to both use it; until then, I don't want to trigger
clashing-section-flags warnings.  (It's not a problem that the .drectve
section gets marked CONTENTS, ALLOC, LOAD, DATA, because it gets dropped at
final link time anyway; it's only ever present in .o files.  Nonetheless, we
should still change it one the feature is there, to match the vendor tools.)

bfd/ChangeLog:

	* cofflink.c (process_embedded_commands):  Ignore "-aligncomm".

gas/ChangeLog:

	* NEWS:  Mention new feature.
	* config/obj-coff.c (obj_coff_common_parse):  New function.
	(obj_coff_comm):  Likewise.
	(coff_pseudo_table):  Override default ".comm" definition on PE.
	* doc/as.texinfo:  Document new feature.

gas/testsuite/ChangeLog

	* gas/pe/:  New directory for PE format-specific tests.
	* gas/pe/aligncomm-a.d:  New test pattern file.
	* gas/pe/aligncomm-a.s:  New test source file.
	* gas/pe/aligncomm-b.d:  New test pattern file.
	* gas/pe/aligncomm-b.s:  New test source file.
	* gas/pe/aligncomm-c.d:  New test pattern file.
	* gas/pe/aligncomm-c.s:  New test source file.
	* gas/pe/aligncomm-d.d:  New test pattern file.
	* gas/pe/aligncomm-d.s:  New test source file.
	* gas/pe/pe.exp:  New test control script.
	* lib/gas-defs.exp (is_pecoff_format):  New function.

ld/ChangeLog:

	* NEWS:  Mention new feature.
	* deffile.h (def_file_aligncomm):  Add new struct definition.
	(def_file):  Add new def_file_aligncomm member.
	* deffilep.y (%token):  Add new ALIGNCOMM token.
	(command):  Add production rule for ALIGNCOMM.
	(def_file_free):  Free any chained def_file_aligncomm structs.
	(diropts[]):  Add entry for '-aligncomm' .drectve command.
	(def_aligncomm):  New grammar function.
	* ld.texinfo:  Document new feature.
	* pe-dll.c (process_def_file):  Rename from this ...
	(process_def_file_and_drectve):  ... to this, updating all callers,
	and process any aligncomms chained to the def file after scanning
	all .drectve sections.
	(generate_edata):  Updated to match.
	(pe_dll_build_sections):  Likewise.

ld/testsuite/ChangeLog:

	* ld-pe/aligncomm-1.c:  New test source file.
	* ld-pe/aligncomm-2.c:  Likewise.
	* ld-pe/aligncomm-3.c:  Likewise.
	* ld-pe/aligncomm-4.c:  Likewise.
	* ld-pe/aligncomm.d:  New test pattern file.
	* ld-pe/pe.exp:  Run new aligned common tests.

  Tests still running, but otherwise, is this ok by all concerned?

    cheers,
      DaveK
-- 
(*) - http://sourceware.org/ml/binutils/2009-05/threads.html#00182
-------------- next part --------------
A non-text attachment was scrubbed...
Name: aligncomm-patch-full.diff
Type: text/x-c
Size: 24435 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20090516/74b0df04/attachment.bin>


More information about the Binutils mailing list