Boost logo

Boost-Build :

Subject: [Boost-build] bug by generating shared lib with PIC
From: Oliver Kowalke (oliver.kowalke_at_[hidden])
Date: 2011-04-27 14:53:14


Hi,

I've encountered a strange behaviour of boost.build generating shared
libs (PIC) on MIPS platform. I've a boost lib containing assembler
calling a function (exit()) from the C-lib:

lw $t9, %call16(exit)($gp)

If I compile the lib with: bjam toolset=gcc link=shared variant=debug
cxxflags="-fPIC" --with-my_lib stage
and use it by a test app: g++ -g test.cpp -I./ -L./stage/lib
-lboost_my_lib -Wl,-rpath=./stage lib -lrt
the line above (calling exit())generates an segfault.

If I compile the library by 'hand' the code works (no segfault):
gcc -fPIC -g -I./ my_lib.cpp
gcc -fPIC -g -I./ some_code.S
gcc -shared -Wl,-soname,libboost_my_lib.so -o libboost_my_lib.so
my_lib.o some_code.o -lc
gcc -g ./test.cpp -I./ -L./ -Wl,-rpath=./ -lboost_my_lib -lrt

It seams that boost.build doesn't apply the -fPIC option to the compiler
invocation for the assembler file.
If the lib is linked statically to the test app it works (asm: 'j exit',
instead using global pointer register).

Could you verify this?! Bugfix?

regards,
Oliver


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk