[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 17:40:57 PDT 2023
MaskRay marked an inline comment as done.
MaskRay added a comment.
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.
================
Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:1261
- Arg *A = Args.getLastArg(options::OPT_ffile_compilation_dir_EQ,
- options::OPT_fdebug_compilation_dir_EQ);
- SmallString<128> T(A ? A->getValue() : "");
----------------
dblaikie wrote:
> I was going to suggest we shouldn't remove this functionality without checking who implemented/whether they rely on it (despite it being untested)
>
> Looks like it went in in some of the earliest patches from Google for Split DWARF ( 248357f62418831c7be9d43d96860b52aae1ef56 ).
>
> We do use `-fdebug-compilation-dir` at Google, but I think we just set it to `.` anyway, so for that use case it'd be a no-op anyway, I think? Might want to test this patch internally just to be sure, though.
>
> Though perhaps we never hit this path, because we'll always be building with `-o` and `-c` which should hit the `if` above?
We use the environment variable, if exists and is an absolute path, is used by GCC and Clang as a fallback when `-fdebug-compilation-dir=` is unspecified. As an example, `PWD=/proc/self/cwd clang ....`
I agree that for most(all?) split DWARF users will not see any difference since they always use `-c -o` and don't combine compilation and linking in one command.
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