[PATCH] D138778: Output alignment in zerofill and comm only if needed

Clement Courbet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 01:25:18 PST 2022


courbet added a comment.

I'm not familiar with `.comm` directives. Do we document them somewhere in LLVM ?

All I could find is this <https://docs.oracle.com/cd/E26502_01/html/E28388/eoiyg.html> and the doc for gnu `as`. The latter states that:

  When using ELF, the .comm directive takes an optional third argument. This
  is the desired alignment of the symbol, specified as a byte boundary (for
  example, an alignment of 16 means that the least significant 4 bits of the
  address should be zero). The alignment must be an absolute expression, and
  it must be a power of two. If ld allocates uninitialized memory for the
  common symbol, it will use the alignment when placing the symbol. If no
  alignment is specified, as will set the alignment to the largest power of
  two less than or equal to the size of the symbol, up to a maximum of 16.

This seems to imply that the directives generated by LLVM are incorrect, as we're emitting log2 values rather than alignment values. What did I miss ?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138778/new/

https://reviews.llvm.org/D138778



More information about the llvm-commits mailing list