diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2012-09-07 17:25:13 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2012-09-07 17:25:13 +0000 |
commit | 39646d96e76aea5d20bffb386233a0dbb5932a21 (patch) | |
tree | 5de73a0fc45310a16dab5a01751ba4302b33a75a /lib/MC/MCAsmStreamer.cpp | |
parent | 8e70b5506ec0d7a6c2740bc89cd1b8f12a78b24f (diff) | |
download | external_llvm-39646d96e76aea5d20bffb386233a0dbb5932a21.zip external_llvm-39646d96e76aea5d20bffb386233a0dbb5932a21.tar.gz external_llvm-39646d96e76aea5d20bffb386233a0dbb5932a21.tar.bz2 |
MC: Overhaul handling of .lcomm
- Darwin lied about not supporting .lcomm and turned it into zerofill in the
asm parser. Push the zerofill-conversion down into macho-specific code.
- This makes the tri-state LCOMMType enum superfluous, there are no targets
without .lcomm.
- Do proper error reporting when trying to use .lcomm with alignment on a target
that doesn't support it.
- .comm and .lcomm alignment was parsed in bytes on COFF, should be power of 2.
- Fixes PR13755 (.lcomm crashes on ELF).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163395 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCAsmStreamer.cpp')
-rw-r--r-- | lib/MC/MCAsmStreamer.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/MC/MCAsmStreamer.cpp b/lib/MC/MCAsmStreamer.cpp index 394f049..804e38e 100644 --- a/lib/MC/MCAsmStreamer.cpp +++ b/lib/MC/MCAsmStreamer.cpp @@ -517,13 +517,16 @@ void MCAsmStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size, /// @param Size - The size of the common symbol. void MCAsmStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size, unsigned ByteAlign) { - assert(MAI.getLCOMMDirectiveType() != LCOMM::None && - "Doesn't have .lcomm, can't emit it!"); OS << "\t.lcomm\t" << *Symbol << ',' << Size; if (ByteAlign > 1) { - assert(MAI.getLCOMMDirectiveType() == LCOMM::ByteAlignment && - "Alignment not supported on .lcomm!"); - OS << ',' << ByteAlign; + assert(MAI.getLCOMMDirectiveSupportsAlignment() && + "alignment not supported on .lcomm!"); + if (MAI.getCOMMDirectiveAlignmentIsInBytes()) { + OS << ',' << ByteAlign; + } else { + assert(isPowerOf2_32(ByteAlign) && "alignment must be a power of 2"); + OS << ',' << Log2_32(ByteAlign); + } } EmitEOL(); } |