linux-mips
[Top] [All Lists]

[Patch]: Fix ld pr11138 FAILures on mips*.

To: binutils <binutils@sourceware.org>
Subject: [Patch]: Fix ld pr11138 FAILures on mips*.
From: David Daney <david.daney@cavium.com>
Date: Mon, 05 Dec 2011 16:49:35 -0800
Cc: linux-mips <linux-mips@linux-mips.org>, Manuel Lauss <manuel.lauss@googlemail.com>, Debian MIPS <debian-mips@lists.debian.org>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101027 Fedora/3.0.10-1.fc12 Thunderbird/3.0.10
The pr11138 testcase links an executable with a version script. On mips64-linux the presence of a version script was causing the MIPS_RLD_MAP dynamic tag to be populated with a NULL value. When such an executable was run ld.so would try to dereference this and receive SIGSEGV, thus killing the process.

The root cause of this is that the mips linker synthesizes a special symbol "__RLD_MAP", and then sets MIPS_RLD_MAP to point to it. When a version script is present, this symbol gets versioned along with all the rest, and when it is time to take its address, the symbol can no longer be found as it has had version information appended to its name.

Since "__RLD_MAP" is really part of the ABI, we want to exclude it from symbol versioning. To this end, I introduced a new symbol flag 'no_sym_version' to tag this type of symbol. When the "__RLD_MAP" symbol is created, we set this flag.

In _bfd_elf_link_assign_sym_version, we then skip all symbols that have 'no_sym_version' set, and everything now works.

This problem has also been reported in the wild when linking the firefox executable.

Tested on mips64-linux-gnu and x86_64-linux-gnu

Ok to commit?

2011-12-05  David Daney  <david.daney@cavium.com>

        * elf-bfd.h (elf_link_hash_entry): Add no_sym_version field.
        * elflink.c (_bfd_elf_link_assign_sym_version): Don't assign a
        version if no_sym_version is set.
        * elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Set
        no_sym_version for "__RLD_MAP".

Attachment: dd-2.patch
Description: Text document

<Prev in Thread] Current Thread [Next in Thread>