Commit Graph

11758 Commits

Author SHA1 Message Date
GDB Administrator 641754af2b Automatic date update in version.in 2015-03-18 00:00:08 +00:00
Alan Modra c4b0b099b8 Fix elf64-ppc.c electric fence warning
* elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Return count of 0
	on nothing to do, before malloc of returned symbol array.
2015-03-17 13:41:01 +10:30
GDB Administrator 4d22acce07 Automatic date update in version.in 2015-03-17 00:00:08 +00:00
Nick Clifton 9c761a5541 Fixes a problem with the RX port trying to perform linker relaxation when -no-keep-memory has been enabled.
* elf32-rx.c (elf32_rx_relax_delete_bytes): If the relocs are not
	stored in the elf_section_data structure then load them as
	necessary.
2015-03-16 11:14:07 +00:00
GDB Administrator a4f851ffab Automatic date update in version.in 2015-03-16 00:00:08 +00:00
GDB Administrator c2cdb853dc Automatic date update in version.in 2015-03-15 00:00:07 +00:00
Andreas Krebbel b9005ba76e S/390: Disable relocation sort against code sections.
When downgrading from GD to IE model we rewrite the call to
__tls_get_offset to a 64 bit load instruction. This relies on the fact
that the additional relocation for the call target has already been
executed when doing the rewrite.

   f1018:       e3 20 d0 00 00 04       lg      %r2,0(%r13)
   f101e:       c0 e5 00 00 00 00       brasl   %r14,f101e <__res_init+0x1e>
                        f101e: R_390_TLS_GDCALL __libc_resp
                        f1020: R_390_PLT32DBL   __tls_get_offset+0x2

0000000f1020  39f6c00000014 R_390_PLT32DBL    0000000000000000 __tls_get_offset + 2
0000000f101e  3afb700000026 R_390_TLS_GDCALL  0000000000000008 __libc_resp + 0

Due to the reloc sorting the order changed an the PLT32DBL reloc is
executed after the rewrite and overwrites part of the load instruction
with garbage.

bfd/
2015-03-14  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

	* elf-s390-common.c (elf_s390_elf_sort_relocs_p): Don't sort
	relocs against code sections.
	* elf32-s390.c: Define elf_backend_sort_relocs_p.
	* elf64-s390.c: Likewise.
2015-03-14 11:45:05 +01:00
GDB Administrator e94dfb0747 Automatic date update in version.in 2015-03-14 00:00:08 +00:00
GDB Administrator a1894d4393 Automatic date update in version.in 2015-03-13 00:00:07 +00:00
GDB Administrator 9773715938 Automatic date update in version.in 2015-03-12 00:00:07 +00:00
Alan Modra 1079403cc0 Fix ppc32 synthetic symbols when __tls_get_addr_opt stub is generated
Also update the 32-bit tls testcases to be secure plt.

bfd/
	* elf32-ppc.c (ppc_elf_get_synthetic_symtab): Examine stubs in
	reverse order.  Account for larger size of __tls_get_addr_opt stub.
ld/testsuite/
	* ld-powerpc/tls32.s: Add GOT pointer setup.
	* ld-powerpc/tls32.d: Update.
	* ld-powerpc/tls32.g: Update.
	* ld-powerpc/tls32.t: Update.
	* ld-powerpc/tlsexe.d: Update.
	* ld-powerpc/tlsexe32.d: Update.
	* ld-powerpc/tlsexe32.g: Update.
	* ld-powerpc/tlsexe32.r: Update.
	* ld-powerpc/tlsexetoc.d: Update.
	* ld-powerpc/tlsso32.d: Update.
	* ld-powerpc/tlsso32.g: Update.
	* ld-powerpc/tlsso32.r: Update.
