Hi, Given such a source file, /*fun.c*/ int b=2; void fun(void) { int a=b; }
Then compile it, $ 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 readelf: Error: Unable to read in 264144 bytes of dynamic segment Relocation section '.rel.dyn' at offset 0x580 contains 2 entries: Offset Info Type Sym.Value Sym. Name 00000000 00000000 R_MIPS_NONE 600207a0 00000003 R_MIPS_REL32 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 Relocation section '.rel.text' at offset 0x3bc contains 1 entries: Offset Info Type Sym.Value Sym. Name 0000000c 00000907 R_MIPS_GPREL16 00000000 b Relocation section '.rel.pdr' at offset 0x3c4 contains 1 entries: Offset Info Type Sym.Value Sym. Name 00000000 00000a02 R_MIPS_32 00000000 fun What's the reason? Seems mips gcc doesn't create GOT relacation. Thanks.