 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Bluddy
Joined: 22 Apr 2007 Posts: 17
|
Posted: Thu Oct 29, 2009 11:22 pm Post subject: Bug in psp-gcc? |
|
|
I'm pretty sure I found a bug in psp-gcc (or actually in ld). It may be with the specific psp-gcc/ld bfd or it may be in binutils itself.
I'm doing some unusual linking in Scummvm to get dynamic plugins going. I borrowed the method from the Dreamcast Scummvm code, where this works fine. Essentially, I use a custom linker file to put all the shorts (.sbss, .sdata) in one area in my main executable, and then I ask ld to keep the relocation entries with the '-q' option, and to use the symbols from the main executable only. In ScummVM itself I relocate the things in memory.
Things were generally working fine in most games. However, looking into one of the games (Kyrandia), I found the following relocations:
| Code: |
0000eb44 00000405 R_MIPS_HI16 000fcf60 .rodata
0000eb48 00000406 R_MIPS_LO16 000fcf60 .rodata
0000eb54 00106206 R_MIPS_LO16 08aecb54 _ZN4Kyra14KyraEngine_L
0000eb58 00223d06 R_MIPS_LO16 08aecb5c _ZN4Kyra14KyraEngine_L
|
Notice that ld is chaining LO16 relocations after HI16's. However, it's doing something illegal! The LO16 for 08aecb54 is not preceded by a valid HI16 entry! Argh! |
|
| Back to top |
|
 |
jimparis
Joined: 10 Jun 2005 Posts: 1179 Location: Boston
|
Posted: Fri Oct 30, 2009 12:54 am Post subject: |
|
|
From http://techpubs.sgi.com/library/manuals/4000/007-4658-001/pdf/007-4658-001.pdf page 47:
| Quote: | An R_MIPS_HI16 must be followed immediately by an R_MIPS_LO16 relocation record in a SHT_REL section. The contents of the two fields to be relocated are combined to form a full 32-bit addend AHL. An R_MIPS_LO16 entry which does not immediately follow a R_MIPS_HI16 is combined with the most recent one encountered, i.e. multiple R_MIPS_LO16 entries may be associated with a single R_MIPS_HI16. Use of these relocation types in a SHT_REL section is discouraged and may be forbidden to avoid this complication.
|
So it sounds valid, although discouraged... |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|