[Bug middle-end/66240] RFE: extend -falign-xyz syntax

vda.linux at googlemail dot com gcc-bugzilla@gcc.gnu.org
Sat Apr 16 20:52:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66240

--- Comment #4 from Denis Vlasenko <vda.linux at googlemail dot com> ---
Created attachment 38293
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38293&action=edit
Proposed patch

This patch implements -falign-functions=N[,M] for now, with the eye for easy
extension to other -falign options.

I tested that with -falign-functions=N (tried 8, 15, 16, 17...) the alignment
directives are the same before and after the patch:

-falign-functions=8  generates ".p2align 3,,7" before and after.
-falign-functions=17 generates ".p2align 5,,16" before and after.

I tested that -falign-functions=N,N (two equal paramenters) works exactly like
-falign-functions=N.

Patch drops currently performed forced alignment to 8 if requested alignment is
higher than 8: before the patch, -falign-functions=9 was generating

        .p2align 4,,8
        .p2align 3

which means "Align to 16 if the skip is 8 bytes or less; else align to 8".
After the patch, "p2align 3" is not emitted.

I drop that because I ultimately want to do something like
-falign-functions=64,8 - IOW, I want to align functions by 64 bytes, but only
if that entails a skip of less than 8 bytes - otherwise I want **no alignment
at all**. The forced ".p2align 3" interferes with that intention.

This is an RFC-patch, IOW: I don't insist on removal of ".p2align 3"
generation. I imagine that it should be retained for compat, and yet another
option should be added to suppress it if desired (how about
"-mno-8byte-code-subalign"? Argh...)


More information about the Gcc-bugs mailing list