aboutsummaryrefslogtreecommitdiff
path: root/ld
AgeCommit message (Collapse)AuthorFilesLines
2016-11-10[AArch64] Bind defined symbol locally in PIEJiong Wang5-0/+30
bfd/ PR target/20737 * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Bind defined symbol locally in PIE. ld/ * testsuite/ld-aarch64/pie-bind-locally-a.s: New test source. * testsuite/ld-aarch64/pie-bind-locally-b.s: Likewise. * testsuite/ld-aarch64/pie-bind-locally.d: New testcase. * testsuite/ld-aarch64/aarch64-elf.exp: Run new testcase.
2016-11-07Fix infinite loop when processing rpath tokens.Nick Clifton3-27/+67
PR ld/20784 * emultempl/elf32.em (search_needed): Fix infinite loop when unable to process a token. Add support for curly braced enclosed tokens. * ld.texinfo (--rpath-link): Document supprot for $ORIGIN and $LIB.
2016-11-07Note that the linker's --compress-debug-sections option overrides the ↵Nick Clifton2-11/+27
compression status of any input debug sections. * ld.texinfo (--compress-debug-sections): Expand documentation of this option.
2016-11-04Remove support for $PLATFORM in rpath search paths.Nick Clifton5-35/+18
* emultempl/elf32.em (search_needed): Remove use of getauxval and inclusion of <sys/auxv.h>. Replace support for $PLATFORM with a warning message. * configure.ac (AC_CHECK_FUNCS): Remove getauxval. * configure: Regenerate. * config.in: Regenerate.
2016-11-04ld: Allow EXCLUDE_FILE to be used outside of the section listAndrew Burgess20-21/+231
Currently the EXCLUDE_FILE linker script construct can only be used within the input section list, and applied only to the section pattern immediately following the EXCLUDE_FILE. For example: *.o (EXCLUDE_FILE (a.o) .text .rodata) In this case all sections matching '.text' are included from all files matching '*.o' but not from the file 'a.o'. All sections matching '.rodata' are also included from all files matching '*.o' (incluing from 'a.o'). If the user wants to restrict the inclusion of section '.rodata' so that this too is not taken from the file 'a.o' then the above example must be extended like this: *.o (EXCLUDE_FILE (a.o) .text EXCLUDE_FILE (a.o) .rodata) However, due to the internal grammar of the linker script language the snippet 'EXCLUDE_FILE (a.o) .text' is parsed by a pattern called 'wildcard_spec'. The same 'wildcard_spec' pattern is also used to parse the input file name snippet '*.o' in the above examples. As a result of this pattern reuse within the linker script grammar then the following is also a valid linker script construct: EXCLUDE_FILE (a.o) *.o (.text .rodata) However, though the linker accepts this without complaint the EXCLUDE_FILE part is silently ignored and has no effect. This commit takes this last example and makes it a useful, valid, construct. The last example now means to include sections '.text' and '.rodata' from all files matching '*.o' except for the file 'a.o'. If the list of input sections is long, and the user knows that the file exclusion applies across the list then the second form might be a clearer alternative to replicating the EXCLUDE_FILE construct. I've added a set of tests for EXCLUDE_FILE to the linker, including tests for the new functionality. ld/ChangeLog: * ldlang.h (struct lang_wild_statement_struct): Add exclude_name_list field. * ldlang.c (walk_wild_file_in_exclude_list): New function. (walk_wild_consider_section): Use new walk_wild_file_in_exclude_list function. (walk_wild_file): Add call to walk_wild_file_in_exclude_list. (print_wild_statement): Print new exclude_name_list field. (lang_add_wild): Initialise new exclude_name_list field. * testsuite/ld-scripts/exclude-file-1.d: New file. * testsuite/ld-scripts/exclude-file-1.map: New file. * testsuite/ld-scripts/exclude-file-1.t: New file. * testsuite/ld-scripts/exclude-file-2.d: New file. * testsuite/ld-scripts/exclude-file-2.map: New file. * testsuite/ld-scripts/exclude-file-2.t: New file. * testsuite/ld-scripts/exclude-file-3.d: New file. * testsuite/ld-scripts/exclude-file-3.map: New file. * testsuite/ld-scripts/exclude-file-3.t: New file. * testsuite/ld-scripts/exclude-file-4.d: New file. * testsuite/ld-scripts/exclude-file-4.map: New file. * testsuite/ld-scripts/exclude-file-4.t: New file. * testsuite/ld-scripts/exclude-file-a.s: New file. * testsuite/ld-scripts/exclude-file-b.s: New file. * testsuite/ld-scripts/exclude-file.exp: New file. * ld.texinfo (Input Section Basics): Update description of EXCLUDE_FILE to cover the new features. * NEWS: Mention new EXCLUDE_FILE usage.
2016-11-04ld: Create test object files based on source file nameAndrew Burgess6-7/+34
When creating object files during testing, base the name of the object file on the name of the source file, rather than using dump0.o, dump1.o, etc. There's a few places where we have multiple source files with the same name but in different directories, in these cases, even after this change, we still add a numerical suffix to make the object file names unique. So if we have 'foo/src.s' and 'bar/src.s', we will create object files 'src.o' and 'src1.o'. Update the few tests that hard code the object file name into the expected test results. ld/ChangeLog: * testsuite/lib/ld-lib.exp (run_dump_test): Use object file names based on the original source file name. * testsuite/ld-discard/extern.d: Update object file names. * testsuite/ld-discard/start.d: Likewise. * testsuite/ld-discard/static.d: Likewise. * testsuite/ld-elf/orphan-8.map: Likewise.
2016-11-04ld/xc16x: This target does not support -sharedAndrew Burgess2-0/+6
Add the xc16x-elf target to the list of targets that do not support the -shared option. Being missing from this list was causing the linker to add '-z norelro' to the link line of many tests, which in turn caused these tests to fail. ld/ChangeLog: * testsuite/lib/ld-lib.exp (check_shared_lib_support): Add xc16x-*-elf to the list of targets that don't support -shared.
2016-11-04ld: Rename pattern within yacc grammar fileAndrew Burgess2-7/+12
Rename file_NAME_list to section_NAME_list in the linker's grammar file. This rename reflects how the pattern is now being used, and makes the grammar easier to understand. There should be no functional change after this commit. ld/ChangeLog: * ldgram.y: Rename file_NAME_list to section_NAME_list throughout.
2016-11-01Add support for RISC-V architecture.Nick Clifton10-1/+176
bfd * Makefile.am: Add entries for riscv32-elf and riscv64-elf. * config.bdf: Likewise. * configure.ac: Likewise. * Makefile.in: Regenerate. * configure: Regenerate. * archures.c: Add bfd_riscv_arch. * reloc.c: Add riscv relocs. * targets.c: Add riscv_elf32_vec and riscv_elf64_vec. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * elf-bfd.h: Add RISCV_ELF_DATA to enum elf_target_id. * elfnn-riscv.c: New file. * elfxx-riscv.c: New file. * elfxx-riscv.h: New file. binutils* readelf.c (guess_is_rela): Add EM_RISCV. (get_machine_name): Likewise. (dump_relocations): Add support for riscv relocations. (get_machine_flags): Add support for riscv flags. (is_32bit_abs_reloc): Add R_RISCV_32. (is_64bit_abs_reloc): Add R_RISCV_64. (is_none_reloc): Add R_RISCV_NONE. * testsuite/binutils-all/objdump.exp (cpus_expected): Add riscv. Expect the debug_ranges test to fail. gas * Makefile.am: Add riscv files. * Makefile.in: Regenerate. * NEWS: Mention the support for this architecture. * configure.in: Define a default architecture. * configure: Regenerate. * configure.tgt: Add entries for riscv. * doc/as.texinfo: Likewise. * testsuite/gas/all/gas.exp: Expect the redef tests to fail. * testsuite/gas/elf/elf.exp: Expect the groupauto tests to fail. * config/tc-riscv.c: New file. * config/tc-riscv.h: New file. * doc/c-riscv.texi: New file. * testsuite/gas/riscv: New directory. * testsuite/gas/riscv/riscv.exp: New file. * testsuite/gas/riscv/t_insns.d: New file. * testsuite/gas/riscv/t_insns.s: New file. ld * Makefile.am: Add riscv files. * Makefile.in: Regenerate. * NEWS: Mention the support for this target. * configure.tgt: Add riscv entries. * emulparams/elf32lriscv-defs.sh: New file. * emulparams/elf32lriscv.sh: New file. * emulparams/elf64lriscv-defs.sh: New file. * emulparams/elf64lriscv.sh: New file. * emultempl/riscvelf.em: New file. opcodes * configure.ac: Add entry for bfd_riscv_arch. * configure: Regenerate. * disassemble.c (disassembler): Add support for riscv. (disassembler_usage): Likewise. * riscv-dis.c: New file. * riscv-opc.c: New file. include * dis-asm.h: Add prototypes for print_insn_riscv and print_riscv_disassembler_options. * elf/riscv.h: New file. * opcode/riscv-opc.h: New file. * opcode/riscv.h: New file.
2016-10-31Initialize input statement created in add_archive_memberThomas Preud'homme3-0/+8
2016-10-31 Thomas Preud'homme <thomas.preudhomme@arm.com> ld/ * ldmain.c (add_archive_element): Initialize input->header.type. * plugin.c (plugin_maybe_claim): Assert the statement is an input statement.
2016-10-15Regenerate spu_ovl.o_cAlan Modra2-53/+57
No real changes here. This is just so that we match current spu_ovl.o with .shstrtab moved. * emultempl/spu_ovl.o_c: Regenerate.
2016-10-14Add separate debug info file sectionAlan Modra2-0/+5
* scripttempl/DWARF.sc: Add .debug_addr.
2016-10-12Update more tests for objdump changeAlan Modra6-9/+17
* testsuite/ld-i386/pr19636-1d-nacl.d: Adjust for objdump change. * testsuite/ld-i386/pr19636-2c-nacl.d: Likewise. * testsuite/ld-tic6x/shlib-1r.dd: Likewise. * testsuite/ld-x86-64/plt-nacl.pd: Likewise. * testsuite/ld-x86-64/pr19636-2d-nacl.d: Likewise.
2016-10-11Enhance objdump so that it will use .got, .plt and .plt.got section symbols ↵Nick Clifton161-677/+841
when disassembling, and it will use dynamic relocs to interpret entries in the PLT and GOT. binutils * objdump.c (is_significant_symbol_name): New function. (remove_useless_symbols): Do not remove significanr symbols. (find_symbol_for_address): If an exact match for the specified address has not been found, try scanning the dynamic relocs to see if one of these matches the address. If so, use the symbol associated with the reloc. (objdump_print_addr_with_symbol): Do not print offsets to symbols with no value. (disassemble_section): Only use dynamic relocs if the user requested this. (disassemble_data): Always load dynamic relocs if they are available. ld * ld-aarch64/emit-relocs-515-be.d: Adjust output to match change in objdump. * ld-aarch64/emit-relocs-515.d: Likewise. * ld-aarch64/emit-relocs-516-be.d: Likewise. * ld-aarch64/emit-relocs-516.d: Likewise. * ld-aarch64/farcall-b-plt.d: Likewise. * ld-aarch64/farcall-bl-plt.d: Likewise. * ld-aarch64/gc-plt-relocs.d: Likewise. * ld-aarch64/tls-desc-ie.d: Likewise. * ld-aarch64/tls-tiny-desc.d: Likewise. * ld-aarch64/tls-tiny-gd.d: Likewise. * ld-aarch64/tls-tiny-ie.d: Likewise. * ld-arm/arm-app-abs32.d: Likewise. * ld-arm/arm-app.d: Likewise. * ld-arm/arm-lib-plt32.d: Likewise. * ld-arm/arm-lib.d: Likewise. * ld-arm/armthumb-lib.d: Likewise. * ld-arm/cortex-a8-fix-b-plt.d: Likewise. * ld-arm/cortex-a8-fix-bcc-plt.d: Likewise. * ld-arm/cortex-a8-fix-bl-plt.d: Likewise. * ld-arm/cortex-a8-fix-bl-rel-plt.d: Likewise. * ld-arm/cortex-a8-fix-blx-plt.d: Likewise. * ld-arm/farcall-mixed-app-v5.d: Likewise. * ld-arm/farcall-mixed-app.d: Likewise. * ld-arm/farcall-mixed-app2.d: Likewise. * ld-arm/farcall-mixed-lib-v4t.d: Likewise. * ld-arm/farcall-mixed-lib.d: Likewise. * ld-arm/ifunc-10.dd: Likewise. * ld-arm/ifunc-14.dd: Likewise. * ld-arm/ifunc-15.dd: Likewise. * ld-arm/ifunc-3.dd: Likewise. * ld-arm/ifunc-4.dd: Likewise. * ld-arm/ifunc-9.dd: Likewise. * ld-arm/long-plt-format.d: Likewise. * ld-arm/mixed-app-v5.d: Likewise. * ld-arm/mixed-app.d: Likewise. * ld-arm/mixed-lib.d: Likewise. * ld-arm/tls-lib-loc.d: Likewise. * ld-cris/dso-pltdis1.d: Likewise. * ld-cris/dso-pltdis2.d: Likewise. * ld-cris/dso12-pltdis.d: Likewise. * ld-elf/symbolic-func.r: Likewise. * ld-frv/fdpic-pie-1.d: Likewise. * ld-frv/fdpic-pie-2.d: Likewise. * ld-frv/fdpic-pie-6.d: Likewise. * ld-frv/fdpic-pie-7.d: Likewise. * ld-frv/fdpic-pie-8.d: Likewise. * ld-frv/fdpic-shared-1.d: Likewise. * ld-frv/fdpic-shared-2.d: Likewise. * ld-frv/fdpic-shared-3.d: Likewise. * ld-frv/fdpic-shared-4.d: Likewise. * ld-frv/fdpic-shared-5.d: Likewise. * ld-frv/fdpic-shared-6.d: Likewise. * ld-frv/fdpic-shared-7.d: Likewise. * ld-frv/fdpic-shared-8.d: Likewise. * ld-frv/fdpic-shared-local-2.d: Likewise. * ld-frv/fdpic-shared-local-8.d: Likewise. * ld-frv/fdpic-static-1.d: Likewise. * ld-frv/fdpic-static-2.d: Likewise. * ld-frv/fdpic-static-6.d: Likewise. * ld-frv/fdpic-static-7.d: Likewise. * ld-frv/fdpic-static-8.d: Likewise. * ld-frv/tls-dynamic-2.d: Likewise. * ld-frv/tls-initial-shared-2.d: Likewise. * ld-frv/tls-relax-shared-2.d: Likewise. * ld-frv/tls-shared-2.d: Likewise. * ld-i386/plt-nacl.pd: Likewise. * ld-i386/plt-pic-nacl.pd: Likewise. * ld-i386/plt-pic.pd: Likewise. * ld-i386/plt.pd: Likewise. * ld-i386/pr19636-1d-nacl.d: Likewise. * ld-i386/pr19636-1d.d: Likewise. * ld-i386/pr19636-2c-nacl.d: Likewise. * ld-i386/pr19636-2c.d: Likewise. * ld-ifunc/ifunc-21-x86-64.d: Likewise. * ld-ifunc/ifunc-22-x86-64.d: Likewise. * ld-ifunc/pr17154-i386.d: Likewise. * ld-ifunc/pr17154-x86-64.d: Likewise. * ld-m68k/plt1-68020.d: Likewise. * ld-m68k/plt1-cpu32.d: Likewise. * ld-m68k/plt1-isab.d: Likewise. * ld-m68k/plt1-isac.d: Likewise. * ld-metag/shared.d: Likewise. * ld-metag/stub_pic_app.d: Likewise. * ld-metag/stub_pic_shared.d: Likewise. * ld-metag/stub_shared.d: Likewise. * ld-s390/tlsbin_64.dd: Likewise. * ld-s390/tlspic_64.dd: Likewise. * ld-tic6x/shlib-1.dd: Likewise. * ld-tic6x/shlib-1b.dd: Likewise. * ld-tic6x/shlib-1rb.dd: Likewise. * ld-tic6x/shlib-app-1.dd: Likewise. * ld-tic6x/shlib-app-1b.dd: Likewise. * ld-tic6x/shlib-app-1r.dd: Likewise. * ld-tic6x/shlib-app-1rb.dd: Likewise. * ld-tic6x/shlib-noindex.dd: Likewise. * ld-vax-elf/export-class-data.dd: Likewise. * ld-vax-elf/plt-local-lib.dd: Likewise. * ld-vax-elf/plt-local.dd: Likewise. * ld-x86-64/bnd-ifunc-2.d: Likewise. * ld-x86-64/bnd-plt-1.d: Likewise. * ld-x86-64/gotpcrel1.dd: Likewise. * ld-x86-64/libno-plt-1b.dd: Likewise. * ld-x86-64/load1c-nacl.d: Likewise. * ld-x86-64/load1c.d: Likewise. * ld-x86-64/load1d-nacl.d: Likewise. * ld-x86-64/load1d.d: Likewise. * ld-x86-64/mov1a.d: Likewise. * ld-x86-64/mov1b.d: Likewise. * ld-x86-64/mov1c.d: Likewise. * ld-x86-64/mov1d.d: Likewise. * ld-x86-64/mov2a.d: Likewise. * ld-x86-64/mov2b.d: Likewise. * ld-x86-64/mov2c.d: Likewise. * ld-x86-64/mov2d.d: Likewise. * ld-x86-64/mpx3.dd: Likewise. * ld-x86-64/mpx4.dd: Likewise. * ld-x86-64/no-plt-1a.dd: Likewise. * ld-x86-64/no-plt-1b.dd: Likewise. * ld-x86-64/no-plt-1c.dd: Likewise. * ld-x86-64/no-plt-1e.dd: Likewise. * ld-x86-64/no-plt-1f.dd: Likewise. * ld-x86-64/no-plt-1g.dd: Likewise. * ld-x86-64/plt-main-bnd.dd: Likewise. * ld-x86-64/plt-nacl.pd: Likewise. * ld-x86-64/plt.pd: Likewise. * ld-x86-64/pr18591.d: Likewise. * ld-x86-64/pr19609-1c.d: Likewise. * ld-x86-64/pr19609-1e.d: Likewise. * ld-x86-64/pr19609-1j.d: Likewise. * ld-x86-64/pr19609-1l.d: Likewise. * ld-x86-64/pr19609-1m.d: Likewise. * ld-x86-64/pr19609-5b.d: Likewise. * ld-x86-64/pr19609-5c.d: Likewise. * ld-x86-64/pr19609-5e.d: Likewise. * ld-x86-64/pr19609-6b.d: Likewise. * ld-x86-64/pr19609-7b.d: Likewise. * ld-x86-64/pr19609-7d.d: Likewise. * ld-x86-64/pr19636-2d.d: Likewise. * ld-x86-64/pr20093-1.d: Likewise. * ld-x86-64/pr20093-2.d: Likewise. * ld-x86-64/pr20253-1b.d: Likewise. * ld-x86-64/pr20253-1d.d: Likewise. * ld-x86-64/pr20253-1f.d: Likewise. * ld-x86-64/pr20253-1h.d: Likewise. * ld-x86-64/pr20253-1j.d: Likewise. * ld-x86-64/pr20253-1l.d: Likewise. * ld-x86-64/protected3.d: Likewise. * ld-x86-64/tlsbin.dd: Likewise. * ld-x86-64/tlsbin2.dd: Likewise. * ld-x86-64/tlsbindesc.dd: Likewise. * ld-x86-64/tlsdesc-nacl.pd: Likewise. * ld-x86-64/tlsdesc.dd: Likewise. * ld-x86-64/tlsdesc.pd: Likewise. * ld-x86-64/tlsgd10.dd: Likewise. * ld-x86-64/tlsgd5.dd: Likewise. * ld-x86-64/tlsgd6.dd: Likewise. * ld-x86-64/tlsgd8.dd: Likewise. * ld-x86-64/tlsgdesc.dd: Likewise. * ld-x86-64/tlspic.dd: Likewise. * ld-x86-64/tlspic2.dd: Likewise. 2016-10-11 Nick Clifton <nickc@redhat.com> PR ld/20535 * emultempl/elf32.em (_search_needed): Add support for pseudo environment variables supported by ld.so. Namely $ORIGIN, $LIB and $PLATFORM. * configure.ac: Add getauxval to list AC_CHECK_FUNCS list. * config.in: Regenerate. * configure: Regenerate. 2016-10-11 Alan Modra <amodra@gmail.com> * ldlang.c (lang_do_assignments_1): Descend into output section statements that do not yet have bfd sections. Set symbol section temporarily for symbols defined in such statements to the undefined section. Don't error on data or reloc statements until final phase. * ldexp.c (exp_fold_tree_1 <etree_assign>): Handle bfd_und_section in expld.section. * testsuite/ld-mmix/bpo-10.d: Adjust. * testsuite/ld-mmix/bpo-11.d: Adjust. 2016-10-10 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * emulparams/elf64_s390.sh: Move binary start to 16M. * testsuite/ld-s390/tlsbin_64.dd: Adjust testcases accordingly. * testsuite/ld-s390/tlsbin_64.rd: Likewise. 2016-10-07 Alan Modra <amodra@gmail.com> * ldexp.c (MAX): Define. (exp_unop, exp_binop, exp_trinop): Alloc at least enough for etree_type.value. 2016-10-07 Alan Modra <amodra@gmail.com> * testsuite/lib/ld-lib.exp (is_generic_elf): New, extracted from.. * testsuite/ld-elf/elf.exp: ..here. 2016-10-06 Ludovic Court?s <ludo@gnu.org> * emulparams/elf32bmipn32-defs.sh: Shift quote of "x$EMULATION_NAME" to the left to work around <http://ftp.gnu.org/gnu/bash/bash-4.2-patches/bash42-007>. 2016-10-06 Alan Modra <amodra@gmail.com> * lexsup.c: Spell fall through comments consistently and add missing fall through comments. 2016-10-06 Alan Modra <amodra@gmail.com> * plugin.c (asymbol_from_plugin_symbol): Avoid compiler warning by adding return. 2016-10-04 Alan Modra <amodra@gmail.com> * ld.texinfo (Expression Section): Update result of arithmetic expressions. * ldexp.c (arith_result_section): New function. (fold_binary): Use it. 2016-10-04 Alan Modra <amodra@gmail.com> * ldexp.c (exp_value_fold): New function. (exp_unop, exp_binop, exp_trinop): Use it. 2016-09-30 Alan Modra <amodra@gmail.com> * scripttempl/v850.sc: Don't reference __ctbp, __ep, __gp when not relocating. * scripttempl/v850_rh850.sc: Likewise. 2016-09-30 Alan Modra <amodra@gmail.com> PR ld/20528 * testsuite/ld-elf/pr20528a.d: xfail generic elf targets. Allow multiple .text sections for hppa-linux. * testsuite/ld-elf/pr20528b.d: Likewise. 2016-09-30 Alan Modra <amodra@gmail.com> * ldmain.c (default_bfd_error_handler): New function pointer. (ld_bfd_error_handler): New function. (main): Arrange to call it on bfd errors/warnings. (ld_bfd_assert_handler): Enable tail call. 2016-09-30 Alan Modra <amodra@gmail.com> * ldlang.c (ignore_bfd_errors): Update params. 2016-09-29 H.J. Lu <hongjiu.lu@intel.com> PR ld/20528 * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Don't merge 2 sections with different SHF_EXCLUDE. * testsuite/ld-elf/pr20528a.d: New file. * testsuite/ld-elf/pr20528a.s: Likewise. * testsuite/ld-elf/pr20528b.d: Likewise. * testsuite/ld-elf/pr20528b.s: Likewise. 2016-09-28 Christophe Lyon <christophe.lyon@linaro.org> PR ld/20608 * testsuite/ld-arm/arm-elf.exp: Handle new testcase. * testsuite/ld-arm/farcall-mixed-app2.d: New file. * testsuite/ld-arm/farcall-mixed-app2.r: Likewise. * testsuite/ld-arm/farcall-mixed-app2.s: Likewise. * testsuite/ld-arm/farcall-mixed-app2.sym: Likewise. 2016-09-26 Vlad Zakharov <vzakhar@synopsys.com> * Makefile.in: Regenerate. * configure: Likewise. 2016-09-26 Alan Modra <amodra@gmail.com> * testsuite/ld-powerpc/attr-gnu-4-4.s: Delete. * testsuite/ld-powerpc/attr-gnu-4-14.d: Delete. * testsuite/ld-powerpc/attr-gnu-4-24.d: Delete. * testsuite/ld-powerpc/attr-gnu-4-34.d: Delete. * testsuite/ld-powerpc/attr-gnu-4-41.d: Delete. * testsuite/ld-powerpc/attr-gnu-4-32.d: Adjust expected warning. * testsuite/ld-powerpc/attr-gnu-8-23.d: Likewise. * testsuite/ld-powerpc/attr-gnu-4-01.d: Adjust expected output. * testsuite/ld-powerpc/attr-gnu-4-02.d: Likewise. * testsuite/ld-powerpc/attr-gnu-4-03.d: Likewise. * testsuite/ld-powerpc/attr-gnu-4-10.d: Likewise. * testsuite/ld-powerpc/attr-gnu-4-11.d: Likewise. * testsuite/ld-powerpc/attr-gnu-4-20.d: Likewise. * testsuite/ld-powerpc/attr-gnu-4-22.d: Likewise. * testsuite/ld-powerpc/attr-gnu-4-33.d: Likewise. * testsuite/ld-powerpc/attr-gnu-8-11.d: Likewise. * testsuite/ld-powerpc/powerpc.exp: Don't run deleted tests. 2016-09-23 Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp> PR ld/20595 * testsuite/ld-arm/unwind-4.d: Add -q option to linker command line and -r option to objdump command line. Match emitted relocs to make sure that superflous relocs are not generated. 2016-09-23 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * emulparams/elf64_s390.sh: Change TEXT_START_ADDR to 256MB. * testsuite/ld-s390/tlsbin_64.dd: Adjust testcase accordingly. * testsuite/ld-s390/tlsbin_64.rd: Likewise. 2016-09-22 Nick Clifton <nickc@redhat.com> * emultempl/elf32.em (_try_needed): In verbose mode, report failed attempts to find a needed library. 2016-09-21 Richard Sandiford <richard.sandiford@arm.com> * testsuite/ld-aarch64/emit-relocs-28.d: Expect spaces after "," in addresses. * testsuite/ld-aarch64/emit-relocs-301-be.d: Likewise. * testsuite/ld-aarch64/emit-relocs-301.d: Likewise. * testsuite/ld-aarch64/emit-relocs-302-be.d: Likewise. * testsuite/ld-aarch64/emit-relocs-302.d: Likewise. * testsuite/ld-aarch64/emit-relocs-310-be.d: Likewise. * testsuite/ld-aarch64/emit-relocs-310.d: Likewise. * testsuite/ld-aarch64/emit-relocs-313.d: Likewise. * testsuite/ld-aarch64/emit-relocs-515-be.d: Likewise. * testsuite/ld-aarch64/emit-relocs-515.d: Likewise. * testsuite/ld-aarch64/emit-relocs-516-be.d: Likewise. * testsuite/ld-aarch64/emit-relocs-516.d: Likewise. * testsuite/ld-aarch64/emit-relocs-531.d: Likewise. * testsuite/ld-aarch64/emit-relocs-532.d: Likewise. * testsuite/ld-aarch64/emit-relocs-533.d: Likewise. * testsuite/ld-aarch64/emit-relocs-534.d: Likewise. * testsuite/ld-aarch64/emit-relocs-535.d: Likewise. * testsuite/ld-aarch64/emit-relocs-536.d: Likewise. * testsuite/ld-aarch64/emit-relocs-537.d: Likewise. * testsuite/ld-aarch64/emit-relocs-538.d: Likewise. * testsuite/ld-aarch64/erratum835769.d: Likewise. * testsuite/ld-aarch64/erratum843419.d: Likewise. * testsuite/ld-aarch64/farcall-b-plt.d: Likewise. * testsuite/ld-aarch64/farcall-bl-plt.d: Likewise. * testsuite/ld-aarch64/gc-plt-relocs.d: Likewise. * testsuite/ld-aarch64/ifunc-21.d: Likewise. * testsuite/ld-aarch64/ifunc-7c.d: Likewise. * testsuite/ld-aarch64/tls-desc-ie.d: Likewise. * testsuite/ld-aarch64/tls-large-desc-be.d: Likewise. * testsuite/ld-aarch64/tls-large-desc.d: Likewise. * testsuite/ld-aarch64/tls-large-ie-be.d: Likewise. * testsuite/ld-aarch64/tls-large-ie.d: Likewise. * testsuite/ld-aarch64/tls-relax-all.d: Likewise. * testsuite/ld-aarch64/tls-relax-gd-ie.d: Likewise. * testsuite/ld-aarch64/tls-relax-gdesc-ie-2.d: Likewise. * testsuite/ld-aarch64/tls-relax-gdesc-ie.d: Likewise. * testsuite/ld-aarch64/tls-relax-large-desc-ie-be.d: Likewise. * testsuite/ld-aarch64/tls-relax-large-desc-ie.d: Likewise. * testsuite/ld-aarch64/tls-tiny-desc.d: Likewise. * testsuite/ld-aarch64/tls-tiny-gd.d: Likewise. gas * gas/arm/tls.d: Adjust output to match change in objdump.
2016-10-11Add support to the static linker for the tokens accepted by the dynamic ↵Nick Clifton5-2/+166
linker when resolving search paths. PR ld/20535 * emultempl/elf32.em (_search_needed): Add support for pseudo environment variables supported by ld.so. Namely $ORIGIN, $LIB and $PLATFORM. * configure.ac: Add getauxval to list AC_CHECK_FUNCS list. * config.in: Regenerate. * configure: Regenerate.
2016-10-11Always descend into output section statements in lang_do_assignmentsAlan Modra5-20/+39
See https://sourceware.org/ml/binutils/2016-07/msg00091.html This patch stop --gc-sections elf_gc_sweep_symbol localizing symbols that ought to remain global. The difficulty with always descending into output section statements is that symbols defined by the script in such statements don't have a bfd section when lang_do_assignments runs early in the link process. There are two approaches to curing this problem. Either we can create the bfd section early, or we can use a special section. This patch takes the latter approach and uses bfd_und_section. (Creating bfd sections early results in changed output section order, and thus lots of testsuite failures. You can't create all output sections early to ensure proper ordering as KEEP then stops empty sections from being stripped.) The wrinkle with this approach is that some code that runs at gc-sections time needs to be made aware of the odd defined symbols using bfd_und_section. bfd/ * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Handle symbols defined temporarily with bfd_und_section. * elflink.c (_bfd_elf_gc_keep): Don't set SEC_KEEP for bfd_und_section. * elfxx-mips.c (mips_elf_local_pic_function_p): Exclude defined symbols with bfd_und_section. ld/ * ldlang.c (lang_do_assignments_1): Descend into output section statements that do not yet have bfd sections. Set symbol section temporarily for symbols defined in such statements to the undefined section. Don't error on data or reloc statements until final phase. * ldexp.c (exp_fold_tree_1 <etree_assign>): Handle bfd_und_section in expld.section. * testsuite/ld-mmix/bpo-10.d: Adjust. * testsuite/ld-mmix/bpo-11.d: Adjust.
2016-10-10S/390: Move binary start to 16M.Andreas Krebbel4-5/+10
Turned out that by moving the binary start to 256M I've hit a case with potentially a lot of aliasing in the branch target buffer between binaries and shared libs. So moving on. Tested on s390x. No regressions. ld/ChangeLog: 2016-10-10 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * emulparams/elf64_s390.sh: Move binary start to 16M. * testsuite/ld-s390/tlsbin_64.dd: Adjust testcases accordingly. * testsuite/ld-s390/tlsbin_64.rd: Likewise.
2016-10-07Fold arithmetic integer expressions falloutAlan Modra2-6/+14
* ldexp.c (MAX): Define. (exp_unop, exp_binop, exp_trinop): Alloc at least enough for etree_type.value.
2016-10-07Pass link_info to _bfd_merge_private_bfd_dataAlan Modra1-1/+1
Most BFD linker functions take a bfd_link_info param, which reinforces the fact that they are linker functions and allow access to linker callbacks, eg. einfo for printing errors. I was going to use einfo for --fatal-warnings support before I decided a better way was the patch commit 4519d071. bfd/ * targets.c (bfd_target <_bfd_merge_private_bfd_data>): Replace obfd param with struct bfd_link_info param. Update all callers. * linker.c (bfd_merge_private_bfd_data): Likewise. (_bfd_generic_verify_endian_match): Likewise. * aoutf1.h (sunos_merge_private_bfd_data): Likewise. * coff-arm.c (coff_arm_merge_private_bfd_data): Likewise. * elf-attrs.c (_bfd_elf_merge_object_attributes): Likewise. * elf-bfd.h (_bfd_elf_ppc_merge_fp_attributes): Likewise. (_bfd_elf_merge_object_attributes): Likewise. * elf-m10300.c (_bfd_mn10300_elf_merge_private_bfd_data): Likewise. * elf-s390-common.c (elf_s390_merge_obj_attributes): Likewise. * elf32-arc.c (arc_elf_merge_private_bfd_data): Likewise. * elf32-arm.c (elf32_arm_merge_eabi_attributes): Likewise. (elf32_arm_merge_private_bfd_data): Likewise. * elf32-bfin.c (elf32_bfin_merge_private_bfd_data): Likewise. * elf32-cr16.c (_bfd_cr16_elf_merge_private_bfd_data): Likewise. * elf32-cris.c (cris_elf_merge_private_bfd_data): Likewise. * elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise. * elf32-h8300.c (elf32_h8_merge_private_bfd_data): Likewise. * elf32-i370.c (i370_elf_merge_private_bfd_data): Likewise. * elf32-iq2000.c (iq2000_elf_merge_private_bfd_data): Likewise. * elf32-m32c.c (m32c_elf_merge_private_bfd_data): Likewise. * elf32-m32r.c (m32r_elf_merge_private_bfd_data): Likewise. * elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Likewise. * elf32-m68hc1x.h (_bfd_m68hc11_elf_merge_private_bfd_data): Likewise. * elf32-m68k.c (elf32_m68k_merge_private_bfd_data): Likewise. * elf32-mcore.c (mcore_elf_merge_private_bfd_data): Likewise. * elf32-mep.c (mep_elf_merge_private_bfd_data): Likewise. * elf32-msp430.c (elf32_msp430_merge_mspabi_attributes): Likewise. (elf32_msp430_merge_private_bfd_data): Likewise. * elf32-mt.c (mt_elf_merge_private_bfd_data): Likewise. * elf32-nds32.c (nds32_elf_merge_private_bfd_data): Likewise. * elf32-nios2.c (nios2_elf32_merge_private_bfd_data): Likewise. * elf32-or1k.c (elf32_or1k_merge_private_bfd_data): Likewise. * elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): Likewise. (ppc_elf_merge_obj_attributes): Likewise. (ppc_elf_merge_private_bfd_data): Likewise. * elf32-rl78.c (rl78_elf_merge_private_bfd_data): Likewise. * elf32-rx.c (rx_elf_merge_private_bfd_data): Likewise. * elf32-s390.c (elf32_s390_merge_private_bfd_data): Likewise. * elf32-score.c (s3_elf32_score_merge_private_bfd_data): Likewise. (elf32_score_merge_private_bfd_data): Likewise. * elf32-score.h (s7_elf32_score_merge_private_bfd_data): Likewise. * elf32-score7.c (s7_elf32_score_merge_private_bfd_data): Likewise. * elf32-sh.c (sh_merge_bfd_arch, sh_elf_merge_private_data): Likewise. * elf32-sh64.c (sh64_elf_merge_private_data): Likewise. * elf32-sparc.c (elf32_sparc_merge_private_bfd_data): Likewise. * elf32-tic6x.c (elf32_tic6x_merge_attributes): Likewise. (elf32_tic6x_merge_private_bfd_data): Likewise. * elf32-v850.c (v850_elf_merge_private_bfd_data): Likewise. * elf32-vax.c (elf32_vax_merge_private_bfd_data): Likewise. * elf32-visium.c (visium_elf_merge_private_bfd_data): Likewise. * elf32-xtensa.c (elf_xtensa_merge_private_bfd_data): Likewise. * elf64-ia64-vms.c (elf64_ia64_merge_private_bfd_data): Likewise. * elf64-ppc.c (ppc64_elf_merge_private_bfd_data): Likewise. * elf64-s390.c (elf64_s390_merge_private_bfd_data): Likewise. * elf64-sh64.c (sh_elf64_merge_private_data): Likewise. * elf64-sparc.c (elf64_sparc_merge_private_bfd_data): Likewise. * elfnn-aarch64.c (elfNN_aarch64_merge_private_bfd_data): Likewise. * elfnn-ia64.c (elfNN_ia64_merge_private_bfd_data): Likewise. * elfxx-mips.c (mips_elf_merge_obj_e_flags): Likewise. (mips_elf_merge_obj_attributes): Likewise. (_bfd_mips_elf_merge_private_bfd_data): Likewise. * elfxx-mips.h (_bfd_mips_elf_merge_private_bfd_data): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_merge_private_bfd_data): Likewise. * elfxx-sparc.h (_bfd_sparc_elf_merge_private_bfd_data): Likewise. * elfxx-target.h (bfd_elfNN_bfd_merge_private_bfd_data): Likewise. * elfxx-tilegx.c (_bfd_tilegx_elf_merge_private_bfd_data): Likewise. * elfxx-tilegx.h (_bfd_tilegx_elf_merge_private_bfd_data): Likewise. * libbfd-in.h (_bfd_generic_bfd_merge_private_bfd_data): Likewise. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. ld/ * ldlang.c (lang_check): Update bfd_merge_private_bfd_data call.
2016-10-07Add is_generic_elf to ld/ld-lib.expAlan Modra3-13/+26
* testsuite/lib/ld-lib.exp (is_generic_elf): New, extracted from.. * testsuite/ld-elf/elf.exp: ..here.
2016-10-06Add workaround for bash 4.2 scripting problem.Ludovic Court?s2-1/+8
* emulparams/elf32bmipn32-defs.sh: Shift quote of "x$EMULATION_NAME" to the left to work around <http://ftp.gnu.org/gnu/bash/bash-4.2-patches/bash42-007>.
2016-10-06-Wimplicit-fallthrough warning fixesAlan Modra2-1/+7
Comment changes. bfd/ * coff-h8300.c: Spell fall through comments consistently. * coffgen.c: Likewise. * elf32-hppa.c: Likewise. * elf32-ppc.c: Likewise. * elf32-score.c: Likewise. * elf32-score7.c: Likewise. * elf64-ppc.c: Likewise. * elfxx-aarch64.c: Likewise. * elfxx-mips.c: Likewise. * cpu-ns32k.c: Add missing fall through comments. * elf-m10300.c: Likewise. * elf32-arm.c: Likewise. * elf32-avr.c: Likewise. * elf32-bfin.c: Likewise. * elf32-frv.c: Likewise. * elf32-i386.c: Likewise. * elf32-microblaze.c: Likewise. * elf32-nds32.c: Likewise. * elf32-ppc.c: Likewise. * elf32-rl78.c: Likewise. * elf32-rx.c: Likewise. * elf32-s390.c: Likewise. * elf32-sh.c: Likewise. * elf32-tic6x.c: Likewise. * elf64-ia64-vms.c: Likewise. * elf64-ppc.c: Likewise. * elf64-s390.c: Likewise. * elf64-x86-64.c: Likewise. * elflink.c: Likewise. * elfnn-aarch64.c: Likewise. * elfnn-ia64.c: Likewise. * ieee.c: Likewise. * oasys.c: Likewise. * pdp11.c: Likewise. * srec.c: Likewise. * versados.c: Likewise. opcodes/ * aarch64-opc.c: Spell fall through comments consistently. * i386-dis.c: Likewise. * aarch64-dis.c: Add missing fall through comments. * aarch64-opc.c: Likewise. * arc-dis.c: Likewise. * arm-dis.c: Likewise. * i386-dis.c: Likewise. * m68k-dis.c: Likewise. * mep-asm.c: Likewise. * ns32k-dis.c: Likewise. * sh-dis.c: Likewise. * tic4x-dis.c: Likewise. * tic6x-dis.c: Likewise. * vax-dis.c: Likewise. binutils/ * dlltool.c: Spell fall through comments consistently. * objcopy.c: Likewise. * readelf.c: Likewise. * dwarf.c: Add missing fall through comments. * elfcomm.c: Likewise. * sysinfo.y: Likewise. * readelf.c: Likewise. Also remove extraneous comments. gas/ * app.c: Add missing fall through comments. * dw2gencfi.c: Likewise. * expr.c: Likewise. * config/tc-alpha.c: Likewise. * config/tc-arc.c: Likewise. * config/tc-arm.c: Likewise. * config/tc-cr16.c: Likewise. * config/tc-crx.c: Likewise. * config/tc-dlx.c: Likewise. * config/tc-h8300.c: Likewise. * config/tc-hppa.c: Likewise. * config/tc-i370.c: Likewise. * config/tc-i386.c: Likewise. * config/tc-i960.c: Likewise. * config/tc-ia64.c: Likewise. * config/tc-m68hc11.c: Likewise. * config/tc-m68k.c: Likewise. * config/tc-mep.c: Likewise. * config/tc-metag.c: Likewise. * config/tc-microblaze.c: Likewise. * config/tc-mips.c: Likewise. * config/tc-ns32k.c: Likewise. * config/tc-rx.c: Likewise. * config/tc-score.c: Likewise. * config/tc-score7.c: Likewise. * config/tc-sh.c: Likewise. * config/tc-tic4x.c: Likewise. * config/tc-vax.c: Likewise. * config/tc-xstormy16.c: Likewise. * config/tc-z80.c: Likewise. * config/tc-z8k.c: Likewise. * config/obj-elf.c: Likewise. * config/tc-i386.c: Likewise. * depend.c: Spell fall through comments consistently. * config/tc-arm.c: Likewise. * config/tc-d10v.c: Likewise. * config/tc-i960.c: Likewise. * config/tc-ia64.c: Likewise. * config/tc-m68k.c: Likewise. * config/tc-mcore.c: Likewise. * config/tc-mep.c: Likewise. * config/tc-ns32k.c: Likewise. * config/tc-visium.c: Likewise. * config/tc-xstormy16.c: Likewise. * config/tc-z8k.c: Likewise. gprof/ * gprof.c: Add missing fall through comments. ld/ * lexsup.c: Spell fall through comments consistently and add missing fall through comments.
2016-10-06-Wimplicit-fallthrough error fixesAlan Modra2-0/+7
Well, not all are errors, but a little more substantive than just fiddling with comments. bfd/ * coffcode.h (coff_slurp_symbol_table): Revert accidental commit made 2015-01-08. * elf32-nds32.c (nds32_elf_grok_psinfo): Add missing break. * reloc.c (bfd_default_reloc_type_lookup): Add missing breaks. opcodes/ * arc-ext.c (create_map): Add missing break. * msp430-decode.opc (encode_as): Likewise. * msp430-decode.c: Regenerate. binutils/ * coffdump.c (dump_coff_where): Add missing break. * stabs.c (stab_xcoff_builtin_type): Likewise. gas/ * config/tc-arc.c (find_opcode_match): Add missing break. * config/tc-i960.c (get_cdisp): Likewise. * config/tc-metag.c (parse_swap, md_apply_fix): Likewise. * config/tc-mt.c (md_parse_option): Likewise. * config/tc-nds32.c (nds32_apply_fix): Likewise. * config/tc-hppa.c (pa_ip): Assert rather than testing last condition of multiple if statements. * config/tc-s390.c (s390_exp_compare): Return 0 on error. * config/tc-tic4x.c (tic4x_operand_parse): Add as_bad and break out of case rather than falling into next case. Formatting. ld/ * plugin.c (asymbol_from_plugin_symbol): Avoid compiler warning by adding return.
2016-10-04ld expression sectionAlan Modra3-22/+39
Changes the result of ld expressions that were previously plain numbers to be an absolute address, in the same circumstances where numbers are treated as absolute addresses. * ld.texinfo (Expression Section): Update result of arithmetic expressions. * ldexp.c (arith_result_section): New function. (fold_binary): Use it.
2016-10-04Fold arithmetic integer expressionsAlan Modra2-0/+34
Commit b751e639 regressed arm linux kernel builds, that have an ASSERT (((__hyp_idmap_text_end - (__hyp_idmap_text_start & ~ (((0x1 << 0xc) - 0x1)))) <= (0x1 << 0xc)), HYP init code too big or misaligned) Due to some insanity in ld expression evaluation, the integer values 0x1 and 0xc above are treated as absolute addresses (ie. they have an associated section, *ABS*, see exp_fold_tree_1 case etree_value) while the expression (0x1 << 0xc) has a plain number result. The left hand side of the inequality happens to evaluate to a "negative" .text section relative value. Comparing a section relative value against an absolute value works since the section relative value is first converted to absolute. Comparing a section relative value against a number just compares the offsets, which fails since the "negative" offset is really a very large positive number. This patch works around the problem by folding integer expressions, so the assert again becomes ASSERT (((__hyp_idmap_text_end - (__hyp_idmap_text_start & 0xfffffffffffff000)) <= 0x1000), HYP init code too big or misaligned) * ldexp.c (exp_value_fold): New function. (exp_unop, exp_binop, exp_trinop): Use it.
2016-09-30v850 linker scriptsAlan Modra3-2/+8
This should mean the 2010-10-28 change for ld -r --gc-sections can be reverted. * scripttempl/v850.sc: Don't reference __ctbp, __ep, __gp when not relocating. * scripttempl/v850_rh850.sc: Likewise.
2016-09-30Fix pr20528 testsuiteAlan Modra3-0/+13
PR ld/20528 * testsuite/ld-elf/pr20528a.d: xfail generic elf targets. Allow multiple .text sections for hppa-linux. * testsuite/ld-elf/pr20528b.d: Likewise.
2016-09-30Better ld --fatal-warnings supportAlan Modra2-3/+23
* ldmain.c (default_bfd_error_handler): New function pointer. (ld_bfd_error_handler): New function. (main): Arrange to call it on bfd errors/warnings. (ld_bfd_assert_handler): Enable tail call.
2016-09-30Make bfd_error_handler_type like vprintfAlan Modra2-1/+6
It was like printf, which means you can't use bfd_set_error_handler to hook in a function to do something and then call the original handler. The patch also deletes some unused functions and makes pointers local. bfd/ * bfd-in.h: Include stdarg.h. * bfd.c (bfd_error_handler_type): Make like vprintf. (_bfd_error_internal): Rename from _bfd_error_handler. Make static. (error_handler_internal): New function, split out from.. (_bfd_default_error_handler): ..here. Rename to _bfd_error_handler. (bfd_set_error_handler): Update. (bfd_get_error_handler, bfd_get_assert_handler): Delete. (_bfd_assert_handler): Make static. * coffgen.c (null_error_handler): Update params. * elf-bfd.h (struct elf_backend_data <link_order_error_handler>): Don't use bfd_error_handler_type. * elf64-mmix.c (mmix_dump_bpo_gregs): Likewise. * elfxx-target.h (elf_backend_link_order_error_handler): Default to _bfd_error_handler. * libbfd-in.h (_bfd_default_error_handler): Don't declare. (bfd_assert_handler_type): Likewise. (_bfd_error_handler): Update. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. ld/ * ldlang.c (ignore_bfd_errors): Update params.
2016-09-29Don't merge 2 sections with different SHF_EXCLUDEH.J. Lu6-1/+48
SEC_EXCLUDE is ignored when doing a relocatable link. But we can't merge 2 input sections with the same name when only one of them has SHF_EXCLUDE. PR ld/20528 * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Don't merge 2 sections with different SHF_EXCLUDE. * testsuite/ld-elf/pr20528a.d: New file. * testsuite/ld-elf/pr20528a.s: Likewise. * testsuite/ld-elf/pr20528b.d: Likewise. * testsuite/ld-elf/pr20528b.s: Likewise.
2016-09-28[ARM] PR ld/20608 Relocation truncated to fit: R_ARM_THM_JUMP24 for ↵Christophe Lyon6-0/+215
relocation to PLT entry 2016-09-28 Christophe Lyon <christophe.lyon@linaro.org> PR ld/20608 bfd/ * elf32-arm.c (arm_type_of_stub): Handle the case when the pre-PLT Thumb-ARM stub is too far. ld * testsuite/ld-arm/arm-elf.exp: Handle new testcase. * testsuite/ld-arm/farcall-mixed-app2.d: New file. * testsuite/ld-arm/farcall-mixed-app2.r: Likewise. * testsuite/ld-arm/farcall-mixed-app2.s: Likewise. * testsuite/ld-arm/farcall-mixed-app2.sym: Likewise.
2016-09-26When building target binaries, ensure that the warning flags selected for ↵Vlad Zakharov3-7/+57
the command line match the target compiler. bfd * warning.m4 (AC_EGREP_CPP_FOR_BUILD): Introduce macro to verify CC_FOR_BUILD compiler. (AM_BINUTILS_WARNINGS): Introduce ac_cpp_for_build variable and add CC_FOR_BUILD compiler checks. * Makefile.in: Regenerate. * configure: Likewise. * doc/Makefile.in: Likewise. binutils * Makefile.am: Replace AM_CLFAGS with AM_CFLAGS_FOR_BUILD when building with CC_FOR_BUILD compiler. * Makefile.in: Regenerate. * configure: Likewise. * doc/Makefile.in: Likewise. gas * Makefile.in: Regenerate. * configure: Likewise. * doc/Makefile.in: Likewise. gold * Makefile.in: Regenerate. * configure: Likewise. * testsuite/Makefile.in: Likewise. gprof * Makefile.in: Regenerate. * configure: Likewise. ld * Makefile.in: Regenerate. * configure: Likewise. opcodes * Makefile.in: Regenerate. * configure: Likewise.
2016-09-26PowerPC .gnu.attributesAlan Modra18-40/+31
This patch extends Tag_GNU_Power_ABI_FP to cover long double ABIs, makes the assembler warn about undefined tag values, and removes similar warnings from the linker. I think it is better to not warn in the linker about undefined tag values as future extensions to the tags then won't result in likely bogus warnings. This is consistent with the fact that an older linker won't warn on an entirely new tag. include/ * elf/ppc.h (Tag_GNU_Power_ABI_FP): Comment. bfd/ * elf-bfd.h (_bfd_elf_ppc_merge_fp_attributes): Declare. * elf32-ppc.c (_bfd_elf_ppc_merge_fp_attributes): New function. (ppc_elf_merge_obj_attributes): Use it. Don't copy first file attributes, merge them. Don't warn about undefined tag bits, or copy unknown values to output. * elf64-ppc.c (ppc64_elf_merge_private_bfd_data): Call _bfd_elf_ppc_merge_fp_attributes. binutils/ * readelf.c (display_power_gnu_attribute): Catch truncated section for all powerpc attributes. Display long double ABI. Don't capitalize words, except for names. Show known bits of tag values when some unknown bits are present. Whitespace fixes. gas/ * config/tc-ppc.c (ppc_elf_gnu_attribute): New function. (md_pseudo_table <ELF>): Handle "gnu_attribute". ld/ * testsuite/ld-powerpc/attr-gnu-4-4.s: Delete. * testsuite/ld-powerpc/attr-gnu-4-14.d: Delete. * testsuite/ld-powerpc/attr-gnu-4-24.d: Delete. * testsuite/ld-powerpc/attr-gnu-4-34.d: Delete. * testsuite/ld-powerpc/attr-gnu-4-41.d: Delete. * testsuite/ld-powerpc/attr-gnu-4-32.d: Adjust expected warning. * testsuite/ld-powerpc/attr-gnu-8-23.d: Likewise. * testsuite/ld-powerpc/attr-gnu-4-01.d: Adjust expected output. * testsuite/ld-powerpc/attr-gnu-4-02.d: Likewise. * testsuite/ld-powerpc/attr-gnu-4-03.d: Likewise. * testsuite/ld-powerpc/attr-gnu-4-10.d: Likewise. * testsuite/ld-powerpc/attr-gnu-4-11.d: Likewise. * testsuite/ld-powerpc/attr-gnu-4-20.d: Likewise. * testsuite/ld-powerpc/attr-gnu-4-22.d: Likewise. * testsuite/ld-powerpc/attr-gnu-4-33.d: Likewise. * testsuite/ld-powerpc/attr-gnu-8-11.d: Likewise. * testsuite/ld-powerpc/powerpc.exp: Don't run deleted tests.
2016-09-23Delete relocations associatesd with deleted exidx entries.Akihiko Odaki2-2/+23
PR ld/20595 ld * testsuite/ld-arm/unwind-4.d: Add -q option to linker command line and -r option to objdump command line. Match emitted relocs to make sure that superflous relocs are not generated. bfd * elf-bfd.h (struct elf_backend_data): Add elf_backend_count_output_relocs callback to count relocations in the final output. * elf-arm.c (elf32_arm_add_relocation): Deleted. (elf32_arm_write_section): Move additional relocation to emit_relocs. (elf32_arm_count_output_relocs): New function. (emit_relocs): New function. (elf32_arm_emit_relocs): New function. (elf32_arm_vxworks_emit_relocs): New function. (elf_backend_emit_relocs): Updated to use the new functions. (elf_backend_count_output_relocs): New define. * bfd/elflink.c (bfd_elf_final_link): Do not add additional_reloc_count to the relocation count. (_bfd_elf_link_size_reloc_section): Use callback to count the relocations which will be in output. (_bfd_elf_default_count_output_relocs): New function. * bfd/elfxx-target.h (elf_backend_count_output_relocs): New define.
2016-09-23S/390: Move start of 64 bit binaries from 2GB to 256MB.Andreas Krebbel4-4/+11
ld/ChangeLog: 2016-09-23 Andreas Krebbel <krebbel@linux.vnet.ibm.com> * emulparams/elf64_s390.sh: Change TEXT_START_ADDR to 256MB. * testsuite/ld-s390/tlsbin_64.dd: Adjust testcase accordingly. * testsuite/ld-s390/tlsbin_64.rd: Likewise.
2016-09-22Report failed attempts to locate DT_NEEDED files when --verbose is in effect.Nick Clifton2-1/+10
* emultempl/elf32.em (_try_needed): In verbose mode, report failed attempts to find a needed library.
2016-09-21[AArch64] Print spaces after commas in addressesRichard Sandiford41-92/+136
I got an off-list request to make the AArch64 disassembler print spaces after commas in addresses. This patch does that. The same code is used to print operands in "did you mean" errors, so to keep things consistent, the patch also prints spaces between operands in those messages. opcodes/ * aarch64-opc.c (print_immediate_offset_address): Print spaces after commas in addresses. (aarch64_print_operand): Likewise. gas/ * config/tc-aarch64.c (print_operands): Print spaces between operands. * testsuite/gas/aarch64/ilp32-basic.d: Expect spaces after "," in addresses. * testsuite/gas/aarch64/ldst-reg-imm-post-ind.d: Likewise. * testsuite/gas/aarch64/ldst-reg-imm-pre-ind.d: Likewise. * testsuite/gas/aarch64/ldst-reg-pair.d: Likewise. * testsuite/gas/aarch64/ldst-reg-reg-offset.d: Likewise. * testsuite/gas/aarch64/ldst-reg-uns-imm.d: Likewise. * testsuite/gas/aarch64/ldst-reg-unscaled-imm.d: Likewise. * testsuite/gas/aarch64/reloc-insn.d: Likewise. * testsuite/gas/aarch64/sve.d: Likewise. * testsuite/gas/aarch64/symbol.d: Likewise. * testsuite/gas/aarch64/system.d: Likewise. * testsuite/gas/aarch64/tls-desc.d: Likewise. * testsuite/gas/aarch64/sve-invalid.l: Expect spaces after "," in suggested alternatives. * testsuite/gas/aarch64/verbose-error.l: Likewise. ld/ * testsuite/ld-aarch64/emit-relocs-28.d: Expect spaces after "," in addresses. * testsuite/ld-aarch64/emit-relocs-301-be.d: Likewise. * testsuite/ld-aarch64/emit-relocs-301.d: Likewise. * testsuite/ld-aarch64/emit-relocs-302-be.d: Likewise. * testsuite/ld-aarch64/emit-relocs-302.d: Likewise. * testsuite/ld-aarch64/emit-relocs-310-be.d: Likewise. * testsuite/ld-aarch64/emit-relocs-310.d: Likewise. * testsuite/ld-aarch64/emit-relocs-313.d: Likewise. * testsuite/ld-aarch64/emit-relocs-515-be.d: Likewise. * testsuite/ld-aarch64/emit-relocs-515.d: Likewise. * testsuite/ld-aarch64/emit-relocs-516-be.d: Likewise. * testsuite/ld-aarch64/emit-relocs-516.d: Likewise. * testsuite/ld-aarch64/emit-relocs-531.d: Likewise. * testsuite/ld-aarch64/emit-relocs-532.d: Likewise. * testsuite/ld-aarch64/emit-relocs-533.d: Likewise. * testsuite/ld-aarch64/emit-relocs-534.d: Likewise. * testsuite/ld-aarch64/emit-relocs-535.d: Likewise. * testsuite/ld-aarch64/emit-relocs-536.d: Likewise. * testsuite/ld-aarch64/emit-relocs-537.d: Likewise. * testsuite/ld-aarch64/emit-relocs-538.d: Likewise. * testsuite/ld-aarch64/erratum835769.d: Likewise. * testsuite/ld-aarch64/erratum843419.d: Likewise. * testsuite/ld-aarch64/farcall-b-plt.d: Likewise. * testsuite/ld-aarch64/farcall-bl-plt.d: Likewise. * testsuite/ld-aarch64/gc-plt-relocs.d: Likewise. * testsuite/ld-aarch64/ifunc-21.d: Likewise. * testsuite/ld-aarch64/ifunc-7c.d: Likewise. * testsuite/ld-aarch64/tls-desc-ie.d: Likewise. * testsuite/ld-aarch64/tls-large-desc-be.d: Likewise. * testsuite/ld-aarch64/tls-large-desc.d: Likewise. * testsuite/ld-aarch64/tls-large-ie-be.d: Likewise. * testsuite/ld-aarch64/tls-large-ie.d: Likewise. * testsuite/ld-aarch64/tls-relax-all.d: Likewise. * testsuite/ld-aarch64/tls-relax-gd-ie.d: Likewise. * testsuite/ld-aarch64/tls-relax-gdesc-ie-2.d: Likewise. * testsuite/ld-aarch64/tls-relax-gdesc-ie.d: Likewise. * testsuite/ld-aarch64/tls-relax-large-desc-ie-be.d: Likewise. * testsuite/ld-aarch64/tls-relax-large-desc-ie.d: Likewise. * testsuite/ld-aarch64/tls-tiny-desc.d: Likewise. * testsuite/ld-aarch64/tls-tiny-gd.d: Likewise.
2016-09-21[AArch64] Add SVE condition codesRichard Sandiford3-8/+13
SVE defines new names for existing NZCV conditions, to reflect the result of instructions like PTEST. This patch adds support for these names. The patch also adds comments to the disassembly output to show the alternative names of a condition code. For example: cinv x0, x1, cc becomes: cinv x0, x1, cc // cc = lo, ul, last and: b.cc f0 <...> becomes: b.cc f0 <...> // b.lo, b.ul, b.last Doing this for the SVE names follows the practice recommended by the SVE specification and is definitely useful when reading SVE code. If the feeling is that it's too distracting elsewhere, we could add an option to turn it off. include/ * opcode/aarch64.h (aarch64_cond): Bump array size to 4. opcodes/ * aarch64-dis.c (remove_dot_suffix): New function, split out from... (print_mnemonic_name): ...here. (print_comment): New function. (print_aarch64_insn): Call it. * aarch64-opc.c (aarch64_conds): Add SVE names. (aarch64_print_operand): Print alternative condition names in a comment. gas/ * config/tc-aarch64.c (opcode_lookup): Search for the end of a condition name, rather than assuming that it will have exactly 2 characters. (parse_operands): Likewise. * testsuite/gas/aarch64/alias.d: Add new condition-code comments to the expected output. * testsuite/gas/aarch64/beq_1.d: Likewise. * testsuite/gas/aarch64/float-fp16.d: Likewise. * testsuite/gas/aarch64/int-insns.d: Likewise. * testsuite/gas/aarch64/no-aliases.d: Likewise. * testsuite/gas/aarch64/programmer-friendly.d: Likewise. * testsuite/gas/aarch64/reloc-insn.d: Likewise. * testsuite/gas/aarch64/b_c_1.d, testsuite/gas/aarch64/b_c_1.s: New test. ld/ * testsuite/ld-aarch64/emit-relocs-280.d: Match branch comments. * testsuite/ld-aarch64/weak-undefined.d: Likewise.
2016-09-20ld: Fix mistake in ChangeLogAndrew Burgess1-1/+1
The previous commit contained a small mistake in the ChangeLog, fixed in this commit.
2016-09-20ld: Extend documentation for EXCLUDE_FILEAndrew Burgess2-0/+20
There was a gap in the documentation of EXCLUDE_FILE that could cause confusion to a user. When writing an input section specifier like this: *(EXCLUDE_FILE (somefile.o) .text .text.*) this could mean one of the following: 1. All '.text' and '.text.*' from all files except for 'somefile.o', or 2. All '.text' from all files except 'somefile.o', and all '.text.*' sections from all files. It turns out that the second interpretation is correct, but the manual does not make this clear (to me at least). Hopefully this patch makes things clearer. ld/ChangeLog: * ld/ld.texinfo (Input Section Basics): Expand the description of EXCLUDE_FILE.
2016-09-14Fix ld --gc-section segfault with ARMv8-M entry function in absolute sectionThomas Preud'homme3-0/+18
bfd/ 2016-09-14 Thomas Preud'homme <thomas.preudhomme@arm.com> * elf32-arm.c (elf32_arm_gc_mark_extra_sections): Only mark section not already marked. ld/ 2016-09-14 Thomas Preud'homme <thomas.preudhomme@arm.com> * testsuite/ld-arm/cmse-veneers.s: Add a test for ARMv8-M Security Extensions entry functions in absolute section. * testsuite/ld-arm/cmse-veneers.rd: Adapt expected output accordingly.
2016-09-14[ARC] Fix parsing dtpoff relocation expression.Claudiu Zissulescu6-0/+60
The assembler accepts dtpoff complex relocation expression like identifier@dtpoff + const. However, it doesn't accept an expression such as identifier@dtpoff@base + const. This patch solves this issue, and adds a number of tests. ld/ 2016-09-14 Claudiu Zissulescu <claziss@synopsys.com> * testsuite/ld-arc/tls-dtpoff.dd: New file. * testsuite/ld-arc/tls-dtpoff.rd: Likewise. * testsuite/ld-arc/tls-dtpoff.s: Likewise. * testsuite/ld-arc/tls-relocs.ld: Likewise. * testsuite/ld-arc/arc.exp: Add new tdpoff test. gas/ 2016-09-14 Claudiu Zissulescu <claziss@synopsys.com> * testsuite/gas/arc/tls-relocs2.d: New file. * testsuite/gas/arc/tls-relocs2.s: Likewise. * config/tc-arc.c (tokenize_arguments): Accept offsets when base is used.
2016-09-14Add support for disabling automatic generation of .eh_frame_hdr sections in ↵Nick Clifton5-11/+38
ELF based linkers. PR ld/20537 * emultempl/elf32.em: More OPTION_xxx values into an enum. Add OPTION_NO_EH_FRAME_HDR. (_add_options): Add support for --no-eh-frame-hdr. * ld.texinfo: Document new option. * lexsup.c (elf_shlib_list_options): List new option. * NEWS: Mention the new option.
2016-09-06Resolve size relocation with copy relocationH.J. Lu4-0/+30
We can resolve size relocation against symbol which needs copy relocation when building executable. bfd/ PR ld/20550 * elf64-x86-64.c (elf_x86_64_relocate_section): Resolve size relocation with copy relocation when building executable. ld/ PR ld/20550 * testsuite/ld-x86-64/pr20550a.s: New file. * testsuite/ld-x86-64/pr20550b.s: Likewise. * testsuite/ld-x86-64/x86-64.exp (x86_64tests): Add tests for PR ld/20550.
2016-09-06Do not pass host compiler sanitization flags on to linker testsuite.Nick Clifton3-4/+21
* Makefile.am (CFLAGS_FOR_TARGET): Define as a copy of CFLAGS but without any sanitization options. (CXXFLAGS_FOR_TARGET): Define as a copy of CXXFLAGS but without any sanitization options. (check-DEJAGNU): Pass CFLAGS_FOR_TARGET and CXXFLAGS_FOR_TARGET as CFLAGS and CXXFLAGS respectively.
2016-09-06Fix PR ld/20545 - relaxation bugs in avr backendSenthil Kumar Selvaraj5-0/+51
Prior to the patch, addends for relocs were being adjusted even if they went beyond an alignment boundary. This is wrong - to preserve alignment constraints, the relaxation logic adds as many padding bytes at the alignment boundary as was deleted, so addends beyond the boundary should not be adjusted. avr-prop-7.s reproduces this scenario. Also, prior to this patch, the relaxation logic assumed that the addr parameter pointed to the middle of the instruction to be deleted, and that addr - count would therefore be the shrinked instruction's address. This is true when actually shrinking instructions. The alignment constraints handling logic also invokes the same logic though, with addr as the starting offset of padding bytes and with count as the number of bytes to be deleted. Calculating the shrinked insn's address as addr - count is obviously wrong in this case - that offset would point to count bytes before the last non-padded byte. avr-prop-8.s reproduces this scenario. To fix scenario 1, the patch adds an additional check to ensure reloc addends aren't adjusted if they cross a shrink boundary. The shrink boundary is either the section size or an alignment boundary. Addends pointing at an alignment boundary don't need to be adjusted, as padding would occur and keep the boundary the same. Addends pointing at section size need to be adjusted though, as no padding occurs and the section size itself would get decremented. The patch records whether padding occured (did_pad) and uses that to detect and handle this condition. To fix scenario 2, the patch adds an additional parameter (delete_shrinks_insn) to elf32_avr_relax_delete_bytes to distinguish instruction bytes deletion from padding bytes deletion. It then uses that to correctly set shrinked_insn_address. bfd/ChangeLog: 2016-09-02 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com> PR ld/20545 * elf32-avr.c (elf32_avr_relax_delete_bytes): Add parameter delete_shrinks_insn. Modify computation of shrinked_insn_address. Compute shrink_boundary and adjust addend only if addend_within_shrink_boundary. (elf32_avr_relax_section): Modify calls to elf32_avr_relax_delete_bytes to pass extra parameter. ld/ChangeLog: 2016-09-02 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com> PR ld/20545 * testsuite/ld-avr/avr-prop-7.d: New test. * testsuite/ld-avr/avr-prop-7.s: New test. * testsuite/ld-avr/avr-prop-8.d: New test. * testsuite/ld-avr/avr-prop-8.s: New test.
2016-09-02Limit pr20513c/pr20513d to Linux and GNU targetsH.J. Lu3-0/+8
* testsuite/ld-elf/pr20513c.d: Limit to *-*-linux* and *-*-gnu* targets. * testsuite/ld-elf/pr20513d.d: Likewise.
2016-09-01Add tests for PR ld/20513H.J. Lu9-0/+84
PR ld/20513 * testsuite/ld-elf/pr20513a.d: New file. * testsuite/ld-elf/pr20513a.s: Likewise. * testsuite/ld-elf/pr20513b.d: Likewise. * testsuite/ld-elf/pr20513b.s: Likewise. * testsuite/ld-elf/pr20513c.d: Likewise. * testsuite/ld-elf/pr20513d.d: Likewise. * testsuite/ld-elf/pr20513e.d: Likewise. * testsuite/ld-elf/pr20513f.d: Likewise.
2016-08-31Ignore symbols defined in SHF_EXCLUDE sectionsAlan Modra2-0/+11
PR 20513 * ldlang.c (section_already_linked): Deal with SHF_EXCLUDE sections.
2016-08-31Adjust VLE testsuiteAlan Modra6-107/+105
To suit f7d69005. * testsuite/ld-powerpc/vle-multiseg-1.d: Adjust to suit segment change. * testsuite/ld-powerpc/vle-multiseg-2.d: Likewise. * testsuite/ld-powerpc/vle-multiseg-3.d: Likewise. * testsuite/ld-powerpc/vle-multiseg-6.d: Likewise. * testsuite/ld-powerpc/vle-reloc-2.d: Likewise.