2015-03-11 18:04:25 +10:30
GDB Administrator 796ecec4cf Automatic date update in version.in 2015-03-11 00:00:07 +00:00
Jiong Wang a5721eddd1 [ARM] PR ld/16572: Remove EF_ARM_HASENTRY flag
bfd/
2015-03-10  Yuri Gribov  <y.gribov@samsung.arm>

	PR ld/16572
	* elf32-arm.c (elf32_arm_final_link_relocate): Remove
	support for ELF_ARM_HASENTRY.
	(elf32_arm_print_private_bfd_data): Likewise.

binutils/
2015-03-10  Yuri Gribov  <y.gribov@samsung.arm>

	PR ld/16572
	* readelf.c: Remove support for ELF_ARM_HASENTRY.

include/
2015-03-10  Matthew Wahab  <matthew.wahab@arm.com>

	PR ld/16572
	* elf/arm.h (EF_ARM_HASENTRY): Remove.
2015-03-10 11:15:13 +00:00
GDB Administrator a24582147f Automatic date update in version.in 2015-03-10 00:00:08 +00:00
GDB Administrator ccf946cb5c Automatic date update in version.in 2015-03-09 00:00:08 +00:00
GDB Administrator d1771b7685 Automatic date update in version.in 2015-03-08 00:00:08 +00:00
GDB Administrator f6162ff58e Automatic date update in version.in 2015-03-07 00:00:08 +00:00
Nick Clifton 65164438aa Fix an undefined 32-bit right shift by replacing it with two 16-bit right shifts.
PR binutils/17765
	* elflink.c (put_value): Like previous delta, but for the 32-bit
	case.
2015-03-06 09:46:15 +00:00
GDB Administrator e80417caef Automatic date update in version.in 2015-03-06 00:00:08 +00:00
Nick Clifton 41cd1ad1b9 Fix a potentially undefined right shift by replacing it with two smaller right shifts.
PR binutils/17765
	* elflink.c (put_value): Avoid using an undefined shift
	operation.
2015-03-05 17:26:10 +00:00
H.J. Lu ca3fe95e46 Add extern_protected_data and set it for x86
With copy relocation, address of protected data defined in the shared
library may be external.  This patch adds extern_protected_data and
changes _bfd_elf_symbol_refs_local_p to return false for protected data
if extern_protected_data is true.

bfd/

	PR ld/pr15228
	PR ld/pr17709
	* elf-bfd.h (elf_backend_data): Add extern_protected_data.
	* elf32-i386.c (elf_backend_extern_protected_data): New.
	Defined to 1.
	* elf64-x86-64.c (elf_backend_extern_protected_data): Likewise.
	* elflink.c (_bfd_elf_adjust_dynamic_copy): Don't error on
	copy relocs against protected symbols if extern_protected_data
	is true.
	(_bfd_elf_symbol_refs_local_p): Don't return true on protected
	non-function symbols if extern_protected_data is true.
	* elfxx-target.h (elf_backend_extern_protected_data): New.
	Default to 0.
	(elfNN_bed): Initialize extern_protected_data with
	elf_backend_extern_protected_data.

ld/testsuite/

	PR ld/pr15228
	PR ld/pr17709
	* ld-i386/i386.exp (i386tests): Add a test for PR ld/17709.
	* ld-i386/pr17709-nacl.rd: New file.
	* ld-i386/pr17709.rd: Likewise.
	* ld-i386/pr17709a.s: Likewise.
	* ld-i386/pr17709b.s: Likewise.
	* ld-i386/protected3.d: Updated.
	* ld-i386/protected3.s: Likewise.
	* ld-x86-64/pr17709-nacl.rd: New file.
	* ld-x86-64/pr17709.rd: Likewise.
	* ld-x86-64/pr17709a.s: Likewise.
	* ld-x86-64/pr17709b.s: Likewise.
	* ld-x86-64/protected3.d: Updated.
	* ld-x86-64/protected3.s: Likewise.
	* ld-x86-64/x86-64.exp (x86_64tests): Add a test for PR ld/17709.
