[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 --- Comment #16 from James Cowgill --- (In reply to Maciej W. Rozycki from comment #15) > NB while I'll implement the missing dynsym ordering case for the MIPS > backend so that it follows the ELF gABI even if weird output is somehow > produced by the generic BFD ELF linker I maintain that dropping symbols > that have been GC-ed (but not other forced local ones) is the right > solution. So you you think the second patch is wrong (since it drops all forced local symbols)? -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 Maciej W. Rozyckichanged: What|Removed |Added Status|NEW |ASSIGNED --- Comment #15 from Maciej W. Rozycki --- I can't comment on individual distribution policies here, this is not the right place to discuss them. As per the milestone set this will be fixed with 2.28. If this does not satisfy your distribution's requirements, then you have several options to choose from, including but possibly not limited to these: 1. Propose a change suitable for inclusion with our sources; I have outlined one earlier on although there may be other acceptable ways to do it too. 2. Temporarily use one of the quick fixes proposed here. 3. Work the problem around by disabling linker GC. It is then up to individual distribution's maintainers to decide which of these options suits them best; in particular submitting a change that can be accepted right away is always welcome and guarantees quick processing. NB while I'll implement the missing dynsym ordering case for the MIPS backend so that it follows the ELF gABI even if weird output is somehow produced by the generic BFD ELF linker I maintain that dropping symbols that have been GC-ed (but not other forced local ones) is the right solution. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 --- Comment #14 from John Paul Adrian Glaubitz --- Hi Maciej! (In reply to Maciej W. Rozycki from comment #12) > There's been no further feedback from other people and myself I haven't > made up my mind about this bug yet, so if you are blocked with your > work, then for the time being please use one of the proposals posted > here as a temporary workaround. The problem with this approach is that our toolchain maintainers are unwilling to merge a patch which has not been fully approved upstream for a supported target architecture. This means, the binutils package in Debian is still broken on all MIPS targets (mips32 big-endian, mips32 little-endian, mips64 little-endian) in Debian and if the issue is not resolved within the near future, the upcoming Debian Stretch release may be shipped without any official support for MIPS [1]. So, from the Debian point-of-view, fixing this bug has urgent priority unless we want to waive for MIPS support. Thanks, Adrian > [1] https://release.debian.org/stretch/arch_qualify.html -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 John Paul Adrian Glaubitz changed: What|Removed |Added CC||glaubitz at physik dot fu-berlin.d ||e -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 --- Comment #13 from Emilio Pozuelo Monfort --- This has been broken in the stable binutils-2_27-branch for a while now, which is rather unfortunate. Granted I could just take this patch myself, but a better solution would be to commit one of the fixes (both to master and the 2.27 and 2.28 branches). A thorough fix is nice, but 'perfect is the enemy of good'. Thanks for working on binutils btw. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 --- Comment #12 from Maciej W. Rozycki--- There's been no further feedback from other people and myself I haven't made up my mind about this bug yet, so if you are blocked with your work, then for the time being please use one of the proposals posted here as a temporary workaround. I will come up with a proper dynsym sorting implementation (which I think we ought to have for general robustness, and which I think I will implement by splitting GGA_NONE into two subclasses, so that we don't need any extra passes over the dynsym table to get it sorted) before 2.28, and then whether we want to keep local dynamic symbols or not can be decided independently; for consistency I'd be leaning towards doing exactly the same what a linker version script does with symbols that end up forced local, and the details of which I don't remember offhand. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 --- Comment #11 from Emilio Pozuelo Monfort --- So do we want to sort the symbols, or drop them altogether? -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 Maciej W. Rozyckichanged: What|Removed |Added Assignee|unassigned at sourceware dot org |ma...@linux-mips.org Target Milestone|--- |2.28 -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 --- Comment #10 from James Cowgill --- (In reply to Maciej W. Rozycki from comment #8) > By the MIPS psABI's definition you shall not have external GGA_NONE > symbols as any GGA_NONE symbols will be assigned to the local GOT part, > whose entries are only relocated by the base address at the load time. > Symbols in the GGA_NONE class will normally not have dynsym entries, > except from selected section symbols. The psABI says: The dynamic symbol table, like all ELF symbol tables, is divided into local and global parts. The global part of the dynamic symbol table is further divided into two parts: symbols that do not have GOT entries associated with them and symbols that do have GOT entries associated with them. Surly this implies that it is legitimate for an external symbol to be GGA_NONE? The case illustrated here where a symbol is defined but not used within a shared library seems like a good use case for this. Since LOCAL symbols must be GGA_NONE, the local symbol handler in my patch could probably be simplified a little. [...] > I agree the presence of (non-section) local symbols in the dynsym table > is a generic issue, and given that `elf_gc_sweep_symbol' appears to be > the only place where they are created I think that rather than > adjusting this piece of code to assign these symbols to the GGA_NONE > class it will make sense to discard them altogether. Unless there is > an actual need for them, that is, which I yet need to be told about. > FAOD it is not incorrect to have them -- it is just useless. It breaks the ld-elf/provide-hidden testcase, but that can be adjusted to not look for local dynamic symbols. This patch implements what you suggest (dropping symbols defined in the linker script dynamic symbol table if they are definitely local) and on its own fixes this bug as well. --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -669,7 +669,8 @@ bfd_elf_record_link_assignment (bfd *output_bfd, || h->ref_dynamic || bfd_link_dll (info) || elf_hash_table (info)->is_relocatable_executable) - && h->dynindx == -1) + && h->dynindx == -1 + && h->forced_local == 0) { if (! bfd_elf_link_record_dynamic_symbol (info, h)) return FALSE; -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 --- Comment #9 from James Cowgill --- I added some debug code ontop of my patch and it seems that at the time the dynamic symbol table indexes are allocated, all the symbols are GGA_NONE. debug: _fdata, LOCAL, GGA_NONE debug: _ftext, LOCAL, GGA_NONE debug: __bss_start, LOCAL, GGA_NONE debug: _edata, LOCAL, GGA_NONE debug: _end, LOCAL, GGA_NONE debug: _fbss, LOCAL, GGA_NONE debug: psi, GLOBAL, GGA_NONE debug: omega, GLOBAL, GGA_NONE Even when --gc-sections is removed all the symbols are GGA_NONE (although they are all now GLOBAL). Clearly at least psi and omega are external symbols. If I adjust stubs.c a bit, it seems a symbol is only ever GGA_NORMAL if it actually needs a GOT entry (eg if I call psi from omega, psi becomes GGA_NORMAL but omega remains GGA_NONE). -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 --- Comment #8 from Maciej W. Rozycki--- By the MIPS psABI's definition you shall not have external GGA_NONE symbols as any GGA_NONE symbols will be assigned to the local GOT part, whose entries are only relocated by the base address at the load time. Symbols in the GGA_NONE class will normally not have dynsym entries, except from selected section symbols. Any external symbols belong to the GGA_NORMAL and GGA_RELOC_ONLY classes -- depending on whether there are any GOT relocations implying signed 16-bit GP-relative access referring to them or not -- and they will be assigned to the global GOT part. The indices of those symbols will be mapped between the GOT and the dynsym table, as mandated by the MIPS psABI, according to the DT_MIPS_LOCAL_GOTNO and DT_MIPS_GOTSYM dynamic tags, such that individual entry's indices relative to the beginning of the global part of both tables will be the same. NB GGA stands for Global GOT Area. I agree the presence of (non-section) local symbols in the dynsym table is a generic issue, and given that `elf_gc_sweep_symbol' appears to be the only place where they are created I think that rather than adjusting this piece of code to assign these symbols to the GGA_NONE class it will make sense to discard them altogether. Unless there is an actual need for them, that is, which I yet need to be told about. FAOD it is not incorrect to have them -- it is just useless. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 --- Comment #7 from James Cowgill --- (In reply to Maciej W. Rozycki from comment #6) > Do we need to have these hidden symbols in the dynsym table at all in > the first place? It looks like unnecessary clutter to me, they won't > ever be used for anything as their references have been gc-ed. Or am > I missing anything -- can someone confirm my conclusion or contradict > it by providing a use case? Possibly not, although it looks like a generic issue - these symbols appear when the test is run on x86_64. > If we do need these symbols in the dynsym table, then I think we just > need to set GGA_NONE for them correctly as they're being hidden and the > existing dynsym index selection code will DTRT. I don't think doing this will ensure they always appear before the other GGA_NONE global symbols. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 --- Comment #6 from Maciej W. Rozycki--- Do we need to have these hidden symbols in the dynsym table at all in the first place? It looks like unnecessary clutter to me, they won't ever be used for anything as their references have been gc-ed. Or am I missing anything -- can someone confirm my conclusion or contradict it by providing a use case? If we do need these symbols in the dynsym table, then I think we just need to set GGA_NONE for them correctly as they're being hidden and the existing dynsym index selection code will DTRT. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 --- Comment #5 from Emilio Pozuelo Monfort --- (In reply to Alan Modra from comment #4) > On second thoughts, don't look at elf_link_output_extsym. bind_local there > can't be right since it's too late to make any decision different to that > done by _bfd_elf_link_renumber_dynsyms. So does the patch look sane? Or do you still have any comments? -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 --- Comment #4 from Alan Modra --- On second thoughts, don't look at elf_link_output_extsym. bind_local there can't be right since it's too late to make any decision different to that done by _bfd_elf_link_renumber_dynsyms. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 --- Comment #3 from Alan Modra --- > Is checking forced_local enough? See elflink.c:elf_link_output_extsym local_bind. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 Mike Hommey changed: What|Removed |Added CC||mh-sourceware at glandium dot org -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 --- Comment #2 from James Cowgill --- Created attachment 9649 --> https://sourceware.org/bugzilla/attachment.cgi?id=9649=edit patch attempt 1 So I had a go at fixing this. The patch basically does an extra pass to assign indexes to all the forced_local symbols first and the original code handles the rest of the symbols. It fixes my testcase and the original mesa bug in Debian. As I'm not too familiar with the internals of binutils, I'm not totally sure this is right. Is checking forced_local enough? -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 Emilio Pozuelo Monfort changed: What|Removed |Added CC||pochu27 at gmail dot com -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 Alan Modra changed: What|Removed |Added Status|UNCONFIRMED |NEW Last reconfirmed||2016-11-17 CC||amodra at gmail dot com Ever confirmed|0 |1 --- Comment #1 from Alan Modra --- mips_elf_sort_hash_table_f takes no notice of local dynamic symbols, so that's why you have local and global symbols out of order. -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils
[Bug ld/20828] [MIPS] produces invalid dynamic symbol table when --gc-sections is used since PR ld/13177 fix
https://sourceware.org/bugzilla/show_bug.cgi?id=20828 Maciej W. Rozyckichanged: What|Removed |Added CC||ma...@linux-mips.org -- You are receiving this mail because: You are on the CC list for the bug. ___ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils