Summary: | GC-ed DSO symbols make corresponding symbols defined by a linker script local | ||
---|---|---|---|
Product: | binutils | Reporter: | James Cowgill <jcowgill+sourceware> |
Component: | ld | Assignee: | Maciej W. Rozycki <macro> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | amodra, glaubitz, macro, mh-sourceware, pochu27, sam |
Priority: | P2 | ||
Version: | 2.27 | ||
Target Milestone: | 2.28 | ||
See Also: |
https://bugs.debian.org/844227 https://bugs.debian.org/844357 |
||
Host: | Target: | ||
Build: | Last reconfirmed: | 2016-11-17 00:00:00 | |
Attachments: | patch attempt 1 |
Description
James Cowgill
2016-11-16 17:09:46 UTC
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. Created attachment 9649 [details]
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?
> Is checking forced_local enough?
See elflink.c:elf_link_output_extsym local_bind.
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. (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? 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. (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. 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. 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). (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; So do we want to sort the symbols, or drop them altogether? 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. 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. 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 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. (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)? I've got down to the bottom of this issue now and as it turns out our initial understanding was completely wrong. The real issue is the presence of unused (and GC-ed) symbols in a DSO used in a link makes identically named symbols ordinarily defined (not hidden or PROVIDEd) by a linker script local, even though the latter symbols are supposed to be global as if no DSO defined them as well. So rather than removing the local entries made in the dynamic symbol table produced we actually need to make them global. See <https://sourceware.org/ml/binutils/2017-01/msg00263.html> for the full analysis, proposed patch, test cases and results. The issue applies to our all ELF targets with DSO support and the outcome just happens to hurt MIPS binaries in the most spectacular way, due to this target psABI's peculiarity and our handling of it, by making any affected binaries produced invalid, in addition to being incorrect as with the remaining ELF targets. Regardless I have made a MIPS dynamic symbol table sorting update in case we have a valid reason sometime to have (non-section) local entries there. This turned out simpler than I had thought as by the time `mips_elf_sort_hash_table' is called all the necessary information has already been gathered by the generic ELF linker and the MIPS backend, as applicable. So all that has to be done is using it properly to assign final indices. With the fix for this issue in place the problematic case of dynamic symbol table sorting cannot be triggered however, so no test case is possible, and I will be only pushing the sorting change, along with a couple of preparatory clean-ups to code affected, to our master branch, with no backport to 2.28 planned. The master branch has been updated by Maciej W. Rozycki <macro@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=81ff47b3a54633819fac4d973e34f1ff0c65606e commit 81ff47b3a54633819fac4d973e34f1ff0c65606e Author: Maciej W. Rozycki <macro@imgtec.com> Date: Mon Jan 16 22:10:57 2017 +0000 PR ld/20828: Fix linker script symbols wrongly forced local with section GC Fix a generic ELF linker regression introduced with a chain of changes made to unused input section garbage collection: - commit 1a766c6843ce ("Also hide symbols without PLT nor GOT references."), <https://sourceware.org/ml/binutils/2011-09/msg00076.html>, - commit 1d5316ab67e1 ("PR ld/13177: garbage collector retains zombie references to external libraries"), <https://sourceware.org/ml/binutils/2011-10/msg00161.html>, - commit 6673f753c019 ("Fix PR 12772, garbage collection of dynamic syms"), <https://sourceware.org/ml/binutils/2011-12/msg00077.html>, causing the garbage collection of unused symbols present in a DSO involved in a link to make identically named symbols ordinarily defined (i.e. not hidden or PROVIDEd) by a linker script local, even though the latter symbols are supposed to be global as if no DSO defined them as well. This is because linker script assignments are processed very late as `lang_process' proceeds, down in the call to `ldemul_before_allocation', which is made after the call to `lang_gc_sections' to do input section garbage collecting. Consequently if unused, then any such DSO-defined symbol has already been garbage-collected and internally marked local. It would ordinarily be removed from dynamic symbol table output, however a linker script assignment correctly replaces its original definition with the new one and enters it into the dynamic symbol table produced as it is supposed to be exported. The original local marking is however retained making the symbol local in the dynamic symbol table and therefore not available externally. This also causes a sorting problem with the MIPS target, which does not expect non-section local dynamic symbols to be output and produces an invalid binary. Fix the problem then, by removing the `forced_local' marking for the offending case and add suitable test cases. First to verify that unused symbols ordinarily defined with linker script assignments remain exported in the context of input section garbage collection whether or not a DSO defining identically named symbols is present in the link. Second that a linker version script still correctly retains or removes such symbols as requested. bfd/ PR ld/20828 * elflink.c (bfd_elf_record_link_assignment): Clear any `forced_local' marking for DSO symbols that are not being provided. ld/ PR ld/20828 * testsuite/ld-elf/pr20828-1.sd: New test. * testsuite/ld-elf/pr20828-2a.sd: New test. * testsuite/ld-elf/pr20828-2b.sd: New test. * testsuite/ld-elf/pr20828.ld: New test linker script. * testsuite/ld-elf/pr20828.ver: New test version script. * testsuite/ld-elf/pr20828.s: New test source. * testsuite/ld-elf/shared.exp: Run the new test. The binutils-2_28-branch branch has been updated by Maciej W. Rozycki <macro@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4030096d6a689125c026ce1e6300717c2050d105 commit 4030096d6a689125c026ce1e6300717c2050d105 Author: Maciej W. Rozycki <macro@imgtec.com> Date: Mon Jan 16 22:10:57 2017 +0000 PR ld/20828: Fix linker script symbols wrongly forced local with section GC Fix a generic ELF linker regression introduced with a chain of changes made to unused input section garbage collection: - commit 1a766c6843ce ("Also hide symbols without PLT nor GOT references."), <https://sourceware.org/ml/binutils/2011-09/msg00076.html>, - commit 1d5316ab67e1 ("PR ld/13177: garbage collector retains zombie references to external libraries"), <https://sourceware.org/ml/binutils/2011-10/msg00161.html>, - commit 6673f753c019 ("Fix PR 12772, garbage collection of dynamic syms"), <https://sourceware.org/ml/binutils/2011-12/msg00077.html>, causing the garbage collection of unused symbols present in a DSO involved in a link to make identically named symbols ordinarily defined (i.e. not hidden or PROVIDEd) by a linker script local, even though the latter symbols are supposed to be global as if no DSO defined them as well. This is because linker script assignments are processed very late as `lang_process' proceeds, down in the call to `ldemul_before_allocation', which is made after the call to `lang_gc_sections' to do input section garbage collecting. Consequently if unused, then any such DSO-defined symbol has already been garbage-collected and internally marked local. It would ordinarily be removed from dynamic symbol table output, however a linker script assignment correctly replaces its original definition with the new one and enters it into the dynamic symbol table produced as it is supposed to be exported. The original local marking is however retained making the symbol local in the dynamic symbol table and therefore not available externally. This also causes a sorting problem with the MIPS target, which does not expect non-section local dynamic symbols to be output and produces an invalid binary. Fix the problem then, by removing the `forced_local' marking for the offending case and add suitable test cases. First to verify that unused symbols ordinarily defined with linker script assignments remain exported in the context of input section garbage collection whether or not a DSO defining identically named symbols is present in the link. Second that a linker version script still correctly retains or removes such symbols as requested. bfd/ PR ld/20828 * elflink.c (bfd_elf_record_link_assignment): Clear any `forced_local' marking for DSO symbols that are not being provided. ld/ PR ld/20828 * testsuite/ld-elf/pr20828-1.sd: New test. * testsuite/ld-elf/pr20828-2a.sd: New test. * testsuite/ld-elf/pr20828-2b.sd: New test. * testsuite/ld-elf/pr20828.ld: New test linker script. * testsuite/ld-elf/pr20828.ver: New test version script. * testsuite/ld-elf/pr20828.s: New test source. * testsuite/ld-elf/shared.exp: Run the new test. (cherry picked from commit 81ff47b3a54633819fac4d973e34f1ff0c65606e) Fixed as per the automatic commit messages. The master branch has been updated by Maciej W. Rozycki <macro@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=adcbdc63e5ccf663dacc8493cec63a95b653285e commit adcbdc63e5ccf663dacc8493cec63a95b653285e Author: Maciej W. Rozycki <macro@imgtec.com> Date: Mon Jan 23 11:18:33 2017 +0000 PR ld/20828: Relax symbol ordering in tests Complement commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols wrongly forced local with section GC") and make tests check for the presence of global `_fdata' and `_edata' symbols separately, removing any dependency on symbol table ordering for tests to succeed and removing: FAIL: PR ld/20828 dynamic symbols with section GC (auxiliary shared library) FAIL: PR ld/20828 dynamic symbols with section GC (plain) failures with the `x86_64-solaris2' target, which has additional intervening entries: Symbol table '.dynsym' contains 6 entries: Num: Value Size Type Bind Vis Ndx Name 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 _fdata 2: 0000000000000000 0 OBJECT GLOBAL DEFAULT 1 _DYNAMIC 3: 0000000000000000 0 OBJECT GLOBAL DEFAULT ABS _PROCEDURE_LINKAGE_TABLE_ 4: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 _edata 5: 00000000000001b8 0 OBJECT GLOBAL DEFAULT 4 _GLOBAL_OFFSET_TABLE_ Rename dump pattern files accordingly for consistency. ld/ PR ld/20828 * testsuite/ld-elf/pr20828-1.sd: Remove test. * testsuite/ld-elf/pr20828-a.sd: New test. * testsuite/ld-elf/pr20828-2a.sd: Rename test to... * testsuite/ld-elf/pr20828-b.sd: ... this. * testsuite/ld-elf/pr20828-2b.sd: Rename test to... * testsuite/ld-elf/pr20828-c.sd: ... this. * testsuite/ld-elf/shared.exp: Adjust accordingly. The master branch has been updated by Maciej W. Rozycki <macro@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=fda46c417ff8324960ca305141df5fc6c2f580af commit fda46c417ff8324960ca305141df5fc6c2f580af Author: Maciej W. Rozycki <macro@imgtec.com> Date: Mon Jan 23 11:19:46 2017 +0000 PR ld/20828: Remove leading `_' from symbols used in tests Complement commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols wrongly forced local with section GC") and remove the leading underscore from `_fdata' and `_edata' symbols used in tests, fixing a: FAIL: PR ld/20828 dynamic symbols with section GC (version script) failure with targets such as: `bfin-elf', `bfin-uclinux', `metag-elf', `metag-linux' `mn10300-elf', `sh-elf', `sh64-elf', and possibly other ones, that have `_' set (with `elf_symbol_leading_char') as the leading character for symbols. As from commit 93252b1cf41a ("bfd/ld: handle ABI prefixes in version scripts") these targets strip the leading underscore before applying version script rules, because the (default) syntax for symbol names is that of the C language rather than their low-level symbol table encoding. ld/ PR ld/20828 * testsuite/ld-elf/pr20828.ld: Rename `_fdata' and `_edata' to `fdata' and `edata' respectively. * testsuite/ld-elf/pr20828.ver: Adjust accordingly. * testsuite/ld-elf/pr20828-a.sd: Likewise. * testsuite/ld-elf/pr20828-b.sd: Likewise. * testsuite/ld-elf/pr20828-c.sd: Likewise. The master branch has been updated by Maciej W. Rozycki <macro@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1e5f45bb15d287ed763b7b638254424149040f7a commit 1e5f45bb15d287ed763b7b638254424149040f7a Author: Maciej W. Rozycki <macro@imgtec.com> Date: Mon Jan 23 11:21:19 2017 +0000 PR ld/20828: Work around RISC-V failures Complement commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols wrongly forced local with section GC") and add `.plt' to the list of output sections created, fixing: FAIL: PR ld/20828 dynamic symbols with section GC (auxiliary shared library) FAIL: PR ld/20828 dynamic symbols with section GC (plain) FAIL: PR ld/20828 dynamic symbols with section GC (version script) failures with `riscv32-elf', `riscv32-linux', `riscv64-elf' and `riscv64-linux' targets caused by LD crashing in the absence of such a section. ld/ PR ld/20828 * testsuite/ld-elf/pr20828.ld: Add `.plt'. The binutils-2_28-branch branch has been updated by Maciej W. Rozycki <macro@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=7d9468120fceed20240511404e6d9498e68f3dc6 commit 7d9468120fceed20240511404e6d9498e68f3dc6 Author: Maciej W. Rozycki <macro@imgtec.com> Date: Mon Jan 23 11:18:33 2017 +0000 PR ld/20828: Relax symbol ordering in tests Complement commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols wrongly forced local with section GC") and make tests check for the presence of global `_fdata' and `_edata' symbols separately, removing any dependency on symbol table ordering for tests to succeed and removing: FAIL: PR ld/20828 dynamic symbols with section GC (auxiliary shared library) FAIL: PR ld/20828 dynamic symbols with section GC (plain) failures with the `x86_64-solaris2' target, which has additional intervening entries: Symbol table '.dynsym' contains 6 entries: Num: Value Size Type Bind Vis Ndx Name 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND 1: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 _fdata 2: 0000000000000000 0 OBJECT GLOBAL DEFAULT 1 _DYNAMIC 3: 0000000000000000 0 OBJECT GLOBAL DEFAULT ABS _PROCEDURE_LINKAGE_TABLE_ 4: 0000000000000000 0 NOTYPE GLOBAL DEFAULT 1 _edata 5: 00000000000001b8 0 OBJECT GLOBAL DEFAULT 4 _GLOBAL_OFFSET_TABLE_ Rename dump pattern files accordingly for consistency. ld/ PR ld/20828 * testsuite/ld-elf/pr20828-1.sd: Remove test. * testsuite/ld-elf/pr20828-a.sd: New test. * testsuite/ld-elf/pr20828-2a.sd: Rename test to... * testsuite/ld-elf/pr20828-b.sd: ... this. * testsuite/ld-elf/pr20828-2b.sd: Rename test to... * testsuite/ld-elf/pr20828-c.sd: ... this. * testsuite/ld-elf/shared.exp: Adjust accordingly. (cherry picked from commit adcbdc63e5ccf663dacc8493cec63a95b653285e) The binutils-2_28-branch branch has been updated by Maciej W. Rozycki <macro@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b70d100fc1c5a130c3fe9387be83b7927e2025fb commit b70d100fc1c5a130c3fe9387be83b7927e2025fb Author: Maciej W. Rozycki <macro@imgtec.com> Date: Mon Jan 23 11:19:46 2017 +0000 PR ld/20828: Remove leading `_' from symbols used in tests Complement commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols wrongly forced local with section GC") and remove the leading underscore from `_fdata' and `_edata' symbols used in tests, fixing a: FAIL: PR ld/20828 dynamic symbols with section GC (version script) failure with targets such as: `bfin-elf', `bfin-uclinux', `metag-elf', `metag-linux' `mn10300-elf', `sh-elf', `sh64-elf', and possibly other ones, that have `_' set (with `elf_symbol_leading_char') as the leading character for symbols. As from commit 93252b1cf41a ("bfd/ld: handle ABI prefixes in version scripts") these targets strip the leading underscore before applying version script rules, because the (default) syntax for symbol names is that of the C language rather than their low-level symbol table encoding. ld/ PR ld/20828 * testsuite/ld-elf/pr20828.ld: Rename `_fdata' and `_edata' to `fdata' and `edata' respectively. * testsuite/ld-elf/pr20828.ver: Adjust accordingly. * testsuite/ld-elf/pr20828-a.sd: Likewise. * testsuite/ld-elf/pr20828-b.sd: Likewise. * testsuite/ld-elf/pr20828-c.sd: Likewise. (cherry picked from commit fda46c417ff8324960ca305141df5fc6c2f580af) The binutils-2_28-branch branch has been updated by Maciej W. Rozycki <macro@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f1e1be692fded333465d71ace0347db736ecc441 commit f1e1be692fded333465d71ace0347db736ecc441 Author: Maciej W. Rozycki <macro@imgtec.com> Date: Mon Jan 23 11:21:19 2017 +0000 PR ld/20828: Work around RISC-V failures Complement commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols wrongly forced local with section GC") and add `.plt' to the list of output sections created, fixing: FAIL: PR ld/20828 dynamic symbols with section GC (auxiliary shared library) FAIL: PR ld/20828 dynamic symbols with section GC (plain) FAIL: PR ld/20828 dynamic symbols with section GC (version script) failures with `riscv32-elf', `riscv32-linux', `riscv64-elf' and `riscv64-linux' targets caused by LD crashing in the absence of such a section. ld/ PR ld/20828 * testsuite/ld-elf/pr20828.ld: Add `.plt'. (cherry picked from commit 1e5f45bb15d287ed763b7b638254424149040f7a) The master branch has been updated by Maciej W. Rozycki <macro@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1a792e1c00e07a1e644145a9f71446cf2e75e9ab commit 1a792e1c00e07a1e644145a9f71446cf2e75e9ab Author: Maciej W. Rozycki <macro@imgtec.com> Date: Mon Jan 23 11:37:19 2017 +0000 Solaris2/LD: Fix anonymous version script acceptance bug Correct a bug in Solaris 2 linker emulation code triggered by a test introduced with commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols wrongly forced local with section GC") and only create implicit version nodes if versioning is actually introduced with a version script (or VERSION command) rather than only global vs local symbol visibility selected, fixing an: ld: anonymous version tag cannot be combined with other version tags linker error produced whenever a version script (or VERSION command) is used that does not assign symbol versions, such as: { global: foo; bar; local: *; }; and consequently removing a: FAIL: PR ld/20828 dynamic symbols with section GC (version script) test suite failure with the `x86_64-solaris2' target. ld/ * emultempl/solaris2.em (elf_solaris2_before_allocation): Do not add implicit version nodes if an anonymous version tag is being used. The master branch has been updated by Maciej W. Rozycki <macro@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b531344c34b05fcd55ce65776ff50b9a752d60c1 commit b531344c34b05fcd55ce65776ff50b9a752d60c1 Author: Maciej W. Rozycki <macro@imgtec.com> Date: Mon Jan 23 11:38:20 2017 +0000 PR ld/20828: Reorder the symbol sweep stage of section GC Complement commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols wrongly forced local with section GC") and move the symbol sweep stage of section GC from `elf_gc_sweep' to `bfd_elf_size_dynamic_sections', avoiding the need to clear the `forced_local' marker, problematic for targets that have special processing in their `elf_backend_hide_symbol' handler. Set `mark' instead in `bfd_elf_record_link_assignment' and, matching changes from commit 3bd43ebcb602 ("ld --gc-sections fail with __tls_get_addr_opt"), also in PowerPC `__tls_get_addr_opt' handling code, removing a: FAIL: PR ld/20828 dynamic symbols with section GC (version script) test suite failure with the `score-elf' target. The rationale is it is enough if symbols are swept at the beginning of `bfd_elf_size_dynamic_sections' as it is only in this function that the size of the GOT, the dynamic symbol table and other dynamic sections is determined, which will depend on the number of symbols making it to the dynamic symbol table. It is also appropriate to do the sweep at this point as it is already after any changes have been made to symbols with `bfd_elf_record_link_assignment', and not possible any earlier as calls to that function are only made just beforehand -- barring audit entry processing -- via `gld${EMULATION_NAME}_find_statement_assignment' invoked from `gld${EMULATION_NAME}_before_allocation' which is the ELF handler for `ldemul_before_allocation'. bfd/ PR ld/20828 * elflink.c (bfd_elf_record_link_assignment): Revert last change and don't ever clear `forced_local'. Set `mark' unconditionally. (elf_gc_sweep_symbol_info, elf_gc_sweep_symbol): Reorder within file. (elf_gc_sweep): Move the call to `elf_gc_sweep_symbol'... (bfd_elf_size_dynamic_sections): ... here. * elf32-ppc.c (ppc_elf_tls_setup): Don't clear `forced_local' and set `mark' instead in `__tls_get_addr_opt' processing. * elf64-ppc.c (ppc64_elf_tls_setup): Likewise. The binutils-2_28-branch branch has been updated by Maciej W. Rozycki <macro@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=8cf12fd327278b6e5edd90f162dc257656603f30 commit 8cf12fd327278b6e5edd90f162dc257656603f30 Author: Maciej W. Rozycki <macro@imgtec.com> Date: Mon Jan 23 11:37:19 2017 +0000 Solaris2/LD: Fix anonymous version script acceptance bug Correct a bug in Solaris 2 linker emulation code triggered by a test introduced with commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols wrongly forced local with section GC") and only create implicit version nodes if versioning is actually introduced with a version script (or VERSION command) rather than only global vs local symbol visibility selected, fixing an: ld: anonymous version tag cannot be combined with other version tags linker error produced whenever a version script (or VERSION command) is used that does not assign symbol versions, such as: { global: foo; bar; local: *; }; and consequently removing a: FAIL: PR ld/20828 dynamic symbols with section GC (version script) test suite failure with the `x86_64-solaris2' target. ld/ * emultempl/solaris2.em (elf_solaris2_before_allocation): Do not add implicit version nodes if an anonymous version tag is being used. (cherry picked from commit 1a792e1c00e07a1e644145a9f71446cf2e75e9ab) Hi Maciej, Unfortunately this bug doesn't seem completely fixed. It still affects "symbol version" symbols (maybe they have a better name?). See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=844227#260 I can reproduce this if I compile both libstubs.so and liboutput.so from my original testcase with this version script: == test.ver === TEST { global: a; }; $ gcc -shared -Wl,--version-script=test.ver libstubs.c -o libstubs.so $ gcc -c stubs.c $ ld -shared --version-script=test.ver --gc-sections -o liboutput.so stubs.o libstubs.so ====== $ readelf --dyn-sym libstubs.so Symbol table '.dynsym' contains 18 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 0000056c 0 SECTION LOCAL DEFAULT 12 2: 000107bc 0 NOTYPE GLOBAL DEFAULT 20 _edata 3: 00000740 0 FUNC GLOBAL DEFAULT 14 _fini 4: 00000710 36 FUNC GLOBAL DEFAULT 13 alpha 5: 00010780 0 NOTYPE GLOBAL DEFAULT 19 _fdata 6: 00000000 0 OBJECT GLOBAL DEFAULT ABS TEST 7: 000107d0 0 NOTYPE GLOBAL DEFAULT 21 _end 8: 000107bc 0 NOTYPE GLOBAL DEFAULT 21 __bss_start 9: 00018770 0 SECTION GLOBAL DEFAULT ABS _gp_disp 10: 000005b0 0 NOTYPE GLOBAL DEFAULT 13 _ftext 11: 000107bc 0 NOTYPE GLOBAL DEFAULT 21 _fbss 12: 0000056c 0 FUNC GLOBAL DEFAULT 12 _init 13: 00000000 0 NOTYPE WEAK DEFAULT UND _ITM_registerTMCloneTable 14: 00000000 0 NOTYPE WEAK DEFAULT UND _Jv_RegisterClasses 15: 00000000 0 FUNC WEAK DEFAULT UND __gmon_start__ 16: 00000000 0 NOTYPE WEAK DEFAULT UND _ITM_deregisterTMCloneTab 17: 00000000 0 FUNC WEAK DEFAULT UND __cxa_finalize@GLIBC_2.2 (3) $ readelf --dyn-sym liboutput.so Symbol table '.dynsym' contains 11 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00000340 0 SECTION LOCAL DEFAULT 8 2: 00010390 0 NOTYPE GLOBAL DEFAULT 9 _fdata 3: 00000340 36 FUNC GLOBAL DEFAULT 8 psi 4: 00000000 0 OBJECT LOCAL DEFAULT ABS TEST 5: 00000340 0 NOTYPE GLOBAL DEFAULT 8 _ftext 6: 00010398 0 NOTYPE GLOBAL DEFAULT 9 __bss_start 7: 00000364 36 FUNC GLOBAL DEFAULT 8 omega 8: 00010398 0 NOTYPE GLOBAL DEFAULT 9 _edata 9: 00010398 0 NOTYPE GLOBAL DEFAULT 9 _end 10: 00010398 0 NOTYPE GLOBAL DEFAULT 9 _fbss As you can see, there is a misplaced LOCAL symbol in liboutput.so. Thanks, James The master branch has been updated by Maciej W. Rozycki <macro@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=15a00b13aedc6300732d0b3b6b9daefa361ced6f commit 15a00b13aedc6300732d0b3b6b9daefa361ced6f Author: Maciej W. Rozycki <macro@imgtec.com> Date: Tue Jan 31 17:59:44 2017 +0000 PR ld/20828: LD/testsuite: Correct indentation ld/ PR ld/20828 * testsuite/ld-elf/shared.exp: Correct PR ld/20828 test indentation. The master branch has been updated by Maciej W. Rozycki <macro@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e17b0c351f0b22fb42edf34e5a6e486d72e9ee05 commit e17b0c351f0b22fb42edf34e5a6e486d72e9ee05 Author: Maciej W. Rozycki <macro@imgtec.com> Date: Thu Feb 2 22:05:46 2017 +0000 MIPS/BFD: Respect the ELF gABI dynamic symbol table sort requirement Ensure all local symbols precede external symbols in the dynamic symbol table. No local symbols are expected to make it to the dynamic symbol table except for section symbols already taken care of, so this is really a safeguard only against a potential BFD bug otherwise not so harmful, which may become a grave one due to a symbol table sorting requirement violation (see PR ld/20828 for an example). This means however that no test suite coverage is possible for this change as code introduced here is not normally expected to trigger. Logically split then the part of the dynamic symbol table which is not global offset table mapped, into a local area at the beginning and an external area following. By the time `mips_elf_sort_hash_table' is called we have the number of local dynamic symbol table entries (section and non-section) already counted in `local_dynsymcount', so use it to offset the external area from the beginning. bfd/ * elfxx-mips.c (mips_elf_hash_sort_data): Add `max_local_dynindx'. (mips_elf_sort_hash_table): Handle it. (mips_elf_sort_hash_table_f) <GGA_NONE>: For forced local symbols bump up `max_local_dynindx' rather than `max_non_got_dynindx'. The binutils-2_28-branch branch has been updated by Maciej W. Rozycki <macro@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e7ec0c47c5500b572b847cddd5b0868ef3784473 commit e7ec0c47c5500b572b847cddd5b0868ef3784473 Author: Maciej W. Rozycki <macro@imgtec.com> Date: Thu Feb 2 22:05:46 2017 +0000 MIPS/BFD: Respect the ELF gABI dynamic symbol table sort requirement Ensure all local symbols precede external symbols in the dynamic symbol table. No local symbols are expected to make it to the dynamic symbol table except for section symbols already taken care of, so this is really a safeguard only against a potential BFD bug otherwise not so harmful, which may become a grave one due to a symbol table sorting requirement violation (see PR ld/20828 for an example). This means however that no test suite coverage is possible for this change as code introduced here is not normally expected to trigger. Logically split then the part of the dynamic symbol table which is not global offset table mapped, into a local area at the beginning and an external area following. By the time `mips_elf_sort_hash_table' is called we have the number of local dynamic symbol table entries (section and non-section) already counted in `local_dynsymcount', so use it to offset the external area from the beginning. bfd/ * elfxx-mips.c (mips_elf_hash_sort_data): Add `max_local_dynindx'. (mips_elf_sort_hash_table): Handle it. (mips_elf_sort_hash_table_f) <GGA_NONE>: For forced local symbols bump up `max_local_dynindx' rather than `max_non_got_dynindx'. (cherry picked from commit e17b0c351f0b22fb42edf34e5a6e486d72e9ee05) The master branch has been updated by Maciej W. Rozycki <macro@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=902e9fc76a0ec9f642cefa71ef88cca1c675ad54 commit 902e9fc76a0ec9f642cefa71ef88cca1c675ad54 Author: Maciej W. Rozycki <macro@imgtec.com> Date: Tue Feb 21 01:46:42 2017 +0000 PR ld/20828: Move symbol version processing ahead of GC symbol sweep Complement commit b531344c34b0 ("PR ld/20828: Reorder the symbol sweep stage of section GC") and commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols wrongly forced local with section GC") and move symbol version processing ahead of the symbol sweep stage of section GC, all in `bfd_elf_size_dynamic_sections', so that version symbols created stay in the global scope and are not output as local symbols to the dynamic symbol table in the presence of corresponding symbol definitions pulled from a DSO involved in a link. Consolidate the whole of symbol version processing into a single block from all parts scattered across the function and rearranging the local variables used as necessary, however leaving the setting of dynamic entries associated with the DT_VERDEF, DT_VERDEFNUM, DT_VERNEED and DT_VERNEEDNUM tags and the SEC_EXCLUDE flag for unused `.gnu.version' section in the original places. With the rearrangement of code blocks `Elf_Internal_Verneed *t' would shadow the previous definition of `struct bfd_elf_version_tree *t', so rename the former variable to `vn'. bfd/ PR ld/20828 * elflink.c (bfd_elf_size_dynamic_sections): Move symbol version processing ahead of the call to `elf_gc_sweep_symbol'. ld/ PR ld/20828 * testsuite/ld-elf/pr20828-d.sd: New test. * testsuite/ld-elf/pr20828-e.sd: New test. * testsuite/ld-elf/pr20828-v.od: New test. * testsuite/ld-elf/pr20828-v.ver: New test version script. * testsuite/ld-elf/pr20828-v.ld: New test linker script. * testsuite/ld-elf/pr20828.ld: Add `.gnu.version' and `.gnu.version_d'. * testsuite/ld-elf/shared.exp: Run the new tests. Fixed again, hopefully for real this time. The master branch has been updated by Maciej W. Rozycki <macro@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=80070c0d3491347f11283c5791b9dd040fedbd4f commit 80070c0d3491347f11283c5791b9dd040fedbd4f Author: Maciej W. Rozycki <macro@imgtec.com> Date: Mon Mar 27 12:39:07 2017 +0100 PR ld/21233: Avoid sweeping forced-undefined symbols in section GC Complement commit 902e9fc76a0e ("PR ld/20828: Move symbol version processing ahead of GC symbol sweep"), commit b531344c34b0 ("PR ld/20828: Reorder the symbol sweep stage of section GC") and commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols wrongly forced local with section GC"), and prevent symbols forcibly entered in the output file with the use of the `--undefined=' or `--require-defined=' linker command line options or the EXTERN linker script command from being swept in section garbage collection and consequently recorded in the dynamic symbol table as local entries. This happens in certain circumstances, where a symbol reference also exists in one of the static input files, however only in a section which is garbage-collected and does not make it to the output file, and the symbol is defined in a dynamic object present in the link. For example with the `i386-linux' target and the `pr21233.s' and `pr21233-l.s' sources, and the `pr21233.ld' linker script included with this change we get: $ as -o pr21233-l.o pr21233-l.s $ ld -shared -T pr21233.ld -o libpr21233.so pr21233-l.o $ as -o pr21233.o pr21233.s $ ld --gc-sections -e foo --require-defined=bar -T pr21233.ld -o pr21233 pr21233.o libpr21233.so $ readelf --dyn-syms pr21233 Symbol table '.dynsym' contains 2 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00000000 0 OBJECT LOCAL DEFAULT UND bar $ which makes the run-time `bar' dependency of the `pr21233' executable different from its corresponding link-time dependency, i.e. the presence of `libpr21233.so' and its `bar' symbol is required at the link time, however at the run time a copy of `libpr21233.so' without `bar' will do. Similarly with `--undefined=' and EXTERN which do not actually require the reference to the symbol requested to be satisfied with a definition at the link time, however once the definition has been pulled at the link time, so it should at the dynamic load time. Additionally with the `mips-linux' target we get: $ ld --gc-sections -e foo --require-defined=bar -T pr21233.ld -o pr21233 pr21233.o libpr21233.so ld: BFD (GNU Binutils) 2.28.51.20170324 assertion fail .../bfd/elfxx-mips.c:3861 $ as the target is not prepared to handle such a local dynamic symbol. With this change in effect we get: $ readelf --dyn-syms pr21233 Symbol table '.dynsym' contains 2 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00000000 0 OBJECT GLOBAL DEFAULT UND bar $ instead, for both targets. ld/ PR ld/21233 * ldlang.c (insert_undefined): Set `mark' for ELF symbols. * testsuite/ld-elf/pr21233.sd: New test. * testsuite/ld-elf/pr21233-l.sd: New test. * testsuite/ld-elf/pr21233.ld: New test linker script. * testsuite/ld-elf/pr21233-e.ld: New test linker script. * testsuite/ld-elf/pr21233.s: New test source. * testsuite/ld-elf/pr21233-l.s: New test source. * testsuite/ld-elf/shared.exp: Run the new tests. The binutils-2_28-branch branch has been updated by Maciej W. Rozycki <macro@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=beefa9cd657b7187659ba455b704b4be3c28ab17 commit beefa9cd657b7187659ba455b704b4be3c28ab17 Author: Maciej W. Rozycki <macro@imgtec.com> Date: Mon Mar 27 12:39:07 2017 +0100 PR ld/21233: Avoid sweeping forced-undefined symbols in section GC Complement commit 902e9fc76a0e ("PR ld/20828: Move symbol version processing ahead of GC symbol sweep"), commit b531344c34b0 ("PR ld/20828: Reorder the symbol sweep stage of section GC") and commit 81ff47b3a546 ("PR ld/20828: Fix linker script symbols wrongly forced local with section GC"), and prevent symbols forcibly entered in the output file with the use of the `--undefined=' or `--require-defined=' linker command line options or the EXTERN linker script command from being swept in section garbage collection and consequently recorded in the dynamic symbol table as local entries. This happens in certain circumstances, where a symbol reference also exists in one of the static input files, however only in a section which is garbage-collected and does not make it to the output file, and the symbol is defined in a dynamic object present in the link. For example with the `i386-linux' target and the `pr21233.s' and `pr21233-l.s' sources, and the `pr21233.ld' linker script included with this change we get: $ as -o pr21233-l.o pr21233-l.s $ ld -shared -T pr21233.ld -o libpr21233.so pr21233-l.o $ as -o pr21233.o pr21233.s $ ld --gc-sections -e foo --require-defined=bar -T pr21233.ld -o pr21233 pr21233.o libpr21233.so $ readelf --dyn-syms pr21233 Symbol table '.dynsym' contains 2 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00000000 0 OBJECT LOCAL DEFAULT UND bar $ which makes the run-time `bar' dependency of the `pr21233' executable different from its corresponding link-time dependency, i.e. the presence of `libpr21233.so' and its `bar' symbol is required at the link time, however at the run time a copy of `libpr21233.so' without `bar' will do. Similarly with `--undefined=' and EXTERN which do not actually require the reference to the symbol requested to be satisfied with a definition at the link time, however once the definition has been pulled at the link time, so it should at the dynamic load time. Additionally with the `mips-linux' target we get: $ ld --gc-sections -e foo --require-defined=bar -T pr21233.ld -o pr21233 pr21233.o libpr21233.so ld: BFD (GNU Binutils) 2.28.51.20170324 assertion fail .../bfd/elfxx-mips.c:3861 $ as the target is not prepared to handle such a local dynamic symbol. With this change in effect we get: $ readelf --dyn-syms pr21233 Symbol table '.dynsym' contains 2 entries: Num: Value Size Type Bind Vis Ndx Name 0: 00000000 0 NOTYPE LOCAL DEFAULT UND 1: 00000000 0 OBJECT GLOBAL DEFAULT UND bar $ instead, for both targets. ld/ PR ld/21233 * ldlang.c (insert_undefined): Set `mark' for ELF symbols. (backported from commit 80070c0d3491347f11283c5791b9dd040fedbd4f) The master branch has been updated by H.J. Lu <hjl@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e6699019c4f363f804f9646974ab1d5e78785ffc commit e6699019c4f363f804f9646974ab1d5e78785ffc Author: H.J. Lu <hjl.tools@gmail.com> Date: Mon Apr 17 07:47:17 2017 -0700 Put soname in the version definition section commit 902e9fc76a0ec9f642cefa71ef88cca1c675ad54 Author: Maciej W. Rozycki <macro@imgtec.com> Date: Tue Feb 21 01:46:42 2017 +0000 PR ld/20828: Move symbol version processing ahead of GC symbol sweep breaks version definition with --version-script --soname. This patch fixes it by getting soname index before generating the version definition section. bfd/ PR ld/21389 * elflink.c (bfd_elf_size_dynamic_sections): Get soname index before generating the version definition section. ld/ PR ld/21389 * testsuite/ld-elf/pr21389.map: New file. * testsuite/ld-elf/pr21389.s: Likewise. * testsuite/ld-elf/pr21389a.d: Likewise. * testsuite/ld-elf/pr21389b.d: Likewise. * testsuite/ld-elf/pr21389c.d: Likewise. The master branch has been updated by H.J. Lu <hjl@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=9d45a7de8b80336b9965ee99353c34be85b1b98f commit 9d45a7de8b80336b9965ee99353c34be85b1b98f Author: H.J. Lu <hjl.tools@gmail.com> Date: Mon Oct 9 12:45:57 2017 -0700 bfin: Don't create .interp section for info->nointerp Don't create the .interp section with "ld --no-dynamic-linker". This fixed: FAIL: PR ld/20828 forcibly exported symbol version without section GC FAIL: PR ld/20828 forcibly exported symbol version with section GC FAIL: readelf version information * elf32-bfin.c (bfin_size_dynamic_sections): Don't create the .interp section with "ld --no-dynamic-linker". The master branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=18e404c4e2eb15443cc6dda93cbd38bdfeb17667 commit 18e404c4e2eb15443cc6dda93cbd38bdfeb17667 Author: Alan Modra <amodra@gmail.com> Date: Wed Apr 11 11:10:18 2018 +0930 Silence nds32 pic warnings Fixes: FAIL: Build pr22471a.so FAIL: Build pr22471b.so FAIL: Build pr22649-1.so FAIL: Build pr22649-2c.so FAIL: Build pr22649-2d.so FAIL: PR ld/20828 dynamic symbols with section GC (auxiliary shared library) FAIL: PR ld/20828 dynamic symbols with section GC (plain) FAIL: PR ld/20828 dynamic symbols with section GC (version script) FAIL: PR ld/20828 dynamic symbols with section GC (versioned shared library) FAIL: PR ld/20828 dynamic symbols with section GC (versioned) FAIL: PR ld/21233 dynamic symbols with section GC (auxiliary shared library) FAIL: Build pr22150.so FAIL: Build shared library for pr14170 FAIL: PR ld/21703 shared FAIL: Build shared library for broken linker script test FAIL: Build pr17068.so FAIL: -Bsymbolic-functions FAIL: Build pr20995.so FAIL: Build pr20995-2.so FAIL: Build pr22374 shared library * testsuite/ld-elf/shared.exp (AFLAGS_PIC): Add -mpic for nds32. The master branch has been updated by Maciej W. Rozycki <macro@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=12f09816cecc4e4ee7574a86846b3a17adbf7904 commit 12f09816cecc4e4ee7574a86846b3a17adbf7904 Author: Maciej W. Rozycki <macro@mips.com> Date: Mon Jul 2 23:57:22 2018 +0100 MIPS/BFD: Make section GC work with `ict_irix5' targets Prevent runtime procedure table symbols, produced with `ict_irix5' MIPS targets, from being swept in section GC, fixing linker errors like: ./ld-new: tmpdir/dump: protected symbol `_procedure_table_size' isn't defined ./ld-new: final link failed: bad value triggered whenever section GC is enabled with those targets and consequently removing the following test suite failures: FAIL: Build pr22649-2a.so FAIL: Build pr22649-2c.so FAIL: PR ld/20828 dynamic symbols with section GC (auxiliary shared library) FAIL: PR ld/20828 dynamic symbols with section GC (plain) FAIL: PR ld/20828 dynamic symbols with section GC (version script) FAIL: PR ld/20828 dynamic symbols with section GC (versioned shared library) FAIL: PR ld/20828 dynamic symbols with section GC (versioned) FAIL: --gc-sections with .text._init FAIL: pr20022 observed with `mips-elf', `tx39-elf', `mipsisa32-elf', `mipsisa64-elf', `mipsel-elf', `mipsisa32el-elf', `mipsisa64el-elf', `mips64vr-elf', `mips64vrel-elf', `mips64vr4300-elf', `mips64vr4300el-elf', `mips-sgi-irix5' and `mips-rtems' targets, among others. This fix makes section GC usable with the affected targets. bfd/ * elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Set `mark' for symbols created from `mips_elf_dynsym_rtproc_names' list. The master branch has been updated by Alan Modra <amodra@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=980a2e42f7439015defdcedad89a13a72749bdb0 commit 980a2e42f7439015defdcedad89a13a72749bdb0 Author: Alan Modra <amodra@gmail.com> Date: Thu Mar 21 08:39:18 2019 +1030 lm32-linux ld testsuite fails A number of the fails are due to ld supporting the creation of shared libraries but not allowing linking against them without using an option like -Bdynamic. FAIL: Symbol export class test (final shared object) FAIL: PROVIDE_HIDDEN test 4 FAIL: PROVIDE_HIDDEN test 6 FAIL: PROVIDE_HIDDEN test 10 FAIL: PROVIDE_HIDDEN test 12 FAIL: Build pr22471b.so FAIL: Build pr22649-2b.so FAIL: Build pr22649-2d.so FAIL: PR ld/20828 dynamic symbols with section GC (plain) FAIL: PR ld/20828 dynamic symbols with section GC (version script) FAIL: PR ld/20828 dynamic symbols with section GC (versioned) FAIL: PR ld/21233 dynamic symbols with section GC (--undefined) FAIL: PR ld/21233 dynamic symbols with section GC (--require-defined) FAIL: PR ld/21233 dynamic symbols with section GC (EXTERN) FAIL: Build pr22150 FAIL: PR ld/14170 FAIL: Link using broken linker script FAIL: pr17068 link --as-needed lib in group FAIL: ld-gc/pr20022 * emulparams/elf32lm32fd.sh (DYNAMIC_LINK): Undef. |