2015-03-05 06:34:53 -08:00
Nick Clifton 425bd9e1bb Allows the binutils to cope with PE binaries where the section addresses have been changed, but the DWARF debug info has not been altered.
PR binutils/18025
	* coffgen.c (coff_find_nearest_line_with_names): If the dwarf2
	lookup fails, check for an address bias in the dwarf info, and if
	one exists, retry the lookup with the biased value.
	* dwarf2.c (_bfd_dwarf2_find_symbol_bias): New function.
	Determines if a bias exists bewteen the addresses of functions
	based on DWARF information vs symbol table information.
	* libbfd-in.h (_bfd_dwarf2_find_symbol_bias): Prototype.
	* libbfd.h: Regenerate.
2015-03-05 12:14:26 +00:00
GDB Administrator 7e848b1a60 Automatic date update in version.in 2015-03-05 00:00:08 +00:00
Marcus Shawcroft 8ef229f32b [AArch64] Removing unused functions.
Removing a group of unused functions from the AArch64 BFD backend.
2015-03-04 12:30:34 +00:00
Marcus Shawcroft 8e2fe09f70 [AArch64] Call abort() consistently in unhandled stub switch statements.
Ensure we hard stop via abort() for unhandled stub types rather than
continuing either silently (or noisly with a BFD_FAIL()).

Call abort() giving a hard stop rather than BFD_FAIL () for unhandled
stub types.
2015-03-04 12:30:32 +00:00
Andreas Arnez df88b70224 S390: Place "s390:31-bit" after default arch in 64-bit arch list
On 64-bit platforms GDB did not include "s390:31-bit" in its list of
architecture names.  This patch fixes that.

To determine the list of architecture names for S390,
gdbarch_printable_names() walks through the linked list of BFD arches
starting with the default S390 arch, which is "s390:64-bit" on 64-bit
platforms.  But since "s390:64-bit" was at the end of that list, the
31-bit architecture was not reached.  The patch swaps the elements of
that list on 64-bit platforms.

bfd/ChangeLog:

	* cpu-s390.c (N): New macro.
	(bfd_s390_31_arch): New.  Define only if default target word size
	is 64 bits.  Otherwise define...
	(bfd_390_64_arch): ...this.  Make static.
	(bfd_s390_arch): Define according to the default target word size.
	Let the 'next' field point to the alternate arch.
2015-03-04 10:40:39 +01:00
Richard Sandiford e09ab7ac78 Allow MOVK for R_AARCH64_TLSLE_MOVW_TPREL_G{0,1}NC
bfd/
	PR gas/17843
	* elfxx-aarch64.c (_bfd_aarch64_elf_put_addend): Expect
	R_AARCH64_TLSLE_MOVW_TPREL_G0_NC and R_AARCH64_TLSLE_MOVW_TPREL_G1_NC
	to be used with MOVK rather than MOVZ.

gas/
	PR gas/17843
	* config/tc-aarch64.c (process_movw_reloc_info): Allow
	R_AARCH64_TLSLE_MOVW_TPREL_G0_NC and R_AARCH64_TLSLE_MOVW_TPREL_G1_NC
	for MOVK.

gas/testsuite/
	PR gas/17843
	* gas/aarch64/tls.s, gas/aarch64/tls.d: Add test for
	R_AARCH64_TLSLE_MOVW_TPREL_G0/R_AARCH64_TLSLE_MOVW_TPREL_G1_NC
	sequence.

ld/testsuite/
	PR gas/17843
	* ld-aarch64/tlsle.s, ld-aarch64/tlsle.d: New test.
	* ld-aarch64/aarch64-elf.exp: Run it.
