Commit Graph

10819 Commits

Author SHA1 Message Date
Alan Modra 978f0babbe daily update 2013-12-17 09:30:38 +10:30
Andreas Schwab 1a1fb62757 Fix missing newline in error message
* elf64-ppc.c (ppc64_elf_relocate_section): Add newline to error
message.
2013-12-16 17:28:54 +01:00
Alan Modra 4bc4619056 daily update 2013-12-16 09:30:37 +10:30
Alan Modra e7d27824a6 daily update 2013-12-15 09:30:39 +10:30
Alan Modra 57fa7b8c7e Correct elf_merge_st_other arguments for weak symbols
* elflink.c (_bfd_elf_merge_symbol): If merging a new weak
	symbol that will be skipped, we don't have a new definition.
2013-12-14 13:14:03 +10:30
Alan Modra 08159f13a2 daily update 2013-12-14 09:31:01 +10:30
Kuan-Lin Chen 35c081572f Add support for Andes NDS32:
BFD:
	* Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Add nds32
	files.
	* Makefile.in: Regenerate.
	* archures.c (bfd_nds32_arch): Add nds32 target.
	* bfd-in2.h: Regenerate.
	* config.bfd (nds32*le-*-linux): Add bfd_elf32_nds32lelin_vec
	and bfd_elf32_nds32belin_vec.
	(nds32*be-*-linux*): Likewise.
	(nds32*le-*-*): Add bfd_elf32_nds32le_vec and bfd_elf32_nds32be_vec.
	(nds32*be-*-*): Likewise.
	* configure.in (bfd_elf32_nds32be_vec): Add elf32-nds32.lo.
	(bfd_elf32_nds32le_vec): Likewise.
	(bfd_elf32_nds32belin_vec): Likewise.
	(bfd_elf32_nds32lelin_vec): Likewise.
	* configure: Regenerate.
	* cpu-nds32.c: New file for nds32.
	* elf-bfd.h: Add NDS32_ELF_DATA.
	* elf32-nds32.c: New file for nds32.
	* elf32-nds32.h: New file for nds32.
	* libbfd.h: Regenerate.
	* reloc.c: Add relocations for nds32.
	* targets.c (bfd_elf32_nds32be_vec): New declaration for nds32.
	(bfd_elf32_nds32le_vec): Likewise.
	(bfd_elf32_nds32belin_vec): Likewise.
	(bfd_elf32_nds32lelin_vec): Likewise.

BINUTILS:
	* readelf.c: Include elf/nds32.h
	(guess_is_rela): Add case for EM_NDS32.
	(dump_relocations): Add case for EM_NDS32.
	(decode_NDS32_machine_flags): New.
	(get_machine_flags): Add case for EM_NDS32.
	(is_32bit_abs_reloc): Likewise.
	(is_16bit_abs_reloc): Likewise.
	(process_nds32_specific): New.
	(process_arch_specific): Add case for EM_NDS32.
	* NEWS: Announce Andes nds32 support.
	* MAINTAINERS: Add nds32 maintainers.
  TESTSUITE:
	* binutils-all/objdump.exp: Add NDS32 cpu.
	* binutils-all/readelf.r: Skip extra reloc created by NDS32.

GAS:
	* Makefile.am (TARGET_CPU_CFILES): Add config/tc-nds32.c.
	(TARGET_CPU_HFILES): Add config/tc-nds32.h.
	* Makefile.in: Regenerate.
	* configure.in (nds32): Add nds32 target extension config support.
	* configure.tgt : Add case for nds32-*-elf* and nds32-*-linux*.
	* configure: Regenerate.
	* config/tc-nds32.c: New file for nds32.
	* config/tc-nds32.h: New file for nds32.
	* doc/Makefile.am (CPU_DOCS): Add c-nds32.texi.
	* doc/Makefile.in: Regenerate.
	* doc/as.texinfo: Add nds32 options.
	* doc/all.texi: Set NDS32.
	* doc/c-nds32.texi: New file dor nds32 document.
	* NEWS: Announce Andes nds32 support.
  TESTSUITE:
	* gas/all/gas.exp: Add expected failures for NDS32.
	* gas/elf/elf.exp: Likewise.
	* gas/lns/lns.exp: Use alternate test.
	* gas/macros/irp.d: Skip for NDS32.
	* gas/macros/macros.exp: Skip some tests for the NDS32.
	* gas/macros/rept.d: Skip for NDS32.
	* gas/macros/test3.d: Skip for NDS32.
	* gas/nds32: New directory.
	* gas/nds32/alu-1.s: New test.
	* gas/nds32/alu-1.d: Likewise.
	* gas/nds32/alu-2.s: Likewise.
	* gas/nds32/alu-2.d: Likewise.
	* gas/nds32/br-1.d: Likewise.
	* gas/nds32/br-1.s: Likewise.
	* gas/nds32/br-2.d: Likewise.
	* gas/nds32/br-2.s: Likewise.
	* gas/nds32/ji-jr.d: Likewise.
	* gas/nds32/ji-jr.s: Likewise.
	* gas/nds32/ls.d: Likewise.
	* gas/nds32/ls.s: Likewise.
	* gas/nds32/lsi.d: Likewise.
	* gas/nds32/lsi.s: Likewise.
	* gas/nds32/to-16bit-v1.d: Likewise.
	* gas/nds32/to-16bit-v1.s: Likewise.
	* gas/nds32/to-16bit-v2.d: Likewise.
	* gas/nds32/to-16bit-v2.s: Likewise.
	* gas/nds32/to-16bit-v3.d: Likewise.
	* gas/nds32/to-16bit-v3.s: Likewise.
	* gas/nds32/nds32.exp: New test driver.

