Subject: backwards compatible ld.so patch

From: Ryan Murray <[email-masked]>
Date: Sun, 13 May 2001 11:54:31 -0700

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?

-- 
Ryan Murray, Debian Developer ([email-masked], [email-masked])
The opinions expressed here are my own.

---

From: Ryan Murray <[email-masked]>
Date: Sun, 13 May 2001 12:23:21 -0700

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

-- 
Ryan Murray, Debian Developer ([email-masked], [email-masked])
The opinions expressed here are my own.
--- sysdeps/mips/dl-machine.h	Sun May 13 22:25:35 2001
+++ sysdeps/mips/dl-machine.h	Sun May 13 22:28:14 2001
@@ -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  */

---

From: Ralf Baechle <[email-masked]>
Date: Mon, 14 May 2001 17:36:55 -0300

> the change should probably be updated to indicate the new state of things,

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