This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: question about pic and relocation
- From: Richard Sandiford <richard at codesourcery dot com>
- To: "Eric Fisher" <joefoxreal at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 23 Feb 2006 15:36:01 +0000
- Subject: Re: question about pic and relocation
- References: <d6afecde0602222133g528850e5v@mail.gmail.com>
"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