Commit Graph

11179 Commits

Author SHA1 Message Date
Alan Modra a0fed88764 daily update 2014-05-22 09:31:09 +09:30
Alan Modra a6e3e144a3 daily update 2014-05-21 09:31:09 +09:30
DJ Delorie bceec4b911 * elf32-msp430.c (msp430_elf_relax_adjust_locals): Avoid overflow. 2014-05-20 15:42:23 -04:00
Alan Modra 93d1b056cb Rewrite ppc32 backend .sdata and .sdata2 handling
1) _SDA_BASE_ and _SDA2_BASE_ and defined automatically, in a similar
   manner to the way _GLOBAL_OFFSET_TABLE_ is handled.  It's a little
   more complicated to remove the symbols because _SDA_BASE_ needs to
   be there if either .sdata or .sbss is present, and similarly for
   _SDA2_BASE.
2) The linker created .sdata and .sdata2 sections used for
   R_PPC_EMB_SDAI16 and R_PPC_EMB_SDA2I16 pointers are created early.
   Nowadays we strip unneeded sections from the output, so it isn't
   necessary to delay creating the sections.
3) The output section for targets of various SDA relocs is now checked
   as per the ABI(s).  We previously allowed .sdata.foo and similar,
   most likely because at some stage we were checking input sections.

Also, the patch fixes a long-standing bug in size_input_sections
that affects the values of symbols defined in stripped input
sections.

	PR 16952
bfd/
	* elf32-ppc.c (ppc_elf_create_linker_section): Move earlier.
	Remove redundant setting of htab->elf.dynobj.  Don't align.
	Define .sdata symbols using _bfd_elf_define_linkage_sym.
	(ppc_elf_create_glink): Call ppc_elf_create_linker_section.
	(create_sdata_sym): Delete.
	(elf_allocate_pointer_linker_section): Rename from
	elf_create_pointer_linker_section.  Align section.
	(ppc_elf_check_relocs): Don't call ppc_elf_creat_linker_section
	directly here, or create_sdata_sym.  Set ref_regular on _SDA_BASE_
	and _SDA2_BASE_.
	(ppc_elf_size_dynamic_sections): Remove ATTRIBUTE_UNUSED on param.
	Remove unnecessary tests on _SDA_BASE_ sym.
	(maybe_strip_sdasym, ppc_elf_maybe_strip_sdata_syms): New functions.
	(ppc_elf_relocate_section): Tighten SDA reloc symbol section checks.
	* elf32-ppc.h (ppc_elf_set_sdata_syms): Delete.
	(ppc_elf_maybe_strip_sdata_syms): Declare.
ld/
	* emulparams/elf32ppccommon.sh (_SDA_BASE_, _SDA2_BASE_): Delete.
	* emultempl/ppc32elf.em (ppc_before_allocation): Call
	ppc_elf_maybe_strip_sdata_syms.
	* ldlang.c (size_input_section): Correct output_offset value
	for excluded input sections.
2014-05-20 13:13:23 +09:30
Alan Modra ab2f2ff937 daily update 2014-05-20 09:30:38 +09:30
Alan Modra f0d7b6ded5 daily update 2014-05-19 09:30:38 +09:30
Alan Modra d7e4851a0c daily update 2014-05-18 09:30:41 +09:30
Ryan Mansfield a7c7b2ba6c * config.bfd: Move QNX target_cflags from arm-*-netbsd* to arm-*-nto*. 2014-05-17 17:48:44 +01:00
Alan Modra ff46be9062 daily update 2014-05-17 09:30:39 +09:30
Jon Turney 6e6e7cfc78 This fixes a few issues with pe/coff build-ids that were discovered since the
original patches were posted:

  pe/coff: Display GUID build-id in the conventional way
  pe/coff: Don't interpret debug directory in section with no contents
  pe/coff: Keep .build-id with --only-keep-debug
  pe/coff: Don't break .build-id with objcopy/strip

	* peXXigen.c (pe_print_debugdata): Don't interpret debug directory
	in a section with no contents.
	(is_vma_in_section, find_section_by_vma): New functions.
	(_bfd_XX_bfd_copy_private_bfd_data_common): Recalculate file
	offsets in the debug directory.
	(_bfd_XXi_slurp_codeview_record, _bfd_XXi_write_codeview_record):
	Byte-swap GUID from little-endian to big-endian order for
	consistent and conventional display.

	* objcopy.c (is_nondebug_keep_contents_section): New function.
	(setup_section): Use it.
2014-05-16 15:34:13 +01:00
Kaushik Phata 856ea05ccf This adds support for marking RL78 binaries as either supporting 32-bit
or 64-bit doubles.  It also makes the linker complain if the user attempts
to link together binaries with different sized doubles.

	* elf32-rl78.c (rl78_elf_merge_private_bfd_data): Complain if
	64-bit doubles objects mix with 32-bit doubles objects.
	(rl78_elf_print_private_bfd_data): Describe 64-bit doubles flag.

	* readelf.c (get_machine_flags): Handle RL78 64-bit doubles flag.

	* config/tc-rl78.c (enum options): Add OPTION_32BIT_DOUBLES
	and OPTION_64BIT_DOUBLES.
	(md_longopts): Add -m32bit-doubles and -m64bit-doubles.
	(md_parse_option): Parse -m32bit-doubles and -m64bit-doubles.
	(md_show_usage): Show all of the RL78 options.
	(rl78_float_cons): New static functions.
	(md_pseudo_table): Update handler for "double".
2014-05-16 14:57:10 +01:00
Alan Modra 791849751d daily update 2014-05-16 09:30:36 +09:30
Alan Modra 57b287416b daily update 2014-05-15 09:30:45 +09:30
Alan Modra 5a9b370378 daily update 2014-05-14 09:30:38 +09:30
Alan Modra 51e719b4e1 daily update 2014-05-13 09:30:39 +09:30
Alan Modra 35a1657d26 daily update 2014-05-12 09:30:37 +09:30
Alan Modra e5898c2827 daily update 2014-05-11 09:30:38 +09:30
Alan Modra b1f02b89ed daily update 2014-05-10 09:30:37 +09:30
Alan Modra 0c263177a5 daily update 2014-05-09 09:30:38 +09:30
Hans-Peter Nilsson 68e0f6b16d Add bfd/ChangeLog entry missing in commit.
* mmo.c: Update URLs in documentation comments.
2014-05-08 12:47:52 +02:00
Alan Modra efefdd6362 daily update 2014-05-08 09:30:41 +09:30
Hans-Peter Nilsson 52f4ea798a mmo.c: Update URLs in documentation comments. 2014-05-08 00:48:19 +02:00
Volodymyr Arbatov 1058c7532d Use signed data type for R_XTENSA_DIFF* relocation offsets.
R_XTENSA_DIFF relocation offsets are in fact signed. Treat them as such.
Add testcase that examines ld behaviour on R_XTENSA_DIFF relocation
changing sign during relaxation.

2014-05-02  Volodymyr Arbatov  <arbatov@cadence.com>
	    David Weatherford  <weath@cadence.com>
	    Max Filippov  <jcmvbkbc@gmail.com>

bfd/
  * elf32-xtensa.c (relax_section): treat R_XTENSA_DIFF* relocations as
  signed.

gas/
  * config/tc-xtensa.c (md_apply_fix): mark BFD_RELOC_XTENSA_DIFF*
  fixups as signed.

ld/testsuite/
  * ld-xtensa/diff_overflow.exp, * ld-xtensa/diff_overflow1.s,
  * ld-xtensa/diff_overflow2.s: Add test for DIFF* relocation
  signedness and overflow checking.
2014-05-08 01:55:41 +04:00
Andreas Tobler e59bc75b65 Add proper arm config for *-*-freebsd*. 2014-05-07 22:52:51 +02:00
Andrew Bennett ae52f48306 Add MIPS r3 and r5 support.
This patch firstly adds support for mips32r3 mips32r5, mips64r3
and mips64r5.  Secondly it adds support for the eretnc instruction.

ChangeLog:

bfd/
	* aoutx.h (NAME (aout, machine_type)): Add mips32r3, mips64r3,
	mips32r5 and mips64r5.
	* archures.c (bfd_architecture): Likewise.
	* bfd-in2.h (bfd_architecture): Likewise.
	* cpu-mips.c (arch_info_struct): Likewise.
	* elfxx-mips.c (mips_set_isa_flags): Likewise.

gas/
	* tc-mips.c (ISA_SUPPORTS_MIPS16E): Add mips32r3, mips32r5, mips64r3
	and mips64r5.
	(ISA_HAS_64BIT_FPRS): Likewise.
	(ISA_HAS_ROR): Likewise.
	(ISA_HAS_ODD_SINGLE_FPR): Likewise.
	(ISA_HAS_MXHC1): Likewise.
	(hilo_interlocks): Likewise.
	(md_longopts): Likewise.
	(ISA_HAS_64BIT_REGS): Add mips64r3 and mips64r5.
	(ISA_HAS_DROR): Likewise.
	(options): Add OPTION_MIPS32R3, OPTION_MIPS32R5, OPTION_MIPS64R3, and
	OPTION_MIPS64R5.
	(mips_isa_rev): Add support for mips32r3, mips32r5, mips64r3 and
	mips64r5.
	(md_parse_option): Likewise.
	(s_mipsset): Likewise.
	(mips_cpu_info_table): Add entries for mips32r3, mips32r5, mips64r3
	and mips64r5.  Also change p5600 entry to be mips32r5.
	* configure.in: Add support for mips32r3, mips32r5, mips64r3 and
	mips64r5.
	* configure: Regenerate.
	* doc/c-mips.texi: Document the -mips32r3, -mips32r5, -mips64r3 and
	-mips64r5 command line options.
	* doc/as.texinfo: Likewise.

gas/testsuite/
	* gas/mips/mips.exp: Add MIPS32r5 tests.  Also add the mips32r3,
	mips32r5, mips64r3 and mips64r5 isas to the testsuite.
	* gas/mips/r5.s: New test.
	* gas/mips/r5.d: Likewise.

include/opcode/
	* mips.h (INSN_ISA_MASK): Updated.
	(INSN_ISA32R3): New define.
	(INSN_ISA32R5): New define.
	(INSN_ISA64R3): New define.
	(INSN_ISA64R5): New define.
	(INSN_ISA64, INSN_ISA64R2, INSN_ISA3_32, INSN_ISA3_32R2, INSN_ISA4_32
	INSN_ISA4_32R2, INSN_ISA5_32R2): Renumbered.
	(mips_isa_table): Add entries for mips32r3, mips32r5, mips64r3 and
	mips64r5.
	(INSN_UPTO32R3): New define.
	(INSN_UPTO32R5): New define.
	(INSN_UPTO64R3): New define.
	(INSN_UPTO64R5): New define.
	(ISA_MIPS32R3): New define.
	(ISA_MIPS32R5): New define.
	(ISA_MIPS64R3): New define.
	(ISA_MIPS64R5): New define.
	(CPU_MIPS32R3): New define.
	(CPU_MIPS32R5): New define.
	(CPU_MIPS64R3): New define.
	(CPU_MIPS64R5): New define.

opcodes/
	* mips-opc.c (mips_builtin_opcodes): Add MIPS32r5 eretnc instruction.
	(I34): New define.
	(I36): New define.
	(I66): New define.
	(I68): New define.
	* mips-dis.c (mips_arch_choices): Add mips32r3, mips32r5, mips64r3 and
	mips64r5.
	(parse_mips_dis_option): Update MSA and virtualization support to
	allow mips64r3 and mips64r5.
2014-05-07 11:47:29 +01:00
Alan Modra 1144861e08 daily update 2014-05-07 09:30:55 +09:30
Richard Sandiford 757a636fb5 bfd/
* elfxx-mips.h (elfxx-mips.h): Declare.
	* elfxx-mips.c (mips_elf_merge_obj_attributes): Use it to report
	Tag_GNU_MIPS_ABI_FP mismatches.
	(_bfd_mips_fp_abi_string): New function.
