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 | 47f9ec92cbd99a0fc9c21570a9f4f877e79eb9af (patch) | |
| tree | e2c24155f21b01c09a39be9386109941e240f53c /llvm/lib/MC/MCParser | |
| parent | 67e0062b7c9e9f81498119708d529983f0872bc7 (diff) | |
| download | bcm5719-llvm-47f9ec92cbd99a0fc9c21570a9f4f877e79eb9af.tar.gz bcm5719-llvm-47f9ec92cbd99a0fc9c21570a9f4f877e79eb9af.zip | |
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).
llvm-svn: 163395
Diffstat (limited to 'llvm/lib/MC/MCParser')
| -rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 11 | 
1 files changed, 5 insertions, 6 deletions
| diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index d60a2701907..271fee02ada 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -2280,8 +2280,11 @@ bool AsmParser::ParseDirectiveComm(bool IsLocal) {      if (ParseAbsoluteExpression(Pow2Alignment))        return true; +    if (IsLocal && !Lexer.getMAI().getLCOMMDirectiveSupportsAlignment()) +      return Error(Pow2AlignmentLoc, "alignment not supported on this target"); +      // If this target takes alignments in bytes (not log) validate and convert. -    if (Lexer.getMAI().getAlignmentIsInBytes()) { +    if (Lexer.getMAI().getCOMMDirectiveAlignmentIsInBytes()) {        if (!isPowerOf2_64(Pow2Alignment))          return Error(Pow2AlignmentLoc, "alignment must be a power of 2");        Pow2Alignment = Log2_64(Pow2Alignment); @@ -2309,13 +2312,9 @@ bool AsmParser::ParseDirectiveComm(bool IsLocal) {    if (!Sym->isUndefined())      return Error(IDLoc, "invalid symbol redefinition"); -  // '.lcomm' is equivalent to '.zerofill'.    // Create the Symbol as a common or local common with Size and Pow2Alignment    if (IsLocal) { -    getStreamer().EmitZerofill(Ctx.getMachOSection( -                                 "__DATA", "__bss", MCSectionMachO::S_ZEROFILL, -                                 0, SectionKind::getBSS()), -                               Sym, Size, 1 << Pow2Alignment); +    getStreamer().EmitLocalCommonSymbol(Sym, Size, 1 << Pow2Alignment);      return false;    } | 

