summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
diff options
context:
space:
mode:
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>2018-07-02 17:29:43 +0000
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>2018-07-02 17:29:43 +0000
commit4d5b1073ba87f6709112d0d9b5270ee51d3abd54 (patch)
tree7092adab58fd58dc72a6580d86337d58dd13a92f /llvm/lib/MC/MCParser/DarwinAsmParser.cpp
parentd4f77a523bb99d3ac7132dfb5783b85835312cce (diff)
downloadbcm5719-llvm-4d5b1073ba87f6709112d0d9b5270ee51d3abd54.tar.gz
bcm5719-llvm-4d5b1073ba87f6709112d0d9b5270ee51d3abd54.zip
[MC] Error on a .zerofill directive in a non-virtual section
On darwin, all virtual sections have zerofill type, and having a .zerofill directive in a non-virtual section is not allowed. Instead of asserting, show a nicer error. In order to use the equivalent of .zerofill in a non-virtual section, the usage of .zero of .space is required. This patch replaces the assert with an error. Differential Revision: https://reviews.llvm.org/D48517 llvm-svn: 336127
Diffstat (limited to 'llvm/lib/MC/MCParser/DarwinAsmParser.cpp')
-rw-r--r--llvm/lib/MC/MCParser/DarwinAsmParser.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
index 82741f80128..e6fc1fac81b 100644
--- a/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
+++ b/llvm/lib/MC/MCParser/DarwinAsmParser.cpp
@@ -888,6 +888,7 @@ bool DarwinAsmParser::parseDirectiveZerofill(StringRef, SMLoc) {
Lex();
StringRef Section;
+ SMLoc SectionLoc = getLexer().getLoc();
if (getParser().parseIdentifier(Section))
return TokError("expected section name after comma in '.zerofill' "
"directive");
@@ -896,9 +897,10 @@ bool DarwinAsmParser::parseDirectiveZerofill(StringRef, SMLoc) {
// the section but with no symbol.
if (getLexer().is(AsmToken::EndOfStatement)) {
// Create the zerofill section but no symbol
- getStreamer().EmitZerofill(getContext().getMachOSection(
- Segment, Section, MachO::S_ZEROFILL,
- 0, SectionKind::getBSS()));
+ getStreamer().EmitZerofill(
+ getContext().getMachOSection(Segment, Section, MachO::S_ZEROFILL, 0,
+ SectionKind::getBSS()),
+ /*Symbol=*/nullptr, /*Size=*/0, /*ByteAlignment=*/0, SectionLoc);
return false;
}
@@ -957,7 +959,7 @@ bool DarwinAsmParser::parseDirectiveZerofill(StringRef, SMLoc) {
getStreamer().EmitZerofill(getContext().getMachOSection(
Segment, Section, MachO::S_ZEROFILL,
0, SectionKind::getBSS()),
- Sym, Size, 1 << Pow2Alignment);
+ Sym, Size, 1 << Pow2Alignment, SectionLoc);
return false;
}
OpenPOWER on IntegriCloud