2014-05-06 20:13:03 +01:00
Alan Modra 5e824b358f daily update 2014-05-06 09:30:39 +09:30
Alan Modra 74183dabc3 daily update 2014-05-05 09:30:36 +09:30
Alan Modra 5c1a8bf516 daily update 2014-05-04 09:30:37 +09:30
Alan Modra 19a170752b daily update 2014-05-03 09:30:42 +09:30
Alan Modra 2f67d68633 Sort target vectors to suit renaming
* targets.c: Sort bfd_target vectors somewhat alphabetically.
	* configure.in: Likewise.
	* configure: Regenerate.
2014-05-02 20:11:49 +09:30
Alan Modra 6d00b59031 bfd target vector rationalisation
This renames the bfd targets to <cpu>_<format>_<other>_<endian>_vec.
So for example, bfd_elf32_ntradlittlemips_vec becomes
mips_elf32_ntrad_le_vec and hp300bsd_vec becomes m68k_aout_hp300bsd_vec.

bfd/
	* aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-ns32k.c,
	* aout-sparcle.c, * aout0.c, * aoutx.h, * armnetbsd.c, * bout.c,
	* cf-i386lynx.c, * cf-sparclynx.c, * cisco-core.c, * coff-alpha.c,
	* coff-apollo.c, * coff-arm.c, * coff-aux.c, * coff-go32.c,
	* coff-h8300.c, * coff-h8500.c, * coff-i386.c, * coff-i860.c,
	* coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mips.c,
	* coff-rs6000.c, * coff-sh.c, * coff-sparc.c, * coff-stgo32.c,
	* coff-svm68k.c, * coff-tic80.c, * coff-u68k.c, * coff-w65.c,
	* coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c,
	* coff64-rs6000.c, * config.bfd, * configure.com, * configure.in,
	* demo64.c, * elf-m10200.c, * elf-m10300.c, * elf32-am33lin.c,
	* elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c,
	* elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c,
	* elf32-d10v.c, * elf32-d30v.c, * elf32-dlx.c, * elf32-epiphany.c,
	* elf32-fr30.c, * elf32-frv.c, * elf32-gen.c, * elf32-h8300.c,
	* elf32-hppa.c, * elf32-i370.c, * elf32-i386.c, * elf32-i860.c,
	* elf32-i960.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c,
	* elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c,
	* elf32-m68k.c, * elf32-m88k.c, * elf32-mcore.c, * elf32-mep.c,
	* elf32-metag.c, * elf32-microblaze.c, * elf32-mips.c, * elf32-moxie.c,
	* elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nios2.c,
	* elf32-or1k.c, * elf32-pj.c, * elf32-ppc.c, * elf32-rl78.c,
	* elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-sh-symbian.c,
	* elf32-sh.c, * elf32-sh64.c, * elf32-sparc.c, * elf32-spu.c,
	* elf32-tic6x.c, * elf32-tilegx.c, * elf32-tilepro.c, * elf32-v850.c,
	* elf32-vax.c, * elf32-xc16x.c, * elf32-xgate.c, * elf32-xstormy16.c,
	* elf32-xtensa.c, * elf64-alpha.c, * elf64-gen.c, * elf64-hppa.c,
	* elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c, * elf64-ppc.c,
	* elf64-s390.c, * elf64-sh64.c, * elf64-sparc.c, * elf64-tilegx.c,
	* elf64-x86-64.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c,
	* epoc-pe-arm.c, * epoc-pei-arm.c, * hp300bsd.c, * hp300hpux.c,
	* hppabsd-core.c, * hpux-core.c, * i386aout.c, * i386bsd.c,
	* i386dynix.c, * i386freebsd.c, * i386linux.c, * i386lynx.c,
	* i386mach3.c, * i386msdos.c, * i386netbsd.c, * i386os9k.c,
	* irix-core.c, * m68k4knetbsd.c, * m68klinux.c, * m68knetbsd.c,
	* m88kmach3.c, * m88kopenbsd.c, * mach-o-i386.c, * mach-o-x86-64.c,
	* makefile.vms, * mipsbsd.c, * mmo.c, * netbsd-core.c, * newsos3.c,
	* nlm32-alpha.c, * nlm32-i386.c, * nlm32-ppc.c, * nlm32-sparc.c,
	* ns32knetbsd.c, * osf-core.c, * pc532-mach.c, * pe-arm-wince.c,
	* pe-arm.c, * pe-i386.c, * pe-mcore.c, * pe-mips.c, * pe-ppc.c,
	* pe-sh.c, * pe-x86_64.c, * pei-arm-wince.c, * pei-arm.c,
	* pei-i386.c, * pei-ia64.c, * pei-mcore.c, * pei-mips.c, * pei-ppc.c,
	* pei-sh.c, * pei-x86_64.c, * ppcboot.c, * ptrace-core.c, * riscix.c,
	* sco5-core.c, * som.c, * sparclinux.c, * sparclynx.c,
	* sparcnetbsd.c, * sunos.c, * targets.c, * trad-core.c,
	* vax1knetbsd.c, * vaxbsd.c, * vaxnetbsd.c, * versados.c,
	* vms-alpha.c, * vms-lib.c: Rename bfd targets to
	<cpu>_<format>_<other>_<endian>_vec.  Adjust associated MY macros
	on aout targets.
	* configure: Regenerate.
binutils/
	* emul_aix.c: Update bfd target vector naming.
	* testsuite/binutils-all/objcopy.exp: Likewise.
ld/
	* emultempl/metagelf.em: Update bfd target vector naming.
	* emultempl/nios2elf.em: Likewise.
	* emultempl/spuelf.em: Likewise.
	* emultempl/tic6xdsbt.em: Likewise.
