[PATCH,trunk+2.20.1] Extend COFF .section directive syntax to specify alignment.

Dave Korn dave.korn.cygwin@googlemail.com
Sun Jan 17 18:21:00 GMT 2010


    Hi gang,

  I propose to apply this patch on HEAD, after the usual day or two for
comments.  And unusual though it is to add new features on the release branch,
I'd like to ask permission to backport it there as well, the reason being that
it's going to be needed in order to be able to support LTO in GCC, and it
seems a long time to wait for the next major release.  If you look at the
code, you'll see it's tiny and pretty low risk, as none of it kicks in unless
you try and use a new syntax that would previously not have been valid.

  There's currently no way to specify the alignment of a section in the
assembler; it can only be done using the linker at present.  The underlying
COFF code in BFD does, however, have a default section alignment, and that is
what gets applied to all sections emitted in the assembler.  The attached
patch provides a trivial way to override this default section alignment by
supplying a power-of-two as a single ascii decimal digit in the section flags.

gas/ChangeLog:

	* NEWS: Mention new feature.
	* config/obj-coff.c (obj_coff_section): Accept digits and use
	to override default section alignment power if specified.
	* doc/as.texinfo (.section directive): Update documentation.

gas/testsuite/ChangeLog:

	* gas/pe/section-align-1.s: New test source file.
	* gas/pe/section-align-1.d: Likewise control script.
	* gas/pe/section-align-2.s: Likewise ...
	* gas/pe/section-align-2.d: ... and likewise.
	* gas/pe/pe.exp: Invoke new testcases.

  Tested on i686-pc-cygwin and cross to x86_64-w64-mingw32 with no regressions
and the new tests passing.

- Any comments before I apply on HEAD?

- Ok for the branch?

    cheers,
      DaveK

-------------- next part --------------
A non-text attachment was scrubbed...
Name: coff-section-directive-alignment.diff
Type: text/x-c
Size: 8766 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20100117/700b449c/attachment.bin>


More information about the Binutils mailing list