Bug? -fno-plt has no effect


I’m developing a shared object module for which I need to ensure there is not PLT section. Some background on why I have this requirement is available in this Stack Overflow question. In gcc, I can accomplish this with -fno-plt. Clang appears to have added support for this option in 2017. However, setting this flag when compiling my module with Clang has no effect, and the module ends up still having a PLT. I’m using CMake as my build system and I added the -fno-plt flag at the top level of my project via add_compile_options(-fno-plt). When building, I can see that the flag gets applied to each compiled source file. I also tried adding it explicitly to the linker options (target_link_options in CMake) and again I can see that it is applied at link time, but it still has no effect. I’ve tried with both Clang 10 and 11.

It’s possible I’m doing something wrong, but the flag works as expected with gcc, using the same compilation process, so right now my assumption is that this is a bug.


Mitch Lindgren