aboutsummaryrefslogtreecommitdiff
path: root/ld
AgeCommit message (Collapse)AuthorFilesLines
2017-02-06[ld, testsuite] Don't print to stdout for "readelf -w" to avoid buffer overflowJiong Wang2-4/+9
ld/ * testsuite/ld-elf/compress.exp: Don't print to stdout for all "readelf -w".
2017-02-02CRIS/LD/testsuite: tls-err-20x.d: Fix a typo, s/n/\n/Maciej W. Rozycki2-1/+5
ld/ * testsuite/ld-cris/tls-err-20x.d: Fix a typo, s/n/\n/.
2017-02-02LD/testsuite: ld-lib.exp: Fix a typo, s/regexp/regex/Maciej W. Rozycki2-1/+6
Match `$check_ld(source)' against "regex" rather than "regexp" in reporting, correcting test framework diagnostics, e.g.: tmpdir/undefined.o: In function `foo': (.text+0x0): undefined reference to `bar' failed with: <tmpdir/undefined.o: In function `foo': (.text+0x0): undefined reference to `bar'>, no expected output tmpdir/undefined.o: In function `foo': (.text+0x0): undefined reference to `bar' PASS: MIPS undefined reference (current) vs: tmpdir/undefined.o: In function `foo': (.text+0x0): undefined reference to `bar' failed with: <tmpdir/undefined.o: In function `foo': (.text+0x0): undefined reference to `bar'>, expected: <\A[^\n]*\.o: In function `foo':\n\(\.text\+0x0\): undefined reference to `bar'\Z> tmpdir/undefined.o: In function `foo': (.text+0x0): undefined reference to `bar' PASS: MIPS undefined reference (corrected). No functional change. ld/ * ld/testsuite/lib/ld-lib.exp (run_dump_test): Fix a typo, s/regexp/regex/.
2017-02-02[ld, testsuite] Restrict dl1*main and dl6*main tests on platforms which have ↵Jiong Wang3-39/+94
libdl support ld/ * testsuite/lib/ld-lib.exp (check_libdl_available): New function. * testsuite/ld-elf/shared.exp (run_tests): Split tests which require dlopen support into "dlopen_run_tests". These tests include dl1*main and dl6*main. (dlopen_run_tests): New and only run it when check_libdl_available returns true. XFAIL on *-*-netbsdelf*.
2017-02-01MIPS/LD/testsuite: Correct relocation addends in VxWorks testsMaciej W. Rozycki5-14/+22
Fix commit 171191bac50e ("Add support for STT_IFUNC"), <https://sourceware.org/ml/binutils/2008-12/msg00052.html>, commit e04d7088afe0 ("PR ld/14088: Always display addend as signed hex number"), <https://sourceware.org/ml/binutils/2012-05/msg00123.html> and commit 343dbc36ffae ("Print addend as signed in objdump"), <https://sourceware.org/ml/binutils/2012-05/msg00163.html> regressions: FAIL: VxWorks executable test 1 (dynamic) FAIL: ld-mips-elf/vxworks-forced-local-1 seen with `mips-vxworks' and `mipsel-vxworks' targets and adjust dump patterns according to changes made to the presentation of relocation addends in `readelf -r' and `objdump -r' output. ld/ * testsuite/ld-mips-elf/vxworks-forced-local-1.d: Correct the presentation of relocation addends. * testsuite/ld-mips-elf/vxworks1-lib.rd: Likewise. * testsuite/ld-mips-elf/vxworks1.dd: Likewise. * testsuite/ld-mips-elf/vxworks1.rd: Likewise.
2017-02-01MIPS/LD/testsuite: Fix a `tls-multi-got-1-1.s' build failureMaciej W. Rozycki4-25/+35
Correct a commit ec9ab52c3217 ("gas: consistently emit diagnostics for non-zero data emission to .bss/.struct"), <https://sourceware.org/ml/binutils/2015-12/msg00073.html> regression: .../ld/testsuite/ld-mips-elf/tls-multi-got-1-1.s: Assembler messages: .../ld/testsuite/ld-mips-elf/tls-multi-got-1-1.s:39: Error: attempt to store non-zero value in section `.tbss' ERROR: -EB -march=mips1 -32 -KPIC .../ld/testsuite/ld-mips-elf/tls-multi-got-1-1.s: assembly failed UNRESOLVED: Shared library with multiple GOTs and TLS in MIPS target testing and move `tlsvar_ld' to `.tdata' section, in line with the remaining local dynamic definitions introduced with the set of tests added with commit f4e584bd00f1 ("TLS support for MIPS"), <https://sourceware.org/ml/binutils/2005-02/msg00607.html>. ld/ * testsuite/ld-mips-elf/tls-multi-got-1-1.s: Place `tlsvar_ld' in `.tdata' section. * testsuite/ld-mips-elf/tls-multi-got-1.got: Adjust accordingly. * testsuite/ld-mips-elf/tls-multi-got-1.r: Likewise.
2017-02-01[ld, testsuite] Append $board_cflags in one more place in ld-unique/unique.expJiong Wang2-1/+6
ld/ * testsuite/ld-unique/unique.exp (Could not link a dynamic executable): Append $board_cflags to link commands.
2017-02-01Fix failing print-memory-usage-1 on WindowsSenthil Kumar Selvaraj2-1/+6
ld/ 2017-01-31 Senthil Kumar Selvaraj <senthilkumar.selvaraj@microchip.com> * testsuite/ld-scripts/print-memory-usage-1.l: Relax check for digit in second decimal place.
2017-02-01PR ld/20828: LD/testsuite: Correct indentationMaciej W. Rozycki2-20/+26
ld/ PR ld/20828 * testsuite/ld-elf/shared.exp: Correct PR ld/20828 test indentation.
2017-01-31Fix buffer overflows in ld when printing translated strings.Nick Clifton3-9/+7
ld * ldmain.c (add_archive_element): Eliminate string buffer. * ldlang.c (lang_print_asneeded): Likewise.
2017-01-30MIPS: Add options to control branch ISA checksMaciej W. Rozycki11-3/+383
Complement commit 9d862524f6ae ("MIPS: Verify the ISA mode and alignment of branch and jump targets") and add GAS and LD options to control the checks for invalid branches between ISA modes introduced there, to help with some handwritten code lacking `.insn' annotation for labels used as branch targets and code produced by older versions of GCC which suffers from the issue with branches to code that has been optimized away, addressed with GCC commit 242424 ("MIPS/GCC: Mark trailing labels with `.insn'"), <https://gcc.gnu.org/ml/gcc-patches/2016-11/msg01061.html>. bfd/ * elfxx-mips.h (_bfd_mips_elf_insn32): Rename prototype to... (_bfd_mips_elf_linker_flags): ... this. Add another parameter. * elfxx-mips.c (mips_elf_link_hash_table): Add `ignore_branch_isa' member. (mips_elf_perform_relocation): Do not treat an ISA mode mismatch in branch relocation calculation as an error if `ignore_branch_isa' has been set. (_bfd_mips_elf_insn32): Rename to... (_bfd_mips_elf_linker_flags): ... this. Rename the `on' parameter to `insn32' and add an `ignore_branch_isa' parameter. Handle the new parameter. gas/ * config/tc-mips.c (mips_ignore_branch_isa): New variable. (options): Add OPTION_IGNORE_BRANCH_ISA and OPTION_NO_IGNORE_BRANCH_ISA enum values. (md_longopts): Add "mignore-branch-isa" and "mno-ignore-branch-isa" options. (md_parse_option): Handle OPTION_IGNORE_BRANCH_ISA and OPTION_NO_IGNORE_BRANCH_ISA. (fix_bad_cross_mode_branch_p): Return FALSE if `mips_ignore_branch_isa' has been set. (md_show_usage): Add `-mignore-branch-isa' and `-mno-ignore-branch-isa'. * doc/as.texinfo (Target MIPS options): Add `-mignore-branch-isa' and `-mno-ignore-branch-isa' options. (-mignore-branch-isa, -mno-ignore-branch-isa): New options. * doc/c-mips.texi (MIPS Options): Add `-mignore-branch-isa' and `-mno-ignore-branch-isa' options. * testsuite/gas/mips/branch-local-ignore-2.d: New test. * testsuite/gas/mips/branch-local-ignore-3.d: New test. * testsuite/gas/mips/branch-local-ignore-n32-2.d: New test. * testsuite/gas/mips/branch-local-ignore-n32-3.d: New test. * testsuite/gas/mips/branch-local-ignore-n64-2.d: New test. * testsuite/gas/mips/branch-local-ignore-n64-3.d: New test. * testsuite/gas/mips/mips.exp: Run the new tests. ld/ * emultempl/mipself.em (ignore_branch_isa): New variable. (mips_create_output_section_statements): Rename `_bfd_mips_elf_insn32' called to `_bfd_mips_elf_linker_flags', add `ignore_branch_isa' argument. (PARSE_AND_LIST_PROLOGUE): Add OPTION_IGNORE_BRANCH_ISA and OPTION_NO_IGNORE_BRANCH_ISA enum values. (PARSE_AND_LIST_LONGOPTS): Add "ignore-branch-isa" and "no-ignore-branch-isa" options. (PARSE_AND_LIST_OPTIONS): Add `--ignore-branch-isa' and `--no-ignore-branch-isa'. (PARSE_AND_LIST_ARGS_CASES): Handle OPTION_IGNORE_BRANCH_ISA and OPTION_NO_IGNORE_BRANCH_ISA. * ld.texinfo (Options specific to MIPS targets): Add `--ignore-branch-isa' and `--no-ignore-branch-isa' options. (ld and the MIPS family): Likewise. * testsuite/ld-mips-elf/bal-jalx-pic-ignore.d: New test. * testsuite/ld-mips-elf/bal-jalx-pic-ignore-n32.d: New test. * testsuite/ld-mips-elf/bal-jalx-pic-ignore-n64.d: New test. * testsuite/ld-mips-elf/unaligned-branch-ignore-2.d: New test. * testsuite/ld-mips-elf/unaligned-branch-ignore-r6-1: New test. * testsuite/ld-mips-elf/unaligned-branch-ignore-mips16: New test. * testsuite/ld-mips-elf/unaligned-branch-ignore-micromips: New test. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2017-01-29Fix another typo in the last ChangeLog entry.Hans-Peter Nilsson1-1/+1
Gah! Though this time I blame autocompletion.
2017-01-29Fix typo in ChangeLogHans-Peter Nilsson1-1/+1
2017-01-29PR binutils/19935Hans-Peter Nilsson1-0/+1
Fix long-standing buglet and fallout from now-default initfini-array. * emulparams/criself.sh (USER_LABEL_PREFIX): Define. (OTHER_READONLY_SECTIONS, ENTRY): Delete now-redunant defines.
2017-01-29Fix long-standing buglet and fallout from now-default initfini-array.Hans-Peter Nilsson2-2/+7
* emulparams/criself.sh (USER_LABEL_PREFIX): Define. (OTHER_READONLY_SECTIONS, ENTRY): Delete now-redunant defines.
2017-01-27[ld, testsuite] XFAIL "pr20995-2", "Build pr20995-2.so" on arm*-*-eabi*Jiong Wang2-1/+12
ld/ * testsuite/ld-elf/elf.exp ("pr20995-2", "Build pr20995-2.so"): XFAIL on arm*-*-eabi*. Some technical discussions about the reason of this XFAIL are available at https://sourceware.org/ml/binutils/2017-01/msg00441.html
2017-01-27Update description of the -plugin option used by the linker, ar and nm.Dilyan Palauzov2-0/+24
PR 20343 ld * ld.texinfo (Options): Extend documentation of the --plugin option. Include a description of where the plugins should be located. binutils* doc/binutils.texi (ar): Extend documentation of the --plugin option. Include a description of where the plugins should be located. (nm): Likewise.
2017-01-27Add Serbian translation for the LD directory.Nick Clifton4-2/+2292
ld * po/sr.po: New Serbian translation. * configure.ac (ALL_LINGUAS): Add sr. * configure: Regenerate.
2017-01-25Move RTEMS target configuration to ELF sectionsSebastian Huber2-24/+28
bfd/ * config.bfd (powerpcle-*-rtems*): Do not mark as removed. (arm-*-rtems*): Move to (arm*-*-eabi*). (i[3-7]86-*-rtems*): Move to (i[3-7]86-*-elf*). (m68-*-rtems*): Move to (m68*-*-elf*). ld/ * configure.tgt (arm-*-rtems*): Move to (arm*-*-eabi*). (bfin-*-rtems*): Move to (bfin*-*-elf*). (i[3-7]86-*-rtems*): Move to (i[3-7]86*-*-elf*). (m68*-*-rtems*): Move to (m68*-*-elf*). (mips*-*-rtems*): Move to (mips*-*-elf*). (or1k*-*-rtems*): Move to (or1k*-*-elf*). (powerpc*-*-rtems*): Move to (powerpc*-*-elf*). (sparc*-*-rtems*): Move to (sparc*-*-elf*). (sparc64*-*-rtems*): Move to (sparc64*-*-elf*).
2017-01-25Remove all RTEMS COFF targetsSebastian Huber2-4/+8
bfd/ * config.bfd (*-*-rtemscoff*): Mark as removed. gas/ * configure.tgt (sh-*-rtemscoff*): Remove. ld/ * configure.tgt (h8300-*-rtemscoff*): Remove. (i960-*-rtems*): Likewise. (m68*-*-rtemscoff*): Likewise. (sh-*-rtemscoff*): Likewise.
2017-01-24Solaris2/LD: Fix anonymous version script acceptance bugMaciej W. Rozycki2-1/+8
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.
2017-01-24[ld, testsuite] Always assemble those intermeidate .o files used laterJiong Wang2-7/+31
ld/ * testsuite/ld-plugin/lto.exp (lto_link_elf_tests): Move "Compile 7", "Compile 8a", "Compile 8b"... (lto_compile_elf_tests): ...to here. Always run these tests. (lto_run_elf_tests): Move "LTO 7"... (lto_run_elf_shared_tests): ...to here. Restrict these tests on environment where share library is supported.
2017-01-24PowerPC dynamic relocationsAlan Modra4-7/+12
This patch fixes a number of issues with powerpc dynamic relocations. 1) Both ppc and ppc64 were emitting more dynamic symbols and relocations than necessary, due to not supporting static linker resolution of tls_index entries for __tls_get_addr_opt. This meant that any @got@tlsgd or @got@tlsld reloc needed to make their symbols dynamic and generate dptmod and dtprel relocs for the dynamic linker. That would have been passable, but what happened was that practically all @got relocations resulted in their symbols being made dynamic and dynamic relocations emitted against the GOT entries. (Mostly visible on ppc32 executables since ppc64 gcc really only uses @got style relocs for TLS.) 2) The PowerOpen syntax was not supported with __tls_get_addr_opt. DTPMOD/DTPREL relocs on tls_index TOC entries did not use the trick of forcing dynamic symbols and relocations so those entries always resulted in the full __tls_get_addr processing. gcc doesn't use the PowerOpen syntax for TLS, and normally such code would be optimized to TLS IE or LE so the impact of missing this support was minimal. 3) In an executable, relocations against GNU indirect functions always used the value of their PLT stub. While this is correct, it is better in some cases to use a dynamic relocation. An extra dynamic relocation can mean that calls via function pointers need not bounce through the PLT stub at runtime. The patch also tidies the PLT handling code in ppc32 allocate_dynrelocs. Allocating PLT entries after other dynamic relocs allows the PLT loop to omit special handling for undefined weak symbols, and that in turn allows the loop to be simplified. bfd/ * elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Merge two cases where dynamic relocs are preferable. Allow ifunc too. (ensure_undefweak_dynamic): New function. (allocate_dynrelocs): Use it here. Move plt handling last and don't make symbols dynamic, simplifying loop. Only make undef weak symbols with GOT entries dynamic. Correct condition for GOT relocs. Handle dynamic relocs on ifuncs. Correct comments. Remove goto. (ppc_elf_relocate_section): Correct test for using dynamic symbol on GOT relocs. Rearrange test for emitting GOT relocs to suit. Set up explicit tls_index entries and implicit GOT tls_index entries resolvable at link time for __tls_get_addr_opt. Simplify test to clear mem for prelink. * elf64-ppc.c (allocate_got): Correct condition for GOT relocs. (ensure_undefweak_dynamic): New function. (allocate_dynrelocs): Use it here. Only make undef weak symbols with GOT entries dynamic. Remove unnecessary test of WILL_CALL_FINISH_DYNAMIC_SYMBOL in PLT handling. (ppc64_elf_relocate_section): Correct test for using dynamic symbol on GOT relocs. Rearrange test for emitting GOT relocs to suit. Set up explicit tls_index entries and implicit GOT tls_index entries resolvable at link time for __tls_get_addr_opt. Simplify expression to clear mem for prelink. ld/ * testsuite/ld-powerpc/tlsexe.r: Update for fewer dynamic relocs and symbols. * testsuite/ld-powerpc/tlsexe.d: Likewise. * testsuite/ld-powerpc/tlsexe.g: Likewise.
2017-01-23Fix AArch64 relocation handling in ILP32 mode.Yury Norov14-1/+233
bfd * elfnn-aarch64.c: Fix relaxations for ILP32 mode. ld * testsuite/ld-aarch64/aarch64-elf.exp: Run new tests. * testsuite/ld-aarch64/tls-desc-ie-ilp32.d: New test. * testsuite/ld-aarch64/tls-relax-all-ilp32.d: New test. * testsuite/ld-aarch64/tls-relax-gd-le-ilp32.d: New test. * testsuite/ld-aarch64/tls-relax-gdesc-le-2-ilp32.d: New test. * testsuite/ld-aarch64/tls-relax-gdesc-le-ilp32.d: New test. * testsuite/ld-aarch64/tls-relax-ie-le-2-ilp32.d: New test. * testsuite/ld-aarch64/tls-relax-ie-le-3-ilp32.d: New test. * testsuite/ld-aarch64/tls-relax-ie-le-ilp32.d: New test. * testsuite/ld-aarch64/tls-tiny-desc-ie-ilp32.d: New test. * testsuite/ld-aarch64/tls-tiny-desc-le-ilp32.d: New test. * testsuite/ld-aarch64/tls-tiny-gd-ie-ilp32.d: New test. * testsuite/ld-aarch64/tls-tiny-gd-le-ilp32.d: New test.
2017-01-23Updated Irish translation for ld and Swedish translation for gas.Nick Clifton2-891/+1247
2017-01-23PR ld/20828: Work around RISC-V failuresMaciej W. Rozycki2-0/+6
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'.
2017-01-23PR ld/20828: Remove leading `_' from symbols used in testsMaciej W. Rozycki6-14/+24
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.
2017-01-23PR ld/20828: Relax symbol ordering in testsMaciej W. Rozycki5-8/+18
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.
2017-01-23[ld, testsuite] Honor cflags when GCC used as linker driverJiong Wang3-2/+28
ld/ * testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Append board_cflags as gcc is used as linker driver. * testsuite/ld-unique/unique.exp: Likewise
2017-01-20[AArch64] Optimize .gnu.hash table size for executableJiong Wang5-0/+31
bfd/ * elfnn-aarch64.c (elf_aarch64_hash_symbol): New function. (elf_backend_hash_symbol): Define. ld/ * testsuite/ld-aarch64/aarch64-elf.exp (aarch64elflinktests): New tests. * testsuite/ld-aarch64/func-in-so.s: New test source file. * testsuite/ld-aarch64/func-sym-hash-opt.s: Likewise. * testsuite/ld-aarch64/func-sym-hash-opt.d: New expected test result.
2017-01-20objdump: Better objdump section headers in wide modeAndrew Burgess2-1/+5
When displaying the section headers table using objdump (-h), the column containing the section header name is currently fixed at 13 characters. A section name that is longer than 13 characters will overflow the column causing the table to become miss-aligned. In this commit I change the behaviour so that _in wide mode_ (-w -h) the section name column is dynamically resized to fit the longest section name we plan to display. In wide mode the column still retains a minimum width of 13 characters. In non-wide more the behaviour is completely unchanged. While I was changing the dump_headers function I have unified the two printf lines that handled the different address widths into a single printf, the address width is now passed into printf using the '*' field width format character. binutils/ChangeLog: * objdump.c (dump_section_header): Extract max section name length from data parameter, use this when formatting output. (find_longest_section_name): New function. (dump_headers): Calculate longest section name when in wide mode, reformat to unify printing of header line. ld/ChangeLog: * testsuite/ld-elf/eh-frame-hdr.d: Update expected results.
2017-01-18PR ld/20995: MIPS: Set GAS flags correctly for testsMaciej W. Rozycki2-10/+23
Complement commit 9acc85a62eb7 ("Use dynrelro for symbols in relro sections too"). ld/ PR ld/20995 * testsuite/ld-elf/elf.exp: Set GAS flags correctly for the `mips*-*-*' target and `pr20995' and `pr20995-2' tests.
2017-01-18PR ld/20828: Fix linker script symbols wrongly forced local with section GCMaciej W. Rozycki8-0/+108
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.
2017-01-18PR gas/20649: MIPS: Fix GOT16/LO16 reloc pairing with comdat sectionsMaciej W. Rozycki2-0/+13
Correct a regression from commit 8614eeee67f9 ("Traditional MIPS patches"), <https://sourceware.org/ml/binutils/2000-07/msg00018.html>, which caused symbols in linkonce or what is these days known as comdat sections to be treated as external for the purpose of PIC relocation generation even if their binding remains STB_LOCAL. This in turn disabled GOT16/LO16 relocation pairing with references to such symbols, as no complementing LO16 relocation is expected for external GOT16 references in the o32 ABI, which ultimately leads to link errors, e.g.: ld: comdat-reloc.o: Can't find matching LO16 reloc against `foo' for R_MIPS_GOT16 at 0x24 in section `.text.bar[bar]' as with the LD test case included with this change. Revert the special case for symbols in comdat sections then, making code actually match `adjust_reloc_syms' as indicated in its explanatory comment, and adjust calling code accordingly. Also bring back the corresponding description of what now is `s_is_linkonce', lost with commit 5f0fe04bc550 ("Improved MIPS16/MIPS32 code intermixing for gas."), <https://www.sourceware.org/ml/binutils/2006-07/msg00039.html>. gas/ PR gas/20649 * config/tc-mips.c (pic_need_relax): Don't check for linkonce symbols, remove the `segtype' parameter. (mips_frob_file, md_estimate_size_before_relax): Adjust accordingly. (s_is_linkonce): Add an explanatory comment. * testsuite/gas/mips/comdat-reloc.d: New test. * testsuite/gas/mips/comdat-reloc.s: New test source. * testsuite/gas/mips/mips.exp: Run the new test. ld/ PR gas/20649 * testsuite/ld-mips-elf/mips-elf.exp: Add PIC comdat GOT16/LO16 relocation pairing link test.
2017-01-18Skip linker tests for unique symbols in shared libraries if the target does ↵Dimitar Dimitrov2-24/+41
not support building shared libraries. ld * testsuite/ld-unique/unique.exp: Filter shared lib cases in uniqeue.exp, as not all targets have such support.
2017-01-16Updated Swedish translations for GAS and LD subdirectories.Nick Clifton2-31/+35
gas * po/sv.po: Updated Swedish translation. ld * po/sv.po: Updated Swedish translation.
2017-01-12x86-64: Also generate unwind info for .plt.bndH.J. Lu5-0/+117
Also generate unwind info for the .plt.bnd section. Sine it is the same as unwind info for the .plt.got section, we use unwind info for the .plt.got section to cover the the .plt.bnd section. bfd/ PR ld/21038 * elf64-x86-64.c (elf_x86_64_link_hash_table): Add plt_bnd_eh_frame. (elf_x86_64_check_relocs): Create .eh_frame section for the .plt.bnd section. (elf_x86_64_size_dynamic_sections): Allocate and initialize .eh_frame section for the .plt.bnd section. (elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section for the .plt.bnd section. ld/ PR ld/21038 * testsuite/ld-x86-64/pr21038b.d: Updated. * testsuite/ld-x86-64/pr21038c.d: New file. * testsuite/ld-x86-64/pr21038c.s: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run pr21038c.
2017-01-11x86-64: Correct unwind info for the BND PLTH.J. Lu6-0/+161
Since the BND PLT has 230: 68 00 00 00 00 pushq $0x0 235: f2 e9 e5 ff ff ff bnd jmpq 220 <.plt> 23b: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) instead of 230: ff 25 e2 0d 20 00 jmpq *0x200de2(%rip) # 201018 <func> 236: 68 00 00 00 00 pushq $0x0 23b: e9 e0 ff ff ff jmpq 220 <.plt> its unwind info should be DW_CFA_def_cfa_expression (DW_OP_breg7 (rsp): 8; DW_OP_breg16 (rip): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit5; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus) bfd/ PR ld/21038 * elf64-x86-64.c (elf_x86_64_eh_frame_bnd_plt): New. (elf_x86_64_bnd_arch_bed): Use elf_x86_64_eh_frame_bnd_plt and elf_x86_64_eh_frame_plt_got. (elf_x86_64_size_dynamic_sections): Get unwind info from elf_x86_64_bnd_arch_bed for the BND PLT. ld/ PR ld/21038 * testsuite/ld-x86-64/pr21038a.d: New file. * testsuite/ld-x86-64/pr21038a.s: Likewise. * testsuite/ld-x86-64/pr21038b.d: Likewise. * testsuite/ld-x86-64/pr21038b.s: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run pr21038a and pr21038b.
2017-01-11Add support for x86/64 redox target.Jeremy Soller2-0/+8
bfd * config.bfd: Add entries for i686-redox and x86_64-redox. gas * configure.tgt: Add entry for i386-redox. ld * configure.tgt: Add entries for x86-redox and x86_64-redox.
2017-01-10i386/x32: Align .eh_frame section to 4 bytesH.J. Lu2-8/+6
.eh_frame section covering PLT sections should be aligned to 4 bytes for i386 and x32. bfd/ * elf32-i386.c (elf_i386_check_relocs): Align .eh_frame section to 4 bytes. * elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Align .eh_frame section to 4 bytes for x32. (elf_x86_64_check_relocs): Likewise. ld/ * testsuite/ld-x86-64/pr20830b.d: Updated.
2017-01-10X32: Place .plt.got section after .plt sectionH.J. Lu5-1/+82
This patch places .plt.got section after .plt section for x32. * emulparams/elf32_x86_64.sh (TINY_READONLY_SECTION): New. * testsuite/ld-x86-64/pr20830.d: Renamed to ... * testsuite/ld-x86-64/pr20830a.d: This. Updated. * testsuite/ld-x86-64/pr20830b.d: New file. * testsuite/ld-x86-64/x86-64.exp: Rename pr20830 to pr20830a. Run pr20830b.
2017-01-10i386/x86-64: Add unwind info for .plt.got sectionH.J. Lu7-0/+159
When there are both PLT and GOT references to the same function symbol, linker combines GOTPLT and GOT slots into a single GOT slot and create an entry in .plt.got section for PLT access via the GOT slot. This patch adds unwind info for .plt.got section. bfd/ PR ld/20830 * elf32-i386.c (elf_i386_eh_frame_plt_got): New. (PLT_GOT_FDE_LENGTH): Likewise. (elf_i386_plt_layout): Add eh_frame_plt_got and eh_frame_plt_got_size. (elf_i386_plt): Updated. (elf_i386_link_hash_table): Add plt_got_eh_frame. (elf_i386_check_relocs): Create .eh_frame section for .plt.got. (elf_i386_size_dynamic_sections): Allocate and initialize .eh_frame section for .plt.got. (elf_i386_finish_dynamic_sections): Adjust .eh_frame section for .plt.got. (elf_i386_nacl_plt): Add FIXME for eh_frame_plt_got and eh_frame_plt_got_size. * elf64-x86-64.c (elf_x86_64_eh_frame_plt_got): New. (PLT_GOT_FDE_LENGTH): Likewise. (elf_x86_64_backend_data): Add eh_frame_plt_got and eh_frame_plt_got_size. (elf_x86_64_arch_bed): Updated. (elf_x86_64_bnd_arch_bed): Add FIXME for eh_frame_plt_got and eh_frame_plt_got_size. (elf_x86_64_nacl_arch_bed): Likewise. (elf_x86_64_link_hash_table): Add plt_got_eh_frame. (elf_x86_64_check_relocs): Create .eh_frame section for .plt.got. (elf_x86_64_size_dynamic_sections): Allocate and initialize .eh_frame section for .plt.got. (elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section for .plt.got. ld/ PR ld/20830 * testsuite/ld-i386/i386.exp: Run pr20830. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr20830.d: New file. * testsuite/ld-i386/pr20830.s: Likewise. * testsuite/ld-x86-64/pr20830.d: Likewise. * testsuite/ld-x86-64/pr20830.s: Likewise.
2017-01-10i386: Pass -Wl,-R,tmpdir/-Wl --as-needed to $CCH.J. Lu3-5/+11
Since linker tests were changed to use $CC, instead of $LD, we need to pass -Wl,-R,tmpdir and -Wl,--as-needed to $CC. * testsuite/ld-i386/i386.exp: Pass -Wl,-R,tmpdir to GCC driver. * testsuite/ld-i386/tls.exp: Likewise.
2017-01-10Updated Swedish translations for GAS and LDNick Clifton2-828/+1437
2017-01-10[ARC] Add new linker emulation for npsGraham Markall8-2/+205
The arc700 nps variant uses some specific named sections to facilitate its CMEM based instructions, which operate on memory regions fixed at specific addresses. This commit adds the arclinux_nps emulation, which is based on the arclinux emulation. The new emulation uses the OTHER_SECTIONS variable in the emulation parameters script to provide symbols mapping to various locations in the CMEM space on nps. The accompanying test ensures that all symbols are provided at the correct address in the linker script. ld/ChangeLog: * Makefile.am: Add earclinux_nps.c target and add to ALL_EMULATION_SOURCES. * Makefile.in: Likewise, regenerated. * configure.tgt: Add arclinux_nps as an extra emulation for arc*-*-elf* and arc*-*-linux*. * emulparams/arc-nps.sh: New file. * emulparams/arclinux_nps.sh: New file. * testsuite/ld-arc/arclinux-nps.d, * testsuite/ld-arc/arclinux-nps.s: New test.
2017-01-09Remove some custom sections from RISC-V's default linker scriptsPalmer Dabbelt1-12/+0
This was added so compressed loads could have smaller offsets for accessing the data section, but the result was that writable sections ended up in INITIAL_READONLY_SECTIONS. This is a bad idea. The fix is to just remove this micro-optimization. Thanks to Alan Morda for finding the problem! ld/ChangeLog 2017-01-09 Palmer Dabbelt <palmer@dabbelt.com> Kito Cheng <kito.cheng@gmail.com> * emulparams/elf32lriscv-defs.sh (INITIAL_READONLY_SECTIONS): Removed. (SDATA_START_SYMBOLS): Likewise.
2017-01-04Use noyywrap option in lex files.Dilan Palauzov3-8/+8
ld PR 20958 * ldlex.l (option): Add noyywrap (yywrap): Delete. * ldlex.h (yywrap): Delete prototype. binutils PR 20958 * syslex.l (option): Add noyywrap (yywrap): Delete.
2017-01-04Check for shared lib support before running ld tests with -sharedAlan Modra8-2/+48
Another fix now that we run these tests non-native. * testsuite/ld-elf/audit.exp: Check for shared lib support. * testsuite/ld-elf/compress.exp: Likewise. * testsuite/ld-elf/dwarf.exp: Likewise. * testsuite/ld-elf/shared.exp: Likewise. * testsuite/ld-elf/wrap.exp: Likewise. * testsuite/ld-ifunc/ifunc.exp: Likewise. * testsuite/ld-plugin/lto.exp: Check $CXX exists.
2017-01-03Check ld_compile return statusAlan Modra2-4/+26
* testsuite/lib/ld-lib.exp (run_ld_link_exec_tests): Do not allow test to continue after compilation errors. (run_cc_link_tests): Likewise.
2017-01-03Fix PRU LD for --enable-targets=all config optionDimitar Dimitrov3-4/+9
I noticed that PRU LD is broken when BFD is configured with --enable-targets=all. This patch fixes it, and takes the opportunity to clean the epruelf.c dependencies. * Makefile.am (ALL_EMULATION_SOURCES): Add epruelf.c. (epruelf.c): Remove unneeded dependencies. * Makefile.in: Regenerate Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>