2014-05-02 20:09:40 +09:30
Alan Modra 4e60800159 daily update 2014-05-02 09:30:38 +09:30
Hans-Peter Nilsson 1218d67db1 * mmo.c (mmo File layout documentation): Add note about low bits
of address.
	(mmo_write_chunk): When handling data remainder, assert that
	previous remaining data is flushed.
	(mmo_write_loc_chunk): Only look for trailing and leading zeros
	when dealing with an aligned VMA and for aligned lengths.  Don't skip
	the last 32-bit-word of zeros.
	(mmo_write_loc_chunk): Emit an error if the VMA is not aligned.
	(mmo_scan) <case LOP_QUOTE>: Move re-alignment of vma before
	emitting data, not after updating it.
	<case LOP_LOC>: Call mmo_decide_section with aligned vma.
2014-05-02 00:30:42 +02:00
Alan Modra a4526a9a95 daily update 2014-05-01 09:30:38 +09:30
Nick Clifton a953eec996 Fixes a problem with the BFD library running out of memory because it mistakenly
thought that an uncompressed .debug_str section was compressed.

	* compress.c (bfd_is_section_compressed): When checking the
	.debug_str section, also check the fifth byte in the section is
	not part of a string.

	* binutils-all/debug_str.s: New test.
	* binutils-all/debug_str.d: New test control file.
	* binutils-all/compress.exp: Run debug_str test.
2014-04-30 17:04:04 +01:00
Alan Modra 5087d52931 Don't use vma to identify eh_frame personality function
This is all we should need to be able to run the eh_frame parts of
bfd_elf_discard_info before bfd_elf_size_dynamic_sections

	* elf-eh-frame.c (struct cie.personality): Replace val with sym.
	(find_merged_cie): Identify personality functions by (bfd_id,index)
	pair when a local sym is used.
2014-04-30 10:11:56 +09:30
Alan Modra 264bddaff1 daily update 2014-04-30 09:30:37 +09:30
Christian Svensson 230977a4a5 or1k: Do not override section for non-TLS symbols.
Outgoing section for relocations was computed by setting a shared
pointer to which section should be used. For TLS this was overriden to
use .rela.got since they use GOT entries but since the pointer is per
section that whole section was relocated to .rela.got, even non-TLS
relocations.

* elf32-or1k.c: Fix a bug where non-TLS relocations would be forced
into .rela.got if it contained TLS relocations as well.
2014-04-29 16:36:32 +02:00
Alan Modra 11903c4c65 daily update 2014-04-29 09:30:42 +09:30
Nick Clifton 40af4a3636 This patch reworks the fix to avoid a compile time warning so that it will work
with later versions of gcc.

	PR ld/16821
	* peXXigen.c (_bfd_XXi_swap_sym_out): Rework fix to avoid compile
	time warning.
2014-04-28 09:34:02 +01:00
Alan Modra e3e163dbb0 daily update 2014-04-28 09:30:57 +09:30
Alan Modra 7b667436a5 daily update 2014-04-27 09:30:59 +09:30
Alan Modra a9e18c6a3c Regenerate files for openrisk -> or1k change
bfd/
	* po/SRC-POTFILES.in: Regenerate.
	* configure: Regenerate.
gas/
	* po/POTFILES.in: Regenerate.
opcodes/
	* po/POTFILES.in: Regenerate.
2014-04-26 23:03:04 +09:30
Alan Modra cec9d598f5 daily update 2014-04-26 09:30:55 +09:30
Nick Clifton 88667baf24 This fixes a compile time warning which is being treated as an error. Older
versions of gcc complain about part of a conditional expression always
evaluating to false because of the size of the operands involved, even when
the entire expression is already known to be false.

	* peXXigen.c (_bfd_XXi_swap_sym_out): Another fix for building on
	a 342-bit host.  This time for older versions of gcc.
2014-04-25 17:00:20 +01:00
Alan Modra d7e6f612d6 daily update 2014-04-25 09:30:56 +09:30
Nick Clifton 08937d8023 * peXXigen.c (rsrc_print_section): Fix compile time warning for
32-bit hosts.
2014-04-24 15:49:37 +01:00
Alan Modra 93ee1e3683 PR16867, linking object with separate debug file
This teaches the DWARF2 find_line functions how to deal with separate
debug relocatable object files.  Also fixes a major bug:
When _bfd_dwarf2_slurp_debug_info was split out, place_sections ran
after .debug_info was relocated.  This defeated the whole purpose of
place_sections.  See the comment I added before place_sections.
Fixes some minor bugs too:
- place_sections didn't set VMA for alloc but non-load sections (bss).
- zero size sections can have symbols, so they need their VMA set too.
- last_vma was incorrectly adjusted.
- my last change to place_sections left VMA unchanged for .debug_info
  when the linker has mapped input to output sections, but this is
  wrong since bfd_simple_get_relocated_section_contents unmaps debug
  sections.

	PR 16867
	* dwarf2.c: Formatting.
	(struct dwarf2_debug): Make adjusted_section_count signed.
	(unset_sections): Make i signed.
	(set_debug_vma): New function.
	(place_sections): Handle separate debug object file.  Set VMA
	on debug sections, even if they have an output section.  Also
	set VMA on zero size sections, and non-load but alloc sections.
	Set adjusted_section_count to -1 when no section adjustment.
	Malloc adjusted_sections.  Don't double last_vma.  Transfer
	alloc section VMAs to separate debug file.
	(_bfd_dwarf2_cleanup_debug_info): Free adjusted_sections.
	(_bfd_dwarf2_slurp_debug_info): Add do_place parameter.  Drop
	test on symbols being the same before using old stash.  Read
	and use separate debug file symbols.  Call place_sections.
	(find_line): Don't call place_sections here.
	* libbfd-in.h (_bfd_dwarf2_slurp_debug_info): Update proto.
	* libbfd.h: Regenerate.
	* mach-o.c (bfd_mach_o_find_nearest_line): Adjust
	_bfd_dwarf2_slurp_debug_info call.
	* simple.c (simple_save_output_info): Clarify comment.
