Commit Graph

2799 Commits

Author SHA1 Message Date
Alan Modra 3f8107ab38 FT32 initial support
FT32 is a new 32-bit RISC core developed by FTDI for embedded applications.

	* configure.ac: Add FT32 support.
	* configure: Regenerate.
bfd/
	* Makefile.am: Add FT32 files.
	* archures.c (enum bfd_architecture): Add bfd_arch_ft32.
	(bfd_mach_ft32): Define.
	(bfd_ft32_arch): Declare.
	(bfd_archures_list): Add bfd_ft32_arch.
	* config.bfd: Handle FT32.
	* configure.ac: Likewise.
	* cpu-ft32.c: New file.
	* elf32-ft32.c: New file.
	* reloc.c (BFD_RELOC_FT32_10, BFD_RELOC_FT32_20, BFD_RELOC_FT32_17,
	BFD_RELOC_FT32_18): Define.
	* targets.c (_bfd_target_vector): Add ft32_elf32_vec.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* po/SRC-POTFILES.in: Regenerate.
binutils/
	* readelf.c: Add FT32 support.
gas/
	* Makefile.am: Add FT32 files.
	* config/tc-ft32.c: New file.
	* config/tc-ft32.h: New file.
	* configure.tgt: Add FT32 support.
	* Makefile.in: Regenerate.
	* po/POTFILES.in: Regenerate.
gas/testsuite/
	* gas/ft32/ft32.exp: New file.
	* gas/ft32/insn.d: New file.
	* gas/ft32/insn.s: New file.
include/
	* dis-asm.h (print_insn_ft32): Declare.
include/elf/
	* common.h (EM_FT32): Define.
	* ft32.h: New file.
include/opcode/
	* ft32.h: New file.
ld/
	* Makefile.am: Add FT32 files.
	* configure.tgt: Handle FT32 target.
	* emulparams/elf32ft32.sh: New file.
	* scripttempl/ft32.sc: New file.
	* Makefile.in: Regenerate.
opcodes/
	* Makefile.am: Add FT32 files.
	* configure.ac: Handle FT32.
	* disassemble.c (disassembler): Call print_insn_ft32.
	* ft32-dis.c: New file.
	* ft32-opc.c: New file.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* po/POTFILES.in: Regenerate.
2015-01-28 16:25:18 +10:30
Senthil Kumar Selvaraj cc9ad334a7 Allow symbols in MEMORY region specification
This patch fixes PR 4643 by allowing symbols in the LENGTH and ORIGIN
fields of MEMORY regions.  Previously, only constants and constant
expressions are allowed.

For the AVR target, this helps define memory constraints more
accurately (per device), without having to create a ton of device
specific linker scripts.

ld/
	PR 4643
	* ldexp.c (fold_name): Fold LENGTH only after
	lang_first_phase_enum.
	* ldgram.y (memory_spec): Don't evaluate ORIGIN and LENGTH
	rightaway.
	* ldlang.h (struct memory_region_struct): Add origin_exp and
	length_exp fields.
	* ldlang.c (lang_do_memory_regions): New.
	(lang_memory_region_lookup): Initialize origin_exp and
	length_exp fields.
	(lang_process): Call lang_do_memory_regions.
ld/testsuite/
	* ld-scripts/memory.t: Define new symbol tred.
	* ld-scripts/memory_sym.t: New.
	* ld-scripts/script.exp: Perform MEMORY with symbols test, and
	conditionally check values of linker symbols.
2015-01-28 15:06:48 +10:30
Alan Modra 5ad18f16ab Reorder more powerpc64 sections again for -z relro
.toc1 is the second level TOC section used by gcc's -mminimal-toc.  It
too should be read-only after relocation.  Also, the last patch
description mentioned .sbss moving but didn't actually do that, so fix
that problem.  .tocbss (whatever that is) was before .sbss previously,
so move that one too.

	* emulparams/elf64ppc.sh (OTHER_SDATA_SECTIONS): Use in place of..
	(OTHER_BSS_SYMBOLS): ..this.
	(OTHER_PLT_RELOC_SECTIONS): Don't define.
	(OTHER_GOT_RELOC_SECTIONS): Add rela.toc1 and rela.tocbss.
	(OTHER_READWRITE_SECTIONS): Don't define.  Move .toc1 to..
	(OTHER_RELRO_SECTIONS_2): ..here.
	* scripttempl/elf.sc: Move SBSS too when DATA_SDATA.
2015-01-20 21:46:07 +10:30
Andrew Burgess c05b575a8d ld: Don't evaluate unneeded PROVIDE expressions.
When creating a linker mapfile (using -Map=MAPFILE), we previously would
always try to evaluate the expression from a PROVIDE statement.

However, this is not always safe, consider:

  PROVIDE (foo = 0x10);
  PROVIDE (bar = foo);

In this example, if neither 'foo' or 'bar' is needed, then while
generating the linker mapfile evaluating the expression for 'foo' is
harmless (just the value 0x10).  However, evaluating the expression for
'bar' requires the symbol 'foo', which is undefined.  This used to cause
a fatal error.

This patch changes the behaviour, so that when the destination of the
PROVIDE is not defined (that is the PROVIDE is not going to provide
anything) the expression is not evaluated, and instead a special string
is displayed to indicate that the linker is discarding the PROVIDE
statement.

This change not only fixes the spurious undefined symbol error, but also
means that a user can now tell if a PROVIDE statement has provided
anything by inspecting the linker mapfile, something that could not be
done before.

ld/ChangeLog:

	* ldlang.c (print_assignment): Only evaluate the expression for a
	PROVIDE'd assignment when the destination is being defined.
	Display a special message for PROVIDE'd symbols that are not being
	provided.

ld/testsuite/ChangeLog:

	* ld-scripts/provide-4.d: New file.
	* ld-scripts/provide-4-map.d: New file.
	* ld-scripts/provide-4.t: New file.
	* ld-scripts/provide-5.d: New file.
	* ld-scripts/provide-5.s: New file.
	* ld-scripts/provide-5-map.d: New file.
	* ld-scripts/provide-5.t: New file.
	* ld-scripts/provide.exp: Run the provide-4.d and provide-5.d
	tests.
2015-01-20 09:49:27 +00:00
Alan Modra 23283c1be0 Reorder more powerpc64 sections for -z relro
This moves .got too, which requires .sdata and .sbss to move with it,
because these sections share addressing via the toc pointer and with
small-model code must be within a 16-bit signed offset.  .plt, .iplt
and .branch_lt must also be moved since they are addressed via a
32-bit offset from the toc pointer, and we might have a very large
.data section.

This change means we may have some bss style sections before the data
segment, necessitating another PT_LOAD header.  Also, since _edata is
defined at the end of the data segment it's possible with an empty
.data to have _edata at the end of .plt which looks a little unusual
since .plt is a bss style section.  That should only happen rarely in
real world binaries, but does occur in the ld testsuite.

ld/
	* emulparams/elf64ppc.sh (BSS_PLT): Don't define.
	(OTHER_READWRITE_SECTIONS): Move .branch_lt to..
	(OTHER_RELRO_SECTIONS_2): ..here.
	(DATA_GOT, SEPARATE_GOTPLT, DATA_SDATA, DATA_PLT,
	PLT_BEFORE_GOT): Define.
	* scripttempl/elf.sc: Handle DATA_SDATA and DATA_GOT/DATA_PLT/
	PLT_BEFORE_GOT combination.
	(DATA_GOT, SDATA_GOT): Don't define if either is already defined.
ld/testsuite/
	* ld-powerpc/ambiguousv1.d,
	* ld-powerpc/ambiguousv1b.d,
	* ld-powerpc/ambiguousv2.d,
	* ld-powerpc/ambiguousv2b.d,
	* ld-powerpc/elfv2exe.d,
	* ld-powerpc/elfv2so.d,
	* ld-powerpc/tlsexe.r,
	* ld-powerpc/tlsexetoc.r,
	* ld-powerpc/tlsso.r,
	* ld-powerpc/tlstocso.r: Update.
