question about pic and relocation
Daniel Jacobowitz
drow@false.org
Thu Feb 23 05:38:00 GMT 2006
On Thu, Feb 23, 2006 at 01:33:05PM +0800, Eric Fisher wrote:
> $ 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.
>
> $ mips-elf-readelf -r fun.so
There are no GOT relocations in shared libraries. They're resolved by
the linker.
> I have no idea about the error and the symble 'b' of pic codes.
> Yet, when use this below
> $ mips-elf-as fun.s -call_shared -o fun.so
>
> $ mips-elf-readelf -r fun.so
That's not a shared object, no matter what you call it. You have to
assemble and then link; please let GCC do the linking, it knows how
to invoke the linker properly for each platform.
--
Daniel Jacobowitz
CodeSourcery
More information about the Gcc
mailing list