[PATCH] D149193: [Driver] Add -dumpdir and change -gsplit-dwarf .dwo names for linking

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 27 10:39:33 PDT 2023


MaskRay marked an inline comment as done.
MaskRay added a comment.

In D149193#4302337 <https://reviews.llvm.org/D149193#4302337>, @scott.linder wrote:

> In D149193#4300885 <https://reviews.llvm.org/D149193#4300885>, @MaskRay wrote:
>
>> I think the patch as-is implements all the useful parts of GCC's complex rules and in the absence of `-dumpbase` (we deliberately don't implement), the rule almost exactly matches GCC unless we do `gcc -g -gsplit-dwarf d/a.c -o e/a.out` (instead of other filenames).
>>
>> https://maskray.me/blog/2023-04-25-compiler-output-files records all my findings.
>
> I agree that the special-casing of `a.out` when explicitly specified is odd.
>
> Another option to avoid any confusion or debates over exact behavior relative to GCC would be to just make our own option. Rather than add `-dumpdir` we could add `-dump-prefix` or something. I'm also OK with just implementing a simpler subset of the GCC options though (i.e. what you have already).

I have thought about this option, using a name like `--aux-prefix=` (I'd prefer aux to dump), but since the behaviors are nearly identical (if we ignore the GCC `-o d/a.out` special case), I think using `-dumpdir` is still fine, and users won't need to remember two options when they have the needs.

I think the GCC `-o e/a.out` special case is a bug to detect `gcc -g -gsplit-dwarf d/a.c` (without `-o`; `a.dwo`). If the bug is fixed, its `-dumpdir` behavior should be identical (for all the experiments I have done) to what this patch implements.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149193/new/

https://reviews.llvm.org/D149193



More information about the cfe-commits mailing list