question about pic and relocation
Richard Sandiford
richard@codesourcery.com
Thu Feb 23 15:36:00 GMT 2006
"Eric Fisher" <joefoxreal@gmail.com> writes:
> $ mips-elf-gcc -shared -fpic fun.c -o fun.so -save-temps
>
> We can see this below from fun.s,
> lw $2,%gp_rel(b)($28)
>
> I think symble 'b' should be of GOT relocation.
> But it isn't.
What platform are you targetting?
mips-elf does not support shared libraries out of the box.
You can compile individual PIC objects using "mips-elf-gcc -mabicalls"
(which implies "-fpic", you don't need to add "-fpic" as well). However,
the libraries built by mips-elf configurations, such as libgcc, are not
PIC, so you won't be able to link PIC code against them. You should
really use a target that creates PIC by default, in the same way as
mips-linux-gnu and mips-sgi-irix* do.
Richard
More information about the Gcc
mailing list