diff options
author | Paul Robinson <paul.robinson@sony.com> | 2018-03-29 17:16:41 +0000 |
---|---|---|
committer | Paul Robinson <paul.robinson@sony.com> | 2018-03-29 17:16:41 +0000 |
commit | b271f31d8d31ad689958fb8ff75110c2db5515df (patch) | |
tree | 9fc7456a6408dc5f91f66d7975f02bfc378de9d6 /llvm/tools/llvm-mc/llvm-mc.cpp | |
parent | 1b20416bfa4ed906d5b5f289aa8a4430b9620132 (diff) | |
download | bcm5719-llvm-b271f31d8d31ad689958fb8ff75110c2db5515df.tar.gz bcm5719-llvm-b271f31d8d31ad689958fb8ff75110c2db5515df.zip |
Reapply "[DWARFv5] Emit file 0 to the line table."
DWARF v5 specifies that the root file (also given in the DW_AT_name
attribute of the compilation unit DIE) should be emitted explicitly to
the line table's list of files. This makes the line table more
independent of the .debug_info section.
We emit the new syntax only for DWARF v5 and later.
Fixes the bug found by asan. Also XFAIL the new test for Darwin, which
is stuck on DWARF v2, and fix up other tests so they stop failing on
Windows. Last but not least, don't break "clang -g" of an assembler
file that has .file directives in it.
Differential Revision: https://reviews.llvm.org/D44054
llvm-svn: 328805
Diffstat (limited to 'llvm/tools/llvm-mc/llvm-mc.cpp')
-rw-r--r-- | llvm/tools/llvm-mc/llvm-mc.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/tools/llvm-mc/llvm-mc.cpp b/llvm/tools/llvm-mc/llvm-mc.cpp index 933aecce696..5d9c060dc21 100644 --- a/llvm/tools/llvm-mc/llvm-mc.cpp +++ b/llvm/tools/llvm-mc/llvm-mc.cpp @@ -390,6 +390,18 @@ int main(int argc, char **argv) { } if (!MainFileName.empty()) Ctx.setMainFileName(MainFileName); + if (DwarfVersion >= 5) { + // DWARF v5 needs the root file as well as the compilation directory. + // If we find a '.file 0' directive that will supersede these values. + MD5 Hash; + MD5::MD5Result *Cksum = + (MD5::MD5Result *)Ctx.allocate(sizeof(MD5::MD5Result), 1); + Hash.update(Buffer->getBuffer()); + Hash.final(*Cksum); + Ctx.setMCLineTableRootFile( + /*CUID=*/0, Ctx.getCompilationDir(), + !MainFileName.empty() ? MainFileName : InputFilename, Cksum, None); + } // Package up features to be passed to target/subtarget std::string FeaturesStr; |