2015-01-20 19:52:42 +10:30
Alan Modra 3e2b0f3116 Reorder powerpc64 sections for -z relro
More sections can be read-only after relocation.  .opd is an obvious
candidate.

	* emulparams/elf64ppc.sh (OTHER_READWRITE_SECTIONS): Move .opd to..
	(OTHER_RELRO_SECTIONS_2): ..here, new define.
	* scripttempl/elf.sc: Add OTHER_RELRO_SECTIONS_2.
2015-01-20 19:48:54 +10:30
H.J. Lu 3e2aa5bbd3 Add a testcase for PR ld/17615
PR ld/17615
	* ld-elf/pr17615.d: New file.
	* ld-elf/pr17615.s: Likewise.
2015-01-19 09:23:29 -08:00
Alan Modra c4621b339e Fix garbage collection of common symbols
Running lang_common before garbage collection means slightly less work
in garbage collection code, since common symbols should no longer
appear there.  It does have the side effect of keeping linker script
symbols (at least those defined outside of sections) global too,
hence some testsuite churn.

bfd/
	PR 17165
	* elf-bfd.h (ELF_COMMON_DEF): Note that this might be true for
	linker script assignments too.
	* elflink.c (elf_gc_sweep_symbol): Don't drop ELF_COMMON_DEF syms.
	(bfd_elf_gc_mark_dynamic_ref_symbol): Similarly.
ld/
	PR 17165
	* ldlang.c (lang_process): Run lang_common before lang_gc_sections.
ld/testsuite/
	* ld-gc/pr14265.d,
	* ld-cris/tls-gc-68.d,
	* ld-cris/tls-gc-69.d,
	* ld-cris/tls-gc-70.d,
	* ld-cris/tls-gc-71.d,
	* ld-cris/tls-gc-75.d,
	* ld-cris/tls-gc-76.d,
	* ld-cris/tls-gc-79.d,
	* ld-mmix/bpo-10.d,
	* ld-mmix/bpo-11.d: Update.
2015-01-19 21:26:30 +10:30
Jiong Wang 52db4ec2d1 [ARM] Reject R_ARM_REL32 when trying to defer it to runtime
bfd/
    * elf32-arm.c (elf32_arm_final_link_relocate): Reject R_ARM_32/_NOI when
    trying to defer them to runtime.

  ld/testsuite/
    * ld-arm/elf32-reject.s: New testcase.
    * ld-arm/elf32-reject.d: Likewise.
    * ld-arm/elf32-reject-pie.s: Likewise.
    * ld-arm/elf32-reject-pie.d: Likewise.
    * ld-arm/arm-elf.exp: Run new testcases.
    * ld-arm/ifunc-7.s: Delete f2/f4 test items.
    * ld-arm/ifunc-7.rd: Likewise.
    * ld-arm/ifunc-7.gd: Likewise.
    * ld-arm/ifunc-7.dd: Likewise.
    * ld-arm/ifunc-8.s: Likewise.
    * ld-arm/ifunc-8.rd: Likewise.
    * ld-arm/ifunc-8.gd: Likewise.
    * ld-arm/ifunc-8.dd: Likewise.
2015-01-14 19:11:54 +00:00
Alan Modra efd321f91c Correct printed year in copyright notices 2015-01-02 01:08:15 +10:30
Alan Modra b90efa5b79 ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
Alan Modra ca0694adf6 Don't create .eh_frame_hdr on shared lib bfd
If no object files have .eh_frame, but some shared library does, then
ld creates a .eh_frame_hdr section using the shared library bfd.  This
is silly since shared library .eh_frame sections don't contribute to
the output .eh_frame and thus no .eh_frame_hdr is needed.

Also, the bfd section list and count is cleared for shared libraries,
and a zero section count used as a flag in lang_check to omit a call
to bfd_merge_private_bfd_data for shared libraries.  If we create a
section on a shared lib bfd then ld will wrongly attempt to merge the
shared library private bfd data.

	PR 17742
	* ld/emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Exclude
	shared libraries in loop looking for .eh_frame sections.
	Similarly for build-id loop.
2014-12-24 23:47:56 +10:30
Andrew Burgess 9d7b48dc6e AVR/ld: Propagate link-relax elf header flag correctly.
The AVR target has an elf header flag to indicate if an object was
assembler ready for linker relaxation.  If a partial link is performed
then it is important that the link-relax flag in the output object is
set correctly, otherwise, during the final link, we might try to perform
linker relaxation on code that was not assembled suitably.

As the link-relax elf header covers the entire object file we must be
conservative when setting the flag in the output object, so, for a
partial link, any input object that does not have the link-relax flag
set will cause the output object to also not have the link-relax flag
set.

This conservative approach could be softened in future, we only need to
disable the link relax flag if an input file is not marked link-relax
ready, and the input file contains a relaxable section.  However, I've
left this optimisation for a later day.

For the final link I've overloaded the use of the link-relax elf header
flag, in a final executable, the flag now indicates if the executable
was built with linker relaxation on or not.

ld/ChangeLog:

	* emultempl/avrelf.em: Add include of elf/avr.h.
	(avr_finish): New function.
	(LDEMUL_FINISH): Added.

ld/testsuite/ChangeLog:

	* ld-avr/relax-elf-flags-01.d: New file.
	* ld-avr/relax-elf-flags-02.d: New file.
	* ld-avr/relax-elf-flags-03.d: New file.
	* ld-avr/relax-elf-flags-04.d: New file.
	* ld-avr/relax-elf-flags-05.d: New file.
	* ld-avr/relax-elf-flags-06.d: New file.
	* ld-avr/relax-elf-flags-07.d: New file.
	* ld-avr/relax-elf-flags-08.d: New file.
	* ld-avr/relax-elf-flags-a.s: New file.
	* ld-avr/relax-elf-flags-b.s: New file.
2014-12-23 15:45:11 +00:00
Alan Modra 422f1c65c9 Report an error for script multiply defined symbols
or maybe not just yet, but this is better than a FIXME.

	* ldexp.c (update_definedness): Return false if script symbol is
	redefining a strong symbol in an object.
	(exp_fold_tree_1 <etree_assign>): Set up for reporting a multiple
	definition error, but for now leave disabled.
2014-12-23 23:36:51 +10:30
Alan Modra 12b2843a6b Use a symbol flag bit to mark linker defined symbols
Trying to use the SEC_LINKER_CREATED section flag to determine whether
a symbol is linker defined fails to work on targets like alpha that
define special SEC_COMMON sections.  These might contain symbols that
originated in an object file.

include/
	* bfdlink.h (struct bfd_link_hash_entry): Comment non_ir_ref.  Add
	linker_def.
bfd/
	* elflink.c (_bfd_elf_define_linkage_sym): Set linker_def.
	* linker.c (_bfd_generic_link_add_one_symbol): Clear linker_def
	for CDEF, DEF, DEFW, COM.
ld/
	* ldexp.c (exp_fold_tree_1 <etree_provide>): Test linker_def.
ld/testsuite/
	* ld-powerpc/sdabase.s,
	* ld-powerpc/sdabase.t,
	* ld-powerpc/sdabase.d: New test.
	* ld-powerpc/sdabase2.t,
	* ld-powerpc/sdabase2.d: New test.
	* ld-powerpc/powerpc.exp: Run them.
2014-12-23 23:36:50 +10:30
Alan Modra 4cc2bf08a4 Don't PROVIDE over top of common symbols
This:
  int end[100000];
  int main(void) { end[99999] = 0; return 0; }
should not segfault.