2014-04-24 22:04:05 +09:30
Nick Clifton 3714081cb3 Fix PE/COFF resource merging problems. There were two issues:
1. Strings (and then resource data) must follow immediately after
     the end of the tables.
  2. Units of resource data must be 8-byte aligned.

	PR ld/16807
	* peXXigen.c (struct rsrc_regions): New structure.
	(rsrc_print_resource_directory): Use new structure.  Include
	offset of directory in listing.
	(rsrc_print_resource_entry): Likewise.
	(rsrc_print_section): Likewise.
	(rsrc_count_entries): Do not increment sizeof_strings or
	sizeof_leaves.
	(rsrc_count_directory): Do not increment sizeof_tables.
	(rsrc_compute_region_sizes): New function.
	(rsrc_write_leaf): Maintain 8-byte alignment for resource data.
	(rsrc_process_section): Compute size of regions after merging
	entries.
2014-04-24 11:15:43 +01:00
Alan Modra 2a87f7b84f daily update 2014-04-24 09:30:44 +09:30
Alan Modra cd0449ab05 PR ld/16787, stale dwarf2 stash
Throw away the dwarf2 stash if it becomes invalid due to section
VMAs changing.  It would be nice to reclaim all the bfd_alloc
memory here when we throw away the stash, perhaps by putting
everything we alloc on a private dwarf2 objalloc, but I haven't done
that with this patch.

I've also fixed a problem with bfd_perform_relocation losing reloc
addends, which meant a second or subsequent look at debug info
sections did not properly relocate the sections.  I can't see why
bfd_perform_relocation should need to change addends except for ld -r,
and the history (985fca12, e98e6ec1) doesn't help much.

Finally, the patch tweaks place_sections to avoid unnecessary work.
If we've mapped input to output sections, then input section VMA
isn't used so there's not much point in adjusting it.  Incidentally,
this also means place_sections isn't effective in all cases.

	PR ld/16787
	* dwarf2.c (struct dwarf2_debug): Add sec_vma field.
	(place_sections): Do not modify VMA of sections when called from
	linker after sections have been placed in output sections.  Short
	circuit single section case.
	(save_section_vma, section_vma_same): New functions.
	(_bfd_dwarf2_slurp_debug_info): Throw away stash if section VMAs
	change.
	* reloc.c (bfd_perform_relocation): Do not modify reloc addend
	when non-relocatable.
2014-04-23 14:29:12 +09:30
Alan Modra e883b50c50 daily update 2014-04-23 09:30:59 +09:30
Nick Clifton d5f59c10fc Another fix for building on a 32-bit host.
PR ld/16821
	* peXXigen.c (_bfd_XXi_swap_sym_out): Fix for 32-bit hosts.
2014-04-22 16:57:34 +01:00
Christian Svensson 73589c9dbd Remove support for the (deprecated) openrisc and or32 configurations and replace
with support for the new or1k configuration.
2014-04-22 15:57:47 +01:00
Yuanhui Zhang 285fc9d8f8 Fix build problem on 32-bit hosts with the recent patch for PR 16821.
PR ld/16821
	* peXXigen.c (abs_finder): Fix for 32-bit host builds.
2014-04-22 11:00:39 +01:00
Will Newton 5d3b02f003 bfd/elfnn-aarch64.c: Remove elfNN_aarch64_section_flags
This function seems to be a left over from some previous
functionality that no longer exists - the comment above seems to
make no sense with the current code. Remove the function as it
breaks handling of SystemTap static probe note sections.

bfd/ChangeLog:

2014-04-22  Will Newton  <will.newton@linaro.org>

	* elfnn-aarch64.c (elfNN_aarch64_section_flags): Remove
	function.  (elf_backend_section_flags): Remove define.
2014-04-22 10:47:30 +01:00
Alan Modra f159927f4d daily update 2014-04-22 09:30:39 +09:30
Richard Henderson d1c109de72 Fix alpha-elf relaxation
ld/
	* emultempl/alphaelf.em (alpha_after_parse): Enable 2 relax passes.
bfd/
	* elf64-alpha.c (elf64_alpha_size_got_sections): New may_merge
	parameter; honor it and disable got merging when false.
	(elf64_alpha_relax_got_load): Do not relax to GPREL relocs during
	the first pass of relaxation.
	(elf64_alpha_relax_with_lituse): Likewise.  Move relaxed relocs to
	the end of the LITERAL+LITUSE chain.
	(elf64_alpha_relax_section): Only process LITERAL relocs during the
	second pass of relaxation.
2014-04-21 08:14:18 -07:00
Richard Henderson cc75d373fd Enable secureplt by default for alpha-linux
* configure.ac (use_secureplt): Enable by default.
	* configure: Rebuild.
2014-04-21 08:05:49 -07:00
Alan Modra a7bdd4ed3f daily update 2014-04-21 09:30:38 +09:30
Alan Modra 8b5c7890e8 daily update 2014-04-20 09:30:38 +09:30
Alan Modra 13cfc86c87 daily update 2014-04-19 09:30:59 +09:30
Tristan Gingold c9ffd2eaf8 mach-o: layout executables
bfd/
	* mach-o.h (bfd_mach_o_dyld_info_command): Add rebase_content,
	bind_content, weak_bind_content, lazy_bind_content,
	export_content.
	(bfd_mach_o_load_command): Add comments, add next field.
	(mach_o_data_struct): Replace commands field by first_command
	and last_command.
	* mach-o.c (bfd_mach_o_append_command): New function.
	(bfd_mach_o_bfd_copy_private_symbol_data): Add blank lines.
	(bfd_mach_o_bfd_copy_private_section_data): Check flavour,
	copy fields.
	(bfd_mach_o_bfd_copy_private_header_data): Copy load commands.
	(bfd_mach_o_pad4, bfd_mach_o_pad_command): New functions.
	(bfd_mach_o_write_thread): Use macro instead of literal.
	(bfd_mach_o_write_dylinker, bfd_mach_o_write_dylib)
	(bfd_mach_o_write_main, bfd_mach_o_write_dyld_info): New
	functions.
	(bfd_mach_o_write_symtab_content): New function (extracted
	from bfd_mach_o_write_symtab).
	(bfd_mach_o_write_symtab): Split.
	(bfd_mach_o_count_indirect_symbols): Move
	(bfd_mach_o_build_dysymtab): Remove layout code.
	(bfd_mach_o_write_contents): Rewritten to build commands in order.
	(bfd_mach_o_count_sections_for_seg): Remove.
	(bfd_mach_o_build_obj_seg_command): New function (extracted from
	bfd_mach_o_build_seg_command).
	(bfd_mach_o_build_exec_seg_command): New function.
	(bfd_mach_o_build_dysymtab_command): Remove.
	(bfd_mach_o_layout_commands): New function.
	(bfd_mach_o_init_segment): New function.
	(bfd_mach_o_build_commands): Major rework to handle non-object
	files.
	(bfd_mach_o_alloc_and_read, bfd_mach_o_read_dyld_content): New
	function.
	(bfd_mach_o_read_dyld_info): Clear content fields.
	(bfd_mach_o_read_segment): Adjust call.
	(bfd_mach_o_flatten_sections): Adjust as now load commands are
	chained.
	(bfd_mach_o_scan_start_address, bfd_mach_o_scan)
	(bfd_mach_o_mkobject_init, bfd_mach_o_get_base_address)
	(bfd_mach_o_lookup_command, bfd_mach_o_core_fetch_environment):
	Likewise.

