Can't modify /build/bft/bfd/.libs/libbfd-2.17.so's text section. Use GCC option -fPIC for shared objects, please.

Gregory Fleischer (Lists) gfleischer.lists at gmail.com
Sat Nov 17 12:32:56 PST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Nov 17, 2007, at 2:01 AM, naruto canada wrote:

> hi
>
> .....
> ....
> Can't modify /build/bft/bfd/.libs/libbfd-2.17.so's text section. Use
> GCC option -fPIC for shared objects, please.
> ....
> ...
>
> I went ahead and modified the Makefile in bfd directory, but
> libbfd-2.17.so still has TEXTREL.

I assume you are in 6.12. Butterfly Toolchain of the uClibc / 2.6 book.

>
> cd bfd
> mv .libs/* /tmp
> mv *.o *.lo /tmp
> sed -i.orig "s/^CFLAGS =.*/CFLAGS=-g -O2 -fno-PIE -fPIC/" Makefile
> sed -i.orig "s/^LDFLAGS =.*/LDFLAGS=-fpic -fPIC/" Makefile
> diff Makefile.orig Makefile
> make tooldir=/usr
> readelf -ld .libs/libbfd-2.17.so | grep -E 'Shared object|TEXTREL'
>

This is the right idea, but in the wrong place.  The entire Butterfly  
toolchain needs to be compiled using "-fPIC".  You can set this by  
changing "-fpic" to "-fPIC" in 'config/mh-x86pic' in the source  
directory.  Since the file gets processed during the configure stage,  
your best bet is to start with a clean build directory.

If you are building C++, you may also run into problems with libstdc+ 
+ and libtool calculations.  I made a post [1] in September that went  
through some of the changes I made to get this working.  Search the  
archives because I remember additional discussion of these issues in  
June to September timeframe.

> I'm about to give up for good.

If you are building an embedded (or memory/hard-disk constrained)  
device and using HLFS with uClibc is a project goal, you should push  
on.  It will be a struggle, but it can be accomplished.  If HLFS  
isn't a project goal, you may be better off just going with buildroot  
[2] and grsecurity patches; invest your time in developing a good  
grsec ACL configuration instead of banging up against the HLFS problems.

If you are building the system for fun and personal satisfaction,  
stick with it and you'll learn a ton about how a system is  
constructed as you work through the problems.  On the other hand, if  
you are building the system just because it sounds cool, don't waste  
your time.  The standard Glibc HLFS is more than sufficient for a  
general purpose computer.

[1] http://linuxfromscratch.org/pipermail/hlfs-dev/2007-September/ 
003834.html
[2] http://buildroot.uclibc.org/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)

iD8DBQFHP0/5WbVJrJm/lrsRAv5HAKDVmVriG3KtzotLCeJaNKSE+ADURgCdFrP6
ISBvtpDnpAX+58kZzQXVhJw=
=kGbt
-----END PGP SIGNATURE-----



More information about the hlfs-dev mailing list