summaryrefslogtreecommitdiffstats
path: root/llvm/lib/MC/MCParser
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2016-05-26 00:22:26 +0000
committerDavid Blaikie <dblaikie@gmail.com>2016-05-26 00:22:26 +0000
commit2274808153e8d3ee749521b5d6e56d8cf4c8c4f7 (patch)
tree72624fdca633434bd040e3be61fca9778d9cde12 /llvm/lib/MC/MCParser
parenta099268e8595f9df0f1b38688e19c70665c377a1 (diff)
downloadbcm5719-llvm-2274808153e8d3ee749521b5d6e56d8cf4c8c4f7.tar.gz
bcm5719-llvm-2274808153e8d3ee749521b5d6e56d8cf4c8c4f7.zip
PR11740: Disable assembly debug info when assembly already contains line directives
If there is already debug info in the assembly file, and user hope to use -g option for compiling, we think we should not directly report an error. According to what GNU assembler did, it just reused the debug info in the assembly file, and turned off the DEBUG_TYPE option so that there will be no new debug info emitted by assembler. This fix is just as what GNU assembler did. The concern is the situation that there are two .text sections in the assembly file, one with debug info and the other one without. Currently with this fix, the assembler will no longer generate any debug info for the second .text section. And this is what GNU assembler exactly did for this situation. So I think this still make some sense. Patch by Zhizhou Yang! Differential Revision: http://reviews.llvm.org/D20002 llvm-svn: 270806
Diffstat (limited to 'llvm/lib/MC/MCParser')
-rw-r--r--llvm/lib/MC/MCParser/AsmParser.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp
index 7da00e89d78..5de8c7d603a 100644
--- a/llvm/lib/MC/MCParser/AsmParser.cpp
+++ b/llvm/lib/MC/MCParser/AsmParser.cpp
@@ -3001,12 +3001,11 @@ bool AsmParser::parseDirectiveFile(SMLoc DirectiveLoc) {
if (FileNumber == -1)
getStreamer().EmitFileDirective(Filename);
else {
+ // If there is -g option as well as debug info from directive file,
+ // we turn off -g option, directly use the existing debug info instead.
if (getContext().getGenDwarfForAssembly())
- Error(DirectiveLoc,
- "input can't have .file dwarf directives when -g is "
- "used to generate dwarf debug info for assembly code");
-
- if (getStreamer().EmitDwarfFileDirective(FileNumber, Directory, Filename) ==
+ getContext().setGenDwarfForAssembly(false);
+ else if (getStreamer().EmitDwarfFileDirective(FileNumber, Directory, Filename) ==
0)
Error(FileNumberLoc, "file number already allocated");
}
OpenPOWER on IntegriCloud