ld/
	* ldexp.c (exp_fold_tree_1 <etree_provide>): Leave bfd_link_hash_common
	symbols alone.
ld/testsuite/
	* ld-elf/endsym.s, *ld-elf/endsym.d: New test.
2014-12-23 23:36:50 +10:30
Alan Modra cd8e2bcf0d Correct logic for "defined by object"
The old code missed testing bfd_link_hash_undefweak, and wrongly
excluded bfd_link_hash_common symbols.  It is also clearer to invert
the set of enum bfd_link_hash_type values tested.
bfd_link_hash_indirect and bfd_link_hash_warning will never appear
here.

	* ldexp.c (update_definedness): Correct logic setting by_object.
2014-12-23 23:36:50 +10:30
Alan Modra 18d6a79d35 Move support code for linker script DEFINED to ldexp.c
This moves support code for DEFINED to ldexp.c where it is used,
losing the lang_ prefix on identifiers.  Two new functions are needed
to initialize and clean up to hash table, but other than that there
are no functional changes here.

	* ldexp.c (struct definedness_hash_entry, definedness_table)
	(definedness_newfunc, symbol_defined, update_definedness): Move
	and rename from..
	* ldlang.h (struct lang_definedness_hash_entry): ..here,..
	* ldlang.c (lang_definedness_table, lang_definedness_newfunc)
	(lang_symbol_defined, lang_update_definedness): ..and here.
	* ldexp.c (ldexp_init, ldexp_finish): New functions, extracted from..
	* ldlang.c (lang_init, lang_finish): ..here.
	* ldexp.h (ldexp_init, ldexp_finish): Declare.
	* ldlang.h (lang_symbol_defined, lang_update_definedness): Delete.
	* ldmain.c (main): Call ldexp_init and ldexp_finish.
2014-12-23 23:36:50 +10:30
Alan Modra f4943d8253 Don't always build coffgen.o
Removes a bunch of unused functions from libbfd when building ELF or
AOUT.  Split off the bits we need externally when not building a COFF
target into coff-bfd.c and coff-bfd.h.