LD:
	* Makefile.am (ALL_EMULATION_SOURCES): Add nds32 target.
	* Makefile.in: Regenerate.
	* configure.tgt: Add case for nds32*le-*-elf*, nds32*be-*-elf*,
	nds32*le-*-linux-gnu*, and nds32*be-*-linux-gnu*.
	* emulparams/nds32belf.sh: New file for nds32.
	* emulparams/nds32belf_linux.sh: Likewise.
	* emulparams/nds32belf16m.sh: Likewise.
	* emulparams/nds32elf.sh: Likewise.
	* emulparams/nds32elf_linux.sh: Likewise.
	* emulparams/nds32elf16m.sh: Likewise.
	* emultempl/nds32elf.em: Likewise.
	* scripttempl/nds32elf.sc}: Likewise.
	* gen-doc.texi: Set NDS32.
	* ld.texinfo: Set NDS32.
	* NEWS: Announce Andes nds32 support.
  TESTSUITE:
	* lib/ld-lib.exp: Add NDS32 to list of targets that do not support
	shared library generation.
	* ld-nds32: New directory.
	* ld-nds32/branch.d: New test.
	* ld-nds32/branch.ld: New test.
	* ld-nds32/branch.s: New test.
	* ld-nds32/diff.d: New test.
	* ld-nds32/diff.ld: New test.
	* ld-nds32/diff.s: New test.
	* ld-nds32/gp.d: New test.
	* ld-nds32/gp.ld: New test.
	* ld-nds32/gp.s: New test.
	* ld-nds32/imm.d: New test.
	* ld-nds32/imm.ld: New test.
	* ld-nds32/imm.s: New test.
	* ld-nds32/imm_symbol.s: New test.
	* ld-nds32/relax_jmp.d: New test.
	* ld-nds32/relax_jmp.ld: New test.
	* ld-nds32/relax_jmp.s: New test.
	* ld-nds32/relax_load_store.d: New test.
	* ld-nds32/relax_load_store.ld: New test.
	* ld-nds32/relax_load_store.s: New test.
	* ld-nds32/nds32.exp: New file.

OPCODES:
	* Makefile.am (TARGET_LIBOPCODES_CFILES): Add nds32-asm.c
	and nds32-dis.c.
	* Makefile.in: Regenerate.
	* configure.in: Add case for bfd_nds32_arch.
	* configure: Regenerate.
	* disassemble.c (ARCH_nds32): Define.
	* nds32-asm.c: New file for nds32.
	* nds32-asm.h: New file for nds32.
	* nds32-dis.c: New file for nds32.
	* nds32-opc.h: New file for nds32.

INCLUDE:
	* dis-asm.h (print_insn_nds32): Add nds32 target.
	* elf/nds32.h: New file for nds32.
	* opcode/nds32.h: New file for nds32.
2013-12-13 11:52:32 +00:00
Alan Modra ec0d6081a0 daily update 2013-12-13 09:30:37 +10:30
H.J. Lu 57b828ef36 Also copy EI_OSABI field
bfd/

	PR binutils/16318
	* elf.c (_bfd_elf_copy_private_bfd_data): Remove BFD_ASSERT.
	Set e_flags only if elf_flags_init is FALSE.  Copy EI_OSABI
	field.

binutils/testsuite/

	PR binutils/16318
	* binutils-all/strip-10.d: Check OS/ABI.