binutils/
	* od-macho.c (dump_section_map): Adjust as load commands
	are now chained.
	(dump_load_command, dump_section_content): Likewise.
2014-04-18 14:32:43 +02:00
Tristan Gingold 967b2c539a mach-o: Define copy_private_header instead of copy_private_bfd.
bfd/
	* mach-o-target.c (bfd_mach_o_bfd_copy_private_header_data):
	Define instead of bfd_mach_o_bfd_copy_private_bfd_data.
	* mach-o.c (bfd_mach_o_bfd_copy_private_bfd_data): Rename.
	* mach-o.h (bfd_mach_o_bfd_copy_private_bfd_data): Likewise.
2014-04-18 12:44:58 +02:00
Tristan Gingold 4525c51ab0 mach-o: remove name_len field.
bfd/
	* mach-o.h (bfd_mach_o_dylinker_command)
	(bfd_mach_o_dylib_command, bfd_mach_o_fvmlib_command): Remove
	name_len field.
	* mach-o.c (bfd_mach_o_read_dylinker, bfd_mach_o_read_dylib)
	(bfd_mach_o_read_fvmlib): Adjust after name_len removal.
2014-04-18 12:23:31 +02:00
Tristan Gingold 4384b28422 mach-o: add page_size to backend data.
This is preliminary work to layout executables.

bfd/
	* mach-o.h (bfd_mach_o_backend_data): Add page_size field.
	* mach-o-target.c: Check TARGET_PAGESIZE is defined.
	(TARGET_NAME_BACKEND): Add TARGET_PAGESIZE.
	* mach-o.c (TARGET_PAGESIZE): Define and undefined for
	each targets declared.
	* mach-o-x86-64.c (TARGET_PAGESIZE): Define.
	* mach-o-i386.c (TARGET_PAGESIZE): Define.
2014-04-18 10:45:33 +02:00
Tristan Gingold 452216ab09 mach-o.c: use boolean instead of int to return status.
bfd/
	* mach-o.c (bfd_mach_o_write_thread)
	(bfd_mach_o_write_section_32, bfd_mach_o_write_section_64)
	(bfd_mach_o_write_segment_32, bfd_mach_o_write_segment_64)
	(bfd_mach_o_read_dylinker, bfd_mach_o_read_dylib)
	(bfd_mach_o_read_prebound_dylib, bfd_mach_o_read_prebind_cksum)
	(bfd_mach_o_read_twolevel_hints, bfd_mach_o_read_fvmlib)
	(bfd_mach_o_read_thread, bfd_mach_o_read_dysymtab)
	(bfd_mach_o_read_symtab, bfd_mach_o_read_uuid)
	(bfd_mach_o_read_linkedit, bfd_mach_o_read_str)
	(bfd_mach_o_read_dyld_info, bfd_mach_o_read_segment)
	(bfd_mach_o_read_segment_32, bfd_mach_o_read_segment_64)
	(bfd_mach_o_read_command): Now return a boolean status.
	Adjust return statements.
	(bfd_mach_o_write_contents, bfd_mach_o_scan): Adjust tests.
	(bfd_mach_o_core_file_failing_command): Remove useless initialization.
2014-04-18 09:44:01 +02:00
Alan Modra 8575cf7345 daily update 2014-04-18 09:30:42 +09:30
Kwok Cheung Yeung cb22ccf411 This patch causes local GOT entries addressed via a 16-bit index to
be placed towards the front of local GOT space, while entries addressed
via a 32-bit index are placed towards the rear.

Provided that there are fewer than ~16K local GOT entries addressed via
a 16-bit index in total, this should eliminate any relocation overflows
caused by such GOT entries being allocated beyond the addressable range.

bfd/
	* elfxx-mips.c (struct mips_got_info): Delete assigned_gotno
	field.  Add assigned_low_gotno and assigned_high_gotno fields.
	(mips_elf_create_local_got_entry): Update out-of-space condition.
	Set index of new GOT entry to assigned_low_gotno if required by
	the current relocation, else set it to assigned_high_gotno.
	(mips_elf_set_global_gotidx): Replace uses of assigned_gotno
	with assigned_low_gotno.
	(mips_elf_multi_got): Initialize assigned_low_gotno and
	assigned_high_gotno in secondary GOTs.  Use assigned_low_gotno
	in place of assigned_gotno when handling global GOT entries.
	(mips_elf_lay_out_got): Initialize assigned_low_gotno and
	assigned_high_gotno.
	(_bfd_mips_elf_finish_dynamic_sections): Account for a possible
	gap in the middle of local GOT space.

ld/testsuite/
	* ld-mips-elf/elf-rel-xgot-n32.d: Update for new GOT layout.
	* ld-mips-elf/elf-rel-xgot-n32-embed.d: Likewise.
	* ld-mips-elf/elf-rel-xgot-n64.d: Likewise.
	* ld-mips-elf/elf-rel-xgot-n64-embed.d: Likewise.
	* ld-mips-elf/elf-rel-xgot-n64-linux.d: Likewise.
