aboutsummaryrefslogtreecommitdiff
path: root/ld
AgeCommit message (Collapse)AuthorFilesLines
2015-07-27Regenerate configure filesH.J. Lu2-2/+6
bfd/ * configure: Regenerated. binutils/ * configure: Regenerated. gas/ * configure: Regenerated. gold/ * configure: Regenerated. gprof/ * configure: Regenerated. ld/ * configure: Regenerated. opcodes/ * configure: Regenerated.
2015-07-27Append $PLT_CFLAGS to CC/CXX for S-records testsH.J. Lu2-0/+22
S-records tests don't work with -fno-plt. This path appends $PLT_CFLAGS to CC and CXX for S-records tests. * ld-srec/srec.exp (CC): Save and restore. Append $PLT_CFLAGS. (CXX): Likewise.
2015-07-27Pass $PLT_CFLAGS to ld_compileH.J. Lu2-3/+8
Some linker shard library tests without PIC expect PLT. This patch passes $PLT_CFLAGS to ld_compile. * ld-shared/shared.exp: Pass $PLT_CFLAGS to ld_compile.
2015-07-27Append $PLT_CFLAGS to CC for NOCROSSREFS testsH.J. Lu2-0/+15
NOCROSSREFS tests don't work with -fno-plt. This path appends $PLT_CFLAGS to CC for NOCROSSREFS tests. * ld-scripts/crossref.exp (CC): Save and restore. Append $PLT_CFLAGS.
2015-07-27Add $PLT_CFLAGS to -fPIC for run_cc_link_testsH.J. Lu4-25/+69
Some x86 linker tests expect PLT. This patch adds $PLT_CFLAGS to -fPIC for run_cc_link_tests. * ld-i386/i386.exp (run_cc_link_tests): Add $PLT_CFLAGS to -fPIC if needed. * ld-x86-64/mpx.exp (run_cc_link_tests): Likewise. * ld-x86-64/x86-64.exp (run_cc_link_tests): Likewise.
2015-07-27Pass $PLT_CFLAGS to ld_compileH.J. Lu2-5/+12
Some linker visibility tests without PIC expect PLT. This patch passes $PLT_CFLAGS to ld_compile. * ld-elfvsb/elfvsb.exp (visibility_run): Pass $PLT_CFLAGS to ld_compile.
2015-07-27Pass $PLT_CFLAGS to build_binaryH.J. Lu2-1/+8
Some linker symbol version tests without PIC expect PLT. This patch adds $PLT_CFLAGS to CFLAGS. * ld-elfvers/vers.exp (build_vers_lib_no_pic): Pass $PLT_CFLAGS to build_binary.
2015-07-27Set PLT_CFLAGS to "-fplt" if supportedH.J. Lu2-0/+39
GCC 6 supports -fno-plt. But some linker tests expect PLT. This patch defines PLT_CFLAGS to "-fplt" if target compiler supports it. * config/default.exp (PLT_CFLAGS): New.
2015-07-27[AArch64] Fix extern protected data handlingSzabolcs Nagy4-0/+30
Emit *GLOB_DAT instead of *RELATIVE relocs for protected data in shared objects. This is needed for the fix of glibc bug 17711: https://sourceware.org/bugzilla/show_bug.cgi?id=17711 bfd: PR ld/18705 * elfnn-aarch64.c (elf_backend_extern_protected_data): Define. ld/testsuite: PR ld/18705 * ld-aarch64/protected-data.d: New. * ld-aarch64/protected-data.s: New. * ld-aarch64/aarch64-elf.exp: Add new test.
2015-07-27[ARM] Fix extern protected data handlingSzabolcs Nagy4-0/+41
Emit *GLOB_DAT instead of *RELATIVE relocs for protected data in shared objects. This is needed for the fix of glibc bug 17711: https://sourceware.org/bugzilla/show_bug.cgi?id=17711 bfd: PR ld/18705 * elf32-arm.c (elf_backend_extern_protected_data): Define. ld/testsuite: PR ld/18705 * ld-arm/protected-data.d: New. * ld-arm/protected-data.s: New. * ld-arm/arm-elf.exp: Add new test.
2015-07-26Compile PR ld/18718 tests with -O2H.J. Lu2-5/+10
PR ld/18718 * ld-elf/shared.exp: Compile PR ld/18718 tests with -O2.
2015-07-26Set errcnt and warncnt to 0 in run_host_cmd_yesnoH.J. Lu2-0/+9
run_host_cmd_yesno should set errcnt and warncnt to 0. Otherwise, they may leak to the next run. * lib/ld-lib.exp (run_host_cmd_yesno): Set errcnt and warncnt to 0.
2015-07-25Add missing ChangeLog filesH.J. Lu1-0/+6
2015-07-25Skip missing symbol version section check for executableH.J. Lu2-0/+71
Missing symbol version section is a run-time problem only if it will be referenced dynamically at run-time. We should skip the check for locally defined symbol, which isn't referenced by shared library, when linking executable. bfd/ PR ld/18718 * elflink.c (elf_link_output_extsym): Check symbol version section check only if not linking executable, the symbol is referenced by shared library or not locally defined. ld/testsuite/ PR ld/18718 * ld-elf/pr18718.c: New file. * ld-elf/shared.exp: Run tests for PR ld/18718.
2015-07-25Fix broken -Bsymbolic-functionsAlan Modra4-1/+46
For selected targets. The testcase reveals a number of targets that still need fixing. bfd/ * elf32-arm.c (elf32_arm_final_link_relocate): Use SYMBOLIC_BIND to check if a symbol should be bound symbolically. * elf32-hppa.c (elf32_hppa_check_relocs, elf32_hppa_adjust_dynamic_symbol, elf32_hppa_relocate_section, elf32_hppa_finish_dynamic_symbol): Likewise. * elf32-m68k.c (elf_m68k_check_relocs, elf_m68k_relocate_section): Likewise. * elf32-nios2.c (nios2_elf32_relocate_section, nios2_elf32_check_relocs, allocate_dynrelocs): Likewise. * elf32-tic6x.c (elf32_tic6x_finish_dynamic_symbol, elf32_tic6x_relocate_section): Likewise. ld/testsuite/ * ld-elf/symbolic-func.s, * ld-elf/symbolic-func.r: New test. * ld-elf/elf.exp: Run it.
2015-07-24Fix the evaluation of RL78 complex relocs, by making immediate values be ↵Nick Clifton2-2/+8
computed relative to a new absolute symbol. gas * config/tc-rl78.c (rl78_abs_sym): New local variable. (md_begin): Initialise the new symbol. (OPIMM): Define the value to be relative to the new symbol and not the absolute section symbol. ld * emulparams/elf32rl78.sh (OTHER_SECTIONS): Provide a value for the _-rl78_abs__ symbol. tests * gas/all/struct.d: Allow for extra symbols in the output. * gas/macros/test1.d: Likewise. * gas/elf/elf.exp: Add an rl78 machine. * gas/elf/sections2e-rl78: New file. tests * binutils-all/localize-hidden-1.d: Allow for extra symbols in the output. * binutils-all/strip-11.d: Skip for the RL78.
2015-07-24Replace -g with -ggdb3 in ld compress testsH.J. Lu4-12/+18
Use -ggdb3 to generate .debug_macro sections, which are bigger and are always compressed. * ld-elf/compress.exp (build_tests): Replace -g with -ggdb3. * ld-elf/zlibbegin.rS: Also expect "GC". * ld-elf/zlibnormal.rS: Likewise.
2015-07-24Remove leading/trailing white spaces in ChangeLogH.J. Lu1-12/+12
2015-07-20Make binutils abort message GDB friendlyH.J. Lu1-2/+2
We used to generate abort messages like: internal error, aborting at .../bfd/elf64-x86-64.c line 1554 in elf_x86_64_check_relocs We can't cut and paste "file line ???" to GDB. This patch changes those abort messages to internal error, aborting at .../bfd/elf64-x86-64.c:1554 in elf_x86_64_check_relocs so that we can cut and paste "file:???" to GDB. bfd/ * bfd.c (_bfd_abort): Replace " line " with ":" in output message. gas/ * messages.c (as_assert): Replace " line " with ":" in output message. (as_abort): Likewise. ld/ * ldmisc.c (ld_abort): Replace " line " with ":" in output message.
2015-07-20ALIGN change affects cris scriptsAlan Modra3-4/+12
More fallout from a2c59f28. This one could have been fixed by simply using ". = ALIGN (ABSOLUTE (.), 2);" but it's nicer to align the section. * emulparams/criself.sh (INIT_ADDR, FINI_ADDR): Define. (INIT_START, FINI_START): Don't ALIGN. * scriptempl/elf.sc (.init, .fini): Apply INIT_ADDR/FINI_ADDR.
2015-07-20ALIGN change affects standard scriptsAlan Modra3-26/+48
a2c59f28 changed the way the unary ALIGN behaved inside output sections, resulting in cris-elf testsuite regressions. This patch pads out .bss in the same manner as it was prior to the ALIGN change. * scripttempl/elf.sc (.ldata, .bss): Align absolute value of dot. * ldexp.c (is_align_conditional): Handle binary ALIGN. (exp_fold_tree_1): Move code setting SEC_KEEP for assignments to dot inside output sections. Handle absolute expressions.
2015-07-16[AArch64][3/3] LD support BFD_RELOC_AARCH64_TLSLD_ADR_PREL21Jiong Wang4-0/+22
2015-07-14Make default compression gABI compliantH.J. Lu6-7/+21
All programs in binutils+gdb git repo now support gABI compression with the SHF_COMPRESSED bit. This patch makes the zlib-gabi option as compression default for gas, gold, ld and objcopy, instead of the zlib-gnu option whose outputs are incompatible with gABI. binutils/ * objcopy.c (copy_file): Set BFD_COMPRESS_GABI if not zlib-gnu. * doc/binutils.texi: Change --compress-debug-sections and --compress-debug-sections=zlib to zlib-gabi. binutils/testsuite/ * binutils-all/compress.exp: Update. gas/ * as.c (parse_args): Make --compress-debug-sections and --compress-debug-sections=zlib the same as --compress-debug-sections=zlib-gabi. * doc/as.texinfo: Change --compress-debug-sections and --compress-debug-sections=zlib to zlib-gabi. gold/ * compressed_output.cc (Output_compressed_section::set_final_data_size): Make --compress-debug-sections=zlib the same as --compress-debug-sections=zlib-gabi. * testsuite/Makefile.am (flagstest_compress_debug_sections.check): Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of ".zdebug_". * testsuite/Makefile.in: Regenerated. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Make --compress-debug-sections=zlib the same as --compress-debug-sections=zlib-gabi. * ld.texinfo: Change --compress-debug-sections=zlib to zlib-gabi. ld/testsuite/ * ld-elf/zlibbegin.rS: Updated to .debug_.* with the SHF_COMPRESSED bit. * ld-elf/zlibnormal.rS: Likewise.
2015-07-14Fix texinfo problem by adding the required period after an @xref.Nick Clifton2-1/+5
* ld.texinfo (Options): Add missing period after @xref.
2015-07-10Make ALIGN(x) behave as ALIGN(.,x)Alan Modra2-2/+15
Inside output sections, ALIGN(.,x) uses a section-relative value for dot. The unary ALIGN always used the absolute value of dot. * ldexp.c (align_dot_val): New function. (fold_unary <ALIGN_K, NEXT>): Use it.
2015-07-092015-07-09 Catherine Moore <clm@codesourcery.com>Catherine Moore13-4/+129
include/ * elf/mips/mips.h (Val_GNU_MIPS_ABI_FP_NAN2008): New. gas/ * config/tc-mips.c (check_fpabi): Handle VAL_GNU_MIPS_ABI_FP_NAN2008. binutils/ * readelf.c (print_mips_fp_abi_value): Handle Val_GNU_MIPS_ABI_FP_NAN2008. ld/testsuite/ * ld-mips-elf/attr-gnu-4-08.d: Update expected output. * ld-mips-elf/attr-gnu-4-09.d: New. * ld-mips-elf/attr-gnu-4-19.d: New. * ld-mips-elf/attr-gnu-4-29.d: New. * ld-mips-elf/attr-gnu-4-39.d: New. * ld-mips-elf/attr-gnu-4-49.d: New. * ld-mips-elf/attr-gnu-4-59.d: New. * ld-mips-elf/attr-gnu-4-69.d: New. * ld-mips-elf/attr-gnu-4-79.d: New. * ld-mips-elf/attr-gnu-4-89.d: New. * ld-mips-elf/attr-gnu-4-9.s: New. * ld-mips-elf/mips-elf.exp: Run new tests.
2015-07-08Define DIFF_EXPR_OK for avr target to allow PC relative difference relocation.Denis Chertykov3-0/+159
When generating relocation (tc_gen_reloc) 32 bit relocation fixup is changed to new 32 bit PC relative relocation if the fixup has pc-relative flag set. bfd/ChangeLog 2015-07-06 Pitchumani Sivanupandi <pitchumani.s@atmel.com> * elf32-avr.c: Add 32 bit PC relative relocation for AVR target. gas/ChangeLog 2015-07-06 Pitchumani Sivanupandi <pitchumani.s@atmel.com> * config/tc-avr.c (tc_gen_reloc): Change 32 bit relocation to 32 bit PC relative and update offset if the fixup is pc-relative. * config/tc-avr.h (DIFF_EXPR_OK): Define to enable PC relative diff relocs. gas/testsuite/ChangeLog 2015-07-06 Pitchumani Sivanupandi <pitchumani.s@atmel.com> * gas/avr/pc-relative-reloc.d: New test for 32 bit pc relative reloc. * gas/avr/per-function-debugline.s: New test source. include/ChangeLog 2015-07-06 Pitchumani Sivanupandi <pitchumani.s@atmel.com> * elf/avr.h: Add new 32 bit PC relative relocation. ld/testsuite/ChangeLog 2015-07-06 Pitchumani Sivanupandi <pitchumani.s@atmel.com> * ld-avr/gc-section-debugline.d: New test. * ld-avr/per-function-debugline.s: Source for new test.
2015-07-05Fix an opd->append index in elf64-ppc.cRichard Sandiford7-0/+138
bfd/ * elf64-ppc.c (toc_adjusting_stub_needed): Use the symbol value plus addend rather than the original st_value when looking up entries in opd->adjust. ld/testsuite/ * ld-powerpc/tocopt6-inc.s, ld-powerpc/tocopt6a.s, ld-powerpc/tocopt6b.s, ld-powerpc/tocopt6c.s, ld-powerpc/tocopt6.d: New test. * ld-powerpc/powerpc.exp (ppc64elftests): Add it.
2015-07-03Add experimental support for --gc-sections with COFF and PE based targets.Kai Tietz7-52/+82
PR ld/11539 bfd * coffcode.h (coff_bfd_gc_sections): Define default to bfd_coff_gc_sections function. * cofflink.c (init_reloc_cookie): Copy and adjust coff related code about gc-sections from elflink.c to here. (fini_reloc_cookie): Likewise. (init_reloc_cookie_rels): Likewise. (fini_reloc_cookie_rels): Likewise. (init_reloc_cookie_for_section): Likewise. (fini_reloc_cookie_for_section): Likewise. (_bfd_coff_gc_mark_hook): Likewise. (_bfd_coff_gc_mark_rsec): Likewise. (_bfd_coff_gc_mark_reloc): Likewise. (_bfd_coff_gc_mark): Likewise. (_bfd_coff_gc_mark_extra_sections): Likewise. (coff_gc_sweep_symbol_info): Likewise. (coff_gc_sweep_symbol): Likewise. (gc_sweep_hook_fn): Likewise. (coff_gc_sweep): Likewise. (bfd_coff_gc_sections): Likewise. (_bfd_coff_gc_keep): Likewise. * libcoff.h (coff_reloc_cookie): New struct. (bfd_coff_gc_sections): New prototype. (coff_gc_mark_hook_fn): New type. ld * scripttempl/pep.sc: Mark .idata*, .CRT*, .tls*, .rsrc*, .init, .ctor*, .dtor*, .fini, .jcr, .eh_frame, .pdata. .xdata, and .gcc_except_table sections as KEEP. * scripttempl/pe.sc: Likewise.
2015-07-03Correct ld Makefile dependendcy for or1kAlan Modra3-4/+9
* Makefile.am (eelf32or1k.c, eelf32or1k_linux.c): Depend on ELF_DEPS. * Makefile.in: Regenerate.
2015-07-01Add Nios II arch flags and compatibility testsSandra Loosemore6-1/+64
2015-07-01 Sandra Loosemore <sandra@codesourcery.com> Cesar Philippidis <cesar@codesourcery.com> bfd/ * archures.c (bfd_mach_nios2r1, bfd_mach_nios2r2): New. * bfd-in2.h: Regenerated. * cpu-nios2.c (nios2_compatible): New. (N): Use nios2_compatible instead of bfd_default_compatible. (NIOS2R1_NEXT, NIOS2R2_NEXT): Define. (arch_info_struct): New. (bfd_nios2_arch): Chain to NIOS2R1_NEXT. * elf32-nios2.c (is_nios2_elf): New. (nios2_elf32_merge_private_bfd_data): New. (nios2_elf32_object_p): New. (bfd_elf32_bfd_merge_private_bfd_data): Define. (elf_backend_object_p): Define. gas/ * config/tc-nios2.c: Adjust includes. (OPTION_MARCH): Define. (md_longopts): Add -march option. (nios2_architecture): New. (nios2_use_arch): New. (md_parse_option): Handle OPTION_MARCH. (md_show_usage): Document -march. (md_begin): Set arch in BFD. (nios2_elf_final_processing): New. * config/tc-nios2.h (elf_tc_final_processing): Define. (nios2_elf_final_processing): New. * doc/c-nios2.texi (-march): Add documentation. include/elf/ * nios2.h (EF_NIOS2_ARCH_R1, EF_NIOS2_ARCH_R2): Define. ld/testsuite/ * ld-nios2/mixed1a.d: New. * ld-nios2/mixed1a.s: New. * ld-nios2/mixed1b.d: New. * ld-nios2/mixed1b.s: New. * ld-nios2/nios2.exp: Build the new compatibility tests.
2015-06-28Remove COMPRESS_DEBUG_ZLIBH.J. Lu2-1/+6
COMPRESS_DEBUG_ZLIB isn't needed. This patch removes COMPRESS_DEBUG_ZLIB and replace COMPRESS_DEBUG_ZLIB with COMPRESS_DEBUG_GNU_ZLIB. bfd/ * bfd-in.h (compressed_debug_section_type): Remove COMPRESS_DEBUG_ZLIB. * bfd-in2.h : Regenerated. gas/ * as.c (parse_args): Replace COMPRESS_DEBUG_ZLIB with COMPRESS_DEBUG_GNU_ZLIB. * config/tc-i386.c (flag_compress_debug): Likewise. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Replace COMPRESS_DEBUG_ZLIB with COMPRESS_DEBUG_GNU_ZLIB.
2015-06-27Update xtensa linker testsH.J. Lu3-28/+37
* ld-xtensa/tlsbin.rd: Updated. * ld-xtensa/tlspic.rd: Likewise.
2015-06-26Compile-in IAMCU linker scriptsH.J. Lu2-0/+5
* emulparams/elf_iamcu.sh (COMPILE_IN): New.
2015-06-26Add support for DT_MIPS_RLD_MAP_REL.Matthew Fortune20-11/+123
This tag makes it possible to access the debug map when debugging position independent executables. bfd/ * elfxx-mips.c (_bfd_mips_elf_create_dynamic_sections): Use executable instead of !shared to indicate an application vs shared library. (_bfd_mips_elf_size_dynamic_sections): Likewise. (_bfd_mips_elf_finish_dynamic_sections): Handle DT_MIPS_RLD_MAP_REL. (_bfd_mips_elf_get_target_dtag): Likewise. binutils/ * readelf.c (get_mips_dynamic_type): Handle DT_MIPS_RLD_MAP_REL. include/ * elf/mips.h (DT_MIPS_RLD_MAP_REL): New macro. ld/testsuite/ * ld-mips-elf/pic-and-nonpic-3b.ad: Adjust for extra dynamic tag. * ld-mips-elf/pic-and-nonpic-4b.ad: Likewise. * ld-mips-elf/pic-and-nonpic-5b.ad: Likewise. * ld-mips-elf/pic-and-nonpic-6-n32.ad: Likewise. * ld-mips-elf/pic-and-nonpic-6-n64.ad: Likewise. * ld-mips-elf/pic-and-nonpic-6-o32.ad: Likewise. * ld-mips-elf/tlsdyn-o32-1.d: Likewise. * ld-mips-elf/tlsdyn-o32-1.got: Likewise. * ld-mips-elf/tlsdyn-o32-2.d: Likewise. * ld-mips-elf/tlsdyn-o32-2.got: Likewise. * ld-mips-elf/tlsdyn-o32-3.d: Likewise. * ld-mips-elf/tlsdyn-o32-3.got: Likewise. * ld-mips-elf/tlsdyn-o32.d: Likewise. * ld-mips-elf/tlsdyn-o32.got: Likewise. * ld-mips-elf/pie-n32.d: New file. * ld-mips-elf/pie-n64.d: Likewise. * ld-mips-elf/pie-o32.d: Likewise. * ld-mips-elf/pie.s: Likewise. * ld-mips-elf/mips-elf.exp: Add new tests.
2015-06-25Run ld-elf/strtab only on linux/gnu targetsH.J. Lu2-0/+5
Since not all ELF targets support -shared, we limit ld-elf/strtab to linux and gnu targets. * ld-elf/strtab.d: Only run on *-*-linux* and *-*-gnu* targets.
2015-06-25Update .strtab section sizes in mmix testsH.J. Lu4-3/+9
Since commit ef10c3ace00674e8c3599c3bf95f06c87d68898b may reduce .strtab section size, we need to adjust expected .strtab section sizes in mmix tests. gas/testsuite/ * gas/mmix/loc-3.d: Updated. * gas/mmix/loc-5.d: Likewise. ld/testsuite/ * ld-mmix/bspec1.d: Updated. * ld-mmix/bspec2.d: Likewise. * ld-mmix/undef-3.d: Likewise.
2015-06-25Use strtab with GC and suffix merging for .strtabH.J. Lu3-0/+21
This patch uses ELF strtab with GC and suffix merging support to create ELF .strtab section. There is some small memory overhead to use ELF strtab: ==14928== HEAP SUMMARY: ==14928== in use at exit: 3,276,318 bytes in 679 blocks ==14928== total heap usage: 1,544 allocs, 865 frees, 15,259,146 bytes allocated vs. ==14936== HEAP SUMMARY: ==14936== in use at exit: 3,276,318 bytes in 679 blocks ==14936== total heap usage: 1,532 allocs, 853 frees, 15,026,402 bytes allocated when running: ./ld-new -m elf_x86_64 -o tmpdir/ld-partial.o -r ldgram.o ldlex-wrapper.o lexsup.o ldlang.o mri.o ldctor.o ldmain.o plugin.o ldwrite.o ldexp.o ldemul.o ldver.o ldmisc.o ldfile.o ldcref.o eelf_x86_64.o eelf32_x86_64.o eelf_i386.o eelf_iamcu.o ei386linux.o eelf_l1om.o eelf_k1om.o ldbuildid.o The results are [32] .strtab STRTAB 0+ 3beff8 00407a 00 0 0 1 vs [32] .strtab STRTAB 0+ 3beff8 0041d8 00 0 0 1 It reduces the .strtab size by 350 bytes, about 2% Saving on libc.so from glibc is much more since libc.so has many alias symbols with the same suffix. For x32 glibc, [82] .strtab STRTAB 0+ 81b348 0159e7 00 0 0 1 vs [82] .strtab STRTAB 0+ 81b8bc 019e72 00 0 0 1 It reduces the .strtab size by 17547 bytes, about 16%. bfd/ PR gas/18451 * elf-bfd.h (elf_sym_strtab): New. (elf_link_hash_table): Add strtabcount, strtabsize and strtab. (_bfd_elf_stringtab_init): Removed. * elf.c (_bfd_elf_stringtab_init): Removed. (_bfd_elf_compute_section_file_positions): Replace bfd_strtab_hash/_bfd_elf_stringtab_init/_bfd_stringtab_free/ _bfd_stringtab_size with elf_strtab_hash/_bfd_elf_strtab_init/_bfd_elf_strtab_free/ _bfd_elf_strtab_size. Use _bfd_elf_strtab_add, _bfd_elf_strtab_finalize and _bfd_elf_strtab_offset to get st_name. (swap_out_syms): Likewise. * elflink.c (elf_final_link_info): Replace bfd_strtab_hash with elf_strtab_hash. Remove symbuf, symbuf_count, symbuf_size and shndxbuf_size. (elf_link_flush_output_syms): Removed. (elf_link_output_sym): Renamed to ... (elf_link_output_symstrtab): This. Replace _bfd_stringtab_add with _bfd_elf_strtab_add. Don't flush symbols to the file nor swap out symbols. (elf_link_swap_symbols_out): New. (elf_link_output_extsym): Replace elf_link_output_sym with elf_link_output_symstrtab. (elf_link_input_bfd): Likewise. (elf_final_link_free): Replace _bfd_stringtab_free with _bfd_elf_strtab_free. Remove symbuf. (bfd_elf_final_link): Replace _bfd_elf_stringtab_init with _bfd_elf_strtab_init. Don't set symbuf, symbuf_count, symbuf_size nor shndxbuf_size. Initialize strtabsize and strtab. Initialize symshndxbuf to -1 when number of sections >= 64K. Replace elf_link_output_sym/elf_link_output_sym with elf_link_output_symstrtab/elf_link_output_symstrtab. Don't call elf_link_flush_output_syms. Call _bfd_elf_strtab_finalize and elf_link_swap_symbols_out. Replace _bfd_stringtab_size and _bfd_stringtab_emit with _bfd_elf_strtab_size and _bfd_elf_strtab_emit. gas/testsuite/ PR gas/18451 * gas/elf/elf.exp: Run strtab. * gas/elf/strtab.d: New file. * gas/elf/strtab.s: Likewise. ld/testsuite/ PR gas/18451 * ld-elf/strtab.d: New file. * ld-elf/strtab.s: Likewise.
2015-06-24Keep .plt section and DT_PLTGOT for prelinkH.J. Lu7-4/+35
Since the .plt section and DT_PLTGOT are used by prelink to undo prelinking for dynamic relocations, we must keep them even if there is no PLT relocation. This patch reverted commit a3747075a. bfd/ * elf32-i386.c (elf_i386_allocate_dynrelocs): Always allocate space for the first .plt entry. (elf_i386_size_dynamic_sections): Always add DT_PLTGOT for .plt section. Add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL only if there are PLT relocations. * elf64-x86-64.c (elf_x86_64_allocate_dynrelocs): Always allocate space for the first .plt entry. (elf_x86_64_size_dynamic_sections): Always add DT_PLTGOT for .plt section. Add DT_PLTRELSZ, DT_PLTREL and DT_JMPREL only if there are PLT relocations. ld/testsuite/ * ld-i386/i386.exp: Run pltgot-2 for Linux targets. * ld-x86-64/x86-64.exp: Likewise. * ld-i386/pltgot-1.d: Updated. * ld-x86-64/pltgot-1.d: Likewise. * ld-i386/pltgot-2.d: New file. * ld-x86-64/pltgot-2.d: Likewise.
2015-06-23[AArch64] Generate DT_TEXTREL for relocation against read-only sectionJiong Wang4-0/+24
2015-06-23 Jiong Wang <jiong.wang@arm.com> bfd/ * elfnn-aarch64.c (aarch64_readonly_dynrelocs): New function. (elfNN_aarch64_size_dynamic_sections): Traverse hash table to check relocations against read-only sections. ld/testsuite/ * ld-aarch64/dt_textrel.s: New testcase. * ld-aarch64/dt_textrel.d: New expectation file. * ld-aarch64/aarch64-elf.exp: Run new testcase.
2015-06-17[AArch64] Select correct linker emulation for ILP32 according to endianesJiong Wang3-10/+24
2015-06-17 Jiong Wang <jiong.wang@arm.com> ld/testsuite/ * ld-aarch64/aarch64-elf.exp (aarch64_choose_ilp32_emul): New function. * ld-aarch64/emit-relocs-28.d: Use aarch64_choose_ilp32_emul to choose emulation mode.
2015-06-16ppc476 linker workaround shared lib fixes againAlan Modra4-21/+55
Huh, I can't even write a binary search properly. bfd/ * elf32-ppc.c (ppc_elf_relocate_section): Correct binary search of dynamic relocs. ld/testsuite/ * ld-powerpc/ppc476-shared.s: Repeat dynamic reloc generating insns. * ld-powerpc/ppc476-shared.d: Update. * ld-powerpc/ppc476-shared2.d: Update.
2015-06-15Fix a segmentation fault triggered when trying to handle an unresolved PE ↵Nick Clifton3-2/+27
symbol with a very long name. PR ld/18466 * emultempl/pe.em (pe_find_data_imports): Generate an error if a symbol name is too long to handle. * emultempl/pep.em (pep_find_data_imports): Likewise.
2015-06-12Add new ld option: --print-memory-usageTristan Gingold20-0/+226
ld/ * NEWS: Mention new option. * lexsup.c (parse_args): Handle --print-memory-usage. (ld_options): Add --print-memory-usage. * ldmain.c (main): Call lang_print_memory_usage. * ldlex.h (enum option_values): Add OPTION_PRINT_MEMORY_USAGE. * ldlang.h: Add prototype of lang_print_memory_usage. * ldlang.c (lang_print_memory_size, lang_print_memory_usage): New functions. * ld.texinfo (Options): Document --print-memory-usage. * ld.h (args_type): Add print_memory_usage field. ld/testsuite/ * ld-scripts/print-memory-usage-1.t, * ld-scripts/print-memory-usage-1.s, * ld-scripts/print-memory-usage-1.l, * ld-scripts/print-memory-usage-2.t, * ld-scripts/print-memory-usage-2.l, * ld-scripts/print-memory-usage-3.s, * ld-scripts/print-memory-usage-3.t, * ld-scripts/print-memory-usage-3.l, * ld-scripts/print-memory-usage.t: New tests. * ld-scripts/print-memory-usage.exp: Run them.
2015-06-08Update French Translations for LD and GOLD.Nick Clifton2-220/+223
ld * po/fr.po: Updated French Translation. gold * po/fr.po: New French Translation.
2015-06-05Fixes a typo in the list of targets that should not run the compressed1d test.Nick Clifton2-1/+5
* ld-elf/compressed1d.d: Fix typo: iq200 -> iq2000.
2015-06-05ppc476 linker workaround shared lib fixesAlan Modra6-0/+72
When building a shared lib from non-PIC objects, we'll get dynamic text relocations. These need to move with any insns we move. Otherwise the dynamic reloc will modify the branch, resulting in crashes and other unpleasant behaviour. Also, ld -r --ppc476-workaround used with sufficiently aligned PIC objects needs a fix for emitted REL16 relocs. bfd/ * elf64-ppc.c (ppc_elf_relocate_section): Move dynamic text relocs with insns moved by --ppc476-workaround. Correct output of REL16 relocs. ld/testsuite/ * ld-powerpc/ppc476-shared.s, * ld-powerpc/ppc476-shared.lnk, * ld-powerpc/ppc476-shared.d, * ld-powerpc/ppc476-shared2.d: New tests. * ld-powerpc/powerpc.exp: Run them.
2015-06-03[AArch64] Revert local changes included in Matthew's commitJiong Wang1-1/+1
When commit the following code for Matthew, I wrongly included my local changes. Revert it. Sorry. commit a5932920ef397c2cbe02efa915686022b78d59a7 Author: Matthew Wahab <matthew.wahab@arm.com> Date: Wed Jun 3 10:03:50 2015 +0100
2015-06-03[ARM] Support for ARMv8.1 command line optionMatthew Wahab1-1/+1
2015-06-03 Matthew Wahab <matthew.wahab@arm.com> gas/ * config/tc-arm.c (arm_archs): Add "armv8.1-a". * doc/c-arm.texi (ARM Options, -march): Add "armv8.1-a". * NEWS: Mention ARMv8.1 support. include/opcode/ * arm.h (FPU_ARCH_CRYPTO_NEON_VFP_ARMV8_1): New. (ARM_ARCH_V8_1A): New. (ARM_ARCH_V8_1A_FP): New. (ARM_ARCH_V8_1A_SIMD): New. (ARM_ARCH_V8_1A_CRYPTOV1): New. (ARM_FEATURE_CORE): New.
2015-06-02[AArch64] Fix typo in testcaseJiong Wang2-3/+7
ld/testsuite/ * ld-aarch64/emit-relocs-313.s: Use gotpage_lo15.