Commit 105a8460 authored by inglorion's avatar inglorion Committed by Commit Bot

goma_link_tests: Add test for -gsplit-dwarf

Support for -gsplit-dwarf was added to distributed ThinLTO in This adds an integration test to verify that
this does indeed cause debug information to be stored in a .dwo
file and not be contained in the main linker output.

Bug: 1058525
Change-Id: I035f4c57ada4efc747a3be4797d7c608da180fcb
Commit-Queue: Bob Haarman <[email protected]>
Reviewed-by: default avatarHans Wennborg <[email protected]>
Cr-Original-Commit-Position: refs/heads/[email protected]{#752092}
Cr-Mirrored-Commit: 962e30d835d458cd10e592285cb9404072913b29
parent 689fb3d0
......@@ -7,7 +7,7 @@
# Usage:
# Ensure that gomacc is in your PATH.
# Ensure that gomacc, llvm-objdump, and llvm-dwarfdump are in your PATH.
# Then run:
# python third_party/pycoverage run tools/clang/scripts/
......@@ -393,6 +393,36 @@ class GomaLdIntegrationTest(unittest.TestCase):
main_disasm = disasm[main_idx:after_main_idx]
self.assertNotIn(b'foo', main_disasm)
def test_debug_params(self):
with NamedDirectory() as d, WorkingDirectory(d):
self.clangxx(), '-c', '-g', '-gsplit-dwarf', '-flto=thin',
'main.cpp', '-o', 'obj/main.o',
self.clangxx(), '-c', '-g', '-gsplit-dwarf', '-flto=thin',
'foo.cpp', '-o', 'obj/foo.o'
with open('main.rsp', 'w') as f:
rc = GomaLinkUnixWhitelistMain().main([
self.clangxx(), '-fuse-ld=lld', '-flto=thin',
'-g', '-gsplit-dwarf', '-Wl,--lto-O2', '-o', 'main', '@main.rsp',
# Should succeed.
self.assertEqual(rc, 0)
# Check debug info present, refers to .dwo file, and does not
# contain full debug info for foo.cpp.
dbginfo = subprocess.check_output(
['llvm-dwarfdump', '-debug-info', 'main']
).decode('utf-8', 'backslashreplace')
self.assertRegexpMatches(dbginfo, '\\bDW_AT_GNU_dwo_name\\b.*\\.dwo"')
self.assertNotRegexpMatches(dbginfo, '\\bDW_AT_name\\b.*foo\\.cpp"')
def test_distributed_lto_params(self):
with NamedDirectory() as d, WorkingDirectory(d):
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment