Trouble with dynamic executables

Jayachandran C. c.jayachandran at gmail.com
Mon May 30 16:33:04 UTC 2011


On Thu, May 19, 2011 at 12:29 AM, Oleksandr Tymoshenko
<gonzo at freebsd.org> wrote:
> On 18/05/2011 5:59 AM, Andrew Duane wrote:
>>
>> Thanks! I will try this patch out as soon as I get a chance. I had to
>> repurpose my boot disk, but I can get it back today.
>>
> Not really. It can be  multiline. Though it's the only place
> where this variable is used and I'm not completely sure
> it's really required there. As a workaround it worked for me,
> but proper fix will require more svn history digging.

I did some digging on this, and your patch looks like the right way to go.

Here's what I got: INITIAL_READONLY_SECTIONS had only the .reginfo or
.MIPS.options entry. n32 was updated to use .reginfo in
elf32bmipn32-defs.sh, and then elf64bmip-defs.sh added to override to
use .MIPS.options for n64. (see
http://sourceware.org/ml/binutils/2006-10/msg00111.html)

But when a further update happened, INITIAL_READONLY_SECTIONS was
expanded to include the '.interp' section in elf32bmipn32-defs.sh. But
it looks like elf64bmip-defs.sh was not updated in the same way.

( see http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/emulparams/elf32bmipn32-defs.sh.diff?r1=1.11&r2=1.12&cvsroot=src&f=h
http://sourceware.org/cgi-bin/cvsweb.cgi/src/ld/emulparams/elf64bmip-defs.sh.diff?r1=1.2&r2=1.3&cvsroot=src&f=h
)

The only change I'd make is to add  ${RELOCATING-0}  part that is
missing from your patch which seems to be the new style. My take on
the same patch would be:

Index: contrib/binutils/ld/emulparams/elf64bmip-defs.sh
===================================================================
--- contrib/binutils/ld/emulparams/elf64bmip-defs.sh    (revision 222445)
+++ contrib/binutils/ld/emulparams/elf64bmip-defs.sh    (working copy)
@@ -1,3 +1,12 @@
 . ${srcdir}/emulparams/elf32bmipn32-defs.sh
 COMMONPAGESIZE="CONSTANT (COMMONPAGESIZE)"
-INITIAL_READONLY_SECTIONS=".MIPS.options : { *(.MIPS.options) }"
+
+# elf32bmipn32-defs.sh use .reginfo now, n64 ABI should use .MIPS.options
+# Override INITIAL_READONLY_SECTIONS to have .MIPS.options instead
+# of .reginfo
+INITIAL_READONLY_SECTIONS=
+if test -z "${CREATE_SHLIB}"; then
+  INITIAL_READONLY_SECTIONS=".interp       ${RELOCATING-0} : { *(.interp) }"
+fi
+INITIAL_READONLY_SECTIONS="${INITIAL_READONLY_SECTIONS}
+  .MIPS.options      ${RELOCATING-0} : { *(.MIPS.options) }"
-- 

Let me know if you plan to check in your changes (you can add a
reviewed by me if you like), otherwise I can check in the changes
above.

JC.


More information about the freebsd-mips mailing list