2013-12-12 14:41:15 -08:00
H.J. Lu 84b66498ef Remove bfd_elf32_bfd_set_private_bfd_flags
* elf32-sh.c (bfd_elf32_bfd_set_private_bfd_flags): Removed.
2013-12-12 14:24:03 -08:00
H.J. Lu 58e7ebacdd Set ET_EXEC for -pie -Ttext-segment=
bfd/

	* elf.c (assign_file_positions_except_relocs): Set e_type in ELF
	header to ET_EXEC for -pie -Ttext-segment=.

2013-12-10  H.J. Lu  <hongjiu.lu@intel.com>

	* ld-pie/vaddr-0.d: New file.
	* ld-pie/vaddr-1.d: Likewise.
	* ld-pie/vaddr.s: Likewise.
2013-12-12 07:41:27 -08:00
Alan Modra 34e627b73c daily update 2013-12-12 09:30:48 +10:30
Alan Modra 3fb00a37d0 daily update 2013-12-11 09:30:38 +10:30
Alan Modra 67cf16836d daily update 2013-12-10 09:30:46 +10:30
Alan Modra a36a852b46 daily update 2013-12-09 09:30:52 +10:30
Alan Modra bc58135abd correct file reference 2013-12-08 15:40:43 +10:30
Alan Modra 68c88cd461 Fix --as-needed undefined symbol references from dynamic libraries.
libx.so refers to some_sym, liby.so provides some_sym@some_version
wasn't seen as satisfying the reference.

	* elf64-ppc.c (_bfd_elf_add_default_symbol): Set dynamic_def
	and ref_dynamic_nonweak when chaining together indirect
	symbols.
2013-12-08 15:33:29 +10:30
Alan Modra 06fe43ca0e daily update 2013-12-08 09:30:56 +10:30
Alan Modra cc59280b3d daily update 2013-12-07 10:16:29 +10:30
Tristan Gingold 2b597f540f Add epilog unwind for x86_64 pe/coff
include/coff/
2013-12-06  Tristan Gingold  <gingold@adacore.com>

	* pe.h (UWOP_EPILOG, UWOP_PARE): Define.

bfd/
2013-12-06  Tristan Gingold  <gingold@adacore.com>

	* pei-x86_64.c (pex64_xdata_print_uwd_codes): Add argument rf.
	Display epilog opcode.
	(pex64_dump_xdata): Add argument rf; make addr a local variable.
	Adjust call to pex64_xdata_print_uwd_codes.
	(pex64_bfd_print_pdata): Display code range, adjust call to
	pex64_dump_xdata.
2013-12-06 11:54:31 +01:00
Alan Modra b945895594 daily update 2013-12-06 09:30:12 +10:30
Tristan Gingold b30a5d18b1 Clear allocated target data.
2013-12-05  Tristan Gingold  <gingold@adacore.com>

	* mach-o.c (bfd_mach_o_mkobject_init): Use bfd_zalloc.
2013-12-05 11:18:59 +01:00
Alan Modra 18e2e72cbe daily update 2013-12-05 09:30:12 +10:30
Alan Modra aa2dbebef8 daily update 2013-12-04 09:30:38 +10:30
Nick Clifton 11a6da5617 * peXXigen.c (pe_print_resource_entries): New function: Displays
an entry in a .rsrc section.
	(pe_print_resource_directory): New function: Displays a directory
	in a .rsrc section.
	(pe_print_rsrc): New function: Displays the contents of .rsrc
	section.
	(_bfd_XX_print_private_bfd_data_common): Call pe_print_rsrc.

	* binutils-all/windres/windres.exp: Run for x86_64-pc-cygwin.
	Add test of "objump -p" output.
2013-12-03 13:57:56 +00:00
Alan Modra 00f412ee52 More PowerPC64 ELFv2 --just-symbols fixes
I don't know what I was thinking here to omit the save of r2.
Possibly I was looking at -msave-toc-indirect code at the time, where
r2 is saved in the function prologue.

	* elf64-ppc.c (ppc_build_one_stub <ppc_stub_plt_branch_r2off>):
	Don't omit saving of r2 for ELFv2.  Don't addi 2,2,0.
	(ppc_size_one_stub <ppc_stub_plt_branch_r2off>): Adjust to suit.
