Commit Graph

12042 Commits

Author SHA1 Message Date
Nick Clifton 79559014b2 Fix the address size computation for the MSP430 port.
* elf32-msp430.c (uses_large_model): New function.
	(msp430_elf_eh_frame_address_size): New function.
	(elf_backend_eh_frame_address_size): Define.
2015-07-27 15:15:28 +01:00
Szabolcs Nagy 32f573bcb3 [AArch64] Fix extern protected data handling
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 11:48:48 +01:00
Szabolcs Nagy b68a20d667 [ARM] Fix extern protected data handling
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-27 11:45:27 +01:00
GDB Administrator 0c096ed760 Automatic date update in version.in 2015-07-27 00:00:08 +00:00
GDB Administrator 805cee45cd Automatic date update in version.in 2015-07-26 00:00:11 +00:00
H.J. Lu 18d9555c6e Add missing ChangeLog files 2015-07-25 08:10:51 -07:00
H.J. Lu 1659f720b0 Skip missing symbol version section check for executable
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-25 08:07:33 -07:00
Alan Modra a496fbc880 Fix broken -Bsymbolic-functions
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-25 20:41:04 +09:30
GDB Administrator f7d3050b19 Automatic date update in version.in 2015-07-25 00:00:08 +00:00
Alan Modra 91cb26dac4 Correct reloc section name
* elf.c (_bfd_elf_assign_file_positions_for_non_load): Use .rela
	prefix for reloc section corresponding to rela section associated
	with renamed debug section.
2015-07-24 14:48:55 +09:30
Alan Modra 2fb9328d8d bfd_get_section_by_name_if hash chain traversal
This function stops too soon, as I found when the hash chain happened
to contain two .debug_macro sections and a .bss section:
.debug_macro -> .bss -> .debug_macro

	* section.c (bfd_get_section_by_name_if): Iterate over entire hash
	chain.
