aboutsummaryrefslogtreecommitdiff
path: root/ld
AgeCommit message (Collapse)AuthorFilesLines
2017-08-06Treat common symbol as undefined for --no-define-commonH.J. Lu12-6/+63
When --no-define-common is used to build shared library, treat common symbol as undefined so that common symbols that are referenced from a shared library to be assigned addresses only in the main program. This eliminates the unused duplicate space in the shared library, and also prevents any possible confusion over resolving to the wrong duplicate when there are many dynamic modules with specialized search paths for runtime symbol resolution. --no-define-common is only allowed when building a shared library. bfd/ PR ld/21903: * elflink.c (elf_link_add_object_symbols): Treat common symbol as undefined for --no-define-common. include/ PR ld/21903: * bfdlink.h (bfd_link_info): Add inhibit_common_definition. ld/ PR ld/21903: * ld.h (command_line): Remove inhibit_common_definition. * ldgram.y: Replace command_line.inhibit_common_definition with link_info.inhibit_common_definition. * ldlang.c (lang_common): Likewise. * lexsup.c (parse_args): Likewise. * ldmain.c (main): Only allow --no-define-common with -shared. * testsuite/ld-elf/pr21903.s: New file. * testsuite/ld-elf/pr21903a.d: Likewise. * testsuite/ld-elf/pr21903b.d: Likewise. * testsuite/ld-elf/pr21903c.d: Likewise. * testsuite/ld-elf/pr21903d.d: Likewise. * testsuite/ld-elf/pr21903e.d: Likewise.
2017-08-05Don't fail in elf32_hppa_set_gpAlan Modra2-1/+5
The base bfd_link_hash_table works fine here, the only thing to watch out for is to only set elf_gp if the output is ELF. bfd/ * elf32-hppa.c (elf32_hppa_set_gp): Don't require an hppa_link_hash_table. ld/ * testsuite/ld-unique/pr21529.d: Don't xfail hppa.
2017-08-04Add a testcase for "ld -d"H.J. Lu3-0/+17
"ld -d" assigns space to common symbols even if a relocatable output file is specified (with '-r'). PR ld/21904 * testsuite/ld-elf/pr21904.d: New file. * testsuite/ld-elf/pr21904.s: Likewise.
2017-08-03Add more targets to the list of architectures not supporting format changing ↵Nick Clifton5-19/+67
during linking. Fix seg-faults triggered when this is attempted. PR ld/21884 * testsuite/ld-elf/pr21884.d: Add AVR, HPPA, IA64, M68HC1x and SCORE to list of targets not supporting file format changes during linking. * testsuite/ld-unique/pr21529.d: Likewise. * emultempl/avrelf.em (_before_allocation): Skip for non-ELF output formats. (avr_elf_create_output_section_statements): Fail if the output format is not ELF. (avr_finish): Do not access the ELF header in non-ELF format output bfds. * emultempl/m68hc1xelf.em (_before_allocation): Skip for non-ELF output formats. (m68hc11elf_create_output_section_statements): Fail if the putput format is not ELF. (m68hc11elf_after_allocation): Skip for non-ELF output formats.
2017-08-03ELF checks for orphan placementAlan Modra2-29/+55
The loop checking for previous orphan placement should run even when the output is non-ELF. PR ld/21884 * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Revert last change. Rename iself to elfinput. Expand comments. Condition ELF checks on having both input and output ELF files. Extract.. (elf_orphan_compatible): ..this new function.
2017-08-02Check ELF section header only for ELF outputH.J. Lu6-1/+40
When placing an orphan input section, check ELF section header only for ELF output. PR ld/21884 * emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Check ELF section header only for ELF output. * testsuite/ld-elf/pr21884.d: New test. * testsuite/ld-elf/pr21884.t: Likewise. * testsuite/ld-elf/pr21884a.s: Likewise. * testsuite/ld-elf/pr21884b.s: Likewise.
2017-08-02Revert the last change to emultempl/elf32.emH.J. Lu2-2/+4
It will be replaced by a different fix. * emultempl/elf32.em (_place_orphan): Revert the last change.
2017-08-02Fix assertion failure for xtensa linker.Max Filippov2-1/+6
* emultempl/xtensaelf.em (xtensa_wild_group_interleave_callback): Only check for by_name sorting.
2017-08-02Fix seg-fault when trying to place non-ELF orphan sections.Nick Clifton2-0/+8
PR 21884 * emultempl/elf32.em (_place_orphan): Skip non-ELF binaries when looking for sections to merge.
2017-07-31PR 21847, PowerPC64 --plt-localentry againAlan Modra2-2/+9
This makes ld warn about --plt-localentry if a version of glibc without the necessary ld.so checks is detected, and revises the documentation. bfd/ * elf64-ppc.c (ppc64_elf_tls_setup): Warn on --plt-localentry without ld.so checks. gold/ * powerpc.cc (Target_powerpc::scan_relocs): Warn on --plt-localentry without ld.so checks. ld/ * ld.texinfo (plt-localentry): Revise.
2017-07-29PR 21847, Don't default PowerPC64 to --plt-localentryAlan Modra2-0/+19
The big comment in ppc64_elf_tls_setup says why. I've also added some code to the bfd linker that catches the -lpthread -lc symbol differences and disable generation of optimized call stubs even when --plt-localentry is activated. Gold doesn't yet have that. PR 21847 bfd/ * elf64-ppc.c (struct ppc_link_hash_entry): Add non_zero_localentry. (ppc64_elf_merge_symbol): Set non_zero_localentry. (is_elfv2_localentry0): Test non_zero_localentry. (ppc64_elf_tls_setup): Default to --no-plt-localentry. gold/ * powerpc.cc (Target_powerpc::scan_relocs): Default to --no-plt-localentry. ld/ * ld.texinfo (plt-localentry): Document.
2017-07-28Make some improvements to how SORT_* specifiers and EXCLUDE_FILE specifiers ↵Andrew Burgess20-60/+244
are handled in the linker script grammar. * ldgram.y (ldgram_had_keep): Make static. (ldgram_vers_current_lang): Likewise. (filename_spec): New rule. (input_section_spec_no_keep): Use filename_spec. (wildcard_maybe_exclude): New rule. (wildcard_spec): Rename to... (section_name_spec): ...this. (section_NAME_list): Rename to... (section_name_list): ...this. (section_name_spec): Simplifiy and use wildcard_maybe_exclude. * ldlang.c (placed_commons): Delete. (lang_add_wild): No longer set placed_commons. (print_wild_statement): Use full names for SORT specifiers. * testsuite/ld-scripts/align.exp: Run new tests. * testsuite/ld-scripts/align3.d: New file. * testsuite/ld-scripts/align3.t: New file. * testsuite/ld-scripts/align4.d: New file. * testsuite/ld-scripts/align4.t: New file. * testsuite/ld-scripts/align5.d: New file. * testsuite/ld-scripts/align5.t: New file. * testsuite/ld-scripts/exclude-file-5.d: New file. * testsuite/ld-scripts/exclude-file-5.map: New file. * testsuite/ld-scripts/exclude-file-5.t: New file. * testsuite/ld-scripts/exclude-file-6.d: New file. * testsuite/ld-scripts/exclude-file-6.map: New file. * testsuite/ld-scripts/exclude-file-6.t: New file. * NEWS: Mention the changes.
2017-07-27Move AVR .promemx.* sections into higher memory.Georg-Johann Lay2-1/+9
PR ld/21849 * scripttempl/avr.sc: Split .progmemx.* from .progmem.* and locate former at a higher address.
2017-07-25__tls_get_addr_opt stub eh_frame infoAlan Modra5-3/+44
Since the __tls_get_addr_opt stub saves LR and makes a call, eh_frame info should be generated to describe how to unwind through the stub. The patch also changes the way the backend iterates over stubs, from looking at all sections in stub_bfd to which all dynamic sections are attached as well, to iterating over the group list, which gets just the stub sections. Most binaries will have just one or two stub groups, so this is a little faster. bfd/ * elf64-ppc.c (struct map_stub): Add tls_get_addr_opt_bctrl. (stub_eh_frame_size): New function. (ppc_size_one_stub): Set group tls_get_addr_opt_bctrl. (group_sections): Init group tls_get_addr_opt_bctrl. (ppc64_elf_size_stubs): Update sizing and initialization of .eh_frame. Iteration over stubs via group list. (ppc64_elf_build_stubs): Iterate over stubs via group list. (ppc64_elf_finish_dynamic_sections): Update finalization of .eh_frame. ld/ * testsuite/ld-powerpc/tlsopt5.s: Add cfi. * testsuite/ld-powerpc/tlsopt5.d: Update. * testsuite/ld-powerpc/tlsopt5.wf: New file. * testsuite/ld-powerpc/powerpc.exp: Perform new tlsopt5 test.
2017-07-24[ARC] Fix big-endian ld tests errors.claziss4-5/+13
A set of small patches that are fixing big-endian observed errors. ld/ 2017-07-24 Claudiu Zissulescu <claziss@synopsys.com> * testsuite/ld-arc/jli-overflow.d: Force testing for little endian. * testsuite/ld-arc/tls_gd-01.d: Fix string to match bigendian systems. * testsuite/ld-arc/tls_ie-01.d: Fix test for bigendian systems.
2017-07-21This patch introduces support for specifing views in .loc directives, so ↵Alexandre Oliva1-30/+29
that the compiler can use the assembler to generate line number information and have the assembler determine view numbers to multiple views at the same program counter. binutils* dwarf.c (struct State_Machine_Registers): Add view field. (reset_state_machine): Reset view. (process_extended_line_op): Reset view when appropriate. (display_debug_lines_raw): Increment or reset view when appropriate. Print nonzero views. Support print view resets, disabled by default. (display_debug_lines_decoded): Likewise. Disambiguate op_code tests, enabling printing of end_sequence. * testsuite/binutils-all/dw2-1.W: Add nonzero views. * testsuite/binutils-all/dw2-3.W: Likewise. * testsuite/binutils-all/dw2-3gabi.W: Likewise. * testsuite/binutils-all/dw5.W: Add end sequence lines. * testsuite/binutils-all/i386/compressed-1a.d: Add nonzero views. * testsuite/binutils-all/libdw2-compressedgabi.out: Likewise. * testsuite/binutils-all/objdump.W: Likewise. * testsuite/binutils-all/objdump.WL: Add end sequence lines. * testsuite/binutils-all/x86-64/compressed-1a.d: Add nonzero views. gas * doc/as.texinfo (.loc): Document view support. * dwarf2dbg.c (unused): Check offset of next in struct line_entry. (current): Initialize view. (force_reset_view, view_assert_failed): New variables. (reverse_line_entry_list): New function. (set_or_check_view): Likewise. (dwarf2_gen_line_info_1): Call it. (dwarf2_where): Set view to NULL. (dwarf2_emit_insn): Return early when called before first file. (dwarf2_directive_loc): Add view support. Emit insn immediately when view option is given. (process_entries): Avoid set_address to reset view when a known address change already implies the view reset. (dwarf2dbg_final_check): New function. * dwarf2dbg.h (struct dwarf2_line_info): Add view. (dwarf2dbg_final_check): Declare. * read.c (s_leb128): Parse expression as deferred. * testsuite/gas/all/gas.exp: Run sleb128-9. * testsuite/gas/all/sleb128-9.d: New. * testsuite/gas/all/sleb128-9.l: New. * testsuite/gas/all/sleb128-9.s: New. * testsuite/gas/elf/dwarf2-1.d: Add nonzero views. * testsuite/gas/elf/dwarf2-2.d: Likewise. * testsuite/gas/elf/dwarf2-5.d: New. * testsuite/gas/elf/dwarf2-5.s: New. * testsuite/gas/elf/dwarf2-6.d: New. * testsuite/gas/elf/dwarf2-6.s: New. * testsuite/gas/elf/dwarf2-7.d: New. * testsuite/gas/elf/dwarf2-7.s: New. * testsuite/gas/elf/dwarf2-8.d: New. * testsuite/gas/elf/dwarf2-8.l: New. * testsuite/gas/elf/dwarf2-8.s: New. * testsuite/gas/elf/dwarf2-9.d: New. * testsuite/gas/elf/dwarf2-9.l: New. * testsuite/gas/elf/dwarf2-9.s: New. * testsuite/gas/elf/dwarf2-10.d: New. * testsuite/gas/elf/dwarf2-10.l: New. * testsuite/gas/elf/dwarf2-10.s: New. * testsuite/gas/elf/dwarf2-11.d: New. * testsuite/gas/elf/dwarf2-11.s: New. * testsuite/gas/elf/dwarf2-12.d: New. * testsuite/gas/elf/dwarf2-12.s: New. * testsuite/gas/elf/dwarf2-13.d: New. * testsuite/gas/elf/dwarf2-13.s: New. * testsuite/gas/elf/dwarf2-14.d: New. * testsuite/gas/elf/dwarf2-14.s: New. * testsuite/gas/elf/dwarf2-15.d: New. * testsuite/gas/elf/dwarf2-15.s: New. * testsuite/gas/elf/dwarf2-16.d: New. * testsuite/gas/elf/dwarf2-16.s: New. * testsuite/gas/elf/dwarf2-17.d: New. * testsuite/gas/elf/dwarf2-17.s: New. * testsuite/gas/elf/dwarf2-18.d: New. * testsuite/gas/elf/dwarf2-18.s: New. * testsuite/gas/elf/elf.exp: Run dwarf2-5..18 tests. * testsuite/gas/i386/dw2-compress-1.d: Add nonzero views. * testsuite/gas/i386/dw2-compressed-1.d: Likewise. * testsuite/gas/i386/ilp32/lns/lns-duplicate.d: Likewise. * testsuite/gas/lns/lns-big-delta.d: Likewise. * testsuite/gas/lns/lns-duplicate.d: Likewise. * testsuite/gas/mips/loc-swap-2.d: Likewise. * testsuite/gas/mips/loc-swap-3.d: Likewise. * testsuite/gas/mips/loc-swap.d: Likewise. * testsuite/gas/mips/micromips@loc-swap-2.d: Likewise. * testsuite/gas/mips/micromips@loc-swap.d: Likewise. * testsuite/gas/mips/mips16@loc-swap-2.d: Likewise. * testsuite/gas/mips/mips16@loc-swap.d: Likewise. * testsuite/gas/mips/mips16e@loc-swap.d: Likewise. * write.c (write_object_file): Check pending view asserts. (cvt_frag_to_fill): Complain about undefined leb128 operand.
2017-07-20PR ld/16656: Add missing annotation to the relevant ChangeLog entriesMaciej W. Rozycki1-0/+2
Add PR ld/16656 annotation to ChangeLog entries for commit 9a0f1d5099fa ("LD/testsuite: Conditionalize the placement of `.dynamic' in GNU_RELRO") and commit ("LD/testsuite: Conditionalize the placement of `.got' in GNU_RELRO").
2017-07-19LD/testsuite: Add 2**4 section alignment FILL script statement testMaciej W. Rozycki7-8/+97
Complement commit ffe54b3798db ("Pad sections according to current script FILL.") and add a FILL script statement test for targets that impose the minimum alignment of more than 2**2 for the `.text' section. These targets include IA-64 targets, MIPS targets other than bare-metal ELF and VxWorks, TILE-Gx targets, TILEPro targets and X86-64 PE targets. Use the `notarget' tag for configuration triplets that are incompatible with the new test, but are supported by the existing FILL test, and `xfail' for ones that have issues due to section alignment or padding with both tests. Make a complementary change to the existing FILL test, removing the following test issues: arm-epoc-pe -FAIL: ld-scripts/fill mips-elf -XPASS: ld-scripts/fill mips-img-elf -XPASS: ld-scripts/fill mips-mti-elf -XPASS: ld-scripts/fill mips-sde-elf -XPASS: ld-scripts/fill mips-vxworks -XPASS: ld-scripts/fill mipsel-elf -XPASS: ld-scripts/fill mipsel-img-elf -XPASS: ld-scripts/fill mipsel-mti-elf -XPASS: ld-scripts/fill mipsel-vxworks -XPASS: ld-scripts/fill mipsisa32-elf -XPASS: ld-scripts/fill mipsisa32el-elf -XPASS: ld-scripts/fill mipsisa64-elf -XPASS: ld-scripts/fill mipsisa64el-elf -XPASS: ld-scripts/fill tilegx-linux -FAIL: ld-scripts/fill tilepro-elf -FAIL: ld-scripts/fill tx39-elf -XPASS: ld-scripts/fill ld/ * testsuite/ld-scripts/fill.d: Adjust `xfail' entries. Add `notarget' entries. Update comments. * testsuite/ld-scripts/fill16.d: New test. * testsuite/ld-scripts/fill16_0.s: New test source. * testsuite/ld-scripts/fill16_1.s: New test source. * testsuite/ld-scripts/fill16_2.s: New test source. * testsuite/ld-scripts/data.exp: Run the new test.
2017-07-19[ARC] Add JLI support.John Eric Martin14-2/+1173
The following relocation types were added to GCC/binutils: ARC_JLI_SECTOFF is a relocation type in Metaware that is now used by GCC as well to adjust the index of function calls to functions with attribute jli_call_always. bfd/ 2017-07-19 Claudiu Zissulescu <claziss@synopsys.com> John Eric Martin <John.Martin@emmicro-us.com> * bfd-in2.h: Regenerate. * libbfd.h: Regenerate. * elf32-arc.c (JLI): Define. * reloc.c: Add JLI relocations. gas/ 2017-07-19 Claudiu Zissulescu <claziss@synopsys.com> * testsuite/gas/arc/jli-1.d: New file. * testsuite/gas/arc/jli-1.s: Likewise. * testsuite/gas/arc/taux.d: Update for jli_base. include/ 2017-07-19 Claudiu Zissulescu <claziss@synopsys.com> John Eric Martin <John.Martin@emmicro-us.com> * elf/arc-reloc.def: Add JLI relocs howto. * opcode/arc-func.h (replace_jli): New function. ld/ 2017-07-19 Claudiu Zissulescu <claziss@synopsys.com> John Eric Martin <John.Martin@emmicro-us.com> * emulparams/arcelf.sh (JLI_START_TABLE): Define. * scripttempl/elfarc.sc: Handle jlitab section. * scripttempl/elfarcv2.sc: Likewise. * testsuite/ld-arc/arc.exp: Add JLI test. * testsuite/ld-arc/jli-script.ld: New file. * testsuite/ld-arc/jli-simple.dd: Likewise. * testsuite/ld-arc/jli-simple.rd: Likewise. * testsuite/ld-arc/jli-simple.s: Likewise. * testsuite/ld/testsuite/ld-arc/jli-overflow.s: Likewise. * testsuite/ld/testsuite/ld-arc/jli-overflow.d: Likewise. * testsuite/ld/testsuite/ld-arc/jli-overflow.err: Likewise. opcode/ 2017-07-19 Claudiu Zissulescu <claziss@synopsys.com> John Eric Martin <John.Martin@emmicro-us.com> * arc-opc.c (UIMM10_6_S_JLIOFF): Define. (UIMM3_23): Adjust accordingly. * arc-regs.h: Add/correct jli_base register. * arc-tbl.h (jli_s): Likewise.
2017-07-19Remove datasize measurements based on sbrk()Tristan Gingold2-16/+4
binutils/ * nm.c (show_stats): Remove variable. (long_options): Remove --stats option. (main): Remove handling of --stats. ld/ * ldmain.c (main): Remove display of data size. gas/ * as.c (start_sbrk): Remove. (main): Remove assignment. (dump_statistics): Remove display of data size.
2017-07-18LD/testsuite: Conditionalize the placement of `.got' in GNU_RELROMaciej W. Rozycki2-1/+24
Complement commit d345186d0535 ("Check if GNU_RELRO segment is is generated") and exclude the presence of a `.got' section from implying the creation of a GNU_RELRO segment for targets which place the section along with small data, and therefore as it stands cannot have the section assigned to GNU_RELRO. This is because we currently only support a single GNU_RELRO segment and we place it at the beginning of regular data which is then separated from small data by read-write data. Currently the list of such targets consists of Alpha, Linux HPPA, NetBSD HPPA, OpenBSD HPPA, Meta, MIPS, Nios II, OpenRISC 1000, RISC-V, SH and X86-64, as determined by examining default linker scripts produced in a `--enable-targets=all' build for those that have DATA_SEGMENT_RELRO_END set and `.got' placed beyond. These targets do not set NO_SMALL_DATA or DATA_GOT in their respective files in ld/emulparams/*, hovever checking for the absence of these settings on its own is not very feasible due to the structure of these files and the lack of support for GNU_RELRO by some targets in the first place. Add a separate control for `.got.plt' which does get placed in GNU_RELRO on MIPS targets even though `.got' does not. ld/ * testsuite/ld-elf/binutils.exp (binutils_test): Make the expectation for `.got' in GNU_RELRO segment target-specific. Handle `.got.plt' separately.
2017-07-18LD/testsuite: Conditionalize the placement of `.dynamic' in GNU_RELROMaciej W. Rozycki2-1/+11
Complement commit d345186d0535 ("Check if GNU_RELRO segment is is generated") and exclude the presence of a `.dynamic' section from implying the creation of a GNU_RELRO segment for targets which place the section in the (read-only) text segment, and therefore cannot have the section assigned to GNU_RELRO and neither it would make sense. Currently the list of such targets consists of 64-bit HPPA and non-VxWorks MIPS targets, as determined by looking for TEXT_DYNAMIC being set across ld/emulparams/* and then verified by examining default linker scripts produced in a `--enable-targets=all' build. ld/ * testsuite/ld-elf/binutils.exp (binutils_test): Make the expectation for `.dynamic' in GNU_RELRO segment target-specific.
2017-07-18Fix spelling typos.Yuri Chornovian3-2/+8
2017-07-17i386: Add tests for PIE with undefined weak symbolH.J. Lu5-0/+49
* testsuite/ld-i386/i386.exp: Run pie1 and pie1-nacl. * testsuite/ld-i386/pie1-nacl.d: New file. * testsuite/ld-i386/pie1.d: Likewise. * testsuite/ld-i386/pie1.s: Likewise.
2017-07-17Add missing ChangeLog entries for PR ld/21782 fixH.J. Lu1-0/+8
2017-07-17x86-64: Limit PIC check to shared library buildH.J. Lu4-0/+34
When building an executable, undefined symbols are error and undefined weak symbols are resolved to zero. We only need to check PIC for building a shared library. bfd/ PR ld/21782 * elf64-x86-64.c (elf_x86_64_relocate_section): Limit PIC check to shared library. ld/ PR ld/21782 * testsuite/ld-x86-64/pie3-nacl.d: New file. * testsuite/ld-x86-64/pie3.d: Likewise. * testsuite/ld-x86-64/pie3.s: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run pie3 and pie3-nacl.
2017-07-14ppc32 tlsopt testsAlan Modra12-46/+87
These all were odd in that they used r13 as the GOT pointer. That didn't matter for the purpose of testing, but would never occur in practice. Also, the tlsopt5 tests could have their global dynamic sequences optimized to initial exec, so link with -shared. * testsuite/ld-powerpc/powerpc.exp: Add -shared to tlsop5 tests. * testsuite/ld-powerpc/tlsopt5.d: Adjust. * testsuite/ld-powerpc/tlsopt1_32.s: Use r30 as GOT pointer. * testsuite/ld-powerpc/tlsopt2_32.s: Likewise. * testsuite/ld-powerpc/tlsopt3_32.s: Likewise. * testsuite/ld-powerpc/tlsopt4_32.s: Likewise. * testsuite/ld-powerpc/tlsopt5_32.s: Rewrite. * testsuite/ld-powerpc/tlsopt1_32.d: Adjust. * testsuite/ld-powerpc/tlsopt2_32.d: Adjust. * testsuite/ld-powerpc/tlsopt3_32.d: Adjust. * testsuite/ld-powerpc/tlsopt5_32.d: Adjust.
2017-07-14PR ld/21529: Use a linker script to limit output with the test caseMaciej W. Rozycki3-1/+11
Complement commit d9409498813c ("Add a testcase for PR ld/21529") and use a linker script to prevent an inter-segment gap arranged by the default linker script associated with some targets such as `rx-elf': $ ld -e main -o tmpdir/dump-elf tmpdir/pr21529.o $ readelf -l tmpdir/dump-elf Elf file type is EXEC (Executable file) Entry point 0x10000004 There are 2 program headers, starting at offset 52 Program Headers: Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align LOAD 0x001000 0x10000000 0x10000000 0x00008 0x00008 R E 0x1000 LOAD 0x001ffc 0xbffffffc 0xbffffffc 0x00004 0x00004 RW 0x1000 Section to Segment mapping: Segment Sections... 00 .text 01 .stack $ and converted to padding with the use of the binary BFD for output from producing unreasonably large files. ld/ * testsuite/ld-unique/pr21529.ld: New test linker script. * testsuite/ld-unique/pr21529.d: Use it.
2017-07-12Update PO filesAlan Modra18-2681/+7930
bfd/ * po/es.po: Update from translationproject.org/latest/bfd/. * po/fi.po: Likewise. * po/fr.po: Likewise. * po/id.po: Likewise. * po/ja.po: Likewise. * po/ro.po: Likewise. * po/ru.po: Likewise. * po/sr.po: Likewise. * po/sv.po: Likewise. * po/tr.po: Likewise. * po/uk.po: Likewise. * po/vi.po: Likewise. * po/zh_CN.po: Likewise. * po/hr.po: New file from translationproject.org. * configure.ac (ALL_LINGUAS): Add hr. Sort. * configure: Regenerate. binutils/ * po/bg.po: Update from translationproject.org/latest/binutils/. * po/ca.po: Likewise. * po/da.po: Likewise. * po/es.po: Likewise. * po/fi.po: Likewise. * po/fr.po: Likewise. * po/hr.po: Likewise. * po/id.po: Likewise. * po/it.po: Likewise. * po/ja.po: Likewise. * po/ro.po: Likewise. * po/ru.po: Likewise. * po/sk.po: Likewise. * po/sr.po: Likewise. * po/sv.po: Likewise. * po/tr.po: Likewise. * po/uk.po: Likewise. * po/vi.po: Likewise. * po/zh_CN.po: Likewise. * po/zh_TW.po: Likewise. gas/ * po/es.po: Update from translationproject.org/latest/gas/. * po/fi.po: Likewise. * po/fr.po: Likewise. * po/id.po: Likewise. * po/ja.po: Likewise. * po/ru.po: Likewise. * po/sv.po: Likewise. * po/tr.po: Likewise. * po/uk.po: Likewise. * po/zh_CN.po: Likewise. gold/ * po/es.po: Update from translationproject.org/latest/gold/. * po/fi.po: Likewise. * po/fr.po: Likewise. * po/id.po: Likewise. * po/it.po: Likewise. * po/vi.po: Likewise. * po/zh_CN.po: Likewise. * po/ja.po: New file from translationproject.org. * po/sv.po: Likewise. * po/uk.po: Likewise. gprof/ * po/bg.po: Update from translationproject.org/latest/gprof/. * po/da.po: Likewise. * po/de.po: Likewise. * po/eo.po: Likewise. * po/es.po: Likewise. * po/fi.po: Likewise. * po/fr.po: Likewise. * po/ga.po: Likewise. * po/hu.po: Likewise. * po/id.po: Likewise. * po/it.po: Likewise. * po/ja.po: Likewise. * po/ms.po: Likewise. * po/nl.po: Likewise. * po/pt_BR.po: Likewise. * po/ro.po: Likewise. * po/ru.po: Likewise. * po/sr.po: Likewise. * po/sv.po: Likewise. * po/tr.po: Likewise. * po/uk.po: Likewise. * po/vi.po: Likewise. ld/ * po/bg.po: Update from translationproject.org/latest/ld/. * po/da.po: Likewise. * po/es.po: Likewise. * po/fi.po: Likewise. * po/fr.po: Likewise. * po/id.po: Likewise. * po/it.po: Likewise. * po/ja.po: Likewise. * po/tr.po: Likewise. * po/uk.po: Likewise. * po/vi.po: Likewise. * po/zh_CN.po: Likewise. * po/zh_TW.po: Likewise. * po/de.po: New file from translationproject.org. * po/ru.po: Likewise. * configure.ac (ALL_LINGUAS): Add de, ru. Sort. * configure: Regenerate. opcodes/ * po/da.po: Update from translationproject.org/latest/opcodes/. * po/de.po: Likewise. * po/es.po: Likewise. * po/fi.po: Likewise. * po/fr.po: Likewise. * po/id.po: Likewise. * po/it.po: Likewise. * po/nl.po: Likewise. * po/pt_BR.po: Likewise. * po/ro.po: Likewise. * po/sv.po: Likewise. * po/tr.po: Likewise. * po/uk.po: Likewise. * po/vi.po: Likewise. * po/zh_CN.po: Likewise.
2017-07-12rs6000 testsuite updateAlan Modra11-10/+22
* testsuite/ld-scripts/align.exp: Exclude powerpc*-*-aix*. * testsuite/ld-scripts/assign-loc.d: Likewise. * testsuite/ld-scripts/defined3.d: Likewise. * testsuite/ld-scripts/defined4.d: Likewise. * testsuite/ld-scripts/defined5.d: Likewise. * testsuite/ld-scripts/expr2.d: Likewise. * testsuite/ld-scripts/provide.exp: Likewise. * testsuite/ld-scripts/sane1.d: Likewise. * testsuite/ld-scripts/size.exp: Likewise. * testsuite/ld-scripts/defined2.d: Don't xfail rs6000-*-aix*.
2017-07-12bfd_error_handler bfd_vma and bfd_size_type argsAlan Modra3-2/+7
This patch uses the new %L _bfd_error_handler support for printing bfd_vma arguments, and fixes a many other format and/or argument errors in error messages. bfd/ * binary.c (binary_set_section_contents): Don't print filepos in error message. (coff_write_object_contents): Cast size_t for error message. (coff_slurp_line_table): Don't use bfd_vma symndx. (coff_slurp_reloc_table): Remove unneeded cast. * dwarf2.c (read_section): Cast bfd_int64_t to long long for error message. (find_abstract_instance_name): Likewise. * elf32-arm.c (arm_type_of_stub): Correct error arg order. (bfd_elf32_arm_stm32l4xx_erratum_scan): Don't cast error arg. (elf32_arm_check_relocs): Make r_symndx an int. * elf32-cris.c (cris_elf_check_relocs): Delete extraneous %s in format string. * elf32-metag.c (elf_metag_relocate_section): Delete extra error message arg. * elf32-nds32.c (nds32_elf_ex9_build_hash_table): Rewrite bogus error message. * elf32-i386.c (elf_i386_check_relocs): Make r_symndx an int. * elf32-s390.c (elf_s390_check_relocs): Likewise. * elf32-tic6x.c (elf32_tic6x_check_relocs): Likewise. * elf32-tilepro.c (tilepro_elf_check_relocs): Likewise. * elf32-xtensa.c (elf_xtensa_check_relocs): Likewise. * elf64-s390.c (elf_s390_check_relocs): Likewise. * elf64-x86-64.c (elf_x86_64_check_relocs): Likewise. * elfnn-aarch64.c (elfNN_aarch64_check_relocs): Likewise. * elfnn-riscv.c (riscv_elf_check_relocs): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise. * elfxx-tilegx.c (tilegx_elf_check_relocs): Likewise. * elf64-mmix.c (_bfd_mmix_after_linker_allocation): Cast size_t args and use %lu for error message. * elflink.c (elf_link_adjust_relocs): Delete extra error message arg. * mmo.c (mmo_scan): Make stab_loc a file_ptr. Cast expression for error message. * elf32-arm.c (elf32_arm_tls_relax): Correct format string and args in error message. (elf32_arm_final_link_relocate): Likewise. * coff-arm.c (bfd_arm_process_before_allocation): Likewise. * coffcode.h (styp_to_sec_flags): Likewise. * cofflink.c (_bfd_coff_write_global_sym): Likewise. * ecoff.c (_bfd_ecoff_slurp_symbol_table): Likewise. * elf32-arc.c (arc_elf_merge_private_bfd_data): Likewise. * elf32-bfin.c (bfinfdpic_check_relocs): Likewise. (elf32_bfin_merge_private_bfd_data): Likewise. * elf32-cris.c (cris_elf_relocate_section): Likewise. * elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise. * elf32-i370.c (i370_elf_merge_private_bfd_data): Likewise. (i370_elf_relocate_section): Likewise. * elf32-iq2000.c (iq2000_elf_merge_private_bfd_data): Likewise. * elf32-m32c.c (m32c_elf_merge_private_bfd_data): Likewise. * elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Likewise. * elf32-mcore.c (mcore_elf_relocate_section): Likewise. * elf32-mep.c (mep_elf_merge_private_bfd_data): Likewise. * elf32-mt.c (mt_elf_merge_private_bfd_data): Likewise. * elf64-sparc.c (elf64_sparc_merge_private_bfd_data): Likewise. * elfxx-mips.c (mips_elf_merge_obj_e_flags): Likewise. (_bfd_mips_elf_merge_private_bfd_data): Likewise. * ieee.c (ieee_write_id, read_id): Likewise. * mach-o.c (bfd_mach_o_write_contents): Likewise. (bfd_mach_o_layout_commands, bfd_mach_o_read_section_32): Likewise. (bfd_mach_o_read_section_64, bfd_mach_o_read_symtab_symbol): Likewise. (bfd_mach_o_read_command, bfd_mach_o_header_p): Likewise. * peXXigen.c (_bfd_XXi_swap_aouthdr_in): Likewise. * stabs.c (_bfd_link_section_stabs): Likewise. * coff-arm.c (coff_arm_relocate_section): Use L modifier in error format. * coff-mcore.c (coff_mcore_relocate_section): Likewise. * coff-ppc.c (coff_ppc_relocate_section): Likewise. * coff-rs6000.c (xcoff_reloc_type_toc): Likewise. * coff-sh.c (sh_relax_section): Likewise. (sh_relax_delete_bytes, sh_swap_insns): Likewise. * coff-tic80.c (coff_tic80_relocate_section): Likewise. * coffcode.h (coff_slurp_reloc_table): Likewise. * coffgen.c (_bfd_coff_get_external_symbols): Likewise. (_bfd_coff_read_string_table): Likewise. * cofflink.c (_bfd_coff_generic_relocate_section): Likewise. * compress.c (bfd_get_full_section_contents): Likewise. * dwarf2.c (read_formatted_entries, decode_line_info): Likewise. * elf-m10300.c (mn10300_elf_relocate_section): Likewise. * elf.c (bfd_elf_string_from_elf_section): Likewise. * elf32-arc.c (arc_special_overflow_checks): Likewise. * elf32-arm.c (elf32_arm_tls_relax): Likewise. (elf32_arm_final_link_relocate, elf32_arm_relocate_section): Likewise. (elf32_arm_write_section): Likewise. * elf32-bfin.c (bfin_relocate_section): Likewise. (bfinfdpic_relocate_section): Likewise. * elf32-hppa.c (hppa_build_one_stub): Likewise. (final_link_relocate, elf32_hppa_relocate_section): Likewise. * elf32-i386.c (elf_i386_tls_transition): Likewise. (elf_i386_relocate_section): Likewise. * elf32-ip2k.c (ip2k_final_link_relocate): Likewise. * elf32-lm32.c (lm32_elf_finish_dynamic_sections): Likewise. * elf32-m32r.c (m32r_elf_relocate_section): Likewise. * elf32-m68k.c (elf_m68k_relocate_section): Likewise. * elf32-metag.c (elf_metag_relocate_section): Likewise. * elf32-nds32.c (unrecognized_reloc_msg): Likewise. (nds32_elf_relax_longcall1, nds32_elf_relax_longcall2): Likewise. (nds32_elf_relax_longcall3, nds32_elf_relax_longjump1): Likewise. (nds32_elf_relax_longjump2, nds32_elf_relax_longjump3): Likewise. (nds32_elf_relax_longcall4, nds32_elf_relax_longcall5): Likewise. (nds32_elf_relax_longcall6, nds32_elf_relax_longjump4): Likewise. (nds32_elf_relax_longjump5, nds32_elf_relax_longjump6): Likewise. (nds32_elf_relax_longjump7, nds32_elf_relax_loadstore): Likewise. (nds32_elf_relax_ptr, nds32_elf_ex9_build_hash_table): Likewise. * elf32-nios2.c (nios2_elf32_relocate_section): Likewise. * elf32-rx.c (UNSAFE_FOR_PID): Likewise. * elf32-s390.c (invalid_tls_insn, elf_s390_relocate_section): Likewise. * elf32-score.c (s3_bfd_score_elf_check_relocs): Likewise. * elf32-score7.c (s7_bfd_score_elf_check_relocs): Likewise. * elf32-sh.c (sh_elf_relax_section): Likewise. (sh_elf_relax_delete_bytes, sh_elf_swap_insns): Likewise. (sh_elf_relocate_section): Likewise. * elf32-sh64.c (shmedia_prepare_reloc): Likewise. * elf32-spu.c (spu_elf_relocate_section): Likewise. * elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise. * elf32-tilepro.c (tilepro_elf_relocate_section): Likewise. * elf32-v850.c (v850_elf_relax_section): Likewise. * elf32-vax.c (elf_vax_check_relocs): Likewise. (elf_vax_relocate_section): Likewise. * elf32-xtensa.c (elf_xtensa_relocate_section): Likewise. (extend_ebb_bounds_forward, extend_ebb_bounds_backward): Likewise. (compute_text_actions, compute_ebb_proposed_actions): Likewise. (do_fix_for_relocatable_link): Likewise. * elf64-alpha.c (elf64_alpha_relax_got_load): Likewise. (elf64_alpha_relax_with_lituse): Likewise. * elf64-hppa.c (elf64_hppa_finish_dynamic_symbol): Likewise. (elf_hppa_final_link_relocate): Likewise. * elf64-ia64-vms.c (elf64_ia64_relax_section): Likewise. (elf64_ia64_choose_gp, elf64_ia64_relocate_section): Likewise. (elf64_vms_link_add_object_symbols): Likewise. * elf64-mmix.c (mmix_elf_perform_relocation): Likewise. (mmix_final_link_relocate): Likewise. * elf64-s390.c (invalid_tls_insn): Likewise. (elf_s390_relocate_section): Likewise. * elf64-sh64.c (sh_elf64_relocate_section): Likewise. * elf64-x86-64.c (elf_x86_64_tls_transition): Likewise. (elf_x86_64_relocate_section): Likewise. * elfcode.h (elf_slurp_symbol_table): Likewise. * elfcore.h (elf_core_file_p): Likewise. * elflink.c (elf_link_read_relocs_from_section): Likewise. * elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise. (elfNN_aarch64_relocate_section): Likewise. * elfnn-ia64.c (elfNN_ia64_relax_section): Likewise. (elfNN_ia64_choose_gp, elfNN_ia64_relocate_section): Likewise. * elfnn-riscv.c (riscv_elf_relocate_section): Likewise. * elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise. (_bfd_mips_elf_relocate_section): Likewise. (_bfd_mips_elf_finish_dynamic_symbol, mips_finish_exec_plt): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise. * elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise. * ieee.c (ieee_slurp_external_symbols): Likewise. * ihex.c (ihex_write_object_content): Likewise. * mach-o.c (bfd_mach_o_build_exec_seg_command): Likewise. * merge.c (_bfd_merged_section_offset): Likewise. * mmo.c (mmo_write_loc_chunk): Likewise. (mmo_write_object_contents): Likewise. * peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Likewise. * stabs.c (_bfd_link_section_stabs): Likewise. * xcofflink.c (xcoff_link_add_symbols, xcoff_find_tc0): Likewise. ld/ * testsuite/ld-arc/nps-1b.err: Update. * testsuite/ld-x86-64/ilp32-11.d: Update.
2017-07-11Support single digit GCC versionH.J. Lu2-1/+7
On Fedora 26, "g++ -dumpversion" displays "7", instead of "7.1.1". Update selective.exp to support single digit GCC version. Also remove duplicated [4-9] version check. * testsuite/ld-selective/selective.exp: Support single digit GCC version.
2017-07-11[AArch64] Use "#pass" instead of "#..." to filter multiple linesJiong Wang2-2/+6
ld/ * testsuite/ld-aarch64/dt_textrel.d: Use "#pass" instead of ".*" to filter out remaining lines.
2017-07-07MIPS/LD: Fix a segfault from ELF `e_flags' access with non-ELF output BFDMaciej W. Rozycki6-6/+36
Fix a commit 861fb55ab50a ("Defer allocation of R_MIPS_REL32 GOT slots"), <https://sourceware.org/ml/binutils/2008-08/msg00096.html>, regression and a more recent: FAIL: ld-unique/pr21529 new LD test case failure, observed with all the relevant MIPS targets whenever the linker is invoked with one or more ELF inputs and the output format set to `binary'. The culprit is a segmentation fault caused in `mips_before_allocation' by a null pointer dereference, where an attempt is made to access the ELF file header's `e_flags' member, for the purpose of determining whether to produce a PLT and copy relocations, without first checking that the output BFD is ELF. The `e_flags' member is stored in BFD's private data pointed to by `tdep', which in the case of the `binary' BFD is null, causing the segmentation fault. With other non-ELF BFDs such as SREC `tdep' is not null and consequently no crash may happen and in that case random data will be interpreted as it was `e_flags'. Disable the access to `e_flags' then and all the associated checks and consequently never produce a PLT and copy relocations if output is not a MIPS ELF BFD, matching `_bfd_mips_elf_merge_private_bfd_data' that does not process `e_flags' in that case either and therefore does not let us decide here anyway if all the input objects included in the link are suitable for use with a PLT and copy relocations. ld/ * emultempl/mipself.em (mips_before_allocation): Avoid ELF processing if not MIPS ELF. * testsuite/ld-mips-elf/binary.d: New test. * testsuite/ld-mips-elf/binary.ld: New test linker script. * testsuite/ld-mips-elf/binary.s: New test source. * testsuite/ld-mips-elf/mips-elf.exp: Run the new test.
2017-07-07Make ppc476 testcases more robustAlan Modra4-9/+15
* testsuite/ld-powerpc/ppc476-shared.lnk: Align .bss. * testsuite/ld-powerpc/ppc476-shared.d: Adjust. * testsuite/ld-powerpc/ppc476-shared2.d: Adjust.
2017-07-07Apply ld/Makefile.in patch to the correct fileAlan Modra2-0/+5
Makefile.in is generated. * Makefile.am (eelf64_s390.c): Depend on emultempl/s390.em.
2017-07-04Regenerate configure.Tristan Gingold2-10/+14
bfd/ 2017-07-04 Tristan Gingold <gingold@adacore.com> * version.m4: Bump version to 2.29.51 * configure: Regenerate. binutils/ 2017-07-04 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. gas/ 2017-07-04 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. gprof/ 2017-07-04 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. ld/ 2017-07-04 Tristan Gingold <gingold@adacore.com> * configure: Regenerate. opcodes/ 2017-07-04 Tristan Gingold <gingold@adacore.com> * configure: Regenerate.
2017-07-04Add markers.Tristan Gingold2-0/+6
binutils/ 2017-07-04 Tristan Gingold <gingold@adacore.com> * NEWS: Add marker for 2.29. gas/ 2017-07-04 Tristan Gingold <gingold@adacore.com> * NEWS: Add marker for 2.29. ld/ 2017-07-04 Tristan Gingold <gingold@adacore.com> * NEWS: Add marker for 2.29.
2017-07-03Regenerate pot files.Tristan Gingold2-468/+476
2017-07-01MIPS/GAS: Use non-zero frag offset directly in PIC branch relaxationMaciej W. Rozycki7-0/+116
Use frag symbols with a non-zero offset directly in `fix_new_exp' calls made in PIC branch relaxation. There is no need here to make a helper symbol to hold the result of a `symbol+offset' calculation requested as only branches to local symbols are relaxed and in this case the LO16 part of the PIC address load sequence will have the offset accounted for in calculation against the local GOT entry retrieved as the GOT16 high part. Consequently actual code produed is identical whether a helper symbol is used or the original `symbol+offset' expression used directly. Verify that this is indeed the case with GAS and LD tests. gas/ * config/tc-mips.c (md_convert_frag): Don't make a helper expression symbol for `fix_new_exp' called with a non-zero offset. * testsuite/gas/mips/relax-offset.d: New test. * testsuite/gas/mips/mips1@relax-offset.d: New test. * testsuite/gas/mips/r3000@relax-offset.d: New test. * testsuite/gas/mips/r3900@relax-offset.d: New test. * testsuite/gas/mips/micromips@relax-offset.d: New test. * testsuite/gas/mips/relax-offset.l: New stderr output. * testsuite/gas/mips/relax-offset.s: New test source. * testsuite/gas/mips/mips.exp: Run the new tests. ld/ * testsuite/ld-mips-elf/relax-offset.dd: New test. * testsuite/ld-mips-elf/relax-offset.gd: New test. * testsuite/ld-mips-elf/relax-offset-umips.dd: New test. * testsuite/ld-mips-elf/relax-offset-umips.gd: New test. * testsuite/ld-mips-elf/relax-offset.ld: New test linker script. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests. (prune_warnings): New temporary procedure.
2017-06-28MIPS: Add new Imagination interAptiv MR2 GAS and LD testsMaciej W. Rozycki2-0/+50
Add GAS tests to verify Imagination interAptiv MR2 instruction assembly, disassembly and ELF object file flags. Add LD tests to verify Imagination interAptiv MR2 ELF object file link-time compatibility and flag merging/propagation. Use the framework enhancement added with commit 7575e6a752ec ("MIPS/LD/testsuite: mips-elf-flags: Add MIPS ABI Flags handling"). gas/ * testsuite/gas/mips/elf_mach_interaptiv-mr2.d: New test. * testsuite/gas/mips/save-err.d: New test. * testsuite/gas/mips/save-sub.d: New test. * testsuite/gas/mips/interaptiv-mr2@save.d: New test. * testsuite/gas/mips/mips1@save-sub.d: New test. * testsuite/gas/mips/mips2@save-sub.d: New test. * testsuite/gas/mips/mips3@save-sub.d: New test. * testsuite/gas/mips/mips4@save-sub.d: New test. * testsuite/gas/mips/mips5@save-sub.d: New test. * testsuite/gas/mips/mips32@save-sub.d: New test. * testsuite/gas/mips/mips64@save-sub.d: New test. * testsuite/gas/mips/mips16@save-sub.d: New test. * testsuite/gas/mips/mips16e@save-sub.d: New test. * testsuite/gas/mips/r3000@save-sub.d: New test. * testsuite/gas/mips/r3900@save-sub.d: New test. * testsuite/gas/mips/r4000@save-sub.d: New test. * testsuite/gas/mips/vr5400@save-sub.d: New test. * testsuite/gas/mips/interaptiv-mr2@save-sub.d: New test. * testsuite/gas/mips/sb1@save-sub.d: New test. * testsuite/gas/mips/octeon2@save-sub.d: New test. * testsuite/gas/mips/octeon3@save-sub.d: New test. * testsuite/gas/mips/xlr@save-sub.d: New test. * testsuite/gas/mips/r5900@save-sub.d: New test. * testsuite/gas/mips/mips16e2-copy.d: New test. * testsuite/gas/mips/mips16e2-copy-err.d: New test. * testsuite/gas/mips/save.d: Remove `MIPS16e' from the `name' option. Adjust for trailing padding change. * testsuite/gas/mips/mips16e2-copy-err.l: New stderr output. * testsuite/gas/mips/save-sub.s: New test source. * testsuite/gas/mips/mips16e2-copy.s: New test source. * testsuite/gas/mips/mips16e2-copy-err.s: New test source. * testsuite/gas/mips/save.s: Update description, change trailing padding and remove trailing white space. * testsuite/gas/mips/mips.exp: Expand `save' and `save-err' tests across the regular MIPS interAptiv MR2 architecture. Run the new tests. ld/ * testsuite/ld-mips-elf/mips-elf-flags.exp: Add interAptiv MR2 tests.
2017-06-27Fix PR 13402Senthil Kumar Selvaraj3-0/+31
Fix incorrect adjustment of diff relocs when relaxing, and thus the resulting source line to address mismatch. Fix two issues when adjusting diff relocs to account for deleted bytes. 1. Don't adjust the difference if the end address is the shrinked insn's address i.e. use < instead of <=. The relaxation code deletes count bytes from or after shrinked_insn_address, so the difference between start_address and end_address should remain unchanged in this case. 2. Adjust the reloc addend if the difference is to be adjusted and symval + reloc addend is past the shrinked insn address. This is because for a typical sym1 - sym2 diff reloc, sym1 is .text + irel->r_addend, and the addend should be reduced to account for the shrinked insn. For example, assume the reloc value is .text + 0x8 with .text = 0, the diff value in the object file = 0x4, and shrinked_insn_address = 0x4 with count = 0x2. Then the existing code writes 0x2 into the object file to account for the deleted bytes, as shrinked_insn_address lies between 0x8 and 0x8 - 0x4 = 0x4, but leaves the addend as is. The next time the reloc is looked at, the code sees if a shrinked_insn_address lies between 0x8 and 0x8 - 0x2 = 0x6, instead of 0x6 and 0x4. If there happens to be one, then the diff value in the object file ends up getting reduced again. bfd/ 2017-06-27 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com> PR ld/13402 * elf32-avr.c (elf32_avr_adjust_diff_reloc_value): Adjust reloc addend if necessary. Adjust diff only if shrinked_insn_address < end_address. ld/ 2017-06-27 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com> PR ld/13402 * testsuite/ld-avr/pr13402.d: New test. * testsuite/ld-avr/pr13402.s: New test.
2017-06-27MIPS/LD/testsuite: mips-elf-flags: Add MIPS ABI Flags handlingMaciej W. Rozycki2-3/+56
Complement commit 351cdf24d223 ("[MIPS] Implement O32 FPXX, FP64 and FP64A ABI extensions") and add optional MIPS ABI Flags handling to `good_combination' in the `mips-elf-flags.exp' test script. This lets callers of this procedure request to examine MIPS ABI Flags in addition to the `e_flags' member of the ELF file header so as to verify that flags are merged correctly by LD. The presence of further arguments triggers this verification, in which case `readelf' is called with the `-A' option additionally specified and the ISA member, the ISA Extension member and the ASEs member will be examined as per the arguments. Unlike with `readelf -h' output consider a failure to retrieve the member requested a test case failure rather than an unresolved result. This is because unlike with the `e_flags' member of the ELF file header which is always there in any valid ELF file the MIPS ABI Flags structure is optional in LD output and the absence of this structure when expected is surely a bug in LD. ld/ * testsuite/ld-mips-elf/mips-elf-flags.exp (good_combination): Add an `args' final argument and examination code for `readelf -A' output. Update procedure description accordingly.
2017-06-27MIPS/LD/testsuite: mips-elf-flags: Use `remote_exec' to call `readelf'Maciej W. Rozycki2-2/+12
For ELF file header flag verification done in `good_combination' in the `mips-elf-flags.exp' test script the version of `readelf' built along with the rest of binutils has to be used rather than any such executable already present on the build system, so that flags recognized by the tool match those supported by LD being tested. Use `remote_exec' as elsewhere in the LD test framework and also with GAS and LD used here, getting and arranging for extra reporting of `readelf' calls included in test logs on this occasion as well. ld/ * testsuite/ld-mips-elf/mips-elf-flags.exp (good_combination): Use `remote_exec' to call `readelf'. Log the command issued.
2017-06-27MIPS/LD/testsuite: mips-elf-flags: Use `-h' only with `readelf'Maciej W. Rozycki2-2/+7
For the purpose of link-time object compatibility handling verification code in the `good_combination' procedure from the `mips-elf-flags.exp' test script only examines the `e_flags' member of the ELF file header and ignores data from any ELF program or section headers present. Use `readelf -h' rather than `readelf --headers' then to obtain data for examination, avoiding unnecessary processing to extract this extraneous information. ld/ * testsuite/ld-mips-elf/mips-elf-flags.exp (good_combination): Use `readelf -h' rather than `readelf --headers'.
2017-06-26MIPS/BFD: Consistently mark the LSI CW4010 as a MIPS II processorMaciej W. Rozycki3-0/+31
Make BFD agree with GAS and mark the LSI MiniRISC CW4010 processor core (for an odd reason referred to as LSI R4010 across our code base) as a MIPS II processor in BFD as well, fixing a bug that has been there since forever and addressing linker warnings like: $ as -m4010 empty.s -o 4010.o $ ld -r 4010.o -o 4010-r.o ld: 4010.o: warning: Inconsistent ISA between e_flags and .MIPS.abiflags $ due to the ISA level being recorded as MIPS III in ELF file header's `e_flags' vs MIPS II in the MIPS ABI Flags section: $ readelf -Ah 4010.o ELF Header: Magic: 7f 45 4c 46 01 02 01 00 00 00 00 00 00 00 00 00 Class: ELF32 Data: 2's complement, big endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: REL (Relocatable file) Machine: MIPS R3000 Version: 0x1 Entry point address: 0x0 Start of program headers: 0 (bytes into file) Start of section headers: 348 (bytes into file) Flags: 0x20821000, 4010, o32, mips3 Size of this header: 52 (bytes) Size of program headers: 0 (bytes) Number of program headers: 0 Size of section headers: 40 (bytes) Number of section headers: 11 Section header string table index: 10 Attribute Section: gnu File Attributes Tag_GNU_MIPS_ABI_FP: Hard float (double precision) MIPS ABI Flags Version: 0 ISA: MIPS2 GPR size: 32 CPR1 size: 32 CPR2 size: 0 FP ABI: Hard float (double precision) ISA Extension: LSI R4010 ASEs: None FLAGS 1: 00000000 FLAGS 2: 00000000 $ Available documentation[1][2] clearly indicates the LSI CW4010 processor is only backwards compatible with the MIPS R4000 processor as far as the latter's 32-bit instructions are concerned and consequently can only be considered a MIPS II ISA implementation (with vendor extensions). This fixes an LD testsuite failure: FAIL: MIPS incompatible objects: "-march=r4010 -32" "-march=r4650 -32" triggered for the `mips-sgi-irix5' and `mips-sgi-irix6' targets. References: [1] Paul Cobb, Bob Caulk, Joe Cesana, "The MiniRISC CW4010: A Superscalar MIPS Processor ASIC Core", LSI Logic, July 1995, presented at Hot Chips VII, Stanford University, Stanford, California, August 1995 [2] "MiniRISC MR4010 Superscalar Microprocessor Reference Device", LSI Logic, November 1996, Doc. No. DB09-000028-00, Order No. C15017 bfd/ * cpu-mips.c (arch_info_struct): Mark the 4010 32-bit. * elfxx-mips.c (mips_set_isa_flags) <bfd_mach_mips4010>: Set E_MIPS_ARCH_2 rather than E_MIPS_ARCH_3 in `e_flags'. (mips_mach_extensions): Mark `bfd_mach_mips4010' as extending `bfd_mach_mips6000' rather than `bfd_mach_mips4000'. ld/ * testsuite/ld-mips-elf/lsi-4010-isa.d: New test. * ld/testsuite/ld-mips-elf/mips-elf.exp: Run the new test.
2017-06-26LD: Fix .startof.SECNAME/.sizeof.SECNAME tests for MIPS/IRIXMaciej W. Rozycki5-8/+16
Correct .startof.SECNAME/.sizeof.SECNAME tests for MIPS/IRIX targets, complementing commit dc74becf498f ("ld: Add tests for -Ur") and commit da614360f520 ("ld: Add tests for .startof.SECNAME/.sizeof.SECNAME") with subsequent updates, and in reference to commit cbd0eecf261c ("Always define referenced __start_SECNAME/__stop_SECNAME") and commit 7dba9362c172 ("Rewrite __start and __stop symbol handling"). These targets set the STT_OBJECT type for non-function symbol references, according to `elf_frob_symbol' code in gas/config/obj-elf.c: /* The Irix 5 and 6 assemblers set the type of any common symbol and any undefined non-function symbol to STT_OBJECT. We try to be compatible, since newer Irix 5 and 6 linkers care. However, we only set undefined symbols to be STT_OBJECT if we are on Irix, because that is the only time gcc will generate the necessary .global directives to mark functions. */ if (S_IS_COMMON (symp)) symbol_get_bfdsym (symp)->flags |= BSF_OBJECT; if (strstr (TARGET_OS, "irix") != NULL && ! S_IS_DEFINED (symp) && (symbol_get_bfdsym (symp)->flags & BSF_FUNCTION) == 0) symbol_get_bfdsym (symp)->flags |= BSF_OBJECT; and consequently entries in the symbol table listing from `readelf' produced with these tests do not match the NOTYPE pattern expected, causing test suite failures: FAIL: ld-elf/sizeofa FAIL: ld-elf/sizeofc FAIL: ld-elf/startofa FAIL: ld-elf/startofc specifically with the `mips-sgi-irix5' and `mips-sgi-irix6' targets. Given that it does not matter for the feature covered by these tests whether the type of the symbols produced is STT_NOTYPE or STT_OBJECT adjust the problematic cases to accept either type, removing the failures observed. ld/ * testsuite/ld-elf/sizeofa.d: Also accept the OBJECT type for the symbols examined. * testsuite/ld-elf/sizeofc.d: Likewise. * testsuite/ld-elf/startofa.d: Likewise. * testsuite/ld-elf/startofc.d: Likewise.
2017-06-26Add pgste marker changelogAndreas Krebbel1-0/+8
2017-06-26Don't attach linker created section to --just-syms bfdAlan Modra2-4/+12
All sections on a --just-syms bfd are discarded from the output, so attaching linker created sections to such a bfd results in errors. In other cases, like the .note.GNU-stack check, it's wrong to have a --just-syms object potentially affect the output. bfd/ * elflink.c (_bfd_elf_link_create_dynstrtab): Don't make dynobj a --just-syms bfd. (_bfd_elf_size_group_sections): Skip --just-syms bfds. (bfd_elf_size_dynamic_sections): Ignore .note.GNU-stack and .preinit_array on --just-syms bfds. (_bfd_elf_gc_mark_extra_sections): Skip --just-syms bfds. (elf_gc_sweep, bfd_elf_parse_eh_frame_entries): Likewise. (bfd_elf_gc_sections, bfd_elf_discard_info): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Skip --just-syms bfds when looking for a place to attach .note.gnu.build-id and .eh_frame_hdr sections. Delete dead code.
2017-06-24[ARM] Add linker support for ARMv8-RThomas Preud'homme8-0/+55
=== Context === This patch is part of a patch series to add support for ARMv8-R architecture. Its purpose is to add support for ARMv8-R in the linker. === Patch description === This patch is composed of 3 changes: 1) The main change is the addition of the logic for merging a file whose Tag_CPU_arch build attribute is 15 (ARMv8-R). Namely, all pre-ARMv8 are merged into ARMv8-R as well as ARMv8-R itself. ARMv8-A (14) merges into ARMv8-A. ARMv8-M Baseline (16) and Mainline (17) are not allowed to merge merge with ARMv8-R. Note that merging only occurs if the two profiles are identical or one is S (Application or Realtime) and the other is R. 2) using_thumb_only, using_thumb2_bl, using_thumb2 and arch_has_arm_nop are updated according to capabilities of ARMv8-R and their BFD_ASSERT updated to reflect that the logic is valid for ARMv8-R. 3) 2 build attribute merging tests are added to test the first change. 2017-06-24 Thomas Preud'homme <thomas.preudhomme@arm.com> bfd/ * elf32-arm.c (using_thumb_only): Update list of architectures in BFD_ASSERT for which the logic is valid. (using_thumb2_bl): Likewise. (using_thumb2): Likewise and return true for ARMv8-R. (arch_has_arm_nop): Likewise. (tag_cpu_arch_combine): New v8r table for ARMv8-R Tag_CPU_arch merging logic. Update commentis for value 15 of v8m_baseline, v8m_mainline and v4t_plus_v6_m arrays. Use v8r array to decide merging of value 15 of Tag_CPU_arch. ld/ * testsuite/ld-arm/arm-elf.exp (EABI attribute merging 11): New test. (EABI attribute merging 12): Likewise. * testsuite/ld-arm/attr-merge-11a.s: New file. * testsuite/ld-arm/attr-merge-11b.s: New file. * testsuite/ld-arm/attr-merge-11.attr: New file. * testsuite/ld-arm/attr-merge-12a.s: New file. * testsuite/ld-arm/attr-merge-12b.s: New file. * testsuite/ld-arm/attr-merge-12.attr: New file.