bfd/
	* Makefile.am (BFD32_LIBS, BFD32_LIBS_CFILES): Remove dwarf2
	and coffgen.  Add coff-bfd.  Sort.
	(BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Add coffgen and dwarf2.
	* bfd-in.h (bfd_coff_get_syment, bfd_coff_get_auxent): Delete.
	(struct coff_comdat_info, bfd_coff_get_comdat_section): Delete.
	* coffgen.c (coff_symbol_from): Move to coff-bfd.h as macro,
	without unused param.  Update uses.
	(bfd_coff_get_comdat_section): Move to coff-bfd.h as macro.
	(bfd_coff_get_syment, bfd_coff_get_auxent): Move to coff-bfd.c.
	* libcoff-in.h: #include "coff-bfd.h".
	(struct coff_section_tdata, coff_section_data): Move to coff-bfd.h.
	(coff_symbol_from): Delete.
	* coff-bfd.c: New file.
	* coff-bfd.h: New file.
	* coff-i386.c: Update coff_symbol_from occurrences.
	* coff-i960.c: Likewise.
	* coff-m68k.c: Likewise.
	* coff-sh.c: Likewise.
	* coff-x86_64.c: Likewise.
	* coffcode.h: Likewise.
	* pe-mips.c: Likewise.
	* configure.ac (elf): Add dwarf2.lo.
	(coffgen, coff, ecoff, xcoff): Define.  Use when mapping bfd
	target vectors to .o files.  Add dwarf2 for mach-o targets.
	Fix the sh target FIXME.
	* po/SRC-POTFILES.in: Regenerate.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* bfd-in2.h: Regenerate.
	* libcoff.h: Regenerate.
binutils/
	* objdump.c: #include "coff-bfd.h".
ld/
	* ldmisc.c: #include "coff-bfd.h"
2014-12-10 23:13:49 +10:30
Eric Botcazou c18392d87d Add Visium support to ld
ld/
	* configure.tgt: Add Visium support.
	* Makefile.am (ALL_EMULATION_SOURCES): Add eelf32visium.c.
	(eelf32visium.c): New rule.
	* Makefile.in: Regenerate.
	* emulparams/elf32visium.sh: New file.
	* scripttempl/visium.sc: Likewise.
ld/testsuite/
	* lib/ld-lib.exp (check_shared_lib_support): Return 0 for Visium.
	* ld-visium/: New directory.
2014-12-06 16:45:22 +01:00
H.J. Lu dd7e64d45b Optimize out i386/x86-64 JUMP_SLOT relocation
When there are both PLT and GOT references to the same function symbol,
linker will create a GOTPLT slot for PLT entry and a GOT slot for GOT
reference.  A run-time JUMP_SLOT relocation is created to update the
GOTPLT slot and a run-time GLOB_DAT relocation is created to update the
GOT slot.  Both JUMP_SLOT and GLOB_DAT relocations will apply the same
symbol value to GOTPLT and GOT slots, respectively, at run-time.

This optimization combines GOTPLT and GOT slots into a single GOT slot
and removes the run-time JUMP_SLOT relocation.  It replaces the regular
PLT entry:

	indirect jump	[GOTPLT slot]
	push		relocation index
	jump		PLT0

with an GOT PLT entry with an indirect jump via the GOT slot:

	indirect jump	[GOT slot]
	nop

and resolves PLT reference to the GOT PLT entry.

We must avoid this optimization if pointer equality is needed since
we don't clear symbol value in this case and the dynamic linker won't
update the GOT slot.  Otherwise, the resulting binary will get into an
infinite loop at run-time.

bfd/

	* elf32-i386.c (elf_i386_got_plt_entry): New.
	(elf_i386_pic_got_plt_entry): Likewise.
	(elf_i386_link_hash_entry): Add plt_got.
	(elf_i386_link_hash_table): Likewise.
	(elf_i386_link_hash_newfunc): Initialize plt_got.offset to -1.
	(elf_i386_get_local_sym_hash): Likewise.
	(elf_i386_check_relocs): Create the GOT PLT if there are both
	PLT and GOT references when the regular PLT is used.
	(elf_i386_allocate_dynrelocs): Use the GOT PLT if there are
	both PLT and GOT references unless pointer equality is needed.
	(elf_i386_relocate_section): Also check the GOT PLT when
	resolving R_386_PLT32.
	(elf_i386_finish_dynamic_symbol): Use the GOT PLT if it is
	available.

	* elf64-x86-64.c (elf_x86_64_link_hash_entry): Add plt_got.
	(elf_x86_64_link_hash_table): Likewise.
	(elf_x86_64_link_hash_newfunc): Initialize plt_got.offset to -1.
	(elf_x86_64_get_local_sym_hash): Likewise.
	(elf_x86_64_check_relocs): Create the GOT PLT if there are both
	PLT and GOT references when the regular PLT is used.
	(elf_x86_64_allocate_dynrelocs): Use the GOT PLT if there are
	both PLT and GOT references unless pointer equality is needed.
	(elf_x86_64_relocate_section): Also check the GOT PLT when
	resolving R_X86_64_PLT32.
	(elf_x86_64_finish_dynamic_symbol): Use the GOT PLT if it is
	available.

ld/

	* emulparams/elf_i386.sh (TINY_READONLY_SECTION): New.
	* emulparams/elf_x86_64.sh (TINY_READONLY_SECTION): Add .plt.got.

ld/testsuite/

	* ld-i386/i386.exp: Add run-time relocation tests for plt-main.
	* ld-i386/plt-main.rd: New file.
	* ld-x86-64/plt-main-bnd.dd: Likewise.
	* ld-x86-64/plt-main.rd: Likewise.
	* ld-x86-64/x86-64.exp: Add run-time relocation tests for
	plt-main.
2014-11-25 05:05:39 -08:00
H.J. Lu 6e733ccea9 Update libtool.m4 from GCC trunk
* libtool.m4: Updated from GCC trunk.

bfd/

	* configure: Regenerated.

binutils/

	* configure: Regenerated.

gas/

	* configure: Regenerated.

gprof/

	* configure: Regenerated.

ld/

	* configure: Regenerated.

opcodes/

	* configure: Regenerated.
2014-11-24 09:14:09 -08:00
Alan Modra e05fa0bad2 PowerPC64 --plt-align
Alignment of plt stubs was broken, firstly because the option was
being dropped due to the alignment value not being set in the "params"
struct used in elf64-ppc.c, and secondly due to not calculating the
number of alignment boundary crossings correctly.

bfd/
	* elf64-ppc.c (plt_stub_pad): Correct.
ld/
	* ld.texinfo: Correct --plt-align documentation.
	* emultempl/ppc64elf.em (plt_stub_align): Delete.  Use and set
	params.plt_stub_align instead.
2014-11-24 12:56:59 +10:30
Igor Zamyatin d258b82828 Add -z bndplt to generate BND prefix in PLT entries
This patch adds "-z bndplt" option Linux/x86-64 linker to generate BND
prefix in PLT entries.  It also updated Linux/x86-64 assembler not to
generate R_X86_64_PLT32_BND nor R_X86_64_PC32_BND relocations.

bfd/

2014-11-18  Igor Zamyatin  <igor.zamyatin@intel.com>

	* elf64-x86-64.c (elf_x86_64_check_relocs): Enable MPX PLT only
	for -z bndplt.

gas/

2014-11-18  Igor Zamyatin  <igor.zamyatin@intel.com>

	* config/tc-i386-intel.c (i386_operator): Remove last argument
	from lex_got call.
	* config/tc-i386.c (reloc): Remove bnd_prefix from parameters'
	list.  Return always BFD_RELOC_32_PCREL.
	* (output_branch): Remove condition for BFD_RELOC_X86_64_PC32_BND.
	* (output_jump): Update call to reloc accordingly.
	* (output_interseg_jump): Likewise.
	* (output_disp): Likewise.
	* (output_imm): Likewise.
	* (x86_cons_fix_new): Likewise.
	* (lex_got): Remove bnd_prefix from parameters' list in macro and
	declarations. Don't use BFD_RELOC_X86_64_PLT32_BND.
	* (x86_cons): Update call to lex_got accordingly.
	* (i386_immediate): Likewise.
	* (i386_displacement): Likewise.
	* (md_apply_fix): Don't use BFD_RELOC_X86_64_PLT32_BND nor
	BFD_RELOC_X86_64_PC32_BND.
	* (tc_gen_reloc): Likewise.

include/

2014-11-18  Igor Zamyatin  <igor.zamyatin@intel.com>

	* bfdlink.h (struct bfd_link_info): Add bndplt.

ld/

2014-11-18  Igor Zamyatin  <igor.zamyatin@intel.com>

	* emulparams/elf_x86_64.sh (BNDPLT): Set to yes for x86_64.
	* emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle
	"-z bndplt" if BNDPLT is yes.
	(gld${EMULATION_NAME}_list_options): Add "-z bndplt" entry.
	* ld.texinfo: Add description for bndplt.

ld/testsuite/

2014-11-18  Igor Zamyatin  <igor.zamyatin@intel.com>

	* testsuite/ld-x86-64/bnd-ifunc-1.d: Add bndplt option.
	* testsuite/ld-x86-64/bnd-ifunc-2.d: Likewise.
	* testsuite/ld-x86-64/bnd-plt-1.d: Likewise.  Update dissassembly
	sections.
	* testsuite/ld-x86-64/mpx.exp: Handle mpx3 and mpx4 tests.
	* testsuite/ld-x86-64/mpx1a.rd: Remove _BND from relocation name.
	* testsuite/ld-x86-64/mpx1c.rd: Likewise.
	* testsuite/ld-x86-64/mpx2a.rd: Likewise.
	* testsuite/ld-x86-64/mpx2c.rd: Likewise.
	* testsuite/ld-x86-64/mpx3.dd: New file.
	* testsuite/ld-x86-64/mpx3a.s: Likewise.
	* testsuite/ld-x86-64/mpx3b.s: Likewise.
	* testsuite/ld-x86-64/mpx4.dd: Likewise.
	* testsuite/ld-x86-64/mpx4a.s: Likewise.
	* testsuite/ld-x86-64/mpx4b.s: Likewise.
2014-11-18 05:40:17 -08:00
Denis Chertykov 51b26797b4 * avrtiny.sc: Apply avr.sc fixes. 2014-11-11 20:44:03 +03:00
Alan Modra 0cdcdbf8db Regenerate spu overlay and icache manager files
Nothing to see here, just the changed placement of section headers.

	* emultempl/spu_icache.o_c: Regenerate.
	* emultempl/spu_ovl.o_c: Regenerate.
2014-11-04 22:36:13 +10:30
Andrew Burgess 931b79ccd6 When relaxing, update size of symbols.
When performing linker relaxation, reduce the size of symbols that span
the deleted bytes.  This ensures that, for example, function symbols
will have the correct size.

bfd/ChangeLog:

	* elf32-avr.c (elf32_avr_relax_delete_bytes): During linker
	relaxation, reduce the size of symbols that span the deleted
	bytes.

ld/ChangeLog:

	* testsuite/ld-avr/relax-02.d: Update to check size of symbols has
	changed.
	* testsuite/ld-avr/relax-03.d: Likewise.
2014-11-03 20:34:13 +00:00
Andrew Burgess a12d0ffc72 When relaxing, update symbols at the very end of the section.
Symbols at the very end of a section were not being updated correctly
when linker relaxation takes place due to the use of '<' instead of
'<='.  Added a couple of tests to cover this behaviour.

bfd/ChangeLog:

	* elf32-avr.c (elf32_avr_relax_delete_bytes): Modify symbols
	located at the very end of the section.

ld/ChangeLog:

	* ld/testsuite/ld-avr/relax-02.d: New file.
	* ld/testsuite/ld-avr/relax-02.s: New file.
	* ld/testsuite/ld-avr/relax-03.d: New file.
	* ld/testsuite/ld-avr/relax-03.s: New file.
2014-11-03 20:33:25 +00:00
Nick Clifton 64b588b51e Updated/new translations provided by the Translations Project. 2014-10-29 16:34:04 +00:00
Jiong Wang 68fcca92b7 [AArch64] Cortex-A53 erratum 835769 linker workaround
2014-10-22  Tejas Belagod  <tejas.belagod@arm.com>

bfd/
	* bfd-in.h (bfd_elf64_aarch64_set_options): Add a parameter.
	* bfd-in2.h (bfd_elf64_aarch64_set_options): Likewise.
	* elfnn-aarch64.c (aarch64_erratum_835769_stub): New.
	(elf_aarch64_stub_type): Add new type
	aarch64_stub_erratum_835769_veneer.
	(elf_aarch64_stub_hash_entry): New fields for erratum 835769.
	(aarch64_erratum_835769_fix): New data struct to record erratum
	835769.
	(elf_aarch64_link_hash_table: Global flags for 835769.
	(aarch64_build_one_stub): Add case for 835769.
	(aarch64_size_one_stub): Likewise.
	(aarch64_mem_op_p, aarch64_mlxl_p,
	aarch64_erratum_sequence,erratum_835769_scan):
	New. Decode and scan functions for erratum 835769.
	(elf_aarch64_create_or_find_stub_sec): New.
	(elfNN_aarch64_size_stubs): Look for erratum 835769 and record
	them.
	(bfd_elfNN_aarch64_set_options: Set global flag for 835769.
	(erratum_835769_branch_to_stub_data,
	make_branch_to_erratum_835769_stub):New. Connect up all the
	erratum stubs to occurances by branches.
	(elfNN_aarch64_write_section): New hook.
	(aarch64_map_one_stub): Output erratum stub symbol.
	(elfNN_aarch64_size_dynamic_sections): Init mapping symbol
	information for erratum 835769.
	(elf_backend_write_section): Define.

ld/
	* emultempl/aarch64elf.em: Add command-line option for erratum
	835769.

ld/testsuite/

	* ld-aarch64/aarch64-elf.exp (aarch64elftests): Drive erratum
	835769 tests.
	* ld-aarch64/erratum835769.d: New.
	* ld-aarch64/erratum835769.s: New.
2014-10-24 11:39:35 +01:00
Hans-Peter Nilsson c1e29d6622 Implement --print-sysroot in ld.
* ldlex.h (enum option_values): Add entry OPTION_PRINT_SYSROOT.
	* lexsup.c (ld_options): Add entry for --print-sysroot.
	(parse_args) <OPTION_PRINT_SYSROOT>: Print sysroot and exit early.
2014-10-17 13:07:09 +02:00
Alan Modra 459609d6f8 PR17488, powerpc64-linux-ld segfault
For binary ouput, we don't have an ELF bfd output so can't access
elf_elfheader.  The elf64-ppc.c changes are really just a tidy,
triggered by looking at all places where the abiversion bits are
accessed.

bfd/
	* elf64-ppc.c (ppc64_elf_before_check_relocs): Do .opd processing
	even when output is not ppc64 ELF.  Remove redundant tests on
	type of input bfd.
ld/
	PR 17488
	* emultempl/ppc64elf.em (gld${EMULATION_NAME}_finish): Don't attempt
	to access ELF header e_flags when not ppc64 ELF output.
2014-10-16 11:22:14 +10:30
Tristan Gingold 91dc4e0a22 Bump bfd version.
bfd/
2014-10-15  Tristan Gingold  <gingold@adacore.com>

	* version.m4: Bump version to 2.25.51
	* configure: Regenerate.

binutils/
2014-10-15  Tristan Gingold  <gingold@adacore.com>

	* configure: Regenerate.

gas/
2014-10-15  Tristan Gingold  <gingold@adacore.com>

	* configure: Regenerate.

gprof/
2014-10-15  Tristan Gingold  <gingold@adacore.com>

	* configure: Regenerate.

ld/
2014-10-15  Tristan Gingold  <gingold@adacore.com>

	* configure: Regenerate.

opcodes/
2014-10-15  Tristan Gingold  <gingold@adacore.com>

	* configure: Regenerate.
2014-10-15 10:21:25 +02:00
Hans-Peter Nilsson eeed9cc785 Allow unquoted = as the first character in ldscript input_list names
* ldlex.l (INPUTLIST): New start condition.
	(comment pattern, ",", "(", ")", "AS_NEEDED")
	({FILENAMECHAR1}{FILENAMECHAR}*, "-l"{FILENAMECHAR}+)
	(quoted string pattern, whitespace pattern): Add INPUTLIST to
	valid start conditions.
	(<INPUTLIST>"="{FILENAMECHAR1}{FILENAMECHAR}*): New NAME rule.
	(ldlex_inputlist): New start-condition-setter function.
	* ldgram.y (input_list1): Rename from input_list.  All recursive
	use changed.
	(input_list): New wrapper rule for input_list1, setting
	INPUTLIST lexer state for the duration of parsing input_list1.

All this to say INPUT(=/path/to/file) and not be forced to use
INPUT("=/path/to/file") whenever there's a need to force a sysroot-
prefix.  Still, IMHO it seems better to make use of a previously
invalid syntax and not only change the meaning of quoted =-prefixed
paths (though arguably that's not very useful before this patchset).

This got a little bit hairier than I'd expected: I had to add a new
lexer state (aka. start condition) to avoid a first "=" being lexed as
the token "=", despite that not making sense in constructs expecting
file-names in the first place.  (The grammar doesn't allow for
expressions in any part of those lists.)  I guess I *could* have made
it work using that token anyway, but I didn't like the idea that you
would be able to separate the "=" from the rest of the file-name with
whitespace.
2014-10-15 03:10:25 +02:00
Hans-Peter Nilsson bfa2343443 If "=" is the first character in a ldscript input file, force a sysroot prefix.
* ldlang.c (lang_add_input_file): If the first character in the
	filename is '=', prepend the sysroot and force the context of that
	input file to non-sysroot.

The "input_flags.sysrooted = 0" thing described in the comment is
covered by the testsuite part ("root-anchored =-prefixed script
inside"), but only observable for --with-sysroot configurations.
2014-10-15 03:04:21 +02:00
Hans-Peter Nilsson cad60a339b ld.texinfo: "=" path-prefix forces sysroot in scripts not only SEARCH_DIR
* ld.texinfo (input files in linker scripts): When mentioning
	behavior of first character "/" on scripts within sysroot, also
	mention that effect can be forced by prefixing with "=" and
	refer to SEARCH_DIR.
2014-10-15 02:50:03 +02:00
Hans-Peter Nilsson b3b9c41dc6 ld.texinfo: Clarify that sysroot affects "=" expansion.
* ld.texinfo (Options): When mentioning "=" and sysroot, mention
	that --sysroot controls it, not only through the configuration.
2014-10-15 02:43:23 +02:00
Tristan Gingold c50415e24c Add NEWS markers for 2.25.
binutils/
2014-10-14  Tristan Gingold  <gingold@adacore.com>

	* NEWS: Add marker for 2.25.

gas/
2014-10-14  Tristan Gingold  <gingold@adacore.com>

	* NEWS: Add marker for 2.25.

ld/
2014-10-14  Tristan Gingold  <gingold@adacore.com>

	* NEWS: Add marker for 2.25.
2014-10-14 09:49:47 +02:00
Alan Modra 5b69e3572d Run eh_frame optimisation for relocatable link
The idea here is to drop .eh_frame FDEs corresponding to dropped
comdat group sections or linkonce sections, but not perform changes in
encoding.

bfd/
	PR 17467
	* elf-eh-frame.c (ENSURE_NO_RELOCS): Don't stop at first NONE reloc.
	(_bfd_elf_parse_eh_frame): When relocatable output, don't set
	flags enabling conversion of CIEs and FDEs to use relative encoding.
	(find_merged_cie): Similarly.
	(_bfd_elf_write_section_eh_frame): Don't edit FDEs when
	relocatable, except for CIE pointer.
	* elflink.c (bfd_elf_reloc_symbol_deleted_p): Return true for
	relocs against symbols in dropped comdat group sections.
	(bfd_elf_discard_info): Do some eh_frame optimisation when
	relocatable.
ld/
	* ldlang.c (lang_add_section): Set up map_head.s and map_tail.s when
	relocatable.
2014-10-13 22:58:44 +10:30
Kuan-Lin Chen 1c8f6a4d1f NDS32: Code refactoring of relaxation.
Refactor each relaxation pattern to raise the maintainability.
In origin, all patterns is analysed in nds32_elf_relax_section,
so it is hard to debug and maintain.  Therefore, we classify all
patterns into different functions in this patch.
Moreover, we adjust all optimizations into nds32_elf_relax_section
to take these optimizations in turn.  This can promise all relaxation
being done after calling gld${EMULATION_NAME}_after_allocation.
2014-09-16 13:08:00 +08:00
Andrew Bennett 7361da2c95 Add support for MIPS R6.
bfd/
 	* aoutx.h (NAME (aout, machine_type)): Add mips32r6 and mips64r6.
 	* archures.c (bfd_architecture): Likewise.
 	* bfd-in2.h (bfd_architecture): Likewise.
 	(bfd_reloc_code_real): Add relocs BFD_RELOC_MIPS_21_PCREL_S2,
 	BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3 and
 	BFD_RELOC_MIPS_19_PCREL_S2.
 	* cpu-mips.c (arch_info_struct): Add mips32r6 and mips64r6.
 	* elf32-mips.c: Define relocs R_MIPS_PC21_S2, R_MIPS_PC26_S2
 	R_MIPS_PC18_S3, R_MIPS_PC19_S2, R_MIPS_PCHI16 and R_MIPS_PCLO16.
 	(mips_reloc_map): Add entries for BFD_RELOC_MIPS_21_PCREL_S2,
 	BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3,
 	BFD_RELOC_MIPS_19_PCREL_S2, BFD_RELOC_HI16_S_PCREL and
 	BFD_RELOC_LO16_PCREL.
 	* elf64-mips.c: Define REL, and RELA relocations R_MIPS_PC21_S2,
	R_MIPS_PC26_S2, R_MIPS_PC18_S3, R_MIPS_PC19_S2, R_MIPS_PCHI16
	and R_MIPS_PCLO16.
 	(mips_reloc_map): Add entries for BFD_RELOC_MIPS_21_PCREL_S2,
 	BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3,
 	BFD_RELOC_MIPS_19_PCREL_S2, BFD_RELOC_HI16_S_PCREL and
 	BFD_RELOC_LO16_PCREL.
 	* elfn32-mips.c: Likewise.
 	* elfxx-mips.c (MIPSR6_P): New define.
 	(mipsr6_exec_plt_entry): New array.
	(hi16_reloc_p): Add support for R_MIPS_PCHI16.
	(lo16_reloc_p): Add support for R_MIPS_PCLO16.
 	(aligned_pcrel_reloc_p): New function.
 	(mips_elf_relocation_needs_la25_stub): Add support for relocs:
 	R_MIPS_PC21_S2 and R_MIPS_PC26_S2.
 	(mips_elf_calculate_relocation): Add support for relocs:
 	R_MIPS_PC21_S2, R_MIPS_PC26_S2, R_MIPS_PC18_S3, R_MIPS_PC19_S2,
 	R_MIPS_PCHI16 and R_MIPS_PCLO16.
 	(_bfd_elf_mips_mach): Add support for mips32r6 and mips64r6.
	(mips_elf_add_lo16_rel_addend): Add support for R_MIPS_PCHI16.
 	(_bfd_mips_elf_check_relocs): Add support for relocs:
	R_MIPS_PC21_S2 and R_MIPS_PC26_S2.
 	(_bfd_mips_elf_relocate_section): Add a check for unaligned
 	pc relative relocs.
 	(_bfd_mips_elf_finish_dynamic_symbol): Add support for MIPS r6
 	plt entry.
 	(mips_set_isa_flags): Add support for mips32r6 and mips64r6.
 	(_bfd_mips_elf_print_private_bfd_data): Likewise.
 	(mips_32bit_flags_p): Add support for mips32r6.
 	* libbfd.h (bfd_reloc_code_real_names): Add entries for
 	BFD_RELOC_MIPS_21_PCREL_S2, BFD_RELOC_MIPS_26_PCREL_S2,
 	BFD_RELOC_MIPS_18_PCREL_S3 and BFD_RELOC_MIPS_19_PCREL_S2.
 	* reloc.c: Document relocs BFD_RELOC_MIPS_21_PCREL_S2,
 	BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3 and
 	BFD_RELOC_MIPS_19_PCREL_S2.

binutils/
 	* readelf.c (get_machine_flags): Add support for mips32r6 and
 	mips64r6.

elfcpp/
 	* mips.h (E_MIPS_ARCH_32R6, E_MIPS_ARCH_64R6): New enum constants.

gas/
 	* config/tc-mips.c (mips_nan2008): New static global.
	(mips_flag_nan2008): Removed.
	(LL_SC_FMT): New define.
	(COP12_FMT): Updated.
	(ISA_IS_R6): New define.
 	(ISA_HAS_64BIT_REGS): Add mips64r6.
 	(ISA_HAS_DROR): Likewise.
 	(ISA_HAS_64BIT_FPRS): Add mips32r6 and mips64r6.
 	(ISA_HAS_ROR): Likewise.
 	(ISA_HAS_ODD_SINGLE_FPR): Likewise.
 	(ISA_HAS_MXHC1): Likewise.
 	(hilo_interlocks): Likewise.
 	(md_longopts): Likewise.
	(ISA_HAS_LEGACY_NAN): New define.
 	(options): Add OPTION_MIPS32R6 and OPTION_MIPS64R6.
 	(mips_ase): Add field rem_rev.
 	(mips_ases): Updated to add which ISA an ASE was removed in.
 	(mips_isa_rev): Add support for mips32r6 and mips64r6.
 	(mips_check_isa_supports_ase): Add support to check if an ASE
 	has been removed in the specified MIPS ISA revision.
 	(validate_mips_insn): Skip '-' character.
	(macro_build): Likewise.
	(mips_check_options): Prevent R6 working with fp32, mips16,
	micromips, or branch relaxation.
	(file_mips_check_options): Set R6 floating point registers to
	64 bit.  Also deal with the nan2008 option.
 	(limited_pcrel_reloc_p): Add relocs: BFD_RELOC_MIPS_21_PCREL_S2,
 	BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3,
 	BFD_RELOC_MIPS_19_PCREL_S2, BFD_RELOC_HI16_S_PCREL and
 	BFD_RELOC_LO16_PCREL.
 	(operand_reg_mask): Add support for OP_SAME_RS_RT, OP_CHECK_PREV
	and OP_NON_ZERO_REG.
 	(match_check_prev_operand): New static function.
 	(match_same_rs_rt_operand): New static function.
	(match_non_zero_reg_operand): New static function.
 	(match_operand): Added entries for: OP_SAME_RS_RT, OP_CHECK_PREV
	and OP_NON_ZERO_REG.
 	(insns_between): Added case to deal with forbidden slots.
 	(append_insn): Added support for relocs: BFD_RELOC_MIPS_21_PCREL_S2
 	and BFD_RELOC_MIPS_26_PCREL_S2.
 	(match_insn): Add support for operands -A, -B, +' and +".  Also
 	skip '-' character.
 	(mips_percent_op): Add entries for %pcrel_hi and %pcrel_lo.
 	(md_parse_option): Add support for mips32r6 and mips64r6.  Also
	update the nan option handling.
 	(md_pcrel_from): Add cases for relocs: BFD_RELOC_MIPS_21_PCREL_S2,
 	BFD_RELOC_MIPS_26_PCREL_S2.
 	(mips_force_relocation): Prevent forced relaxation for MIPS r6.
 	(md_apply_fix): Add support for relocs: BFD_RELOC_MIPS_21_PCREL_S2,
 	BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3,
 	BFD_RELOC_MIPS_19_PCREL_S2, BFD_RELOC_HI16_S_PCREL and
 	BFD_RELOC_LO16_PCREL.
 	(s_mipsset): Add support for mips32r6 and mips64r6.
	(s_nan): Update to support the new nan2008 framework.
 	(tc_gen_reloc): Add relocs: BFD_RELOC_MIPS_21_PCREL_S2,
 	BFD_RELOC_MIPS_26_PCREL_S2, BFD_RELOC_MIPS_18_PCREL_S3,
 	BFD_RELOC_MIPS_19_PCREL_S2, BFD_RELOC_HI16_S_PCREL and
 	BFD_RELOC_LO16_PCREL.
	(mips_elf_final_processing): Updated to use the mips_nan2008.
 	(mips_cpu_info_table): Add entries for mips32r6 and mips64r6.
	(macro): Enable ldc2, sdc2, ll, lld, swc2, sc, scd, cache, pref
	macros for R6.
	(mips_fix_adjustable): Make PC relative R6 relocations relative
	to the symbol and not the section.
 	* configure.ac: Add support for mips32r6 and mips64r6.
 	* configure: Regenerate.
 	* doc/c-mips.texi: Document the -mips32r6 and -mips64r6 command line
 	options.
	* doc/as.texinfo: Likewise.

gas/testsuite/
	* gas/mips/24k-triple-stores-1.s: If testing for r6 prevent
	non-supported instructions from being tested.
	* gas/mips/24k-triple-stores-2.s: Likewise.
	* gas/mips/24k-triple-stores-3.s: Likewise.
	* gas/mips/24k-triple-stores-6.s: Likewise.
	* gas/mips/beq.s: Likewise.
	* gas/mips/eva.s: Likewise.
	* gas/mips/ld-zero-3.s: Likewise.
	* gas/mips/mips32-cp2.s: Likewise.
	* gas/mips/mips32.s: Likewise.
	* gas/mips/mips4.s: Likewise.
	* gas/mips/add.s: Don't test the add instructions if r6, and
	add padding.
	* gas/mips/add.d: Check for a triple dot not a nop at the end of the
	disassembly output.
	* gas/mips/micromips@add.d: Likewise.
	* gas/mips/mipsr6@24k-branch-delay-1.d: New file.
	* gas/mips/mipsr6@24k-triple-stores-1.d: New file.
	* gas/mips/mipsr6@24k-triple-stores-2-llsc.d: New file.
	* gas/mips/mipsr6@24k-triple-stores-2.d: New file.
	* gas/mips/mipsr6@24k-triple-stores-3.d: New file.
	* gas/mips/mipsr6@24k-triple-stores-6.d: New file.
	* gas/mips/mipsr6@add.d: New file.
	* gas/mips/mipsr6@attr-gnu-4-1-msingle-float.l: New file.
	* gas/mips/mipsr6@attr-gnu-4-1-msingle-float.s: New file.
	* gas/mips/mipsr6@attr-gnu-4-1-msoft-float.l: New file.
	* gas/mips/mipsr6@attr-gnu-4-1-msoft-float.s: New file.
	* gas/mips/mipsr6@attr-gnu-4-2-mdouble-float.l: New file.
	* gas/mips/mipsr6@attr-gnu-4-2-mdouble-float.s: New file.
	* gas/mips/mipsr6@beq.d: New file.
	* gas/mips/mipsr6@bge.d: New file.
	* gas/mips/mipsr6@bgeu.d: New file.
	* gas/mips/mipsr6@blt.d: New file.
	* gas/mips/mipsr6@bltu.d: New file.
	* gas/mips/mipsr6@branch-misc-1.d: New file.
	* gas/mips/mipsr6@branch-misc-2-64.d: New file.
	* gas/mips/mipsr6@branch-misc-2pic-64.d: New file.
	* gas/mips/mipsr6@branch-misc-4-64.d: New file.
	* gas/mips/mipsr6@cache.d: New file.
	* gas/mips/mipsr6@eva.d: New file.
	* gas/mips/mipsr6@jal-svr4pic-noreorder.d: New file.
	* gas/mips/mipsr6@jal-svr4pic.d: New file.
	* gas/mips/mipsr6@ld-zero-2.d: New file.
	* gas/mips/mipsr6@ld-zero-3.d: New file.
	* gas/mips/mipsr6@loc-swap-dis.d: New file.
	* gas/mips/mipsr6@mips32-cp2.d: New file.
	* gas/mips/mipsr6@mips32-imm.d: New file.
	* gas/mips/mipsr6@mips32.d: New file.
	* gas/mips/mipsr6@mips32r2.d: New file.
	* gas/mips/mipsr6@mips4-fp.d: New file.
	* gas/mips/mipsr6@mips4-fp.l: New file.
	* gas/mips/mipsr6@mips4-fp.s: New file.
	* gas/mips/mipsr6@mips4.d: New file.
	* gas/mips/mipsr6@mips5-fp.d: New file.
	* gas/mips/mipsr6@mips5-fp.l: New file.
	* gas/mips/mipsr6@mips5-fp.s: New file.
	* gas/mips/mipsr6@mips64.d: New file.
	* gas/mips/mipsr6@msa-branch.d: New file.
	* gas/mips/mipsr6@msa.d: New file.
	* gas/mips/mipsr6@pref.d: New file.
	* gas/mips/mipsr6@relax-swap3.d: New file.
	* gas/mips/r6-64-n32.d: New file.
	* gas/mips/r6-64-n64.d: New file.
	* gas/mips/r6-64-removed.l: New file.
	* gas/mips/r6-64-removed.s: New file.
	* gas/mips/r6-64.s: New file.
	* gas/mips/r6-attr-none-double.d: New file.
	* gas/mips/r6-n32.d: New file.
	* gas/mips/r6-n64.d: New file.
	* gas/mips/r6-removed.l: New file.
	* gas/mips/r6-removed.s: New file.
	* gas/mips/r6.d: New file.
	* gas/mips/r6.s: New file.
	* gas/mips/mipsr6@mips32-dsp.d: New file.
	* gas/mips/mipsr6@mips32-dspr2.d: New file.
	* gas/mips/mipsr6@mips32r2-ill.l: New file.
	* gas/mips/mipsr6@mips32r2-ill.s: New file.
	* gas/mips/cache.s: Add r6 instruction varients.
	* gas/mips/mips.exp: Add support for the mips32r6 and mips64r6
	architectures.  Also prevent non r6 supported tests from running.
	Finally, add in support for running the new r6 tests.
	(run_dump_test_arch): Add support for mipsr6 tests.
	(run_list_test_arch): Add support for using files of the
	form arch@testname.l .

include/elf/
 	* mips.h: Add relocs: R_MIPS_PC21_S2, R_MIPS_PC26_S2, R_MIPS_PC18_S3,
 	R_MIPS_PC19_S2, R_MIPS_PCHI16 and R_MIPS_PCLO16.
 	(E_MIPS_ARCH_32R6): New define.
 	(E_MIPS_ARCH_64R6): New define.

include/opcode/
 	* mips.h (mips_operand_type): Add new entries: OP_SAME_RS_RT,
 	OP_CHECK_PREV and OP_NON_ZERO_REG.  Add descriptions for the MIPS R6
	instruction arguments: -a, -b, -d, -s, -t, -u, -v, -w, -x, -y, -A, -B,
	 +I, +O, +R, +:, +\, +", +;
	(mips_check_prev_operand): New struct.
 	(INSN2_FORBIDDEN_SLOT): New define.
 	(INSN_ISA32R6): New define.
 	(INSN_ISA64R6): New define.
	(INSN_UPTO32R6): New define.
	(INSN_UPTO64R6): New define.
	(mips_isa_table): Add INSN_UPTO32R6 and INSN_UPTO64R6.
 	(ISA_MIPS32R6): New define.
 	(ISA_MIPS64R6): New define.
 	(CPU_MIPS32R6): New define.
 	(CPU_MIPS64R6): New define.
 	(cpu_is_member): Add cases for CPU_MIPS32R6, and CPU_MIPS64R6.

ld/
 	* ldmain.c (get_emulation): Add support for -mips32r6 and -mips64r6.

opcodes/
 	* mips-dis.c (mips_arch_choices): Add entries for mips32r6 and
 	mips64r6.
 	(parse_mips_dis_option): Allow MSA and virtualization support for
 	mips64r6.
 	(mips_print_arg_state): Add fields dest_regno and seen_dest.
 	(mips_seen_register): New function.
 	(print_insn_arg): Refactored code to use mips_seen_register
	function.  Add support for OP_SAME_RS_RT, OP_CHECK_PREV and
	OP_NON_ZERO_REG.  Changed OP_REPEAT_DEST_REG case to print out
	the register rather than aborting.
 	(print_insn_args): Add length argument.  Add code to correctly
	calculate the instruction address for pc relative instructions.
	(validate_insn_args): New static function.
 	(print_insn_mips): Prevent jalx disassembling for r6.  Use
	validate_insn_args.
	(print_insn_micromips): Use validate_insn_args.
	all the arguments are valid.
	* mips-formats.h (PREV_CHECK): New define.
 	* mips-opc.c (decode_mips_operand): Add support for -a, -b, -d, -s,
 	-t, -u, -v, -w, -x, -y, -A, -B, +I, +O, +R, +:, +\, +", +;
 	(RD_pc): New define.
 	(FS): New define.
 	(I37): New define.
 	(I69): New define.
 	(mips_builtin_opcodes): Add MIPS R6 instructions.  Exclude recoded
 	MIPS R6 instructions from MIPS R2 instructions.
2014-09-15 12:15:55 +01:00
Andrew Bennett a9d58c068c Add mips*-img-elf* target triple.
/
	* configure.ac: Add mips*-img-elf* target triple.
	* configure: Regenerate.

bfd/
	* config.bfd: Add mips*-img-elf* target triple.

gas/
	* configure.tgt: Add mips*-img-elf* target triple.

gas/testsuite/
	* gas/mips/mips.exp: Add mips*-img-elf* target triple.

binutils/testsuite/
	* binutils-all/objcopy.exp: Add mips*-img-elf* target triple.
	* binutils-all/readelf.exp: Likewise.

ld/
	* configure.tgt: Add mips*-img-elf* target triple.

ld/testsuite/
	* ld-mips-elf/mips-elf.exp: Add support for mips*-img-elf* target
	triple.
2014-09-12 14:25:15 +01:00
Jon TURNEY 74fffc3982 Change pe/coff build-id section name to '.buildid'
The section name used to store the build-id on pe/coff is arbitrary, as it's
contents should be located using the pe/coff header's DataDirectory debug data
entry, not by using the section name.

But '.build-id' is not a good choice for that section name, as it is 9
characters long, and hence truncated to 8 characters when
--disable-long-section-names is used (which is the default, when producing an
executable with no dwarf debug sections, e.g. using ld --strip-all --build-id)

This truncation then breaks 'objcopy --only-keep-debug', which does use the
section name, due to concerns that keeping an arbitrary section which contains
the debug directory is not sensible.

binutils/ChangeLog

2014-09-01  Jon TURNEY  <jon.turney@dronecode.org.uk>

	* objcopy.c (is_nondebug_keep_contents_section): Change pe/coff
	build-id section name from '.build-id' to '.buildid'.

ld/ChangeLog

2014-09-01  Jon TURNEY  <jon.turney@dronecode.org.uk>

	* emultempl/pe.em (write_build_id, setup_build_id): Change pe/coff
	build-id section name from '.build-id' to '.buildid'.
	* emultempl/pep.em (write_build_id, setup_build_id): Ditto.

Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
2014-09-08 17:54:20 +01:00
Andreas Tobler baa23169d1 * emulparams/armelf_fbsd.sh (TEXT_START_ADDR): Increase alignment to 64kB boundary like in armelf_linux.sh 2014-08-22 06:33:45 +02:00
Alan Modra da44f4e546 Index PowerPC64 linker generated .eh_frame in .eh_frame_hdr
I noticed recently that .eh_frame FDEs generated by the linker for
call stubs and .glink weren't being indexed in .eh_frame_hdr, due to
bfd_elf_discard_info being run before the linker generated .eh_frame
sections were available for parsing.  This patch moves code around in
elf64-ppc.c and ppc64elf.em to avoid that problem.

Another problem fixed here is that --gc-sections parses .eh_frame
early, and the existing machinery allows only one go at parsing the
.eh_frame sections.  That resulted in the linker generated .eh_frame
CIEs not being merged and no .eh_frame_hdr index entries for those
FDEs.  It turns out that all the info from parsing .eh_frame is
attached to the section, so order of parsing isn't important, and
after parsing sec_info_type being set will prevent a section being
parsed again.  At least, when parsing doesn't hit an error.  So there
isn't really any need for "parsed_eh_frame".  "merge_cies" is also
redundant, which means _bfd_elf_{begin,end}_eh_frame_parsing can also
disappear.

bfd/
	* elf-bfd.h (struct eh_frame_hdr_info): Delete merge_cies and
	parsed_eh_frames.
	(_bfd_elf_begin_eh_frame_parsing): Delete.
	(_bfd_elf_end_eh_frame_parsing): Delete.
	* elf-eh-frame.c (_bfd_elf_begin_eh_frame_parsing): Delete.
	(_bfd_elf_end_eh_frame_parsing): Delete.
	(_bfd_elf_parse_eh_frame): Don't test parsed_eh_frame.  Test
	!info->relocatable in place of merge_cies.
	* elflink.c (bfd_elf_gc_sections, bfd_elf_discard_info): Adjust.
	* elf64-ppc.c (glink_eh_frame_cie): Pad to multiple of 8.
	(ppc64_elf_size_stubs): Likewise pad stub FDE.
	(ppc64_elf_build_stubs): Move code setting glink .eh_frame to..
	(ppc64_elf_size_stubs): ..here and..
	(ppc64_elf_finish_dynamic_sections): ..here.
ld/
	* emultempl/ppc64elf.em (gld${EMULATION_NAME}_after_allocation): Call
	bfd_elf_discard_info after generating glink .eh_frame.  Delete
	redundant test on ppc64_elf_setup_section_lists status.
2014-08-22 10:09:09 +09:30
Maciej W. Rozycki 8c45e5ec6b ARM/ld: Correct macro formatting in armelf.em
* emultempl/armelf.em (OPTION_STUBGROUP_SIZE): Fix formatting.
	(OPTION_NO_MERGE_EXIDX_ENTRIES, OPTION_LONG_PLT): Likewise.
2014-08-20 20:17:18 +01:00
Will Newton 01e6c1a48d ARM: Add support for armeb-*-eabi*
At the moment it is possible to configure binutils for these triples
but the resulting linker defaults to little endian with huge numbers
of testsuite failures, which on the face of it does not appear to make
much sense.

This patch makes the behaviour similar to armeb-elf and the testsuite
is clean.

bfd/ChangeLog:

2014-08-20  Will Newton  <will.newton@linaro.org>

	* config.bfd: Default armeb-*-eabi* to big endian.

ld/ChangeLog:

2014-08-20  Will Newton  <will.newton@linaro.org>

	* configure.tgt: Default armeb-*-eabi* to big endian.
2014-08-20 16:58:36 +01:00
Nick Clifton 2d5c3743a3 Enabling the HIGH_ENTROPY_VA flag allows the operating system to use
addresses outside of the 32-bit range before memory exhaustion. This
results in a higher entropy implementation of ASLR when used with the
DYNAMIC_BASE flag.

	* include/coff/pe.h: Add HIGH_ENTROPY_VA flag
	* ld/emultempl/pep.em: Add --high-entropy-va switch
	* ld/ld.texinfo: Document the --high-entropy-va switch
2014-08-20 16:10:29 +01:00
Nick Clifton 985743c7fb Add copyright notice to linker script files. 2014-08-20 10:34:58 +01:00
Alan Modra 2974be626b Fix --diable-shared --enable-plugins build breakage
Directories that don't use libtool need to add -ldl (on most *nix
hosts) to provide dlopen for libbfd.

config/
	* plugins.m4 (AC_PLUGINS): If plugins are enabled, add -ldl to
	LIBS via AC_SEARCH_LIBS.
gdb/
	* acinclude.m4 (GDB_AC_CHECK_BFD): Don't add -ldl.
	* config.in: Regenerate.
sim/ppc/
	* configure.ac: Invoke AC_PLUGINS.
	* config.in: Regenerate.

and regen lots of configure files.
2014-08-19 21:59:56 +09:30