2013-12-03 18:02:44 +10:30
Alan Modra 2c3f079f58 PowerPC64 linking of --just-symbols objects (klibc)
With -mcmodel=medium we can't assume that a -R object doesn't use
toc-relative addressing if there's no toc.  Lots of things are
accessed via r2, not just the toc/got section.  Also, testing for
.opd is plain wrong for ELFv2.

	* elf64-ppc.c (ppc64_elf_link_just_syms): Remove .got check.
	Handle ELFv2.
2013-12-03 15:16:12 +10:30
Alan Modra 310bf259c3 daily update 2013-12-03 09:30:22 +10:30
Alan Modra ce3ca210b5 daily update 2013-12-02 09:30:01 +10:30
Alan Modra 4f36e1fee3 daily update 2013-12-01 09:30:12 +10:30
Alan Modra f1ec7f0f3e daily update 2013-11-30 09:30:12 +10:30
Alan Modra 5425b0d80b daily update 2013-11-29 09:30:13 +10:30
Alan Modra a6c8f227fe daily update 2013-11-28 09:30:14 +10:30
Tristan Gingold 48d5accb7a Improve dump of xdata/pdata on x86_64.
bfd/
2013-11-27  Tristan Gingold  <gingold@adacore.com>

	* pei-x86_64.c (pex_regs): Make it const.  Add comments.
	(pex64_get_runtime_function): Do not split UnwindData.
	(pex64_get_unwind_info): Extract the chain and the handler.
	(pex64_xdata_print_uwd_codes): Rewritten: do not reverse print
	the opcode, handle version 2, add consistency check, make the
	code host neutral.
	(pex64_dump_xdata): Change arguments to pass the section and its
	content.  Handle version 2, change output.
	(pex64_bfd_print_pdata): Add comments, load section for xdata.
	Avoid duplicate outputs.

include/coff
2013-11-27  Tristan Gingold  <gingold@adacore.com>

	* pe.h (struct pex64_runtime_function): Remove isChained.
	(UWOP_SAVE_XMM): Add comment.
	(struct pex64_unwind_info): Remove extra fields.
2013-11-27 11:21:03 +01:00
Alan Modra 247196c840 daily update 2013-11-27 09:30:14 +10:30
Will Newton 4920638856 bfd/elfnn-aarch64.c: Handle static links with ifunc correctly.
The code for handling GOT references to ifunc symbols in static links
was missing.

bfd/ChangeLog:

2013-11-26  Will Newton  <will.newton@linaro.org>

	* elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol):
	Handle STT_GNU_IFUNC symbols correctly in static links.

ld/testsuite/ChangeLog:

2013-11-26  Will Newton  <will.newton@linaro.org>

	* ld-aarch64/aarch64-elf.exp: Add ifunc-22.
	* ld-aarch64/ifunc-22.d: New file.
	* ld-aarch64/ifunc-22.s: Likewise.
2013-11-26 15:25:11 +00:00
Will Newton b1ee0cc489 bfd/elfnn-aarch64.c: Fix miscalculation of GOTPLT offset for ifunc syms.
The .got.plt header size was not being correctly taken into account
when calculating the offset for relocations against ifunc symbols.

bfd/ChangeLog:

2013-11-26  Will Newton  <will.newton@linaro.org>

	* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Ensure
	PLT_INDEX is calculated using correct header size.

ld/testsuite/ChangeLog:

2013-11-26  Will Newton  <will.newton@linaro.org>

	* ld-aarch64/aarch64-elf.exp: Add ifunc-21 test.
	* ld-aarch64/ifunc-21.d: New file.
	* ld-aarch64/ifunc-21.s: Likewise.
2013-11-26 15:24:54 +00:00
Alan Modra 88e80851c9 daily update 2013-11-26 09:30:12 +10:30
Alan Modra 5a75f60bc2 daily update 2013-11-25 09:30:20 +10:30
Alan Modra 1fd4d43dbe daily update 2013-11-24 09:30:12 +10:30
Alan Modra 08f4871a65 daily update 2013-11-23 09:30:01 +10:30
Cory Fields 0cb112f740 * windres.c (define_resource): Use zero for timestamp, making
output deterministic. time.h include is no longer needed.
	* resres.c (res_append_resource): Likewise.

	* pe-dll.c (fill_edata): Only use a real timestamp if
	--insert-timestamp was used.
	* emultempl/pe.em: Add the --insert-timestamp option.
	* emultempl/pep.em: Likewise for 64bit.
	* ld.texinfo: Document the --insert-timestamp option.

	* libcoff-in.h: Add insert_timestamp flag to the pe_data struct.
	* libcoff.h: Regenerate.
	* peXXigen.c (_bfd_XXi_only_swap_filehdr_out): Only use a real
	timestamp if --insert-timestamp was used.
