3 ms·
I've been following for a while the CMake issue #14983 (https://gitlab.kitware.com/cmake/cmake/issues/14983 https://gitlab.kitware.com/cmake/cmake/issues/14983)
by j1elo 9y ago
I've been following for a while the CMake issue #14983 (https://gitlab.kitware.com/cmake/cmake/issues/14983 https://gitlab.kitware.com/cmake/cmake/issues/14983), which doesn't really get much attention but affects the behavior of the feature POSITION_INDEPENDENT_CODE. As it is, it's not very reliable because it misses adding the flag '-pie' to the linker step, which AFAIK should be done to generate a proper PIE executable.
All this became relevant to me while integrating some Sanitizer CMake modules in my projects: https://github.com/arsenm/sanitizers-cmake https://github.com/arsenm/sanitizers-cmake where I opened an issue to talk about the subject (https://github.com/arsenm/sanitizers-cmake/issues/13 https://github.com/arsenm/sanitizers-cmake/issues/13).
Turns out Qt seems to depend on some obscure / not very well documented behavior of PIC instead of PIE, so their builds would break if using '-pie', or at least that's what I understood. In summary I'm amused how such a seemingly simple operation is getting so much time and complications to implement properly.
I'm happy to see more conversation about this topic, because as of now it is still somewhat difficult to grasp and use correctly.