2015-03-04 09:09:05 +00:00
GDB Administrator bb3d65e427 Automatic date update in version.in 2015-03-04 00:00:08 +00:00
DJ Delorie 71eef2bd8d RL78 - fix ADDR16 relax
* elf32-rl78.c (rl78_elf_relax_section): Only relax ADDR16's if
there's a symbol.
2015-03-03 17:57:39 -05:00
GDB Administrator cfe6bf4392 Automatic date update in version.in 2015-03-03 00:00:07 +00:00
GDB Administrator a07229507b Automatic date update in version.in 2015-03-02 00:00:07 +00:00
GDB Administrator 3ea9863f6b Automatic date update in version.in 2015-03-01 00:00:07 +00:00
Alan Modra f01f1741df Tweak ppc32 tls_get_addr optimisation
This patch is cosmetic.  It prevents references to __tls_get_addr_opt
(an alias for __tls_get_addr) when the optimisation isn't possible.

	* elf32-ppc.c (ppc_elf_tls_setup): Set no_tls_get_addr_opt if
	not PLT_NEW.
2015-02-28 13:09:11 +10:30
GDB Administrator eb704cb656 Automatic date update in version.in 2015-02-28 00:00:08 +00:00
H.J. Lu c1d11331c9 Convert mov to lea only if needed
We can convert mov to lea only if there are R_386_GOT32/R_X86_64_GOTPCREL
relocations against non IFUNC symbols.

	* elf32-i386.c (need_convert_mov_to_lea): New.
	(elf_i386_check_relocs): Set need_convert_mov_to_lea if needed.
	(elf_i386_convert_mov_to_lea): Return TRUE if
	need_convert_mov_to_lea is unset.
	* elf64-x86-64.c (need_convert_mov_to_lea): New.
	(elf_x86_64_check_relocs): Set need_convert_mov_to_lea if needed.
	(elf_x86_64_convert_mov_to_lea): Return TRUE if
	need_convert_mov_to_lea is unset.
2015-02-27 11:35:37 -08:00
Nick Clifton cdb602b175 Fixes a problem recognizing libraries created by Visual Studio.
PR binutils/17910
	* coffgen.c (_bfd_coff_internal_syment_name): Only check for
	string length overflow when the string table length is actually
	set.
2015-02-27 15:40:49 +00:00
Marcus Shawcroft 96c20bc18d Regenerate bfd-in2.h and libbfd.h 2015-02-27 12:25:03 +00:00
Marcus Shawcroft 73920eed1d Adjust ChangeLog entry. 2015-02-27 08:09:23 +00:00
GDB Administrator 2ae824de90 Automatic date update in version.in 2015-02-27 00:00:08 +00:00
Marcus Shawcroft 1ada945d05 [AArch64] Add support for :tlsdesc: and TLSDESC_LD_PREL19 2015-02-26 22:59:23 +00:00
Marcus Shawcroft 389b8029b6 [AArch64] Add support for :tlsdesc: and TLSDESC_ADR_PREL21 2015-02-26 22:59:16 +00:00
Marcus Shawcroft 3c12b05436 Add ADR :tlsgd: directive and TLSGD_ADR_PREL21 support. 2015-02-26 22:23:09 +00:00
Marcus Shawcroft 043bf05a3d Adding support for TLSIE_LD_GOTTREL_PREL19. 2015-02-26 22:23:09 +00:00
Marcus Shawcroft 7366006f66 Fix field size for TLSDESC_CALL
This relocation is a marker and does not result in a modification to
the binary.  Changing the HOWTO bit field width to reflect this
property.
2015-02-26 22:23:08 +00:00
Marcus Shawcroft 07875fbce7 Fix field size for TLSLE_MOVW_TPREL_* relocations.
The HOWTO table entries for the TLSLE_MOVW_TPREL_* relocations are
wrong by inspection.  The current implementation does not actually use
these field widths for these relocations but they should be corrected.
2015-02-26 22:23:08 +00:00
Marcus Shawcroft 49d8f92c6e Fix TLSIE_MOVW_GOTTPREL_G0_NC field size. 2015-02-26 22:23:08 +00:00
Nick Clifton c86934ceee Fixes illegal memory access errors and arithmetic overflows when running strip on fuzzed binaries.
PR binutils/17512
	* coffcode.h (coff_compute_section_file_positions): Report
	negative page sizes.
	* elf.c (elf_fake_sections): Handle excessive alignmment powers.
	(assign_file_positions_for_non_load_sections): Replace assertion
	with an error message.
	(rewrite_elf_program_header): Handle excessive segment
	alignments.
	* mach-o.c (bfd_mach_o_read_section_32): Likewise.
	(bfd_mach_o_read_section_64): Likewise.
	* peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Use %B to
	print a bfd name, not %A.
2015-02-26 21:32:04 +00:00
Alan Modra bd4d2eaad0 PowerPC64 thread-safe stubs not needed for iplt
I was looking at a current glibc using objdump today and saw an odd
plt call stub.

0000000000044d80 <00000033.plt_call.__strchrnul>:
   44d80:       f8 41 00 28     std     r2,40(r1)
   44d84:       e9 82 8c f8     ld      r12,-29448(r2)
   44d88:       7d 89 03 a6     mtctr   r12
   44d8c:       e8 42 8d 00     ld      r2,-29440(r2)
   44d90:       28 22 00 00     cmpldi  r2,0
   44d94:       4c e2 04 20     bnectr+
   44d98:       48 13 84 f0     b       17d288 <realloc@plt>

What?  It doesn't branch to __strchrnul@plt on finding a zero r2?

Turns out this isn't a real problem since the stub is for loading an
ifunc, so will not be lazily resolved and thus r2 will never be zero.
Of course, that means the thread-safety check is unnecessary.

I also tweak the special __tls_get_addr_opt call stub here, to
restore r2 immediately after the call.  Not doing that might affect
eh_frame unwinding.

	* elf64-ppc.c (plt_stub_size, build_plt_stub): Don't build
	thread-safe stubs for iplt.
	(build_tls_get_addr_stub): Restore r2 immediately after call.
2015-02-26 21:49:54 +10:30
Terry Guo 99654aaf36 [ARM]Update for Tag_ABI_HardFP_use per EABI doc
Updated how we merge and display this attribute per the latest
EABI documents.

bfd/ChangeLog
	* elf32-arm.c (elf32_arm_merge_eabi_attributes): Update how we
	merge Tag_ABI_HardFP_use.

binutils/ChangeLog
	* readelf.c (arm_attr_tag_ABI_HardFP_use): Update how we
	display it.

ld/testsuite/ChangeLog
	* ld-arm/attr-merge-3.attr: Remove Tag_ABI_HardFP_use.
	* ld-arm/attr-merge-vfp-10.d: Likewise.
	* ld-arm/attr-merge-vfp-10r.d: Likewise.
	* ld-arm/attr-merge-vfp-12.d: Likewise.
	* ld-arm/attr-merge-vfp-12r.d: Likewise.
	* ld-arm/attr-merge-vfp-13.d: Likewise.
	* ld-arm/attr-merge-vfp-13r.d: Likewise.
	* ld-arm/attr-merge-vfp-14.d: Likewise.
	* ld-arm/attr-merge-vfp-14r.d: Likewise.
	* ld-arm/attr-merge-vfp-6.d: Likewise.
	* ld-arm/attr-merge-vfp-6r.d: Likewise.
	* ld-arm/attr-merge-vfp-7.d: Likewise.
	* ld-arm/attr-merge-vfp-7r.d: Likewise.
	* ld-arm/attr-merge-vfp-8.d: Likewise.
	* ld-arm/attr-merge-vfp-8r.d: Likewise.
2015-02-26 14:11:41 +08:00
Alan Modra a127494f2d Use dynamic text relocs for protected vars
Rather than reporting a link error on attempting to use dynbss for
protected vars, use dynamic text relocs.

	* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Heed -z nocopyreloc.
	Use text relocs rather than giving an error on trying to use
	.dynbss for protected shared lib vars.
	* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Likewise.
2015-02-26 14:09:50 +10:30