2013-11-22 14:55:56 +00:00
Alan Modra 46b2ff5b53 daily update 2013-11-22 09:32:36 +10:30
Alan Modra 76fbd4629c daily update 2013-11-21 09:30:14 +10:30
Roland McGrath 33aa641a5d Fix *-nacl* target objcopy/strip of binary made with custom linker script
bfd/
	* elf-nacl.c (nacl_modify_segment_map): Calculate SIZEOF_HEADERS
	when not doing linking (i.e. INFO is a null pointer).
2013-11-19 15:05:15 -08:00
Alan Modra aa01e46a4c daily update 2013-11-20 09:30:14 +10:30
H.J. Lu 0c7231013c Re-indent elf_x86_64_section_from_shdr
* elf64-x86-64.c (elf_x86_64_section_from_shdr): Re-indent.
2013-11-19 13:00:42 -08:00
Alan Modra 3737b3210b daily update 2013-11-19 09:30:19 +10:30
Alan Modra 0e7c43d8ec daily update 2013-11-18 09:30:16 +10:30
H.J. Lu c33205431a Add R_X86_64_PC32_BND and R_X86_64_PLT32_BND
bfd/

	* elf64-x86-64.c (x86_64_elf_howto_table): Add R_X86_64_PC32_BND
	and R_X86_64_PLT32_BND.
	(R_X86_64_standard): Replace R_X86_64_RELATIVE64 with
	R_X86_64_PLT32_BND.
	(IS_X86_64_PCREL_TYPE): Add R_X86_64_PLT32_BND.
	(x86_64_reloc_map): Add BFD_RELOC_X86_64_PC32_BND and
	BFD_RELOC_X86_64_PLT32_BND.
	(elf_x86_64_check_relocs): Handle R_X86_64_PC32_BND and
	R_X86_64_PLT32_BND.
	(elf_x86_64_gc_sweep_hook): Likewise.
	(elf_x86_64_relocate_section): Likewise.
	* reloc.c (bfd_reloc_code_real): Add BFD_RELOC_X86_64_PC32_BND
	and BFD_RELOC_X86_64_PLT32_BND.
	* bfd-in2.h: Regenerated.
	* libbfd.h: Likewise.

gas/

	* config/tc-i386.c (reloc): Add an argument, bnd_prefix, to
	indicate if instruction has the BND prefix.  Return
	BFD_RELOC_X86_64_PC32_BND instead of BFD_RELOC_32_PCREL if
	bnd_prefix isn't zero.
	(output_branch): Pass BFD_RELOC_X86_64_PC32_BND to frag_var
	if needed.
	(output_jump): Update reloc call.
	(output_interseg_jump): Likewise.
	(output_disp): Likewise.
	(output_imm): Likewise.
	(x86_cons_fix_new): Likewise.
	(lex_got): Add an argument, bnd_prefix, to indicate if
	instruction has the BND prefix.  Use BFD_RELOC_X86_64_PLT32_BND
	if needed.
	(x86_cons): Update lex_got call.
	(i386_immediate): Likewise.
	(i386_displacement): Likewise.
	(md_apply_fix): Handle BFD_RELOC_X86_64_PC32_BND and
	BFD_RELOC_X86_64_PLT32_BND.
	(tc_gen_reloc): Likewise.
	* config/tc-i386-intel.c (i386_operator): Update lex_got call.

gas/testsuite/

	* gas/i386/i386.exp: Run x86-64-mpx-branch-1 and
	x86-64-mpx-branch-2 on 64-bit ELF targets.
	* gas/i386/x86-64-mpx-branch-1.d: New file.
	* gas/i386/x86-64-mpx-branch-1.s: Likewise.
	* gas/i386/x86-64-mpx-branch-2.d: Likewise.
	* gas/i386/x86-64-mpx-branch-2.s: Likewise.

include/elf/

	* x86-64.h: Add R_X86_64_PC32_BND and R_X86_64_PLT32_BND.

ld/testsuite/

	* ld-x86-64/mpx.exp: New file.
	* ld-x86-64/mpx1.out: Likewise.
	* ld-x86-64/mpx1a.c: Likewise.
	* ld-x86-64/mpx1a.rd: Likewise.
	* ld-x86-64/mpx1b.c: Likewise.
	* ld-x86-64/mpx1c.c: Likewise.
	* ld-x86-64/mpx1c.rd: Likewise.
2013-11-17 08:57:56 -08:00