Re: question about pic and relocation

2006-02-23 Thread Richard Sandiford
"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 s

Re: question about pic and relocation

2006-02-23 Thread Daniel Jacobowitz
On Thu, Feb 23, 2006 at 01:51:08PM +0800, Eric Fisher wrote: > But flag '-shared' and '-fpic' are used to create shared object, > aren't they? When I use objdump to see the codes, I find that the > program address doesn't start from 0. Such as, On MIPS, it happens that shared libraries are linked

Re: question about pic and relocation

2006-02-22 Thread Eric Fisher
But flag '-shared' and '-fpic' are used to create shared object, aren't they? When I use objdump to see the codes, I find that the program address doesn't start from 0. Such as, 5ffe065c : 5ffe065c: 3c02lui v0,0x0 5ffe0660: 27bdffe8addiu sp,sp,-24 5ffe0664:

Re: question about pic and relocation

2006-02-22 Thread Daniel Jacobowitz
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 a

question about pic and relocation

2006-02-22 Thread Eric Fisher
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