This is the mail archive of the
mailing list for the binutils project.
Re: Linking non-PIC modules with PIC modules for MIPS SVR4.2MP
- From: Thiemo Seufer <ica2_ts at csv dot ica dot uni-stuttgart dot de>
- To: binutils at sources dot redhat dot com
- Date: Fri, 15 Feb 2002 19:39:30 +0100
- Subject: Re: Linking non-PIC modules with PIC modules for MIPS SVR4.2MP
- References: <200202150021.CAA07430@mail.mbnet.fi>
Kai Ruottu wrote:
> but trying the '-Bstatic' and '-Bdynamic' for the same 'non-PIC'/'PIC'-mixing
> with GNU ld doesn't work. It tells that it still cannot mix the PIC- and non-PIC
> stuff... Is there any way to do this mixing?
Current binutils ld doesn't allow this. In theory, it should AFAICS be
possible to mix non-PIC/CPIC and PIC.
> Disassembly of section .text:
> 00000000 <_start>:
> 0: 3c1c0000 lui gp,0x0
> 4: 279c0000 addiu gp,gp,0
$gp setup is not needed for non-PIC.
> a0: 0c000000 jal 0 <_start> <--- Some function called
> a4: 00402021 move a0,v0
> a8: 0000000d break
> ac: 03e00008 jr ra
> b0: 00000000 nop
This isn't production ready, I assume. :-)
> Is there any way to see the called function names and the names for the addresses
> in the disassembly listing? Then cloning the current non-PIC 'crt1.o' could be a little
> more easy...
> But if looking at the beginning of the startup, it looks having the tinkering
> with 'gp' as if it being a PIC-file... But 'readelf -h' claims it isn't... Is here only a wrong
> flag in the file header?
I assume _gp results from setting up $gp at the beginning.
> Anyway if the original non-PIC/PIC stuff could be used with the GNU ld, that would be
> best... Is there some way to do this now ? For instance using the native linker etc. to
> convert the non-PIC stuff into PIC-stuff. This seems to happen now -- when looking
> with 'objdump -d' at the natively linked executable, the '_start' etc. stuff there is in
> PIC-mode and the whole executable is in the required PIC-mode...
I don't believe the native linker converts object files in such a way.
It might do mixed linking as mentioned above.