Re: Does gcc enable -fPIC by default?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 24 Jan 2019, Peng Yu wrote:

> Is it because gcc enables -fPIC by default, but clang does not? I
> don't see this documented. Or it is due to some other reasons. On what
> systems gcc enables -fPIC by default?

There are platforms (e.g. Darwin) where all code is implicitly PIC by
convention (but there Clang will emit position-independent code as well),
but in your case the issue is likely because in your distribution GCC
is configured to produce PIE by default (see --enable-default-pie in
output of gcc -v):

> configure:3772: gcc -g -finstrument-functions
> -L/root/linux/bin/wrappercomposite/src/xplat/llvmxplat/src/mkvar/bin/Linux
> conftest.c -ltrace >&5
> /usr/bin/ld: /root/linux/bin/wrappercomposite/src/xplat/llvmxplat/src/mkvar/bin/Linux/libtrace.a(trace.o):
> relocation R_X86_64_32S against `.bss' can not be used when making a
> PIE object; recompile with -fPIC

   ^^^^^^^^^
   (as the error message hints)

Hope that helps.
Alexander



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux