summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2019-02-05 21:14:09 +0000
committerReid Kleckner <rnk@google.com>2019-02-05 21:14:09 +0000
commitf38bc4fc999cf85ccdc6de6c5e9f5633dd28c552 (patch)
tree87816d54de7a85d60a11c8c0a548c16728e46703 /llvm/lib
parent0d0e9c08a49d4314c5c484ab91f3956f3daac0f4 (diff)
downloadbcm5719-llvm-f38bc4fc999cf85ccdc6de6c5e9f5633dd28c552.tar.gz
bcm5719-llvm-f38bc4fc999cf85ccdc6de6c5e9f5633dd28c552.zip
[MC] Don't error on numberless .file directives on MachO
Summary: Before r349976, MC ignored such directives when producing an object file and asserted when re-producing textual assembly output. I turned this assertion into a hard error in both cases in r349976, but this makes it unnecessarily difficult to write a single assembly file that supports both MachO and other object formats that support .file. A user reported this as PR40578, and we decided to go back to ignoring the directive. Fixes PR40578 Reviewers: mstorsjo Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D57772 llvm-svn: 353218
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index b2ff1e1dc47..a66a4eb29af 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -3370,10 +3370,11 @@ bool AsmParser::parseDirectiveFile(SMLoc DirectiveLoc) {
}
if (FileNumber == -1) {
- if (!getContext().getAsmInfo()->hasSingleParameterDotFile())
- return Error(DirectiveLoc,
- "target does not support '.file' without a number");
- getStreamer().EmitFileDirective(Filename);
+ // Ignore the directive if there is no number and the target doesn't support
+ // numberless .file directives. This allows some portability of assembler
+ // between different object file formats.
+ if (getContext().getAsmInfo()->hasSingleParameterDotFile())
+ getStreamer().EmitFileDirective(Filename);
} else {
// In case there is a -g option as well as debug info from directive .file,
// we turn off the -g option, directly use the existing debug info instead.
OpenPOWER on IntegriCloud