[PATCH] D90041: [AIX][cmake] Adjust management of `-G` for linking
Hubert Tong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 23 13:26:06 PDT 2020
hubert.reinterpretcast added inline comments.
================
Comment at: llvm/CMakeLists.txt:939
+ # with plugins.
+ string(APPEND CMAKE_MODULE_LINKER_FLAGS " -shared -Wl,-G")
----------------
daltenty wrote:
> hubert.reinterpretcast wrote:
> > daltenty wrote:
> > > An aside: we should consider if this is worth mentioning to upstream CMake.
> > @daltenty, this is building on your prior work to reduce the run-time linking exposure. It seems upstream CMake does understand the need on AIX for `-shared -Wl,-G` for non-XL and `-G` for XL when the intent is to use run-time linking. That is, out-of-the-box, I think CMake works if we were happy with the run-time linking. It seems the ability for a user to communicate the run-time linking intent in terms of CMake may be where there is a gap.
> The runtime linking aspect was fixed in CMake 3.16: https://gitlab.kitware.com/cmake/cmake/-/issues/19163 . After that version -G / runtime linking is dropped from the default options.
>
> I'm more referring to the fact that `CMAKE_MODULE_LINKER_FLAGS` seems like it should probably contain `-shared` out-of-the-box
I'm not sure `CMAKE_MODULE_LINKER_FLAGS` is or is not the right level in CMake. For the LLVM build, I think putting it in `CMAKE_MODULE_LINKER_FLAGS` is consistent with a more manually-tuned build (but actually only when using an XL compiler at this time). Since the builds on AIX are still in flux, I left the `-shared` from https://gitlab.kitware.com/cmake/cmake/-/blob/5988a4deea67ed122b30c2c0437f70e074273789/Modules/Compiler/GNU.cmake#L36 alone for the builds using a Clang build compiler.
For general CMake, I think the lack of `-qmkshrobj` in a similar position in the base configuration when using an XL build compiler is a good starting point for the discussion.
================
Comment at: llvm/cmake/modules/AddLLVM.cmake:94
+ # FIXME: `-Wl,-bE:` bypasses whatever handling there is in the build
+ # compiler driver to defer to the specified export list.
set(native_export_file "${export_file}")
----------------
daltenty wrote:
> Just an aside note, very recent version of CMake on AIX now write their own export lists. When this gets fixed, it would also be good to check the interactions with that.
We need to check both that the LLVM mechanism can drive/override the CMake management of export lists and that the CMake mechanism is respected by the compiler's linker invocation. For GCC on AIX, I think CMake might need to avoid using `-shared`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D90041/new/
https://reviews.llvm.org/D90041
More information about the llvm-commits
mailing list