Skip to contentSkip to conversation

backwards compatible ld.so patch

DISCUSSION Ryan Murray 2 participants 3 messages May 13, 2001 – May 14, 2001 MIPS

lore
Share & tools
lore
#0 lore raw

Attached is a patch that changes the MAP_BASE_ADDR macro to one that Dan mentioned in his question about a backwards-compatible change to ld.so that allows both new and old shlibs to run.

This seems to work -- I've run perl (with an old-binutils libperl.so), with a new-binutils built ld.so and libc.so, and it works fine. The comment above the change should probably be updated to indicate the new state of things, as well...

Comments?

Signature · 2 lines
Ryan Murray, Debian Developer ([email protected], [email protected])
The opinions expressed here are my own.
#1 lore raw

And, of course, the actual patch....:)

Signature · 2 lines
Ryan Murray, Debian Developer ([email protected], [email protected])
The opinions expressed here are my own.
mips/dl-machine.h +1 -6
@@ -71,12 +71,7 @@
  * libraries have their base address at 0x5ffe0000.  This needs to be
  * fixed before we can safely get rid of this MIPSism.
  */
-#if 0
-#define MAP_BASE_ADDR(l) ((l)->l_info[DT_MIPS(BASE_ADDRESS)] ? \
-			  (l)->l_info[DT_MIPS(BASE_ADDRESS)]->d_un.d_ptr : 0)
-#else
-#define MAP_BASE_ADDR(l) 0x5ffe0000
-#endif
+#define MAP_BASE_ADDR(l) ((l)->l_addr >= 0x5ffe0000 ? 0x5ffe0000 : 0)
 
 /* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in
    with the run-time address of the r_debug structure  */
#2 lore raw
In reply to Ryan Murray
Quoted 10 lines · Ryan Murray

Attached is a patch that changes the MAP_BASE_ADDR macro to one that Dan mentioned in his question about a backwards-compatible change to ld.so that allows both new and old shlibs to run.

This seems to work -- I've run perl (with an old-binutils libperl.so), with a new-binutils built ld.so and libc.so, and it works fine. The comment above the change should probably be updated to indicate the new state of things, as well...

Comments?

Wrong. You're replacing a hack with something even more evil.

Right thing would be to make sure that the dynamic table is loaded before MAP_BASE_ADDR gets dereferenced; then you can reactivate the commented out code.

Ralf