2015-07-24 14:48:35 +09:30
GDB Administrator f0b0791b05 Automatic date update in version.in 2015-07-24 00:00:14 +00:00
Joseph Myers d5cff5df74 Fix DT_MIPS_RLD_MAP_REL tag for n64 target and 32-bit host.
For the case of MIPS n64 target and 32-bit host, the computation of
the DT_MIPS_RLD_MAP_REL tag involves sdyn->output_section->vma +
sdyn->output_offset (64-bit) being added to b (32-bit host pointer),
so losing the high part and resulting in an incorrect
DT_MIPS_RLD_MAP_REL tag, and all dynamically linked glibc tests
failing for n64.  This patch fixes this (spot-tested with glibc tests;
however, I don't have a self-contained testcase for this bug).

	* elfxx-mips.c (_bfd_mips_elf_finish_dynamic_sections)
	<DT_MIPS_RLD_MAP_REL>: Add target address to host address
	difference, not to host pointer.
2015-07-23 21:52:04 +00:00
GDB Administrator 510fac86d7 Automatic date update in version.in 2015-07-23 00:00:07 +00:00
Alan Modra bb854a36d1 Fix ppc64 ELFv1 assertion failure
Bogus assembly can hit an assertion in opd_entry_value when the symbol
referenced by a function descriptor is undefined.  Worse, the code
after the assert copies unitialised memory to return the code section.
This uninitialised pointer can later be dereferencd, possibly causing
a linker segmentation fault.

	* elf64-ppc.c (opd_entry_value): Remove assertion.  Instead,
	return -1 if symbol referenced is not defined.  Tidy.
2015-07-22 19:20:38 +09:30
GDB Administrator 6dca8d51d5 Automatic date update in version.in 2015-07-22 00:00:08 +00:00
GDB Administrator 391538482e Automatic date update in version.in 2015-07-21 00:00:07 +00:00
H.J. Lu 7ac018954b Make binutils abort message GDB friendly
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-20 05:53:31 -07:00
Alan Modra f2d7e0f450 Regen two files
bfd/
	* po/SRC-POTFILES.in: Regenerate.
binutils/
	* doc/Makefile.in: Regenerate.
2015-07-20 14:31:23 +09:30
GDB Administrator 5e63e45255 Automatic date update in version.in 2015-07-20 00:00:07 +00:00
GDB Administrator 0bda1f8819 Automatic date update in version.in 2015-07-19 00:00:08 +00:00
GDB Administrator ce62125ee9 Automatic date update in version.in 2015-07-18 00:00:08 +00:00
Jiong Wang 4c0a9a6fa1 [AArch64] Sort TLS reloc types alphabetically 2015-07-17 13:03:26 +01:00
GDB Administrator 4f9b735fea Automatic date update in version.in 2015-07-17 00:00:08 +00:00
Jiong Wang 77a69ff840 [AArch64][3/3] LD support BFD_RELOC_AARCH64_TLSLD_ADR_PREL21 2015-07-16 15:46:21 +01:00
Jiong Wang 6c37fedc41 [AArch64][2/3] GAS support BFD_RELOC_AARCH64_TLSLD_ADR_PREL21 2015-07-16 15:43:21 +01:00
GDB Administrator bb20bd8373 Automatic date update in version.in 2015-07-16 00:00:07 +00:00
GDB Administrator 2101878487 Automatic date update in version.in 2015-07-15 00:00:08 +00:00
GDB Administrator 05e83eb1b6 Automatic date update in version.in 2015-07-14 00:00:08 +00:00
GDB Administrator c576455ba7 Automatic date update in version.in 2015-07-13 00:00:08 +00:00
GDB Administrator 9394ff46fb Automatic date update in version.in 2015-07-12 00:00:08 +00:00
GDB Administrator e571fc2b05 Automatic date update in version.in 2015-07-11 00:00:08 +00:00
H.J. Lu 889884731e Properly convert objects between different ELF classes
The output SHF_COMPRESSED section size is different from input if
ELF classes of input and output aren't the same.  We must adjust
the section sizes as well as the compression headers in
SHF_COMPRESSED sections when converting objects between different
ELF classes.

bfd/

	 PR binutils/18656
	 * bfd.c (bfd_convert_section_size): New function.
	 (bfd_convert_section_contents): Likewise.
	 * bfd-in2.h: Regenerated.

binutils/

2015-07-10  H.J. Lu  <hongjiu.lu@intel.com>

	 PR binutils/18656
	 * objcopy.c (setup_section): Call bfd_convert_section_size
	 to get the output section size.
	 (copy_section): Get the section size from the output section
	 and call bfd_get_full_section_contents to convert section
	 contents for output.

binutils/testsuite/

	 PR binutils/18656
	 * binutils-all/compress.exp (convert_test): New proc.
	 Run conversion tests between x86-64 and x32.
2015-07-10 14:27:39 -07:00
GDB Administrator f250f5c6dd Automatic date update in version.in 2015-07-10 00:00:08 +00:00
Catherine Moore de231f2015 2015-07-09 Catherine Moore <clm@codesourcery.com>
* elflink.c (bfd_elf_size_dynamic_sections): Call to
        _bfd_elf_maybe_strip_eh_frame_hdr should be before
        bed->elf_backend_size_dynamic_sections.
2015-07-09 08:07:47 -07:00
GDB Administrator de0ef28545 Automatic date update in version.in 2015-07-09 00:00:07 +00:00
Denis Chertykov 328e7bfdde Define DIFF_EXPR_OK for avr target to allow PC relative difference relocation.
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-08 21:41:52 +03:00
GDB Administrator 501f83eb18 Automatic date update in version.in 2015-07-08 00:00:07 +00:00
GDB Administrator fa446e20d9 Automatic date update in version.in 2015-07-07 00:00:08 +00:00
H.J. Lu 1a617dc351 Remove the merge conflict introduced by
commit 2f0c68f23b
Author: Catherine Moore <clm@codesourcery.com>
Date:   Thu May 28 14:50:36 2015 -0700

    Compact EH Support
2015-07-06 12:03:01 -07:00
GDB Administrator 0d3a523baa Automatic date update in version.in 2015-07-06 00:00:07 +00:00
Richard Sandiford 92a9c616e4 Fix an opd->append index in elf64-ppc.c
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-05 19:57:07 +01:00
GDB Administrator 533edc14b8 Automatic date update in version.in 2015-07-05 00:00:07 +00:00
GDB Administrator e7ba597a2e Automatic date update in version.in 2015-07-04 00:00:08 +00:00
Kai Tietz 0f088b2a94 Add experimental support for --gc-sections with COFF and PE based targets.
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-03 15:50:29 +01:00
GDB Administrator 69ae7f4d16 Automatic date update in version.in 2015-07-03 00:00:08 +00:00
GDB Administrator 7d8d1bd943 Automatic date update in version.in 2015-07-02 00:00:08 +00:00
Sandra Loosemore 8c163c5a87 Relocations for Nios II R2
2015-07-01  Sandra Loosemore  <sandra@codesourcery.com>
	    Cesar Philippidis  <cesar@codesourcery.com>

	bfd/
	* bfd-in2.h: Regenerated.
	* elf32-nios2.c (elf_nios2_howto_table_rel): Rename to...
	(elf_nios2_r1_howto_table_rel): This.
	(elf_nios2_r2_howto_table_rel): New.
	(BFD_IS_R2): New.
	(lookup_howto): Add ABFD parameter.  Adjust to look up in either
	the R1 or R2 relocation table, as determined by ABFD.
	(nios2_reloc_map): Add R2 relocations.
	(nios2_elf32_bfd_reloc_type_lookup): Do lookup using lookup_howto.
	Pass it the ABFD parameter.
	(nios2_elf32_bfd_reloc_name_lookup): Use ABFD to decide whether to
	return an R1 or R2 relocation.
	(nios2_elf32_info_to_howto): Do lookup using lookup_howto.
	Pass it the ABFD parameter.
	(nios2_elf32_do_call26_relocate): Check for alignment on a 4-byte
	boundary.
	(nios2_elf32_relocate_section): Adjust call to lookup_howto.
	* libbfd.h: Regenerated.
	* reloc.c (BFD_RELOC_NIOS2_R2_S12): New.
	(BFD_RELOC_NIOS2_R2_I10_1_PCREL): New.
	(BFD_RELOC_NIOS2_R2_T1I7_1_PCREL): New.
	(BFD_RELOC_NIOS2_R2_T1I7_2): New.
	(BFD_RELOC_NIOS2_R2_T2I4): New.
	(BFD_RELOC_NIOS2_R2_T2I4_1): New.
	(BFD_RELOC_NIOS2_R2_T2I4_2): New.
	(BFD_RELOC_NIOS2_R2_X1I7_2): New.
	(BFD_RELOC_NIOS2_R2_X2L5): New.
	(BFD_RELOC_NIOS2_R2_F1I5_2): New.
	(BFD_RELOC_NIOS2_R2_L5I4X1): New.
	(BFD_RELOC_NIOS2_R2_T1X1I6): New.
	(BFD_RELOC_NIOS2_R2_T1X1I6_2): New.

	include/elf/
	* nios2.h (R_NIOS2_R2_S12): New.
	(R_NIOS2_R2_I10_1_PCREL): New.
	(R_NIOS2_R2_T1I7_1_PCREL): New.
	(R_NIOS2_R2_T1I7_2): New.
	(R_NIOS2_R2_T2I4): New.
	(R_NIOS2_R2_T2I4_1): New.
	(R_NIOS2_R2_T2I4_2): New.
	(R_NIOS2_R2_X1I7_2): New.
	(R_NIOS2_R2_X2L5): New.
	(R_NIOS2_R2_F1I5_2): New.
	(R_NIOS2_R2_L5I4X1): New.
	(R_NIOS2_R2_T1X1I6): New.
	(R_NIOS2_R2_T1X1I6_2): New.
	(R_NIOS2_ILLEGAL): Renumber.
2015-07-01 16:02:09 -07:00
Sandra Loosemore 965b1d8083 Add Nios II arch flags and compatibility tests
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-07-01 15:55:28 -07:00
H.J. Lu dfc87947b5 Refactor elf_x86_64_convert_mov_to_lea
* elf64-x86-64.c (elf_x86_64_convert_mov_to_lea): Refactor.
2015-07-01 09:33:27 -07:00