https://reviews.llvm.org/D157280 enabled -fprofile-update for -fprofile-generate, but omitted adding -latomic to the linker command on AIX. This omission causes linking to fail due to an undefined symbol. This patch fixes the link error.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Driver/ToolChains/AIX.cpp | ||
---|---|---|
440 | This check here is copied from https://github.com/llvm/llvm-project/blob/77596e6b167bf0a5efa790597d6b75ac5e685b55/clang/lib/Driver/ToolChains/Clang.cpp#L867, and I don't think it is good to copy this particular code over because we are doing the same check twice at different places and the code can go out of sync. May I get some suggestions to avoid duplicating the code? Thanks! |
clang/lib/Driver/ToolChains/AIX.cpp | ||
---|---|---|
440 | This seems ok to me. You can also use != "single" instead. getLastArgNoClaim is probably slightly better. | |
clang/test/Driver/fprofile-update.c | ||
17 | The idiom is to use --target=.... This driver decision is not dependent on what OS the host runs, so %if system-aix should be avoided. |
clang/test/Driver/fprofile-update.c | ||
---|---|---|
17 | Ah yes thanks for the feedback. Fixed! |
clang/test/Driver/fprofile-update.c | ||
---|---|---|
18 | not sure if it's typical to also add a negative test that -latomic is not added by default or with "single" suboption. I'll leave it to you to decide. |
This check here is copied from https://github.com/llvm/llvm-project/blob/77596e6b167bf0a5efa790597d6b75ac5e685b55/clang/lib/Driver/ToolChains/Clang.cpp#L867, and I don't think it is good to copy this particular code over because we are doing the same check twice at different places and the code can go out of sync.
May I get some suggestions to avoid duplicating the code? Thanks!