[cfe-dev] Why clang may not be compatible with gcc for .a file generation?
Peng Yu via cfe-dev
cfe-dev at lists.llvm.org
Thu Jan 24 03:48:24 PST 2019
clang works fine.
On Thu, Jan 24, 2019 at 2:45 AM Csaba Raduly <rcsaba at gmail.com> wrote:
> On Thu, Jan 24, 2019 at 4:00 AM Peng Yu via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>> I have the following trace.c file compiled with the following command
>> with clang.
>> $ clang -Wall -pedantic -c -o trace.o trace.c
>> $ ar cr libtrace.a trace.o
>> $ ranlib libtrace.a
>> Then, I run configure from a GNU package, which gives the following
>> error. It asks to recompile the .a with -fPIC. Is it because gcc and
>> clang has different default on whether -fPIC is enabled? Could anybody
>> help explain why there is such a difference? Thanks.
>> configure:3772: gcc -g -finstrument-functions
>> conftest.c -ltrace >&5
>> relocation R_X86_64_32S against `.bss' can not be used when making a
>> PIE object; recompile with -fPIC
>> /usr/bin/ld: final link failed: Nonrepresentable section on output
> What happens if you run this command with clang instead of gcc ?
> You can get very substantial performance improvements
> by not doing the right thing. - Scott Meyers, An Effective C++11/14 Sampler
> So if you're looking for a completely portable, 100% standards-conformat
> to get the wrong information: this is what you want. - Scott Meyers
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev