Commit Graph

13266 Commits

Author SHA1 Message Date
Maciej W. Rozycki 55f8b9d243 MIPS/BFD: Use `bfd_size_type' for dynamic symbol table indices
Use the `bfd_size_type' data type for dynamic symbol table indices in
the MIPS backend, in line with generic code and removing the need to use
a cast.

	bfd/
	* elfxx-mips.c (mips_elf_hash_sort_data): Convert the
	`min_got_dynindx', `max_unref_got_dynindx' and
	`max_non_got_dynindx' members to the `bfd_size_type' data type.
	(mips_elf_sort_hash_table): Adjust accordingly.
2017-02-02 22:37:16 +00:00
Maciej W. Rozycki 0f8c4b60ef MIPS/BFD: Streamline hash table references in `mips_elf_sort_hash_table'
Make all hash table references throughout `mips_elf_sort_hash_table' use
`htab', simplifying code and improving readability.

	bfd/
	* elfxx-mips.c (mips_elf_sort_hash_table): Use `htab' throughout
	to access the hash table.
2017-02-02 22:35:29 +00:00
Maciej W. Rozycki 17a80fa80a MIPS/BFD: Fix assertion in `mips_elf_sort_hash_table'
Move the assertion on non-NULL `htab' in `mips_elf_sort_hash_table' to
the beginning, before the pointer is dereferenced (`mips_elf_hash_table
(info)' and `elf_hash_table (info)' both point to the same memory
location, differently typed).

	bfd/
	* elfxx-mips.c (mips_elf_sort_hash_table): Move assertion on
	non-NULL `htab' to the beginning.
2017-02-02 22:33:40 +00:00
Maciej W. Rozycki 8f56d4fd28 BFD: Wrap overlong error handler call line in `elf_gc_sweep'
bfd/
	* elflink.c (elf_gc_sweep): Wrap overlong line.
2017-02-02 22:17:42 +00:00
GDB Administrator 981d5de71d Automatic date update in version.in 2017-02-02 00:00:33 +00:00
GDB Administrator a8128fa6a7 Automatic date update in version.in 2017-02-01 00:00:22 +00:00
GDB Administrator 07fbc63d1e Automatic date update in version.in 2017-01-31 00:00:20 +00:00
Maciej W. Rozycki 8b10b0b3e1 MIPS: Add options to control branch ISA checks
Complement commit 9d862524f6 ("MIPS: Verify the ISA mode and alignment
of branch and jump targets") and add GAS and LD options to control the
checks for invalid branches between ISA modes introduced there, to help
with some handwritten code lacking `.insn' annotation for labels used as
branch targets and code produced by older versions of GCC which suffers
from the issue with branches to code that has been optimized away,
addressed with GCC commit 242424 ("MIPS/GCC: Mark trailing labels with
`.insn'"), <https://gcc.gnu.org/ml/gcc-patches/2016-11/msg01061.html>.

	bfd/
	* elfxx-mips.h (_bfd_mips_elf_insn32): Rename prototype to...
	(_bfd_mips_elf_linker_flags): ... this.  Add another parameter.
	* elfxx-mips.c (mips_elf_link_hash_table): Add
	`ignore_branch_isa' member.
	(mips_elf_perform_relocation): Do not treat an ISA mode mismatch
	in branch relocation calculation as an error if
	`ignore_branch_isa' has been set.
	(_bfd_mips_elf_insn32): Rename to...
	(_bfd_mips_elf_linker_flags): ... this.  Rename the `on'
	parameter to `insn32' and add an `ignore_branch_isa' parameter.
	Handle the new parameter.

	gas/
	* config/tc-mips.c (mips_ignore_branch_isa): New variable.
	(options): Add OPTION_IGNORE_BRANCH_ISA and
	OPTION_NO_IGNORE_BRANCH_ISA enum values.
	(md_longopts): Add "mignore-branch-isa" and
	"mno-ignore-branch-isa" options.
	(md_parse_option): Handle OPTION_IGNORE_BRANCH_ISA and
	OPTION_NO_IGNORE_BRANCH_ISA.
	(fix_bad_cross_mode_branch_p): Return FALSE if
	`mips_ignore_branch_isa' has been set.
	(md_show_usage): Add `-mignore-branch-isa' and
	`-mno-ignore-branch-isa'.

	* doc/as.texinfo (Target MIPS options): Add
	`-mignore-branch-isa' and `-mno-ignore-branch-isa' options.
	(-mignore-branch-isa, -mno-ignore-branch-isa): New options.
	* doc/c-mips.texi (MIPS Options): Add `-mignore-branch-isa' and
	`-mno-ignore-branch-isa' options.

	* testsuite/gas/mips/branch-local-ignore-2.d: New test.
	* testsuite/gas/mips/branch-local-ignore-3.d: New test.
	* testsuite/gas/mips/branch-local-ignore-n32-2.d: New test.
	* testsuite/gas/mips/branch-local-ignore-n32-3.d: New test.
	* testsuite/gas/mips/branch-local-ignore-n64-2.d: New test.
	* testsuite/gas/mips/branch-local-ignore-n64-3.d: New test.
	* testsuite/gas/mips/mips.exp: Run the new tests.

	ld/
	* emultempl/mipself.em (ignore_branch_isa): New variable.
	(mips_create_output_section_statements): Rename
	`_bfd_mips_elf_insn32' called to `_bfd_mips_elf_linker_flags',
	add `ignore_branch_isa' argument.
	(PARSE_AND_LIST_PROLOGUE): Add OPTION_IGNORE_BRANCH_ISA and
	OPTION_NO_IGNORE_BRANCH_ISA enum values.
	(PARSE_AND_LIST_LONGOPTS): Add "ignore-branch-isa" and
	"no-ignore-branch-isa" options.
	(PARSE_AND_LIST_OPTIONS): Add `--ignore-branch-isa' and
	`--no-ignore-branch-isa'.
	(PARSE_AND_LIST_ARGS_CASES): Handle OPTION_IGNORE_BRANCH_ISA and
	OPTION_NO_IGNORE_BRANCH_ISA.

	* ld.texinfo (Options specific to MIPS targets): Add
	`--ignore-branch-isa' and `--no-ignore-branch-isa' options.
	(ld and the MIPS family): Likewise.

	* testsuite/ld-mips-elf/bal-jalx-pic-ignore.d: New test.
	* testsuite/ld-mips-elf/bal-jalx-pic-ignore-n32.d: New test.
	* testsuite/ld-mips-elf/bal-jalx-pic-ignore-n64.d: New test.
	* testsuite/ld-mips-elf/unaligned-branch-ignore-2.d: New test.
	* testsuite/ld-mips-elf/unaligned-branch-ignore-r6-1: New test.
	* testsuite/ld-mips-elf/unaligned-branch-ignore-mips16: New
	test.
	* testsuite/ld-mips-elf/unaligned-branch-ignore-micromips: New
	test.
	* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2017-01-30 17:16:01 +00:00
GDB Administrator 17e9c56297 Automatic date update in version.in 2017-01-30 00:00:21 +00:00
GDB Administrator 520306539a Automatic date update in version.in 2017-01-29 00:00:21 +00:00
GDB Administrator 6a849af808 Automatic date update in version.in 2017-01-28 00:00:27 +00:00
Hans-Peter Nilsson 22d9a0dee3 Fix unused-but-set warning in elf32-cris.c:elf_cris_finish_dynamic_symbol
* elf32-cris.c (elf_cris_finish_dynamic_symbol): Remove now unused
	local variable dynobj.
2017-01-27 09:12:14 +01:00
Hans-Peter Nilsson 1fbd05e16e Fix PR ld/20995 for cris-linux
PR ld/20995
	* elf32-cris.c (elf_cris_size_dynamic_sections): Handle sdynrelro.
	(elf_cris_adjust_dynamic_symbol): Place variables copied into the
	executable from read-only sections into sdynrelro.
	(elf_cris_finish_dynamic_symbol): Select sreldynrelro for
	dynamic relocs in sdynrelro.
	(elf_backend_want_dynrelro): Define.
2017-01-27 01:50:06 +01:00
GDB Administrator 03bc0a24dc Automatic date update in version.in 2017-01-27 00:00:20 +00:00
GDB Administrator 8e87a59348 Automatic date update in version.in 2017-01-26 00:00:31 +00:00
Sebastian Huber 4a7324e1bc Remove all RTEMS a.out targets
* config.bfd (*-*-rtemsaout*): Mark as removed.
2017-01-25 17:56:46 +10:30
Sebastian Huber c75b4ebd4f Move RTEMS target configuration to ELF sections
bfd/
	* config.bfd (powerpcle-*-rtems*): Do not mark as removed.
	(arm-*-rtems*): Move to (arm*-*-eabi*).
	(i[3-7]86-*-rtems*): Move to (i[3-7]86-*-elf*).
	(m68-*-rtems*): Move to (m68*-*-elf*).
ld/
	* configure.tgt (arm-*-rtems*): Move to (arm*-*-eabi*).
	(bfin-*-rtems*): Move to (bfin*-*-elf*).
	(i[3-7]86-*-rtems*): Move to (i[3-7]86*-*-elf*).
	(m68*-*-rtems*): Move to (m68*-*-elf*).
	(mips*-*-rtems*): Move to (mips*-*-elf*).
	(or1k*-*-rtems*): Move to (or1k*-*-elf*).
	(powerpc*-*-rtems*): Move to (powerpc*-*-elf*).
	(sparc*-*-rtems*): Move to (sparc*-*-elf*).
	(sparc64*-*-rtems*): Move to (sparc64*-*-elf*).
2017-01-25 17:55:57 +10:30
Sebastian Huber 850d84f6a4 Remove all RTEMS COFF targets
bfd/
	* config.bfd (*-*-rtemscoff*): Mark as removed.
gas/
	* configure.tgt (sh-*-rtemscoff*): Remove.
ld/
	* configure.tgt (h8300-*-rtemscoff*): Remove.
	(i960-*-rtems*): Likewise.
	(m68*-*-rtemscoff*): Likewise.
	(sh-*-rtemscoff*): Likewise.
2017-01-25 17:52:27 +10:30
GDB Administrator 3fe6a8e647 Automatic date update in version.in 2017-01-25 00:00:22 +00:00
Maciej W. Rozycki b531344c34 PR ld/20828: Reorder the symbol sweep stage of section GC
Complement commit 81ff47b3a5 ("PR ld/20828: Fix linker script symbols
wrongly forced local with section GC") and move the symbol sweep stage
of section GC from `elf_gc_sweep' to `bfd_elf_size_dynamic_sections',
avoiding the need to clear the `forced_local' marker, problematic for
targets that have special processing in their `elf_backend_hide_symbol'
handler.  Set `mark' instead in `bfd_elf_record_link_assignment' and,
matching changes from commit 3bd43ebcb6 ("ld --gc-sections fail with
__tls_get_addr_opt"), also in PowerPC `__tls_get_addr_opt' handling
code, removing a:

FAIL: PR ld/20828 dynamic symbols with section GC (version script)

test suite failure with the `score-elf' target.

The rationale is it is enough if symbols are swept at the beginning of
`bfd_elf_size_dynamic_sections' as it is only in this function that the
size of the GOT, the dynamic symbol table and other dynamic sections is
determined, which will depend on the number of symbols making it to the
dynamic symbol table.  It is also appropriate to do the sweep at this
point as it is already after any changes have been made to symbols with
`bfd_elf_record_link_assignment', and not possible any earlier as calls
to that function are only made just beforehand -- barring audit entry
processing -- via `gld${EMULATION_NAME}_find_statement_assignment'
invoked from `gld${EMULATION_NAME}_before_allocation' which is the ELF
handler for `ldemul_before_allocation'.

	bfd/
	PR ld/20828
	* elflink.c (bfd_elf_record_link_assignment): Revert last
	change and don't ever clear `forced_local'.  Set `mark'
	unconditionally.
	(elf_gc_sweep_symbol_info, elf_gc_sweep_symbol): Reorder within
	file.
	(elf_gc_sweep): Move the call to `elf_gc_sweep_symbol'...
	(bfd_elf_size_dynamic_sections): ... here.
	* elf32-ppc.c (ppc_elf_tls_setup): Don't clear `forced_local'
	and set `mark' instead in `__tls_get_addr_opt' processing.
	* elf64-ppc.c (ppc64_elf_tls_setup): Likewise.
2017-01-24 13:11:32 +00:00
Alan Modra f0158f4416 PowerPC dynamic relocations
This patch fixes a number of issues with powerpc dynamic relocations.

1) Both ppc and ppc64 were emitting more dynamic symbols and
relocations than necessary, due to not supporting static linker
resolution of tls_index entries for __tls_get_addr_opt.  This meant
that any @got@tlsgd or @got@tlsld reloc needed to make their symbols
dynamic and generate dptmod and dtprel relocs for the dynamic linker.
That would have been passable, but what happened was that practically
all @got relocations resulted in their symbols being made dynamic and
dynamic relocations emitted against the GOT entries.  (Mostly visible
on ppc32 executables since ppc64 gcc really only uses @got style
relocs for TLS.)

2) The PowerOpen syntax was not supported with __tls_get_addr_opt.
DTPMOD/DTPREL relocs on tls_index TOC entries did not use the trick of
forcing dynamic symbols and relocations so those entries always
resulted in the full __tls_get_addr processing.  gcc doesn't use the
PowerOpen syntax for TLS, and normally such code would be optimized to
TLS IE or LE so the impact of missing this support was minimal.

3) In an executable, relocations against GNU indirect functions always
used the value of their PLT stub.   While this is correct, it is
better in some cases to use a dynamic relocation.  An extra dynamic
relocation can mean that calls via function pointers need not bounce
through the PLT stub at runtime.

The patch also tidies the PLT handling code in ppc32
allocate_dynrelocs.  Allocating PLT entries after other dynamic relocs
allows the PLT loop to omit special handling for undefined weak
symbols, and that in turn allows the loop to be simplified.

bfd/
	* elf32-ppc.c (ppc_elf_adjust_dynamic_symbol): Merge two cases
	where dynamic relocs are preferable.  Allow ifunc too.
	(ensure_undefweak_dynamic): New function.
	(allocate_dynrelocs): Use it here.  Move plt handling last and
	don't make symbols dynamic, simplifying loop.  Only make undef
	weak symbols with GOT entries dynamic.  Correct condition
	for GOT relocs.  Handle dynamic relocs on ifuncs.  Correct
	comments.  Remove goto.
	(ppc_elf_relocate_section): Correct test for using dynamic
	symbol on GOT relocs.  Rearrange test for emitting GOT relocs
	to suit.  Set up explicit tls_index entries and implicit GOT
	tls_index entries resolvable at link time for
	__tls_get_addr_opt.  Simplify test to clear mem for prelink.
	* elf64-ppc.c (allocate_got): Correct condition for GOT relocs.
	(ensure_undefweak_dynamic): New function.
	(allocate_dynrelocs): Use it here.  Only make undef weak symbols
	with GOT entries dynamic.  Remove unnecessary test of
	WILL_CALL_FINISH_DYNAMIC_SYMBOL in PLT handling.
	(ppc64_elf_relocate_section): Correct test for using dynamic
	symbol on GOT relocs.  Rearrange test for emitting GOT relocs
	to suit.  Set up explicit tls_index entries and implicit GOT
	tls_index entries resolvable at link time for __tls_get_addr_opt.
	Simplify expression to clear mem for prelink.
ld/
	* testsuite/ld-powerpc/tlsexe.r: Update for fewer dynamic relocs
	and symbols.
	* testsuite/ld-powerpc/tlsexe.d: Likewise.
	* testsuite/ld-powerpc/tlsexe.g: Likewise.
2017-01-24 12:15:54 +10:30
GDB Administrator c780b47c74 Automatic date update in version.in 2017-01-24 00:00:18 +00:00
Yury Norov 2d0ca82411 Fix AArch64 relocation handling in ILP32 mode.
bfd	* elfnn-aarch64.c: Fix relaxations for ILP32 mode.

ld	* testsuite/ld-aarch64/aarch64-elf.exp: Run new tests.
	* testsuite/ld-aarch64/tls-desc-ie-ilp32.d: New test.
	* testsuite/ld-aarch64/tls-relax-all-ilp32.d: New test.
	* testsuite/ld-aarch64/tls-relax-gd-le-ilp32.d: New test.
	* testsuite/ld-aarch64/tls-relax-gdesc-le-2-ilp32.d: New test.
	* testsuite/ld-aarch64/tls-relax-gdesc-le-ilp32.d: New test.
	* testsuite/ld-aarch64/tls-relax-ie-le-2-ilp32.d: New test.
	* testsuite/ld-aarch64/tls-relax-ie-le-3-ilp32.d: New test.
	* testsuite/ld-aarch64/tls-relax-ie-le-ilp32.d: New test.
	* testsuite/ld-aarch64/tls-tiny-desc-ie-ilp32.d: New test.
	* testsuite/ld-aarch64/tls-tiny-desc-le-ilp32.d: New test.
	* testsuite/ld-aarch64/tls-tiny-gd-ie-ilp32.d: New test.
	* testsuite/ld-aarch64/tls-tiny-gd-le-ilp32.d: New test.
2017-01-23 17:07:13 +00:00
GDB Administrator dcd310a08c Automatic date update in version.in 2017-01-23 00:00:25 +00:00
GDB Administrator 54f1917fb1 Automatic date update in version.in 2017-01-22 00:00:22 +00:00
GDB Administrator 6dd1c25a5a Automatic date update in version.in 2017-01-21 00:00:21 +00:00
Jiong Wang 7f784814df [AArch64] Optimize .gnu.hash table size for executable
bfd/
	* elfnn-aarch64.c (elf_aarch64_hash_symbol): New function.
	(elf_backend_hash_symbol): Define.

ld/
	* testsuite/ld-aarch64/aarch64-elf.exp (aarch64elflinktests): New tests.
	* testsuite/ld-aarch64/func-in-so.s: New test source file.
	* testsuite/ld-aarch64/func-sym-hash-opt.s: Likewise.
	* testsuite/ld-aarch64/func-sym-hash-opt.d: New expected test result.
2017-01-20 13:30:32 +00:00
GDB Administrator 8b5a555d09 Automatic date update in version.in 2017-01-20 00:00:39 +00:00
GDB Administrator 530d10ca18 Automatic date update in version.in 2017-01-19 00:00:31 +00:00
Maciej W. Rozycki 81ff47b3a5 PR ld/20828: Fix linker script symbols wrongly forced local with section GC
Fix a generic ELF linker regression introduced with a chain of changes
made to unused input section garbage collection:

- commit 1a766c6843 ("Also hide symbols without PLT nor GOT
  references."),
  <https://sourceware.org/ml/binutils/2011-09/msg00076.html>,

- commit 1d5316ab67 ("PR ld/13177: garbage collector retains zombie
  references to external libraries"),
  <https://sourceware.org/ml/binutils/2011-10/msg00161.html>,

- commit 6673f753c0 ("Fix PR 12772, garbage collection of dynamic
  syms"), <https://sourceware.org/ml/binutils/2011-12/msg00077.html>,

causing the garbage collection of unused symbols present in a DSO
involved in a link to make identically named symbols ordinarily defined
(i.e. not hidden or PROVIDEd) by a linker script local, even though the
latter symbols are supposed to be global as if no DSO defined them as
well.

This is because linker script assignments are processed very late as
`lang_process' proceeds, down in the call to `ldemul_before_allocation',
which is made after the call to `lang_gc_sections' to do input section
garbage collecting.  Consequently if unused, then any such DSO-defined
symbol has already been garbage-collected and internally marked local.
It would ordinarily be removed from dynamic symbol table output, however
a linker script assignment correctly replaces its original definition
with the new one and enters it into the dynamic symbol table produced as
it is supposed to be exported.  The original local marking is however
retained making the symbol local in the dynamic symbol table and
therefore not available externally.  This also causes a sorting problem
with the MIPS target, which does not expect non-section local dynamic
symbols to be output and produces an invalid binary.

Fix the problem then, by removing the `forced_local' marking for the
offending case and add suitable test cases.  First to verify that unused
symbols ordinarily defined with linker script assignments remain
exported in the context of input section garbage collection whether or
not a DSO defining identically named symbols is present in the link.
Second that a linker version script still correctly retains or removes
such symbols as requested.

	bfd/
	PR ld/20828
	* elflink.c (bfd_elf_record_link_assignment): Clear any
	`forced_local' marking for DSO symbols that are not being
	provided.

	ld/
	PR ld/20828
	* testsuite/ld-elf/pr20828-1.sd: New test.
	* testsuite/ld-elf/pr20828-2a.sd: New test.
	* testsuite/ld-elf/pr20828-2b.sd: New test.
	* testsuite/ld-elf/pr20828.ld: New test linker script.
	* testsuite/ld-elf/pr20828.ver: New test version script.
	* testsuite/ld-elf/pr20828.s: New test source.
	* testsuite/ld-elf/shared.exp: Run the new test.
2017-01-18 18:30:34 +00:00
GDB Administrator 11741d50ef Automatic date update in version.in 2017-01-18 00:00:27 +00:00
Kuan-Lin Chen 640d6bfddb RISC-V/bfd: Hook elf_backend_object_p to set the mach type. 2017-01-17 16:43:31 +08:00
GDB Administrator f964e51d90 Automatic date update in version.in 2017-01-17 00:00:21 +00:00
GDB Administrator 17a3046bfd Automatic date update in version.in 2017-01-16 00:00:21 +00:00
GDB Administrator e707b49e73 Automatic date update in version.in 2017-01-15 00:00:21 +00:00
GDB Administrator 545e07dffd Automatic date update in version.in 2017-01-14 00:00:23 +00:00
GDB Administrator 404c843430 Automatic date update in version.in 2017-01-13 00:00:22 +00:00
H.J. Lu 8361ed4d6b x86-64: Also generate unwind info for .plt.bnd
Also generate unwind info for the .plt.bnd section.  Sine it is the same
as unwind info for the .plt.got section, we use unwind info for the
.plt.got section to cover the the .plt.bnd section.

bfd/

	PR ld/21038
	* elf64-x86-64.c (elf_x86_64_link_hash_table): Add
	plt_bnd_eh_frame.
	(elf_x86_64_check_relocs): Create .eh_frame section for the
	.plt.bnd section.
	(elf_x86_64_size_dynamic_sections): Allocate and initialize
	.eh_frame section for the .plt.bnd section.
	(elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
	for the .plt.bnd section.

ld/

	PR ld/21038
	* testsuite/ld-x86-64/pr21038b.d: Updated.
	* testsuite/ld-x86-64/pr21038c.d: New file.
	* testsuite/ld-x86-64/pr21038c.s: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run pr21038c.
2017-01-12 10:32:17 -08:00
Nick Clifton 2425a30e40 Add support for locating separate debug info files via the build-id method.
PR binutils/20876
bfd	* opncls.c (find_separate_debug_file): Add include_dirs
	parameter.  Only include the directory part of the bfd's filename
	in search paths if include_dirs is true.  Add a couple of extra
	locations for looking for debug files.
	( bfd_follow_gnu_debuglink): Update invocation of
	find_separate_debug_file.
	(bfd_follow_gnu_debugaltlink): Likewise.
	(get_build_id): New function: Finds the build-id of the given bfd.
	(get_build_id_name): New function: Computes the name of the
	separate debug info file for a bfd, based upon its build-id.
	(check_build_id_file): New function: Checks to see if a separate
	debug info file exists at the given location, and that its
	build-id matches that of the original bfd.
	(bfd_follow_build_id_debuglink): New function: Finds a separate
	debug info file for a given bfd by using the build-id method.
	* dwarf2.c (_bfd_dwarf2_slurp_debug_info): Try using the build-id
	method of locating a separate debug info file before using the
	debuglink method.
	* bfd-in2.h: Regenerate.

binutils * NEWS: Mention the new feature.
	* testsuite/binutils-all/objdump.exp (test_build_id_debuglink):
	New proc to test the location of separate debug info files using
	the build-id method.
2017-01-12 16:56:54 +00:00
GDB Administrator eed0b5b263 Automatic date update in version.in 2017-01-12 00:00:25 +00:00
H.J. Lu 9e65917652 x86-64: Correct unwind info for the BND PLT
Since the BND PLT has

 230:	68 00 00 00 00       	pushq  $0x0
 235:	f2 e9 e5 ff ff ff    	bnd jmpq 220 <.plt>
 23b:	0f 1f 44 00 00       	nopl   0x0(%rax,%rax,1)

instead of

 230:	ff 25 e2 0d 20 00    	jmpq   *0x200de2(%rip)        # 201018
<func>
 236:	68 00 00 00 00       	pushq  $0x0
 23b:	e9 e0 ff ff ff       	jmpq   220 <.plt>

its unwind info should be

DW_CFA_def_cfa_expression (DW_OP_breg7 (rsp): 8; DW_OP_breg16 (rip): 0;
DW_OP_lit15; DW_OP_and; DW_OP_lit5; DW_OP_ge; DW_OP_lit3; DW_OP_shl;
DW_OP_plus)

bfd/

	PR ld/21038
	* elf64-x86-64.c (elf_x86_64_eh_frame_bnd_plt): New.
	(elf_x86_64_bnd_arch_bed): Use elf_x86_64_eh_frame_bnd_plt and
	elf_x86_64_eh_frame_plt_got.
	(elf_x86_64_size_dynamic_sections): Get unwind info from
	elf_x86_64_bnd_arch_bed for the BND PLT.

ld/

	PR ld/21038
	* testsuite/ld-x86-64/pr21038a.d: New file.
	* testsuite/ld-x86-64/pr21038a.s: Likewise.
	* testsuite/ld-x86-64/pr21038b.d: Likewise.
	* testsuite/ld-x86-64/pr21038b.s: Likewise.
	* testsuite/ld-x86-64/x86-64.exp: Run pr21038a and pr21038b.
2017-01-11 09:17:05 -08:00
Jeremy Soller f2e2d2f54b Add support for x86/64 redox target.
bfd	* config.bfd: Add entries for i686-redox and x86_64-redox.

gas	* configure.tgt: Add entry for i386-redox.

ld	* configure.tgt: Add entries for x86-redox and x86_64-redox.
2017-01-11 15:05:53 +00:00
GDB Administrator 0b67023188 Automatic date update in version.in 2017-01-11 00:00:35 +00:00
H.J. Lu 52b232b366 i386/x32: Align .eh_frame section to 4 bytes
.eh_frame section covering PLT sections should be aligned to 4 bytes
for i386 and x32.

bfd/

	* elf32-i386.c (elf_i386_check_relocs): Align .eh_frame section
	to 4 bytes.
	* elf64-x86-64.c (elf_x86_64_create_dynamic_sections): Align
	.eh_frame section to 4 bytes for x32.
	(elf_x86_64_check_relocs): Likewise.

ld/

	* testsuite/ld-x86-64/pr20830b.d: Updated.
2017-01-10 14:21:21 -08:00
H.J. Lu fff53daefb i386/x86-64: Add unwind info for .plt.got section
When there are both PLT and GOT references to the same function symbol,
linker combines GOTPLT and GOT slots into a single GOT slot and create
an entry in .plt.got section for PLT access via the GOT slot.  This
patch adds unwind info for .plt.got section.

bfd/

	PR ld/20830
	* elf32-i386.c (elf_i386_eh_frame_plt_got): New.
	(PLT_GOT_FDE_LENGTH): Likewise.
	(elf_i386_plt_layout): Add eh_frame_plt_got and
	eh_frame_plt_got_size.
	(elf_i386_plt): Updated.
	(elf_i386_link_hash_table): Add plt_got_eh_frame.
	(elf_i386_check_relocs): Create .eh_frame section for .plt.got.
	(elf_i386_size_dynamic_sections): Allocate and initialize
	.eh_frame section for .plt.got.
	(elf_i386_finish_dynamic_sections): Adjust .eh_frame section for
	.plt.got.
	(elf_i386_nacl_plt): Add FIXME for eh_frame_plt_got and
	eh_frame_plt_got_size.
	* elf64-x86-64.c (elf_x86_64_eh_frame_plt_got): New.
	(PLT_GOT_FDE_LENGTH): Likewise.
	(elf_x86_64_backend_data): Add eh_frame_plt_got and
	eh_frame_plt_got_size.
	(elf_x86_64_arch_bed): Updated.
	(elf_x86_64_bnd_arch_bed): Add FIXME for eh_frame_plt_got and
	eh_frame_plt_got_size.
	(elf_x86_64_nacl_arch_bed): Likewise.
	(elf_x86_64_link_hash_table): Add plt_got_eh_frame.
	(elf_x86_64_check_relocs): Create .eh_frame section for .plt.got.
	(elf_x86_64_size_dynamic_sections): Allocate and initialize
	.eh_frame section for .plt.got.
	(elf_x86_64_finish_dynamic_sections): Adjust .eh_frame section
	for .plt.got.

ld/

	PR ld/20830
	* testsuite/ld-i386/i386.exp: Run pr20830.
	* testsuite/ld-x86-64/x86-64.exp: Likewise.
	* testsuite/ld-i386/pr20830.d: New file.
	* testsuite/ld-i386/pr20830.s: Likewise.
	* testsuite/ld-x86-64/pr20830.d: Likewise.
	* testsuite/ld-x86-64/pr20830.s: Likewise.
2017-01-10 13:31:59 -08:00
H.J. Lu f129e49f4d Don't use elf_i386_eh_frame_plt directly
Use eh_frame_plt_size and eh_frame_plt from elf_i386_plt_layout for
.eh_frame covering the .plt section.

	* elf32-i386.c (elf_i386_size_dynamic_sections): Set
	plt_eh_frame->size to eh_frame_plt_size and use eh_frame_plt.
2017-01-10 11:30:25 -08:00
GDB Administrator eaa38cfd42 Automatic date update in version.in 2017-01-10 00:00:22 +00:00
Nick Clifton cd6581da62 Speed up objdump when displaying disassembly mixed with line number and source code information.
bfd	* dwarf2.c (lookup_address_in_function_table): Return early if
	there are no functions in the given comp unit, or if the high
	address of the last function in the comp unit is less than the
	desired address.

binutils * objdump.c (display_file): Add new parameter 'last_file'.  If
	last_file is true, do not call bfd_close at the end of the
	function.
	(main): Set the value of the last_file parameter when calling
	display_file.
2017-01-09 16:49:48 +00:00
Nick Clifton 98f02962fe Improve objdump's behaviour when it encounters a corrupt binary with an excessively large symbol table.
PR binutils/21013
	* coffgen.c (_bfd_coff_get_external_symbols): Generate an error
	message if there are too many symbols to load.
2017-01-09 09:27:46 +00:00
GDB Administrator a631dd7b79 Automatic date update in version.in 2017-01-09 00:00:20 +00:00