"Eric Fisher" <[EMAIL PROTECTED]> 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