This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gcc does not use the pic version libiberty.a if built


Hello!

gcc builds 2 versions of libiberty.a, one w/ pic and one w/o, but uses 
only the non-pic version later for the intermediate execs (gen*)
On a system, that supports text relocations, but text relocation is 
not allowed due to restrictions in libc or kernel these binaries will all 
fail if built as PIE (the binaries end up w/ text relocations)

The same can also be observed in binutils and RedHat "circumvents" this, 
by rebuilding libiberty.a a second time separately by adding -fPIC to 
CFLAGS (because this libiberty.a is used system-wide, and not the one 
provided by gcc)

The attached patch solves the problem by overwriting the non-pic version 
w/ the pic version, if the pic version is built.

Index: libiberty/ChangeLog

from Peter S. Mazinger <ps.m@gmx.net>

	* if pic version of libiberty.a is built, make also use of it

Peter

-- 
Peter S. Mazinger <ps dot m at gmx dot net>           ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08  BB6E C389 975E A5F0 59F2

Attachment: gcc-3.4-libiberty-pic.patch
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]