[PATCH] D94647: [Driver] -gsplit-dwarf: Produce .dwo regardless of -gN if -fthinlto-index= is specified
Fangrui Song via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 13 20:31:43 PST 2021
MaskRay added a comment.
In D94647#2497170 <https://reviews.llvm.org/D94647#2497170>, @dblaikie wrote:
> In implicit thinlto this seemed to work for me without any changes:
>
> $ clang++-tot -flto=thin test.cpp -g -c
> $ clang++-tot -flto=thin -fuse-ld=lld -gsplit-dwarf test.o && llvm-dwarfdump-tot a.out
> a.out: file format elf64-x86-64
>
> .debug_info contents:
> 0x00000000: Compile Unit: length = 0x0000002c, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000030)
>
> 0x0000000b: DW_TAG_compile_unit
> DW_AT_stmt_list (0x00000000)
> DW_AT_comp_dir ("/usr/local/google/home/blaikie/dev/scratch")
> DW_AT_GNU_dwo_name ("a.out_dwo/1.dwo")
> DW_AT_GNU_dwo_id (0xf29563d7c812deae)
> DW_AT_low_pc (0x0000000000201730)
> DW_AT_high_pc (0x0000000000201738)
> DW_AT_GNU_addr_base (0x00000000)
>
> Any idea why that worked without the need for a special case/changes? Might be nice if both these use cases (implicit and explicit thinlto) somehow managed to use more common code generation options. But I guess that's too different - probably some generic "take all the clang flags and pass them through to the linker to pass back to the compiler", which isn't really relevant to this... well, maybe (if they're being passed back to the compiler in implicit thin lto, how does implicit thin lto work correctly without the -g flag?)
Interesting. D44788 <https://reviews.llvm.org/D44788> let Clang driver pass `-plugin-opt=dwo_dir=` to the linker. LTOBackend.cpp emits `$dwo_dir/[1234].dwo`.
There are .dwo files but the file names are a bit less ideal. For distributed ThinLTO, I think specifying the dwo filename explicitly is better.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94647/new/
https://reviews.llvm.org/D94647
More information about the cfe-commits
mailing list