Skip to content

gcc's -falign-* compilation options are incompatible with clang #124460

@joebonrichie

Description

@joebonrichie

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

Since gcc 9 the -falign-xyz options where extended to support the following syntax:

-falign-xyz
-falign-xyz=n
-falign-xyz=n:m
-falign-xyz=n:m:n2
-falign-xyz=n:m:n2:m2
  • n is the default byte boundary currently supported by clang e.g. -falign-functions=32,
  • n:m is where m only aligns to n if it can be achieved by skipping <= m bytes e.g. falign-functions=32:6
  • n:m:n2 is where n2 is the second fallback byte boundary if n:m isn't achieved e.g. falign-functions=64:6:32
  • n:m:n2:m2 is where m2 only aligns to n2 if it can be achieved by skipping <= m2 e.g. falign-functions=64:6:32:4

gcc's documentation: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-falign-functions

The follow flags are affected:

falign-functions
falign-labels
falign-loops
falign-jumps

The extended syntax supported by gcc can affect performance characteristics e.g. aligning to 64 byte boundary for better performance but falling back to a smaller byte boundary to avoid extensive code padding on x86_64.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:driver'clang' and 'clang++' user-facing binaries. Not 'clang-cl'

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions