[PATCH] D94647: [Driver] -gsplit-dwarf: Produce .dwo regardless of -gN for -fthinlto-index=

Bob Haarman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 14 12:35:25 PST 2021


inglorion added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:3758
+  // Normally -gsplit-dwarf is only useful with -gN. For -gsplit-dwarf in the
+  // backend phase of a distributed ThinLTO which does object file generation
+  // and no IR generation, -gN should not be needed. So allow -gsplit-dwarf with
----------------
tejohnson wrote:
> MaskRay wrote:
> > dblaikie wrote:
> > > tejohnson wrote:
> > > > Better to simply check if the input type is IR/BC via types::isLLVMIR(Input.getType()). Technically you don't need ThinLTO to do a clang compile with bitcode input. Looks like Input can be passed down from the caller.
> > > Good point! +1 to that.
> > That currently does not work:
> > `clang -g -c -flto a.c; fclang -gsplit-dwarf -g a.o -o a`
> > there is no .dwo
> I assume you mean clang and not "fclang"?
> 
> Try with "-x ir" like "clang -gsplit-dwarf -g -x ir a.o -o a". I thought that the -x ir was needed when passing a .o file that was actually bitcode?
> I thought that the -x ir was needed when passing a .o file that was actually bitcode?

I think that's a linker invocation, not a codegen invocation.

I would have spelled it

  clang -fuse-ld=lld -flto -gsplit-dwarf -g a.o -o a

And, for me at least, it does use debug fission:

  objdump -g a | grep dwo                                    
      DW_AT_GNU_dwo_name DW_FORM_strp
      DW_AT_GNU_dwo_id   DW_FORM_data8
      <14>   DW_AT_GNU_dwo_name: (indirect string, offset: 0x29): a_dwo/0.dwo
      <18>   DW_AT_GNU_dwo_id  : 0x24fab96c73f98143
    0x00000020 2f746d70 2f747374 00615f64 776f2f30 /tmp/tst.a_dwo/0
    0x00000030 2e64776f 00                         .dwo.



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