2014-04-17 14:40:08 +01:00
Alan Modra 4c34aff883 Fix LTO mismatched TLS reference
PR 16846
	* elflink.c (_bfd_elf_merge_symbol): Ignore TLS mismatch when
	current bfd is a plugin.  Don't always set type_change_ok
	when old bfd is a plugin.
2014-04-17 13:10:35 +09:30
Alan Modra 1568481a55 daily update 2014-04-17 09:31:10 +09:30
Tristan Gingold 12241a34d7 Mach-O: add cpu and cpusubtype caps.
include/mach-o/
2014-04-16  Tristan Gingold  <gingold@adacore.com>

	* loader.h (BFD_MACH_O_CPU_ARCH_MASK, BFD_MACH_O_CPU_ARCH_ABI64)
	(BFD_MACH_O_CPU_SUBTYPE_MASK, BFD_MACH_O_CPU_SUBTYPE_LIB64): Define.

bfd/
2014-04-16  Tristan Gingold  <gingold@adacore.com>

	* mach-o-x86-64.c (bfd_mach_o_x86_64_mkobject): Adjust cpusubtype
	flag.
2014-04-16 10:04:19 +02:00
Alan Modra 40fd06d188 fill ppc476 fixup area
Stops false positive warnings from scanner.

	* elf32-ppc.c (ppc_elf_relocate_section): Fill 476 fixup area
	with "ba 0" rather than zeros.
2014-04-16 11:50:30 +09:30
Alan Modra 7d9ac5f946 daily update 2014-04-16 09:31:06 +09:30
Marcus Shawcroft fa85fb9a1b [AArch64] Fix off by one error in instruction relaxation mask.
The AArch64 TLSDESC to IE relaxation code uses a bit mask intended to
ensure that destination register in a relaxed ldr instruction is
always X0.  The mask has an off by one error resulting in the most
significant bit of the destination register being retained in the
relaxed instruction.  The issue generally appears when the compiler
emits TLS accesses code under high register pressure resulting in a
broken code sequence.
2014-04-15 17:46:07 +01:00
Alan Modra 170015c5a0 daily update 2014-04-15 09:30:44 +09:30
Alan Modra da3a208854 ppc476 plt call stubs
Fuss over bctr in call stubs.

	* elf32-ppc.c (BA): Define
	(ppc_elf_link_hash_table_create): Correct default_params.
	(write_glink_stub): Pad small plt call stub with "ba 0" rather
	than "nop" for ppc476_workaround.
	(ppc_elf_finish_dynamic_sections): Likewise for branch table
	and __glink_PLTresolve.  Ensure plt call stub at end of page
	doesn't allow fall-thru prefetch.
2014-04-14 18:17:13 +09:30
Alan Modra f871211585 daily update 2014-04-14 09:30:41 +09:30
Alan Modra 3c4630ee7e daily update 2014-04-13 09:30:41 +09:30
Alan Modra d616f26a04 daily update 2014-04-12 09:30:56 +09:30
Nick Clifton 32ae0d80cd PE32+ binaries that use addresses > 1^32 have a problem in that the linker
converts some address expressions into absolute values, but the PE format
only stores absolutes as 32-bits.  This is a partial solution which attempts
to convert such absolute values back to section relative ones instead.  It
fails for symbols like __image_base and ImageBase__, but it is unclear as to
whether these values are ever actually used by applications.

	PR ld/16821
	* peXXigen.c (abs_finder): New function.
	(_bfd_XXi_swap_sym_out): For absolute symbols with values larger
	than 1^32 try to convert them into section relative values
	instead.
2014-04-11 16:02:52 +01:00
Nick Clifton 85cf705b9d Regenerate header files after this commit:
2014-04-10  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>

	* reloc.c: Add BFD_RELOC_AVR_DIFF8/16/32 relocations
2014-04-11 12:39:03 +01:00
Sandra Loosemore 1511baeca9 Ignore non-stub sections for nios2 stub_bfd processing.
2014-04-10  Cesar Philippidis  <cesar@codesourcery.com>

	bfd/
	* elf32-nios2.c (nios2_elf32_build_stubs): Ignore dynobjs
	when building function stubs.
2014-04-10 17:14:18 -07:00
Alan Modra 0a1478f501 daily update 2014-04-11 09:30:57 +09:30
Denis Chertykov e4ef1b6c3f bfd/ChangeLog
* elf32-avr.c: Add DIFF relocations for AVR.
	(avr_final_link_relocate): Handle the DIFF relocs.
	(bfd_elf_avr_diff_reloc): New.
	(elf32_avr_is_diff_reloc): New.
	(elf32_avr_adjust_diff_reloc_value): Reduce difference value.
	(elf32_avr_relax_delete_bytes): Recompute difference after deleting
	bytes.

	* reloc.c: Add BFD_RELOC_AVR_DIFF8/16/32 relocations

gas/ChangeLog

	* config/tc-avr.c: Add new flag mlink-relax.
	(md_show_usage): Add flag and help text.
	(md_parse_option): Record whether link relax is turned on.
	(relaxable_section): New.
	(avr_validate_fix_sub): New.
	(avr_force_relocation): New.
	(md_apply_fix): Generate DIFF reloc.
	(avr_allow_local_subtract): New.

	* config/tc-avr.h (TC_LINKRELAX_FIXUP): Define to 0.
	(TC_FORCE_RELOCATION): Define.
	(TC_FORCE_RELOCATION_SUB_SAME): Define.
	(TC_VALIDATE_FIX_SUB): Define.
	(avr_force_relocation): Declare.
	(avr_validate_fix_sub): Declare.
	(md_allow_local_subtract): Define.
	(avr_allow_local_subtract): Declare.

gas/testsuite/ChangeLog

	* gas/avr/diffreloc_withrelax.d: New testcase.
	* gas/avr/noreloc_withoutrelax.d: Likewise.
	* gas/avr/relax.s: Likewise.

include/ChangeLog

	* elf/avr.h: Add new DIFF relocs.

ld/testsuite/ChangeLog

	* ld-avr/norelax_diff.d: New testcase.
	* ld-avr/relax_diff.d: Likewise.
	* ld-avr/relax.s: Likewise.
