set fPIC option for librt
Carmelo AMOROSO
carmelo.amoroso at st.com
Thu Sep 11 12:13:07 UTC 2008
Bernhard Reutner-Fischer wrote:
> On Thu, Sep 11, 2008 at 07:32:09PM +0800, JACOB BENJAMIN-VGH684 wrote:
>> Hello ppl,
>
>> and ran the resultant a.out on a monta vista box
>> I got an error saying something to the effect of "Can't modify text
>> section. Use GCC option -fPIC for shared objects, please".
>>
>> I looked into the config files and echo-ed out stuff in the makefiles
>> (esp Makefile.in in uClibc/librt) only to find out the CC variable is
>> set to arm_v6_be_uclibc-gcc only. Using this compile the os files are
>> created.
>> I hardcoded "CC:= arm_v6_be_uclibc-gcc -fPIC"
>> and then re-compiled uClibc and the program as well and it ran perfectly
>> well.
>>
>> Now how and where do i make the config files to have fPIC set for the
>> cross compiler??
>
>
> I was under the impression that we already use pic for the shared
> objects, but ok.
>
Yes, exactly. I do think that there is some bogus asm code that is not
PIC, and FORCE_SHAREBLAE_TEXT_SEGMENT is set so linker refuses loading
non pic libraries.
Carmelo
> $ grep FLAGS .config
> UCLIBC_EXTRA_CFLAGS=""
>
> i.e. run 'make menuconfig'
> go to the "uClibc development/debugging options" menu and set the
> "Enter any extra CFLAGS to use to build uClibc" according to your needs.
>
> Of course you can pass UCLIBC_EXTRA_{C,LD}FLAGS down via make if you do
> not want or need to keep them in your .config.
>
> Just as a sidenote, you should not hardcode anything in any makefile,
> that's what .config is for, or a wrapper-script that passes down the
> desired flags, if you really need (you shouldn't).
>
>> All help appreciated.
>
> HTH,
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://busybox.net/cgi-bin/mailman/listinfo/uclibc
>
More information about the uClibc
mailing list