Opened 21 months ago
Last modified 21 months ago
#18258 closed bug
Clang should default to generating PIC — at Version 2
Reported by: | gharris | Owned by: | nobody |
---|---|---|---|
Priority: | normal | Milestone: | R1/beta5 |
Component: | - General | Version: | R1/beta4 |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Platform: | All |
Description (last modified by )
I'm a member of The Tcpdump Group and am working on getting our build test matrix working on Haiku (tcpdump issue 996).
We support both autotools and CMake for configuration, and are testing with both GCC and Clang.
gcc (2021_07_28) 11.2.0 from the Haiku repositories appears to have been modified to produce PIC by default and to have an -fno-pic option to get position-dependent code.
clang version 12.0.1 from the Haiku repositories has *not* been modified in this fashion, which means that, if -fPIC isn't specified, the object files it produces aren't fit for linking into an executable by default.
This not only causes problems when building tcpdump, it causes problems when performing configuration tests in both the autotools configure script and in CMake, as several of those tests involve compiling and linking test code.
That's how those tests work in autotools and CMake; it's not our scripts choosing to work that way, so this probably will affect building other software with Clang if that software uses either autotools or CMake.
We're coming up with workarounds, of varying degrees of pain, to force -fPIC to be used in *all* compiles, including those performed in autotools and CMake configuration tests, but it would probably be best if all software using autotools or CMake didn't require those workarounds in order to support building with Clang on Haiku.
Change History (2)
comment:1 by , 21 months ago
Description: | modified (diff) |
---|
comment:2 by , 21 months ago
Description: | modified (diff) |
---|