2014-04-10 19:50:33 +04:00
Alan Modra 7af20180c0 daily update 2014-04-10 09:30:52 +09:30
Alan Modra 19e1c431f7 Add a time-stamp for chew
One last time-stamp.  Now none of the doc rules using move-if-change
will run unnecessarily.

	* Makefile.am ($(MKDOC)): New rule, depend on chew.stamp.  Move
	old rule to..
	(chew.stamp): ..here.
	(DISTCLEANFILES): Move *.stamp..
	(MOSTLYCLEANFILES): ..to here.
	* Makefile.in: Regenerate.
2014-04-09 15:32:14 +09:30
Alan Modra e30d16e9ec Fix fallout from splitting ldbuildid.[ch] off elf32.em.
bfd/
	* libcoff.h: Regenerate.
ld/
	* emultempl/spuelf.em: Include safe-ctype.h, remove duplicate errno.h.
	* emultempl/nds32elf.em: Include bfd_stdint.h.
	* po/POTFILES.in: Regenerate.
2014-04-09 13:49:05 +09:30
Alan Modra 81b1ec4ff6 bfd doc chew
I got tired of watching chew.c being compiled a dozen or more times
each time I do a binutils build.

	* Makefile.am (MKDOC): Use $@ in command.
	(aoutx.texi): New rule, depend on aoutx.stamp.  Move old rule..
	(aoutx.stamp): .. to here.  Don't depend on chew.c, depend on MKDOC
	and omit recursive MAKE.  Use $< in command.
	(archive.texi, archures.texi, bfdt.texi, cache.texi, coffcode.texi,
	core.texi, elf.texi, elfcode.texi, mmo.texi, format.texi, libbfd.texi,
	bfdio.texi, bfdwin.texi, opncls.texi, reloc.texi, section.texi,
	syms.texi, targets.texi, init.texi, hash.texi, linker.texi): Similarly.
	(DISTCLEANFILES): Remove *.stamp.
	* Makefile.in: Regenerate.
2014-04-09 09:56:15 +09:30
Alan Modra 3f7df22100 daily update 2014-04-09 09:30:57 +09:30
Alan Modra b4ab436423 ppc476 icache workaround fix for bctr
I got the ppc476 workaround wrong.  bctr (and bctrl) as the last
instruction in a page can hit the icache bug if the preceding mtctr
insn is close by, and the destination is in the first few instructions
on the next page.  This scenario can occur with code generated by gcc
to implement switch statements, or in code generated to call by
function pointer.

To prevent the bctr problem it is also necessary to remove other
instructions that otherwise would be safe.

bfd/
	* elf32-ppc.c (ppc_elf_relocate_section): Remove bctr from list
	of safe ppc476 insns at end of page.  Also remove non-branch insns.
	Expand comments.
ld/
	* emultempl/ppc32elf.em (no_zero_padding, ppc_finish): New functions.
	(LDEMUL_FINISH): Define.
2014-04-09 07:07:06 +09:30
Jon TURNEY 61e2488cd8 Add support for generating and inserting build IDs into COFF binaries.
* peXXigen.c (pe_print_debugdata): New function: Displays the
	contents of the debug directory and decodes codeview entries.
	(_bfd_XXi_swap_debugdir_in, _bfd_XXi_swap_debugdir_out)
	(_bfd_XXi_slurp_codeview_record, _bfd_XXi_write_codeview_record):
	Add functions for reading and writing debugdir and codeview
	records.
	* libpei.h (_bfd_XXi_swap_debugdir_in, _bfd_XXi_swap_debugdir_out)
	(_bfd_XXi_write_codeview_record): Add prototypes and macros.
	* libcoff-in.h (pe_tdata): Add build-id data.
	* libcoff.h: Regenerate.
	* coffcode.h (coff_write_object_contents): Run build_id
	after_write_object_contents hook.

	* pe.h (external_IMAGE_DEBUG_DIRECTORY, _CV_INFO_PDB70)
	(_CV_INFO_PDB20): Add structures and constants for debug directory
	and codeview records.
	* internal.h (internal_IMAGE_DEBUG_DIRECTORY, CODEVIEW_INFO):
	Add structures and constants for internal representation of debug
	directory and codeview records.

	* emultempl/elf32.em (id_note_section_size, read_hex, write_build_id):
	Move code for parsing build-id option and calculating the build-id to...
	* ldbuildid.c: New file.
	* ldbuildid.h: New file.
	* Makefile.am (CFILES, HFILES, OFILES, ld_new_SOURCES): Add new
	files.
	* Makefile.in: Regenerate.
	* ld.texinfo: Update --build-id description to mention COFF
	support.
	* NEWS: Mention support for COFF build ids.
	* emultempl/pe.em (gld${EMULATION_NAME}_handle_option):
	(pecoff_checksum_contents, write_build_id, setup_build_id)
	(gld_${EMULATION_NAME}_after_open):  Handle and implement
	build-id option.
	* emultempl/pep.em: Likewise.
2014-04-08 10:59:43 +01:00
Alan Modra ebb8ed8e94 daily update 2014-04-08 09:30:58 +09:30
Alan Modra 27f0d6b4fe daily update 2014-04-07 09:30:38 +09:30
Alan Modra 8520f58492 daily update 2014-04-06 09:30:52 +09:30
Alan Modra 115c6d5c37 Fix map file reference
The testcase in pr16417 comment #6 produces a map file showing
libpthread.so.0               (write@@GLIBC_2.2.5)
ie. missing the file referencing the symbol.

	* elflink.c (_bfd_elf_add_default_symbol): Pass poldbfd when
	merging non-default sym.
2014-04-05 17:31:47 +10:30
Alan Modra 2cafe348f6 daily update 2014-04-05 09:30:58 +10:30
Tristan Gingold 26954155a6 mach-o: reject 64 bit targets when not configured for.
bfd/
	* mach-o.c (bfd_mach_o_header_p): Reject 64 bit target when not
	configured for.
2014-04-04 14:40:34 +02:00