[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug ld/21334] [MIPS] Undefined hidden symbols cause assertion failure b
From: |
address@hidden |
Subject: |
[Bug ld/21334] [MIPS] Undefined hidden symbols cause assertion failure bfd/elfxx-mips.c:3860 |
Date: |
Thu, 06 Apr 2017 10:27:37 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=21334
Maciej W. Rozycki <address@hidden> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2017-04-06
Assignee|unassigned at sourceware dot org |address@hidden
Ever confirmed|0 |1
--- Comment #4 from Maciej W. Rozycki <address@hidden> ---
Created attachment 9975
--> https://sourceware.org/bugzilla/attachment.cgi?id=9975&action=edit
WIP bug fix
The problem here is the MIPS backend sorts the dynamic symbol table
even if no dynamic sections have been created. The latter means
`local_dynsymcount' remains unchanged from its initial 0 value even
though `a' is local and has been speculatively assigned a `dynindx'
upon LD encountering a GOT relocation (NB you need to compile test.c
with `-fPIE' or suchlike for the issue to trigger).
Normally `_bfd_elf_link_renumber_dynsyms', first called from
`bfd_elf_size_dynsym_hash_dynstr', would have set `local_dynsymcount'.
This situation then results in the assertion failure, as `a' despite
being local has been assigned a `dynindx' beyond `local_dynsymcount'.
James and Alastair, can you please try the patch attached then and see
if it fixes the issue for you? I'll proceed with the usual integration
dance if so.
NB we have what looks like a bug to me in that another call to
`_bfd_elf_link_renumber_dynsyms', arranged in
`bfd_elf_size_dynamic_sections' after section GC has completed,
is made even if no dynamic sections have been created. Consequently
you can work this PR around by using `--gc-sections' with LD (and with
James's test case also say `-e x' so that the reference to `a' itself
is not GCed). I'll be sending a fix proposal for this bug separately.
Finally I think we have another issue in the MIPS backend, with handling
hidden and internal weak undefined symbols. References to such symbols
are supposed to resolve to 0, however if a GOT relocation is used, then
a local GOT entry is created and used to satisfy the reference. Such an
entry is then subject to the usual constant load-time relocation, which
means a non-zero value will be returned if the base address is non-zero.
This will defeat the usual run-time sequence like:
void a (void) __attribute__ ((visibility ("hidden"), weak));
void
x (void)
{
if (a)
a ();
}
What instead we should do I believe is create an *external* GOT entry
for the weak undefined symbol entered in the dynamic symbol table as
local absolute and having the value of 0. I'll handle this separately
as well.
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/21334] [MIPS] Undefined hidden symbols cause assertion failure bfd/elfxx-mips.c:3860,
address@hidden <=
- [Bug ld/21334] [MIPS] Undefined hidden symbols cause assertion failure bfd/elfxx-mips.c:3860, james410 at cowgill dot org.uk, 2017/04/06
- [Bug ld/21334] [MIPS] Undefined hidden symbols cause assertion failure bfd/elfxx-mips.c:3860, address@hidden, 2017/04/07
- [Bug ld/21334] [MIPS] Undefined hidden symbols cause assertion failure bfd/elfxx-mips.c:3860, james410 at cowgill dot org.uk, 2017/04/10
- [Bug ld/21334] [MIPS] Undefined hidden symbols cause assertion failure bfd/elfxx-mips.c:3860, address@hidden, 2017/04/11
- [Bug ld/21334] [MIPS] Undefined hidden symbols cause assertion failure bfd/elfxx-mips.c:3860, hobbitalastair at yandex dot com, 2017/04/26
- [Bug ld/21334] [MIPS] Undefined hidden symbols cause assertion failure bfd/elfxx-mips.c:3860, cvs-commit at gcc dot gnu.org, 2017/04/26
- [Bug ld/21334] [MIPS] Undefined hidden symbols cause assertion failure bfd/elfxx-mips.c:3860, cvs-commit at gcc dot gnu.org, 2017/04/26
- [Bug ld/21334] [MIPS] Undefined hidden symbols cause assertion failure bfd/elfxx-mips.c:3860, address@hidden, 2017/04/26
- [Bug ld/21334] [MIPS] Undefined hidden symbols cause assertion failure bfd/elfxx-mips.c:3860, costamagnagianfranco at yahoo dot it, 2017/04/27
- [Bug ld/21334] [MIPS] Undefined hidden symbols cause assertion failure bfd/elfxx-mips.c:3860, address@hidden, 2017/04/27