[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
Wed Apr 26 15:06:30 PDT 2023
MaskRay added inline comments.
================
Comment at: clang/lib/Driver/Driver.cpp:3884
+ nullptr, getOpts().getOption(options::OPT_dumpdir),
+ Args.MakeArgString(Args.getLastArgValue(options::OPT_o, "a") + "-"));
+ Arg->claim();
----------------
dblaikie wrote:
> would be nice to have this "a" derive from wherever we hardcode "a.out" as the default output rather than independently hardcoded here?
>
> & what does GCC do when the `-o` value has a `.` in it? (if you use `-o a.out` do you get the same `a-x.dwo` behavior, or do you get `a.out-x.dwo`?)
We can use `llvm::sys::path::stem(getDefaultImageName())`, but I feel that this just complicates the code.
The default is `a.out` or `a.exe`. If a downstream platform decides to deviate and use another filename, say, `b.out`. We will use `-dumpdir b-` on this platform and `-dumpdir a-` on everything else. I think they will likely be fine with `a-` even if they don't use `a` as the stem name of the default image...
GCC generally doesn't special case `.` in `-o` for linking, but the `a.out` filename is different.
```
gcc -g -gsplit-dwarf d/a.c.c -o e/x.out # e/x.out-a.dwo
gcc -g -gsplit-dwarf d/a.c.c -o e/a.out # e/a-a.dwo
```
I think Clang should not special case `a.out`.
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