MIPS multigot at linker
Rafael Martínez Torres
rmartine@fdi.ucm.es
Thu Mar 27 13:43:00 GMT 2003
Hi:
I apologize if this is not the list to deal with this. I'm a newbie and my
message may seem a bit fuzzy.
1.- gcc-2.95
=============
I'm running gcc-2.95.3 on mips-sgi-irix65. GNU Binutils then were not
supported at this platform, so this tar.gz was prepared to be integrated
with
native (as and ld) MipsPro .
My applcation runs finely when no "multigot" is invoked.
However , some times MipsPro ld invokes automatically MULTIGOT . As far as
I know, GOT ( Global Offset table) is a special way to access data using
economical 16-bit addressing mode, by using the $gp register pointing into
".sdata" region. MULTI-GOT splits this region into several ones when some
thing bigger than 64K is detected.
If I'm not wrong , "const struct" data are allocated inside "section
.rodata" in gcc-2.95 . When assembling and linking, this remains so:
nm foo
...
[22] | 270909440| 266108|SECT |LOCL |DEFAULT |MIPS_DATA|.rodata
[23] | 271175552| 39236|SECT |LOCL |DEFAULT |MIPS_DATA|.data
[136] | 270909440| 0|SECT |GLOB |DEFAULT |MIPS_DATA|fdata
[137] | 270909440| 0|SECT |GLOB |DEFAULT |MIPS_DATA|_fdata
...
Since no reference into ".sdata" and ".rsdata", it crashes when trying to
use MULTIGOT ( and may be GOT ? )
2.- gcc-3.0
====================================
gcc-3.0 solved this problem by allocating "const struct" into ".data"
instead of "section .rodata" .
diff foo.s.gcc-2.95 diff foo.s.gcc-3.0
> .data
.align 3
.size aMi_id34,16
aMi_id34:
.word aMi_srt
>.section .rodata
.align 3
.size aMi_id34,16
aMi_id34:
.word aMi_srt
BTW, when
nm foo
[25] | 271286272| 69268|SECT |LOCL |DEFAULT |MIPS_DATA|.rodata
[26] | 271355544| 236268|SECT |LOCL |DEFAULT |MIPS_DATA|.data
[31] | 271618896| 3|SECT |LOCL |DEFAULT |MIPS_DATA|.srdata
A new region is included ...".srdata", this makes MULTIGOT run sucessfull.
May be gcc-2.95 doesn't handle $gp addressing properly ...
3.= WHAT I'M ASKING FOR
=========================
I need to run gcc-2.95/gcc-3.0 without GP/MULTIGOT addressing mode,
(hacking some piece
that needs to know if a pointer belongs to ".rodata" section ).
Which flag should apply to gcc ( or pass to MipsPro ld) to disable
MULTIGOT and GOT addressing mode...?
LARGE_GOT is discard.
Best Regards.
Rafael Martinez Torres . Univeridad Complutense de Madrid (Spain)
More information about the Binutils
mailing list