Commit Graph

87 Commits

Author SHA1 Message Date
Alan Modra c95949892f Replace "if (x) free (x)" with "free (x)", bfd
* aoutx.h: Replace "if (x) free (x)" with "free (x)" throughout.
	* archive.c, * bfd.c, * bfdio.c, * coff-alpha.c, * coff-ppc.c,
	* coff-sh.c, * coff-stgo32.c, * coffcode.h, * coffgen.c,
	* cofflink.c, * cpu-arm.c, * doc/chew.c, * dwarf2.c, * ecoff.c,
	* ecofflink.c, * elf-eh-frame.c, * elf-m10200.c, * elf-m10300.c,
	* elf-strtab.c, * elf.c, * elf32-arc.c, * elf32-arm.c,
	* elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-crx.c,
	* elf32-epiphany.c, * elf32-ft32.c, * elf32-h8300.c,
	* elf32-ip2k.c, * elf32-m32c.c, * elf32-m68hc11.c,
	* elf32-m68k.c, * elf32-microblaze.c, * elf32-msp430.c,
	* elf32-nds32.c, * elf32-nios2.c, * elf32-ppc.c, * elf32-pru.c,
	* elf32-rl78.c, * elf32-rx.c, * elf32-sh.c, * elf32-spu.c,
	* elf32-v850.c, * elf32-xtensa.c, * elf64-alpha.c,
	* elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mips.c
	* elf64-mmix.c, * elf64-ppc.c, * elf64-sparc.c, * elfcode.h,
	* elflink.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-mips.c,
	* elfxx-x86.c, * format.c, * ihex.c, * libbfd.c, * linker.c,
	* mmo.c, * opncls.c, * pdp11.c, * peXXigen.c, * pef.c,
	* peicode.h, * simple.c, * som.c, * srec.c, * stabs.c, * syms.c,
	* targets.c, * vms-lib.c, * xcofflink.c, * xtensa-isa.c: Likewise.
2020-05-21 10:11:57 +09:30
Hans-Peter Nilsson 7b948a2580 mmo.c: Fix ld testsuite regression "objcopy executable (pr25662)".
* mmo.c (mmo_scan): Create .text section only when needed, not
	from the start.

For the test-case at hand, the .data section is created and output
first by the linker, but the mmo input-reader mmo_scan always creates
a .text section.  Since sections are output in the order in which
they're created, it's output first, breaking the assumption that
obcopy without options (or with -p) creates output identical to its
input.  The point of creating it at the top of mmo_scan is a trivial
default assignment for the current section variable "sec".  Instead we
now defer the default, creating it only when needed and sec is NULL.
2020-04-01 04:03:46 +02:00
Alan Modra cb001c0d28 bfd_cleanup for object_p
The object_p (and archive_p, core_file_p) functions are not supposed
to have any target specific malloc'd memory attached to the bfd on
their return.  This should be obvious on a failure return, but it's
also true for a successful return.  The reason is that even though the
object_p recognises the file, that particular target may not be used
and thus the bfd won't be closed calling close_and_cleanup for the
target that allocated the memory.

It turns out that the object_p bfd_target* return value isn't needed.
In all cases except ld/plugin.c the target is abfd->xvec and with
ld/plugin.c the target isn't used.  So this patch returns a cleanup
function from object_p instead, called in bfd_check_format_matches to
tidy the bfd before trying a different target match.  The only cleanup
that does anything at this stage is the alpha-vms one.

bfd/
	* targets.c (bfd_cleanup): New typedef.
	(struct bfd <_bfd_check_format>): Return a bfd_cleanup.
	* libbfd-in.h (_bfd_no_cleanup): Define.
	* format.c (bfd_reinit): Add cleanup parameter, call it.
	(bfd_check_format_matches): Set cleanup from _bfd_check_format
	call and pass to bfd_reinit.  Delete temp, use abfd->xvec instead.
	* aout-target.h (callback, object_p): Return bfd_cleanup.
	* aout-tic30.c (tic30_aout_callback, tic30_aout_object_p): Likewise.
	* archive.c (bfd_generic_archive_p): Likewise.
	* binary.c (binary_object_p): Likewise.
	* coff-alpha.c (alpha_ecoff_object_p): Likewise.
	* coff-ia64.c (ia64coff_object_p): Likewise.
	* coff-rs6000.c (_bfd_xcoff_archive_p, rs6000coff_core_p): Likewise.
	* coff-sh.c (coff_small_object_p): Likewise.
	* coff-stgo32.c (go32_check_format): Likewise.
	* coff64-rs6000.c (xcoff64_archive_p, rs6000coff_core_p),
	(xcoff64_core_p): Likewise.
	* coffgen.c (coff_real_object_p, coff_object_p): Likewise.
	* elf-bfd.h (bfd_elf32_object_p, bfd_elf32_core_file_p),
	(bfd_elf64_object_p, bfd_elf64_core_file_p): Likewise.
	* elfcode.h (elf_object_p): Likewise.
	* elfcore.h (elf_core_file_p): Likewise.
	* i386msdos.c (msdos_object_p): Likewise.
	* ihex.c (ihex_object_p): Likewise.
	* libaout.h (some_aout_object_p): Likewise.
	* libbfd-in.h (bfd_generic_archive_p, _bfd_dummy_target),
	(_bfd_vms_lib_alpha_archive_p, _bfd_vms_lib_ia64_archive_p): Likewise.
	* libbfd.c (_bfd_dummy_target): Likewise.
	* libcoff-in.h (coff_object_p): Likewise.
	* mach-o-aarch64.c (bfd_mach_o_arm64_object_p),
	(bfd_mach_o_arm64_core_p): Likewise.
	* mach-o-arm.c (bfd_mach_o_arm_object_p),
	(bfd_mach_o_arm_core_p): Likewise.
	* mach-o-i386.c (bfd_mach_o_i386_object_p),
	(bfd_mach_o_i386_core_p): Likewise.
	* mach-o-x86-64.c (bfd_mach_o_x86_64_object_p),
	(bfd_mach_o_x86_64_core_p): Likewise.
	* mach-o.c (bfd_mach_o_header_p, bfd_mach_o_gen_object_p),
	(bfd_mach_o_gen_core_p, bfd_mach_o_fat_archive_p): Likewise.
	* mach-o.h (bfd_mach_o_object_p, bfd_mach_o_core_p),
	(bfd_mach_o_fat_archive_p, bfd_mach_o_header_p): Likewise.
	* mmo.c (mmo_object_p): Likewise.
	* pef.c (bfd_pef_object_p, bfd_pef_xlib_object_p): Likewise.
	* peicode.h (coff_real_object_p, pe_ILF_object_p),
	(pe_bfd_object_p): Likewise.
	* plugin.c (ld_plugin_object_p, bfd_plugin_object_p): Likewise.
	* ppcboot.c (ppcboot_object_p): Likewise.
	* rs6000-core.c (rs6000coff_core_p): Likewise.
	* som.c (som_object_setup, som_object_p): Likewise.
	* srec.c (srec_object_p, symbolsrec_object_p): Likewise.
	* tekhex.c (tekhex_object_p): Likewise.
	* vms-alpha.c (alpha_vms_object_p): Likewise.
	* vms-lib.c (_bfd_vms_lib_archive_p, _bfd_vms_lib_alpha_archive_p),
	(_bfd_vms_lib_ia64_archive_p, _bfd_vms_lib_txt_archive_p): Likewise.
	* wasm-module.c (wasm_object_p): Likewise.
	* xsym.c (bfd_sym_object_p): Likewise.
	* xsym.h (bfd_sym_object_p): Likewise.
	* aoutx.h (some_aout_object_p): Likewise, and callback parameter
	return type.
	* pdp11.c (some_aout_object_p): Likewise.
	* plugin.c (register_ld_plugin_object_p): Update object_p
	parameter type.
	* plugin.h (register_ld_plugin_object_p): Likewise.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
	* libcoff.h: Regenerate.
ld/
	* plugin.c (plugin_object_p): Return a bfd_cleanup.
	(plugin_cleanup): New function.
2020-03-02 19:30:48 +10:30
Alan Modra 5f60280291 mmix-mmo set SEC_DATA for .data section
With the bfd_decode_symclass change, ld SIZEOF test fails due to
data_end being reported as type '?'.

bfd/
	PR 24511
	* mmo.c (mmo_scan): Set SEC_DATA for .data.
ld/
	PR 24511
	* testsuite/ld-mmix/b-fixo2.d: Adjust for .data change.
	* testsuite/ld-mmix/sec-2.d: Likewise.
	* testsuite/ld-mmix/sec-3.d: Likewise.
	* testsuite/ld-mmix/sec-4.d: Likewise.
	* testsuite/ld-mmix/spec802.d: Likewise.
	* testsuite/ld-mmix/spec803.d: Likewise.
	* testsuite/ld-mmix/spec804.d: Likewise.
	* testsuite/ld-mmix/spec805.d: Likewise.
	* testsuite/ld-mmix/spec806.d: Likewise.
	* testsuite/ld-mmix/spec807.d: Likewise.
	* testsuite/ld-mmix/spec808.d: Likewise.
2020-02-28 08:19:42 +10:30
Alan Modra f24bdec486 mmo tdata leak
malloc'd tdata isn't freed.

	* mmo.c (mmo_mkobject): Allocate tdata with bfd_zalloc.
2020-01-04 19:20:33 +10:30
Alan Modra b3adc24a07 Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
Alan Modra 13c9c48599 bfd signed overflow fixes
Aimed at quietening ubsan.

include/
	* opcode/mmix.h (PUSHGO_INSN_BYTE): Make unsigned.
	(GO_INSN_BYTE, SETL_INSN_BYTE, INCML_INSN_BYTE, INCMH_INSN_BYTE),
	(INCH_INSN_BYTE, SWYM_INSN_BYTE, JMP_INSN_BYTE): Likewise.
bfd/
	* elf32-rx.c (elf32_rx_relax_section): Avoid signed overflow.
	* libaout.h (N_SET_INFO, N_SET_FLAGS): Likewise.
	* netbsd.h (write_object_contents): Likewise.
	* elf32-arm.c (bfd_elf32_arm_vfp11_erratum_scan): Likewise.
	* libhppa.h (HPPA_R_CONSTANT): Don't signed extend with shifts.
	(stm32l4xx_create_replacing_stub_vldm): Don't truncate high bits
	with shifts.
	* elf32-nds32.h (R_NDS32_RELAX_ENTRY_DISABLE_RELAX_FLAG): Define
	using 1u shifted left.  Ditto for other macros.
	* mmo.c (LOP): Make unsigned.
2019-12-11 21:14:19 +10:30
Alan Modra fd3619828e bfd_section_* macros
This large patch removes the unnecessary bfd parameter from various
bfd section macros and functions.  The bfd is hardly ever used and if
needed for the bfd_set_section_* or bfd_rename_section functions can
be found via section->owner except for the com, und, abs, and ind
std_section special sections.  Those sections shouldn't be modified
anyway.

The patch also removes various bfd_get_section_<field> macros,
replacing their use with bfd_section_<field>, and adds
bfd_set_section_lma.  I've also fixed a minor bug in gas where
compressed section renaming was done directly rather than calling
bfd_rename_section.  This would have broken bfd_get_section_by_name
and similar functions, but that hardly mattered at such a late stage
in gas processing.

bfd/
	* bfd-in.h (bfd_get_section_name, bfd_get_section_vma),
	(bfd_get_section_lma, bfd_get_section_alignment),
	(bfd_get_section_size, bfd_get_section_flags),
	(bfd_get_section_userdata): Delete.
	(bfd_section_name, bfd_section_size, bfd_section_vma),
	(bfd_section_lma, bfd_section_alignment): Lose bfd parameter.
	(bfd_section_flags, bfd_section_userdata): New.
	(bfd_is_com_section): Rename parameter.
	* section.c (bfd_set_section_userdata, bfd_set_section_vma),
	(bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section),
	(bfd_set_section_size): Delete bfd parameter, rename section parameter.
	(bfd_set_section_lma): New.
	* bfd-in2.h: Regenerate.
	* mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param,
	update callers.
	* aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c,
	* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
	* compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h,
	* elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c,
	* elf-s390-common.c, * elf-vxworks.c, * elf.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-csky.c,
	* elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c,
	* elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c,
	* elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c,
	* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c,
	* elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
	* elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c,
	* elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c,
	* elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
	* elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
	* elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c,
	* elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c,
	* elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c,
	* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
	* elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c,
	* elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c,
	* elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c,
	* mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c,
	* peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c,
	* xcofflink.c: Update throughout for bfd section macro and function
	changes.
binutils/
	* addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c,
	* objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c,
	* od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c,
	* resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update
	throughout for bfd section macro and function changes.
gas/
	* as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c,
	* read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c,
	* config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c,
	* config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c,
	* config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c,
	* config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c,
	* config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c,
	* config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c,
	* config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c,
	* config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c,
	* config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c,
	* config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c,
	* config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c,
	* config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c,
	* config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c,
	* config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c,
	* config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c,
	* config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c,
	* config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c,
	* config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c,
	* config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c,
	* config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c,
	* config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for
	bfd section macro and function changes.
	* write.c (compress_debug): Use bfd_rename_section.
gdb/
	* aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c,
	* coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c,
	* dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c,
	* exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h,
	* hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c,
	* i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c,
	* maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c,
	* mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c,
	* objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c,
	* ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c,
	* rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c,
	* s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c,
	* solib-spu.c, * solib-svr4.c, * solib-target.c,
	* spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c,
	* symmisc.c, * symtab.c, * target.c, * windows-nat.c,
	* xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c,
	* mi/mi-interp.c: Update throughout for bfd section macro and
	function changes.
	* gcore (gcore_create_callback): Use bfd_set_section_lma.
	* spu-tdep.c (spu_overlay_new_objfile): Likewise.
gprof/
	* corefile.c, * symtab.c: Update throughout for bfd section
	macro and function changes.
ld/
	* ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c,
	* emultempl/aarch64elf.em, * emultempl/aix.em,
	* emultempl/armcoff.em, * emultempl/armelf.em,
	* emultempl/cr16elf.em, * emultempl/cskyelf.em,
	* emultempl/m68hc1xelf.em, * emultempl/m68kelf.em,
	* emultempl/mipself.em, * emultempl/mmix-elfnmmo.em,
	* emultempl/mmo.em, * emultempl/msp430.em,
	* emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em,
	* emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update
	throughout for bfd section macro and function changes.
libctf/
	* ctf-open-bfd.c: Update throughout for bfd section macro changes.
opcodes/
	* arc-ext.c: Update throughout for bfd section macro changes.
sim/
	* common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c,
	* erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c,
	* m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c,
	* rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c,
	* rx/trace.c: Update throughout for bfd section macro changes.
2019-09-19 09:40:13 +09:30
Alan Modra cb7f4b298e Tidy ld/ldmisc.c
The idea here is to not use elf-bfd.h and coff-bfd.h in generic linker
code.

bfd/
	* targets.c (struct bfd_target): Add _bfd_group_name.
	(BFD_JUMP_TABLE): Likewise.
	* coffgen.c (bfd_coff_group_name): New function.
	* elf.c (bfd_elf_group_name): New function.
	* linker.c (_bfd_nolink_bfd_group_name): New function.
	* section.c (bfd_generic_group_name): New function.
	* elf-bfd.h (bfd_elf_group_name): Declare.
	* libbfd-in.h (_bfd_nolink_bfd_group_name): Declare.
	* libcoff-in.h (bfd_coff_group_name): Declare.
	* aout-target.h (MY_bfd_group_name): Define.
	* aout-tic30.c (MY_bfd_group_name): Define.
	* bfd.c (bfd_group_name): Define.
	* binary.c (binary_bfd_group_name): Define.
	* coff-alpha.c (_bfd_ecoff_bfd_group_name): Define.
	* coff-mips.c (_bfd_ecoff_bfd_group_name): Define.
	* coff-rs6000.c (_bfd_xcoff_bfd_group_name): Define.
	* coffcode.h (coff_bfd_group_name): Define.
	* elfxx-target.h (bfd_elfNN_bfd_group_name): Define.
	* i386msdos.c (msdos_bfd_group_name): Define.
	* ihex.c (ihex_bfd_group_name): Define.
	* mach-o-target.c (bfd_mach_o_bfd_group_name): Define.
	* mmo.c (mmo_bfd_group_name): Define.
	* pef.c (bfd_pef_bfd_group_name): Define.
	* plugin.c (bfd_plugin_bfd_group_name): Define.
	* ppcboot.c (ppcboot_bfd_group_name): Define.
	* som.c (som_bfd_group_name): Define.
	* srec.c (srec_bfd_group_name): Define.
	* tekhex.c (tekhex_bfd_group_name): Define.
	* verilog.c (verilog_bfd_group_name): Define.
	* vms-alpha.c (vms_bfd_group_name, alpha_vms_bfd_group_name): Define.
	* xsym.c (bfd_sym_bfd_group_name): Define.
	* coff64-rs6000.c (rs6000_xcoff64_vec): Init new field.
	(rs6000_xcoff64_aix_vec): Likewise.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
	* libcoff.h: Regenerate.
ld/
	* ldmisc.c: Don't #include elf-bfd.h or coff-bfd.h.
	(vfinfo): Use bfd_group_name.
2019-09-11 13:43:29 +09:30
Alan Modra 827041555a Update year range in copyright notice of binutils files 2019-01-01 22:06:53 +10:30
Alan Modra 865dcc8a4d Don't init array at run time
When it can be done at compile time.

	* mmo.c (valid_mmo_symbol_character_set): Initialize and make
	array const.
	(mmo_init): Don't init valid_mmo_symbol_character_set.
2018-08-20 09:54:20 +09:30
H.J. Lu 34a87bb07a ld: Hide symbols defined by HIDDEN/PROVIDE_HIDDEN
There should be no difference in output for symbols defined by HIDDEN
or PROVIDE_HIDDEN assignments whether they are explicitly marked as
hidden or not.  This patch adds a new BFD function, bfd_link_hide_symbol,
to hide symbols defined by HIDDEN and PROVIDE_HIDDEN assignments.

bfd

	PR ld/23201
	* aout-target.h (MY_bfd_link_hide_symbol): New.
	* aout-tic30.c (MY_bfd_link_hide_symbol): Likewise.
	* binary.c (binary_bfd_link_hide_symbol): Likewise.
	* coff-alpha.c (_bfd_ecoff_bfd_link_hide_symbol): Likewise.
	* coff-mips.c (_bfd_ecoff_bfd_link_hide_symbol): Likewise.
	* coff-rs6000.c (_bfd_xcoff_bfd_link_hide_symbol): Likewise.
	* coffcode.h (coff_bfd_link_hide_symbol): Likewise.
	* elf-bfd.h (_bfd_elf_link_hide_symbol): Likewise.
	* elfxx-target.h (bfd_elfNN_bfd_link_hide_symbol): Likewise.
	* i386msdos.c (msdos_bfd_link_hide_symbol): Likewise.
	* ihex.c (ihex_bfd_link_hide_symbol): Likewise.
	* libbfd-in.h (_bfd_nolink_bfd_link_hide_symbol): Likewise.
	* linker.c (_bfd_generic_link_hide_symbol): Likewise.
	(bfd_link_hide_symbol): Likewise.
	* mach-o-target.c (bfd_mach_o_bfd_link_hide_symbol): Likewise.
	* mmo.c (mmo_bfd_link_hide_symbol): Likewise.
	* pef.c (bfd_pef_bfd_link_hide_symbol): Likewise.
	* plugin.c (bfd_plugin_bfd_link_hide_symbol): Likewise.
	* ppcboot.c (ppcboot_bfd_link_hide_symbol): Likewise.
	* som.c (som_bfd_link_hide_symbol): Likewise.
	* srec.c (srec_bfd_link_hide_symbol): Likewise.
	* tekhex.c (tekhex_bfd_link_hide_symbol): Likewise.
	* vms-alpha.c (vms_bfd_link_hide_symbol): Likewise.
	(alpha_vms_bfd_link_hide_symbol): Likewise.
	* xsym.c (bfd_sym_bfd_link_hide_symbol): Likewise.
	* coff64-rs6000.c (rs6000_xcoff64_vec): Add
	_bfd_generic_link_hide_symbol.
	(rs6000_xcoff64_aix_vec): Likewise.
	* elflink.c (bfd_elf_record_link_assignment): Don't make forced
	local symbol dynamic.
	(_bfd_elf_link_hide_symbol): New function.
	* elfxx-x86.c (_bfd_x86_elf_link_symbol_references_local): Don't
	check root.ldscript_def.
	* targets.c (bfd_target): Add _bfd_link_hide_symbol.
	(BFD_JUMP_TABLE_LINK): Add NAME##_bfd_link_hide_symbol.
	* bfd-in2.h: Regenerated.
	* libbfd.h: Likewise.

ld/

	PR ld/23201
	* ldexp.c (exp_fold_tree_1): Call bfd_link_hide_symbol to hide
	a symbol.
	* testsuite/ld-elf/provide-hidden-dynabs.nd: Removed.
	* testsuite/ld-elf/provide-hidden-dynsec.nd: Likewise.
	* testsuite/ld-elf/provide-hidden.exp: Replace
	provide-hidden-dynsec.nd with provide-hidden-sec.nd and
	provide-hidden-dyn.nd.  Replace provide-hidden-dynabs.nd with
	provide-hidden-abs.nd and provide-hidden-dyn.nd.
	* testsuite/ld-i386/pr23189.d: Expect no dynamic relocation.
	* testsuite/ld-x86-64/pr23189.d: Likewise.
2018-05-21 20:39:30 -07:00
Alan Modra 38f14ab8fc assorted target messages
bfd/
	* elf-m10300.c, * elf-s390-common.c, * elf32-arc.c, * elf32-cris.c,
	* elf32-dlx.c, * elf32-frv.c, * elf32-i370.c, * elf32-lm32.c,
	* elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c,
	* elf32-microblaze.c, * elf32-msp430.c, * elf32-nds32.c,
	* elf32-nios2.c, * elf32-or1k.c, * elf32-rl78.c, * elf32-rx.c,
	* elf32-score.c, * elf32-score7.c, * elf32-sh-symbian.c,
	* elf32-sh.c, * elf32-spu.c, * elf32-v850.c, * elf32-xtensa.c,
	* elf64-alpha.c, * elf64-ia64-vms.c, * elf64-mmix.c,
	* elf64-sh64.c, * elf64-sparc.c, * elfnn-ia64.c, * elfxx-tilegx.c,
	* mmo.c, * osf-core.c, * srec.c, * vms-alpha.c: Standardize
	error/warning messages.
ld/
	* testsuite/ld-cris/pcrelcp-1.d,
	* testsuite/ld-mmix/start-2.d: Update.
2018-02-26 09:34:15 +10:30
Alan Modra 2dcf00ce6c %L conversions
* bfd-in.h: Include inttypes.h or if not available define
	PRId64, PRIu64 and PRIx64.
	* bfd.c (_bfd_doprnt, _bfd_doprnt_scan): Remove support for L
	modifier to print bfd_vma.
	* coff-arm.c, * coff-mcore.c, * coff-ppc.c, * coff-rs6000.c,
	* coff-sh.c, * coff-tic80.c, * coffcode.h, * coffgen.c, * cofflink.c,
	* compress.c, * dwarf2.c, * elf-m10300.c, * elf.c, * elf32-arc.c,
	* elf32-arm.c, * elf32-bfin.c, * elf32-cris.c, * elf32-hppa.c,
	* elf32-i386.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32r.c,
	* elf32-m68k.c, * elf32-metag.c, * elf32-nds32.c, * elf32-nios2.c,
	* elf32-ppc.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c,
	* elf32-score7.c, * elf32-sh.c, * elf32-sh64.c, * elf32-spu.c,
	* elf32-tic6x.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c,
	* elf32-xtensa.c, * elf64-alpha.c, * elf64-hppa.c, * elf64-ia64-vms.c,
	* elf64-mmix.c, * elf64-s390.c, * elf64-sh64.c, * elf64-x86-64.c,
	* elfcode.h, * elfcore.h, * elflink.c, * elfnn-aarch64.c,
	* elfnn-ia64.c, * elfnn-riscv.c, * elfxx-mips.c, * elfxx-sparc.c,
	* elfxx-tilegx.c, * ieee.c, * ihex.c, * mach-o.c, * merge.c, * mmo.c,
	* peXXigen.c, * xcofflink.c: Replace use of Lx modifier with PRIx64,
	and cast input to uint64_t, and similarly for Ld and Lu.
	* bfd-in2.h: Regenerate.
2018-02-19 23:55:54 +10:30
Alan Modra 871b3ab29e Use %pA and %pB in messages rather than %A and %B
First step towards compiler verification of _bfd_error_handler
arguments, and better verification of translated messages.

bfd/
	* bfd.c (_bfd_doprnt, _bfd_doprnt_scan): Handle %pA and %pB in place
	of %A and %B.
	* aout-adobe.c: Update all messages using %A and %B.
	* aout-cris.c: Likewise.
	* aoutx.h: Likewise.
	* archive.c: Likewise.
	* binary.c: Likewise.
	* cache.c: Likewise.
	* coff-alpha.c: Likewise.
	* coff-arm.c: Likewise.
	* coff-i860.c: Likewise.
	* coff-mcore.c: Likewise.
	* coff-ppc.c: Likewise.
	* coff-rs6000.c: Likewise.
	* coff-sh.c: Likewise.
	* coff-tic4x.c: Likewise.
	* coff-tic54x.c: Likewise.
	* coff-tic80.c: Likewise.
	* coff64-rs6000.c: Likewise.
	* coffcode.h: Likewise.
	* coffgen.c: Likewise.
	* cofflink.c: Likewise.
	* coffswap.h: Likewise.
	* compress.c: Likewise.
	* cpu-arm.c: Likewise.
	* ecoff.c: Likewise.
	* elf-attrs.c: Likewise.
	* elf-eh-frame.c: Likewise.
	* elf-ifunc.c: Likewise.
	* elf-m10300.c: Likewise.
	* elf-properties.c: Likewise.
	* elf-s390-common.c: Likewise.
	* elf.c: Likewise.
	* elf32-arc.c: Likewise.
	* elf32-arm.c: Likewise.
	* elf32-avr.c: Likewise.
	* elf32-bfin.c: Likewise.
	* elf32-cr16.c: Likewise.
	* elf32-cr16c.c: Likewise.
	* elf32-cris.c: Likewise.
	* elf32-crx.c: Likewise.
	* elf32-d10v.c: Likewise.
	* elf32-d30v.c: Likewise.
	* elf32-epiphany.c: Likewise.
	* elf32-fr30.c: Likewise.
	* elf32-frv.c: Likewise.
	* elf32-gen.c: Likewise.
	* elf32-hppa.c: Likewise.
	* elf32-i370.c: Likewise.
	* elf32-i386.c: Likewise.
	* elf32-i960.c: Likewise.
	* elf32-ip2k.c: Likewise.
	* elf32-iq2000.c: Likewise.
	* elf32-lm32.c: Likewise.
	* elf32-m32c.c: Likewise.
	* elf32-m32r.c: Likewise.
	* elf32-m68hc11.c: Likewise.
	* elf32-m68hc12.c: Likewise.
	* elf32-m68hc1x.c: Likewise.
	* elf32-m68k.c: Likewise.
	* elf32-mcore.c: Likewise.
	* elf32-mep.c: Likewise.
	* elf32-metag.c: Likewise.
	* elf32-microblaze.c: Likewise.
	* elf32-moxie.c: Likewise.
	* elf32-msp430.c: Likewise.
	* elf32-mt.c: Likewise.
	* elf32-nds32.c: Likewise.
	* elf32-nios2.c: Likewise.
	* elf32-or1k.c: Likewise.
	* elf32-pj.c: Likewise.
	* elf32-ppc.c: Likewise.
	* elf32-rl78.c: Likewise.
	* elf32-rx.c: Likewise.
	* elf32-s390.c: Likewise.
	* elf32-score.c: Likewise.
	* elf32-score7.c: Likewise.
	* elf32-sh-symbian.c: Likewise.
	* elf32-sh.c: Likewise.
	* elf32-sh64.c: Likewise.
	* elf32-sparc.c: Likewise.
	* elf32-spu.c: Likewise.
	* elf32-tic6x.c: Likewise.
	* elf32-tilepro.c: Likewise.
	* elf32-v850.c: Likewise.
	* elf32-vax.c: Likewise.
	* elf32-visium.c: Likewise.
	* elf32-wasm32.c: Likewise.
	* elf32-xgate.c: Likewise.
	* elf32-xtensa.c: Likewise.
	* elf64-alpha.c: Likewise.
	* elf64-gen.c: Likewise.
	* elf64-hppa.c: Likewise.
	* elf64-ia64-vms.c: Likewise.
	* elf64-mmix.c: Likewise.
	* elf64-ppc.c: Likewise.
	* elf64-s390.c: Likewise.
	* elf64-sh64.c: Likewise.
	* elf64-sparc.c: Likewise.
	* elf64-x86-64.c: Likewise.
	* elfcode.h: Likewise.
	* elfcore.h: Likewise.
	* elflink.c: Likewise.
	* elfnn-aarch64.c: Likewise.
	* elfnn-ia64.c: Likewise.
	* elfnn-riscv.c: Likewise.
	* elfxx-mips.c: Likewise.
	* elfxx-sparc.c: Likewise.
	* elfxx-tilegx.c: Likewise.
	* elfxx-x86.c: Likewise.
	* hpux-core.c: Likewise.
	* ieee.c: Likewise.
	* ihex.c: Likewise.
	* libbfd.c: Likewise.
	* linker.c: Likewise.
	* mach-o.c: Likewise.
	* merge.c: Likewise.
	* mmo.c: Likewise.
	* oasys.c: Likewise.
	* pdp11.c: Likewise.
	* pe-mips.c: Likewise.
	* peXXigen.c: Likewise.
	* peicode.h: Likewise.
	* reloc.c: Likewise.
	* rs6000-core.c: Likewise.
	* srec.c: Likewise.
	* stabs.c: Likewise.
	* vms-alpha.c: Likewise.
	* xcofflink.c: Likewise.
ld/
	* ldmisc.c (vfinfo): Handle %pA and %pB in place of %A and %B.
	* ldcref.c: Update all messages using %A and %B.
	* ldexp.c: Likewise.
	* ldlang.c: Likewise.
	* ldmain.c: Likewise.
	* ldmisc.c: Likewise.
	* pe-dll.c: Likewise.
	* plugin.c: Likewise.
	* emultempl/beos.em: Likewise.
	* emultempl/cr16elf.em: Likewise.
	* emultempl/elf32.em: Likewise.
	* emultempl/m68kcoff.em: Likewise.
	* emultempl/m68kelf.em: Likewise.
	* emultempl/mmo.em: Likewise.
	* emultempl/nds32elf.em: Likewise.
	* emultempl/pe.em: Likewise.
	* emultempl/pep.em: Likewise.
	* emultempl/spuelf.em: Likewise.
	* emultempl/sunos.em: Likewise.
	* emultempl/xtensaelf.em: Likewise.
2018-02-19 23:55:53 +10:30
Alan Modra d00dd7dc5e Remove bfd stub function casts.
This patch defines a bunch of new functions to use in the BFD target
structs rather than casting bfd_false or bfd_true and similar stub
functions.  I've also renamed the stub functions to reflect their
parameters and put "error" in the name if they set bfd_error.  The
latter change is important since there were quite a few uses of
bfd_false where setting bfd_error was inappropriate, for example in
elf_backend_allow_non_load_phdr and is_target_special_symbol.

	* libbfd.c (_bfd_bool_bfd_false_error): Rename from bfd_false.
	(_bfd_bool_bfd_true): Rename from bfd_true.
	(_bfd_ptr_bfd_null_error): Rename from bfd_nullvoidptr.
	(_bfd_int_bfd_0): Rename from bfd_0.
	(_bfd_uint_bfd_0): Rename from bfd_0u.
	(_bfd_long_bfd_0): Rename from bfd_0l.
	(_bfd_long_bfd_n1_error): Rename from _bfd_n1.
	(_bfd_void_bfd): Rename from bfd_void.
	(_bfd_bool_bfd_false, _bfd_bool_bfd_asymbol_false),
	(_bfd_bool_bfd_link_false_error),
	(_bfd_bool_bfd_link_true, _bfd_bool_bfd_bfd_true),
	(_bfd_bool_bfd_uint_true, _bfd_bool_bfd_ptr_true),
	(_bfd_bool_bfd_asection_bfd_asection_true),
	(_bfd_bool_bfd_asymbol_bfd_asymbol_true),
	(_bfd_void_bfd_link, _bfd_void_bfd_asection): New functions.
	* archive.c (_bfd_noarchive_get_elt_at_index),
	(_bfd_noarchive_openr_next_archived_file),
	(_bfd_noarchive_construct_extended_name_table),
	(_bfd_noarchive_write_ar_hdr, _bfd_noarchive_truncate_arname),
	(_bfd_noarchive_write_armap): New functions.
	* archures.c (_bfd_nowrite_set_arch_mach): New function.
	* coff-alpha.c (alpha_ecoff_swap_coff_aux_in),
	(alpha_ecoff_swap_coff_sym_in, alpha_ecoff_swap_coff_lineno_in),
	(alpha_ecoff_swap_coff_aux_out, alpha_ecoff_swap_coff_sym_out),
	(alpha_ecoff_swap_coff_lineno_out),
	(alpha_ecoff_swap_coff_reloc_out): New functions.
	* coff-mips.c (mips_ecoff_swap_coff_aux_in),
	(mips_ecoff_swap_coff_sym_in, mips_ecoff_swap_coff_lineno_in),
	(mips_ecoff_swap_coff_aux_out, mips_ecoff_swap_coff_sym_out),
	(mips_ecoff_swap_coff_lineno_out),
	(mips_ecoff_swap_coff_reloc_out): New functions.
	* coffcode.h (coff_set_alignment_hook): Replace define with
	new function.
	(symname_in_debug_hook): Likewise.
	* ecoff.c (_bfd_ecoff_set_alignment_hook): New function.
	* elfxx-target.h (elf_backend_allow_non_load_phdr): Default to 0.
	* elf.c (assign_file_positions_except_relocs): Test
	elf_backend_allow_non_load_phdr for NULL.
	* elflink.c (_bfd_elf_omit_section_dynsym_default): Rename from
	_bfd_elf_link_omit_section_dynsym.  Update uses.
	(_bfd_elf_omit_section_dynsym_all): New function.
	* elf-bfd.h (_bfd_elf_link_omit_section_dynsym): Delete.
	(_bfd_elf_omit_section_dynsym_default): Declare.
	(_bfd_elf_omit_section_dynsym_all): Declare.
	* linker.c (_bfd_nolink_sizeof_headers, _bfd_nolink_bfd_relax_section),
	(_bfd_nolink_bfd_get_relocated_section_contents),
	(_bfd_nolink_bfd_lookup_section_flags),
	(_bfd_nolink_bfd_is_group_section, _bfd_nolink_bfd_discard_group),
	(_bfd_nolink_bfd_link_hash_table_create),
	(_bfd_nolink_bfd_link_just_syms),
	(_bfd_nolink_bfd_copy_link_hash_symbol_type),
	(_bfd_nolink_bfd_link_split_section),
	(_bfd_nolink_section_already_linked),
	(_bfd_nolink_bfd_define_common_symbol),
	(_bfd_nolink_bfd_define_start_stop): New functions.
	* reloc.c (_bfd_norelocs_bfd_reloc_type_lookup),
	(_bfd_norelocs_bfd_reloc_name_lookup),
	(_bfd_nodynamic_canonicalize_dynamic_reloc): New functions.
	* section.c (_bfd_nowrite_set_section_contents): New function.
	* syms.c (_bfd_nosymbols_canonicalize_symtab),
	(_bfd_nosymbols_print_symbol, _bfd_nosymbols_get_symbol_info),
	(_bfd_nosymbols_get_symbol_version_string),
	(_bfd_nosymbols_bfd_is_local_label_name),
	(_bfd_nosymbols_get_lineno, _bfd_nosymbols_find_nearest_line),
	(_bfd_nosymbols_find_line, _bfd_nosymbols_find_inliner_info),
	(_bfd_nosymbols_bfd_make_debug_symbol),
	( _bfd_nosymbols_read_minisymbols),
	( _bfd_nosymbols_minisymbol_to_symbol),
	(_bfd_nodynamic_get_synthetic_symtab): New functions.
	* libbfd-in.h: Declare new functions.  Update existing defines,
	removing casts.
	* aix386-core.c: Update to use new hooks.  Formatting.
	* aout-adobe.c: Likewise.
	* aout-arm.c: Likewise.
	* aout-target.h: Likewise.
	* aout-tic30.c: Likewise.
	* aoutf1.h: Likewise.
	* binary.c: Likewise.
	* bout.c: Likewise.
	* cisco-core.c: Likewise.
	* coff-alpha.c: Likewise.
	* coff-i386.c: Likewise.
	* coff-i860.c: Likewise.
	* coff-i960.c: Likewise.
	* coff-ia64.c: Likewise.
	* coff-mips.c: Likewise.
	* coff-ppc.c: Likewise.
	* coff-rs6000.c: Likewise.
	* coff-sh.c: Likewise.
	* coff-tic30.c: Likewise.
	* coff-tic54x.c: Likewise.
	* coff-x86_64.c: Likewise.
	* coff64-rs6000.c: Likewise.
	* coffcode.h: Likewise.
	* elf-m10300.c: Likewise.
	* elf32-cr16.c: Likewise.
	* elf32-lm32.c: Likewise.
	* elf32-m32r.c: Likewise.
	* elf32-metag.c: Likewise.
	* elf32-score.c: Likewise.
	* elf32-score7.c: Likewise.
	* elf32-tilepro.c: Likewise.
	* elf32-xstormy16.c: Likewise.
	* elf32-xtensa.c: Likewise.
	* elf64-alpha.c: Likewise.
	* elf64-hppa.c: Likewise.
	* elf64-ia64-vms.c: Likewise.
	* elf64-mmix.c: Likewise.
	* elf64-sh64.c: Likewise.
	* elfnn-ia64.c: Likewise.
	* elfxx-sparc.c: Likewise.
	* elfxx-target.h: Likewise.
	* elfxx-tilegx.c: Likewise.
	* elfxx-x86.h: Likewise.
	* hp300hpux.c: Likewise.
	* hppabsd-core.c: Likewise.
	* hpux-core.c: Likewise.
	* i386msdos.c: Likewise.
	* i386os9k.c: Likewise.
	* ieee.c: Likewise.
	* ihex.c: Likewise.
	* irix-core.c: Likewise.
	* libaout.h: Likewise.
	* libecoff.h: Likewise.
	* mach-o-target.c: Likewise.
	* mach-o.c: Likewise.
	* mipsbsd.c: Likewise.
	* mmo.c: Likewise.
	* netbsd-core.c: Likewise.
	* nlm-target.h: Likewise.
	* oasys.c: Likewise.
	* osf-core.c: Likewise.
	* pdp11.c: Likewise.
	* pe-mips.c: Likewise.
	* pe-x86_64.c: Likewise.
	* pef.c: Likewise.
	* plugin.c: Likewise.
	* ppcboot.c: Likewise.
	* ptrace-core.c: Likewise.
	* sco5-core.c: Likewise.
	* som.c: Likewise.
	* sparclynx.c: Likewise.
	* srec.c: Likewise.
	* tekhex.c: Likewise.
	* trad-core.c: Likewise.
	* verilog.c: Likewise.
	* versados.c: Likewise.
	* vms-alpha.c: Likewise.
	* vms-lib.c: Likewise.
	* wasm-module.c: Likewise.
	* xsym.c: Likewise.
	* libbfd.h: Regenerate.
2018-02-16 19:09:23 +10:30
Nick Clifton 12ef3f5a7c Fix compilation of the BFD sub-directory with a gcc v8 compiler by adding extra casts.
GCC v8 issues warnings about mis-matching casts of function pointers.
A previous patch tried to fix this problem by adding new dummy functions
which accepted a variable number of arguments.  But this introduces serious
problems when compiled with other versions of gcc, (notably gcc 4.4).  This
patch reverts that previous solution and instead adds extra casts (to
function types without a parameter list).

For more details see: https://sourceware.org/ml/binutils/2018-02/msg00198.html

	PR 22823
	Revert previous delta.  Add extra casts to avoid compile time
	warnings instead.
	* libbfd-in.h (_bfd_generic_bfd_copy_private_bfd_data): Add extra
	cast to avoid warning from gcc v8 compiler.
	(_bfd_generic_bfd_merge_private_bfd_data): Likewise.
	(_bfd_generic_bfd_set_private_flags): Likewise.
	(_bfd_generic_bfd_copy_private_section_data): Likewise.
	(_bfd_generic_bfd_copy_private_symbol_data): Likewise.
	(_bfd_generic_bfd_copy_private_header_data): Likewise.
	(_bfd_generic_bfd_print_private_bfd_data): Likewise.
	(_bfd_noarchive_construct_extended_name_table): Likewise.
	(_bfd_noarchive_truncate_arname): Likewise.
	(_bfd_noarchive_write_ar_hdr): Likewise.
	(_bfd_noarchive_get_elt_at_index): Likewise.
	(_bfd_nosymbols_canonicalize_symtab): Likewise.
	(_bfd_nosymbols_print_symbol): Likewise.
	(_bfd_nosymbols_get_symbol_info): Likewise.
	(_bfd_nosymbols_get_symbol_version_string): Likewise.
	(_bfd_nosymbols_bfd_is_local_label_name): Likewise.
	(_bfd_nosymbols_bfd_is_target_special_symbol): Likewise.
	(_bfd_nosymbols_get_lineno): Likewise.
	(_bfd_nosymbols_find_nearest_line): Likewise.
	(_bfd_nosymbols_find_line): Likewise.
	(_bfd_nosymbols_find_inliner_info): Likewise.
	(_bfd_nosymbols_bfd_make_debug_symbol): Likewise.
	(_bfd_nosymbols_read_minisymbols): Likewise.
	(_bfd_nosymbols_minisymbol_to_symbol): Likewise.
	(_bfd_norelocs_bfd_reloc_type_lookup): Likewise.
	(_bfd_norelocs_bfd_reloc_name_lookup): Likewise.
	(_bfd_nowrite_set_arch_mach): Likewise.
	(_bfd_nowrite_set_section_contents): Likewise.
	(_bfd_nolink_sizeof_headers): Likewise.
	(_bfd_nolink_bfd_get_relocated_section_contents): Likewise.
	(_bfd_nolink_bfd_relax_section): Likewise.
	(_bfd_nolink_bfd_gc_sections): Likewise.
	(_bfd_nolink_bfd_lookup_section_flags): Likewise.
	(_bfd_nolink_bfd_merge_sections): Likewise.
	(_bfd_nolink_bfd_is_group_section): Likewise.
	(_bfd_nolink_bfd_discard_group): Likewise.
	(_bfd_nolink_bfd_link_hash_table_create): Likewise.
	(_bfd_nolink_bfd_link_add_symbols): Likewise.
	(_bfd_nolink_bfd_link_just_syms): Likewise.
	(_bfd_nolink_bfd_copy_link_hash_symbol_type): Likewise.
	(_bfd_nolink_bfd_final_link): Likewise.
	(_bfd_nolink_bfd_link_split_section): Likewise.
	(_bfd_nolink_section_already_linked): Likewise.
	(_bfd_nolink_bfd_define_common_symbol): Likewise.
	(_bfd_nolink_bfd_define_start_stop): Likewise.
	(_bfd_nodynamic_canonicalize_dynamic_symtab): Likewise.
	(_bfd_nodynamic_get_synthetic_symtab): Likewise.
	(_bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_): Likewise.
	(_bfd_nodynamic_canonicalize_dynamic_reloc): Likewise.
	* libbfd.c (bfd_false_any): Delete.
	(bfd_true_any, bfd_nullvoidptr_any, bfd_0_any): Delete.
	(bfd_0u_any, bfd_0l_any, _bfd_n1_any, bfd_void_any): Delete.
	* libbfd.h (extern): Regenerate
	* aout-target.h (MY_bfd_is_target_special_symbol): Add extra
	cast to avoid warning from gcc v8 compiler.
	* aout-tic30.c (tic30_aout_set_arch_mach): Likewise.
	* binary.c (binary_get_symbol_info): Likewise.
	* coff-alpha.c (alpha_ecoff_backend_data): Likewise.
	* coff-mips.c (mips_ecoff_backend_data): Likewise.
	* coffcode.h (coff_set_alignment_hook): Likewise.
	(symname_in_debug_hook): Likewise.
	(bfd_coff_backend_data bigobj_swap_table): Likewise.
	* elf-m10300.c (elf_backend_omit_section_dynsym): Likewise.
	* elf32-cr16.c (elf_backend_omit_section_dynsym): Likewise.
	* elf32-lm32.c (elf_backend_omit_section_dynsym): Likewise.
	* elf32-m32r.c (elf_backend_omit_section_dynsym): Likewise.
	* elf32-metag.c (elf_backend_omit_section_dynsym): Likewise.
	* elf32-score.c (elf_backend_omit_section_dynsym): Likewise.
	* elf32-score7.c (elf_backend_omit_section_dynsym): Likewise.
	* elf32-xstormy16.c (elf_backend_omit_section_dynsym): Likewise.
	* elf32-xtensa.c (elf_backend_omit_section_dynsym): Likewise.
	* elf64-alpha.c (elf_backend_omit_section_dynsym): Likewise.
	* elf64-hppa.c (elf_backend_omit_section_dynsym): Likewise.
	* elf64-ia64-vms.c (elf_backend_omit_section_dynsym): Likewise.
	* elf64-mmix.c (elf_backend_omit_section_dynsym): Likewise.
	* elf64-sh64.c (elf_backend_omit_section_dynsym): Likewise.
	* elfnn-ia64.c (elf_backend_omit_section_dynsym): Likewise.
	* elfxx-target.h (bfd_elfNN_bfd_debug_info_accumulate): Likewise.
	(bfd_elfNN_bfd_make_debug_symbol): Likewise.
	(bfd_elfNN_bfd_merge_private_bfd_data): Likewise.
	(bfd_elfNN_bfd_set_private_flags): Likewise.
	(bfd_elfNN_bfd_is_target_special_symbol): Likewise.
	(elf_backend_init_index_section): Likewise.
	(elf_backend_allow_non_load_phdr): Likewise.
	* elfxx-x86.h (elf_backend_omit_section_dynsym): Likewise.
	* i386msdos.c (msdos_bfd_is_target_special_symbol): Likewise.
	* ieee.c (ieee_construct_extended_name_table): Likewise.
	(ieee_write_armap): Likewise.
	(ieee_write_ar_hdr): Likewise.
	(ieee_bfd_is_target_special_symbol): Likewise.
	* ihex.c (ihex_canonicalize_symtab): Likewise.
	(ihex_bfd_is_target_special_symbol): Likewise.
	* libaout.h (aout_32_bfd_is_target_special_symbol): Likewise.
	* libecoff.h (_bfd_ecoff_bfd_is_target_special_symbol): Likewise.
	(_bfd_ecoff_set_alignment_hook): Likewise.
	* mach-o-target.c (bfd_mach_o_bfd_is_target_special_symbol): Likewise.
	* mmo.c (mmo_bfd_is_target_special_symbol): Likewise.
	* nlm-target.h (nlm_bfd_is_target_special_symbol): Likewise.
	* oasys.c (oasys_construct_extended_name_table): Likewise.
	(oasys_write_armap): Likewise.
	(oasys_write_ar_hdr): Likewise.
	(oasys_bfd_is_target_special_symbol): Likewise.
	* pef.c (bfd_pef_bfd_is_target_special_symbol): Likewise.
	* plugin.c (bfd_plugin_bfd_is_target_special_symbol): Likewise.
	* ppcboot.c (ppcboot_bfd_is_target_special_symbol): Likewise.
	* som.c (som_bfd_is_target_special_symbol): Likewise.
	* srec.c (srec_bfd_is_target_special_symbol): Likewise.
	* tekhex.c (tekhex_bfd_is_target_special_symbol): Likewise.
	* verilog.c (verilog_bfd_is_target_special_symbol): Likewise.
	* versados.c (versados_bfd_is_target_special_symbol): Likewise.
	(versados_bfd_reloc_name_lookup): Likewise.
	* vms-alpha.c (vms_bfd_is_target_special_symbol): Likewise.
	(vms_bfd_define_start_stop): Likewise.
	(alpha_vms_bfd_is_target_special_symbol): Likewise.
	* wasm-module.c (wasm_bfd_is_target_special_symbol): Likewise.
	* xsym.c (bfd_sym_bfd_is_target_special_symbol): Likewise.
2018-02-14 14:56:21 +00:00
Nick Clifton 68d2067666 Fix compile time warning messages from gcc version 8 about cast between incompatible function types.
PR 22823
bfd	Fix compile time warnings generated by gcc version 8.
	* libbfd-in.h: Remove extraneous text from prototypes.
	Add prototypes for bfd_false_any, bfd_true_any,
	bfd_nullvoidptr_any, bfd_0_any, bfd_0u_any, bfd_0l_any,
	bfd_n1_any, bfd_void_any.
	(_bfd_generic_bfd_copy_private_bfd_data): Use vararg based dummy
	function.
	(_bfd_generic_bfd_merge_private_bfd_data): Likewise.
	(_bfd_generic_bfd_set_private_flags): Likewise.
	(_bfd_generic_bfd_copy_private_section_data): Likewise.
	(_bfd_generic_bfd_copy_private_symbol_data): Likewise.
	(_bfd_generic_bfd_copy_private_header_data): Likewise.
	(_bfd_generic_bfd_print_private_bfd_data): Likewise.
	(_bfd_noarchive_construct_extended_name_table): Likewise.
	(_bfd_noarchive_truncate_arname): Likewise.
	(_bfd_noarchive_write_ar_hdr): Likewise.
	(_bfd_noarchive_get_elt_at_index): Likewise.
	(_bfd_nosymbols_canonicalize_symtab): Likewise.
	(_bfd_nosymbols_print_symbol): Likewise.
	(_bfd_nosymbols_get_symbol_info): Likewise.
	(_bfd_nosymbols_get_symbol_version_string): Likewise.
	(_bfd_nosymbols_bfd_is_local_label_name): Likewise.
	(_bfd_nosymbols_bfd_is_target_special_symbol): Likewise.
	(_bfd_nosymbols_get_lineno): Likewise.
	(_bfd_nosymbols_find_nearest_line): Likewise.
	(_bfd_nosymbols_find_line): Likewise.
	(_bfd_nosymbols_find_inliner_info): Likewise.
	(_bfd_nosymbols_bfd_make_debug_symbol): Likewise.
	(_bfd_nosymbols_read_minisymbols): Likewise.
	(_bfd_nosymbols_minisymbol_to_symbol): Likewise.
	(_bfd_norelocs_bfd_reloc_type_lookup): Likewise.
	(_bfd_norelocs_bfd_reloc_name_lookup): Likewise.
	(_bfd_nowrite_set_arch_mach): Likewise.
	(_bfd_nowrite_set_section_contents): Likewise.
	(_bfd_nolink_sizeof_headers): Likewise.
	(_bfd_nolink_bfd_get_relocated_section_contents): Likewise.
	(_bfd_nolink_bfd_relax_section): Likewise.
	(_bfd_nolink_bfd_gc_sections): Likewise.
	(_bfd_nolink_bfd_lookup_section_flags): Likewise.
	(_bfd_nolink_bfd_merge_sections): Likewise.
	(_bfd_nolink_bfd_is_group_section): Likewise.
	(_bfd_nolink_bfd_discard_group): Likewise.
	(_bfd_nolink_bfd_link_hash_table_create): Likewise.
	(_bfd_nolink_bfd_link_add_symbols): Likewise.
	(_bfd_nolink_bfd_link_just_syms): Likewise.
	(_bfd_nolink_bfd_copy_link_hash_symbol_type): Likewise.
	(_bfd_nolink_bfd_final_link): Likewise.
	(_bfd_nolink_bfd_link_split_section): Likewise.
	(_bfd_nolink_section_already_linked): Likewise.
	(_bfd_nolink_bfd_define_common_symbol): Likewise.
	(_bfd_nolink_bfd_define_start_stop): Likewise.
	(_bfd_nodynamic_canonicalize_dynamic_symtab): Likewise.
	(_bfd_nodynamic_get_synthetic_symtab): Likewise.
	(_bfd_nodynamic_get_dynamic_reloc_upper_bound _bfd_): Likewise.
	(_bfd_nodynamic_canonicalize_dynamic_reloc): Likewise.
	* libbfd.c (bfd_false_any): New function.  Like bfd_false but
	accepts one or more arguments.
	(bfd_true_any): Likewise.
	(bfd_nullvoidptr_any): Likewise.
	(bfd_0_any): Likewise.
	(bfd_0u_any): Likewise.
	(bfd_0l_any): Likewise.
	(_bfd_n1_any): Likewise.
	(bfd_void_any): Likewise.
	* libbfd.h (extern): Regenerate
	* aout-target.h (MY_bfd_is_target_special_symbol): Use vararg
	based dummy function.
	* aout-tic30.c (tic30_aout_set_arch_mach): Likewise.
	* binary.c (binary_get_symbol_info): Likewise.
	* coff-alpha.c (alpha_ecoff_backend_data): Likewise.
	* coff-mips.c (mips_ecoff_backend_data): Likewise.
	* coffcode.h (coff_set_alignment_hook): Likewise.
	(symname_in_debug_hook): Likewise.
	(bfd_coff_backend_data bigobj_swap_table): Likewise.
	* elf-m10300.c (elf_backend_omit_section_dynsym): Likewise.
	* elf32-cr16.c (elf_backend_omit_section_dynsym): Likewise.
	* elf32-lm32.c (elf_backend_omit_section_dynsym): Likewise.
	* elf32-m32r.c (elf_backend_omit_section_dynsym): Likewise.
	* elf32-metag.c (elf_backend_omit_section_dynsym): Likewise.
	* elf32-score.c (elf_backend_omit_section_dynsym): Likewise.
	* elf32-score7.c (elf_backend_omit_section_dynsym): Likewise.
	* elf32-xstormy16.c (elf_backend_omit_section_dynsym): Likewise.
	* elf32-xtensa.c (elf_backend_omit_section_dynsym): Likewise.
	* elf64-alpha.c (elf_backend_omit_section_dynsym): Likewise.
	* elf64-hppa.c (elf_backend_omit_section_dynsym): Likewise.
	* elf64-ia64-vms.c (elf_backend_omit_section_dynsym): Likewise.
	* elf64-mmix.c (elf_backend_omit_section_dynsym): Likewise.
	* elf64-sh64.c (elf_backend_omit_section_dynsym): Likewise.
	* elfnn-ia64.c (elf_backend_omit_section_dynsym): Likewise.
	* elfxx-target.h (bfd_elfNN_bfd_debug_info_accumulate): Likewise.
	(bfd_elfNN_bfd_make_debug_symbol): Likewise.
	(bfd_elfNN_bfd_merge_private_bfd_data): Likewise.
	(bfd_elfNN_bfd_set_private_flags): Likewise.
	(bfd_elfNN_bfd_is_target_special_symbol): Likewise.
	(elf_backend_init_index_section): Likewise.
	(elf_backend_allow_non_load_phdr): Likewise.
	* elfxx-x86.h (elf_backend_omit_section_dynsym): Likewise.
	* i386msdos.c (msdos_bfd_is_target_special_symbol): Likewise.
	* ieee.c (ieee_construct_extended_name_table): Likewise.
	(ieee_write_armap): Likewise.
	(ieee_write_ar_hdr): Likewise.
	(ieee_bfd_is_target_special_symbol): Likewise.
	* ihex.c (ihex_canonicalize_symtab): Likewise.
	(ihex_bfd_is_target_special_symbol): Likewise.
	* libaout.h (aout_32_bfd_is_target_special_symbol): Likewise.
	* libecoff.h (_bfd_ecoff_bfd_is_target_special_symbol): Likewise.
	(_bfd_ecoff_set_alignment_hook): Likewise.
	* mach-o-target.c (bfd_mach_o_bfd_is_target_special_symbol): Likewise.
	* mmo.c (mmo_bfd_is_target_special_symbol): Likewise.
	* nlm-target.h (nlm_bfd_is_target_special_symbol): Likewise.
	* oasys.c (oasys_construct_extended_name_table): Likewise.
	(oasys_write_armap): Likewise.
	(oasys_write_ar_hdr): Likewise.
	(oasys_bfd_is_target_special_symbol): Likewise.
	* pef.c (bfd_pef_bfd_is_target_special_symbol): Likewise.
	* plugin.c (bfd_plugin_bfd_is_target_special_symbol): Likewise.
	* ppcboot.c (ppcboot_bfd_is_target_special_symbol): Likewise.
	* som.c (som_bfd_is_target_special_symbol): Likewise.
	* srec.c (srec_bfd_is_target_special_symbol): Likewise.
	* tekhex.c (tekhex_bfd_is_target_special_symbol): Likewise.
	* verilog.c (verilog_bfd_is_target_special_symbol): Likewise.
	* versados.c (versados_bfd_is_target_special_symbol): Likewise.
	(versados_bfd_reloc_name_lookup): Likewise.
	* vms-alpha.c (vms_bfd_is_target_special_symbol): Likewise.
	(vms_bfd_define_start_stop): Likewise.
	(alpha_vms_bfd_is_target_special_symbol): Likewise.
	* wasm-module.c (wasm_bfd_is_target_special_symbol): Likewise.
	* xsym.c (bfd_sym_bfd_is_target_special_symbol): Likewise.
	* elf32-arc.c (get_replace_function): Assign replacement function
	to func pointer.
	* elf32-i370.c (i370_noop): Update prototype.

gas	* config/obj-elf.c (elf_pseudo_table): Remove now redundant
	casts.
	(obj_elf_vtable_inherit): Rename to obj_elf_get_vtable_inherit.
	(obj_elf_vtable_inherit): New stub function that calls
	obj_elf_get_vtable_inherit.
	(obj_elf_vtable_entry): Rename to obj_elf_get_vtable_entry.
	(obj_elf_vtable_entry): New stub function that calls
	obj_elf_get_vtable_entry.
	* config/obj-elf.h (obj_elf_vtable_inherit): Update prototype.
	(obj_elf_vtable_entry) Likewise.
	(obj_elf_get_vtable_inherit) Likewise.
	(obj_elf_get_vtable_entry) Likewise.
	* config/tc-arm.c (md_pseudo_table): Remove now redundant cast.
	* config/tc-i386c (md_pseudo_table): Likewise.
	* config/tc-hppa.c (pa_vtable_entry): Call
	obj_elf_get_vtable_entry.
	(pa_vtable_inherit): Call obj_elf_get_vtable_inherit.
	* config/tc-mips.c (s_mips_file): Replace call to dwarf2_get_file
	with call to dwarf2_get_filename.
	* dwarf2dbg.c (dwarf2_directive_file): Rename to
	dwarf2_directive_filename.
	(dwarf2_directive_file): New stub function that calls
	dwarf2_directive_filename.
	* dwarf2dbg.h: Prototype dwarf2_directive_filename.

opcodes	* metag-dis.c (print_fmmov): Double buffer size to avoid warning
	about truncation of printing.
2018-02-13 13:14:47 +00:00
Alan Modra 219d1afa89 Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
Alan Modra 07d6d2b834 BFD whitespace fixes
Binutils is supposed to use tabs.  In my git config I have
whitespace = indent-with-non-tab,space-before-tab,trailing-space
and I got annoyed enough seeing red in "git diff" output to fix
the problems.

	* doc/header.sed: Trim trailing space when splitting lines.
	* aix386-core.c, * aout-adobe.c, * aout-arm.c, * aout-cris.c,
	* aout-ns32k.c, * aout-target.h, * aout-tic30.c, * aoutf1.h, * aoutx.h,
	* arc-got.h, * arc-plt.def, * arc-plt.h, * archive.c, * archive64.c,
	* archures.c, * armnetbsd.c, * bfd-in.h, * bfd.c, * bfdio.c, * binary.c,
	* bout.c, * cache.c, * cisco-core.c, * coff-alpha.c, * coff-apollo.c,
	* coff-arm.c, * coff-h8300.c, * coff-i386.c, * coff-i860.c,
	* coff-i960.c, * coff-m68k.c, * coff-m88k.c, * coff-mcore.c,
	* coff-mips.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c,
	* coff-stgo32.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c,
	* coff-we32k.c, * coff-x86_64.c, * coff-z80.c, * coff-z8k.c,
	* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
	* coffswap.h, * compress.c, * corefile.c, * cpu-alpha.c, * cpu-arm.c,
	* cpu-avr.c, * cpu-bfin.c, * cpu-cr16.c, * cpu-cr16c.c, * cpu-crx.c,
	* cpu-d10v.c, * cpu-frv.c, * cpu-ft32.c, * cpu-i370.c, * cpu-i960.c,
	* cpu-ia64-opc.c, * cpu-ip2k.c, * cpu-lm32.c, * cpu-m32r.c,
	* cpu-mcore.c, * cpu-microblaze.c, * cpu-mips.c, * cpu-moxie.c,
	* cpu-mt.c, * cpu-nios2.c, * cpu-ns32k.c, * cpu-or1k.c, * cpu-powerpc.c,
	* cpu-pru.c, * cpu-sh.c, * cpu-spu.c, * cpu-v850.c, * cpu-v850_rh850.c,
	* cpu-xgate.c, * cpu-z80.c, * dwarf1.c, * dwarf2.c, * ecoff.c,
	* ecofflink.c, * ecoffswap.h, * elf-bfd.h, * elf-eh-frame.c,
	* elf-hppa.h, * elf-m10200.c, * elf-m10300.c, * elf-s390-common.c,
	* elf-strtab.c, * elf-vxworks.c, * elf.c, * elf32-am33lin.c,
	* elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-avr.h,
	* 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-ft32.c,
	* elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-i860.c,
	* elf32-i960.c, * elf32-ip2k.c, * elf32-lm32.c, * elf32-m32c.c,
	* elf32-m32r.c, * elf32-m68hc11.c, * elf32-m68hc12.c, * elf32-m68hc1x.c,
	* elf32-m68hc1x.h, * 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-nds32.h, * elf32-nios2.c, * elf32-or1k.c, * elf32-pj.c,
	* elf32-ppc.c, * elf32-ppc.h, * elf32-pru.c, * elf32-rl78.c,
	* elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score.h,
	* elf32-score7.c, * elf32-sh-symbian.c, * elf32-sh.c, * elf32-sh64.c,
	* elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilegx.c,
	* elf32-tilegx.h, * elf32-tilepro.c, * elf32-tilepro.h, * elf32-v850.c,
	* elf32-vax.c, * elf32-wasm32.c, * elf32-xc16x.c, * elf32-xgate.c,
	* elf32-xgate.h, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.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-tilegx.h, * elf64-x86-64.c, * elfcore.h,
	* elflink.c, * elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c,
	* elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-aarch64.h, * elfxx-ia64.c,
	* elfxx-ia64.h, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-sparc.c,
	* elfxx-tilegx.c, * elfxx-x86.c, * elfxx-x86.h, * freebsd.h, * hash.c,
	* host-aout.c, * hp300hpux.c, * hppabsd-core.c, * hpux-core.c,
	* i386aout.c, * i386linux.c, * i386lynx.c, * i386mach3.c, * i386msdos.c,
	* i386netbsd.c, * ieee.c, * ihex.c, * irix-core.c, * libaout.h,
	* libbfd-in.h, * libbfd.c, * libcoff-in.h, * libnlm.h, * libpei.h,
	* libxcoff.h, * linker.c, * lynx-core.c, * m68k4knetbsd.c,
	* m68klinux.c, * m68knetbsd.c, * m88kmach3.c, * mach-o-aarch64.c,
	* mach-o-arm.c, * mach-o-i386.c, * mach-o-target.c, * mach-o-x86-64.c,
	* mach-o.c, * mach-o.h, * merge.c, * mipsbsd.c, * mmo.c, * netbsd.h,
	* netbsd-core.c, * newsos3.c, * nlm-target.h, * nlm32-ppc.c,
	* nlm32-sparc.c, * nlmcode.h, * ns32k.h, * ns32knetbsd.c, * oasys.c,
	* opncls.c, * pc532-mach.c, * pdp11.c, * pe-arm.c, * pe-i386.c,
	* pe-mcore.c, * pe-mips.c, * pe-x86_64.c, * peXXigen.c, * pef.c,
	* pef.h, * pei-arm.c, * pei-i386.c, * pei-mcore.c, * pei-x86_64.c,
	* peicode.h, * plugin.c, * ppcboot.c, * ptrace-core.c, * reloc.c,
	* riscix.c, * rs6000-core.c, * section.c, * som.c, * som.h,
	* sparclinux.c, * sparcnetbsd.c, * srec.c, * stabs.c, * sunos.c,
	* syms.c, * targets.c, * tekhex.c, * trad-core.c, * vax1knetbsd.c,
	* vaxnetbsd.c, * verilog.c, * versados.c, * vms-alpha.c, * vms-lib.c,
	* vms-misc.c, * wasm-module.c, * wasm-module.h, * xcofflink.c,
	* xsym.c, * xsym.h: Whitespace fixes.
	* bfd-in2.h, * libbfd.h, * libcoff.h: Regenerate.
2017-12-06 17:51:43 +10:30
Alan Modra d42c267e9b bfd_error_handler bfd_vma and bfd_size_type args
This patch uses the new %L _bfd_error_handler support for printing
bfd_vma arguments, and fixes a many other format and/or argument
errors in error messages.

bfd/
	* binary.c (binary_set_section_contents): Don't print filepos in
	error message.
	(coff_write_object_contents): Cast size_t for error message.
	(coff_slurp_line_table): Don't use bfd_vma symndx.
	(coff_slurp_reloc_table): Remove unneeded cast.
	* dwarf2.c (read_section): Cast bfd_int64_t to long long for
	error message.
	(find_abstract_instance_name): Likewise.
	* elf32-arm.c (arm_type_of_stub): Correct error arg order.
	(bfd_elf32_arm_stm32l4xx_erratum_scan): Don't cast error arg.
	(elf32_arm_check_relocs): Make r_symndx an int.
	* elf32-cris.c (cris_elf_check_relocs): Delete extraneous %s in
	format string.
	* elf32-metag.c (elf_metag_relocate_section): Delete extra error
	message arg.
	* elf32-nds32.c (nds32_elf_ex9_build_hash_table): Rewrite bogus
	error message.
	* elf32-i386.c (elf_i386_check_relocs): Make r_symndx an int.
	* elf32-s390.c (elf_s390_check_relocs): Likewise.
	* elf32-tic6x.c (elf32_tic6x_check_relocs): Likewise.
	* elf32-tilepro.c (tilepro_elf_check_relocs): Likewise.
	* elf32-xtensa.c (elf_xtensa_check_relocs): Likewise.
	* elf64-s390.c (elf_s390_check_relocs): Likewise.
	* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
	* elfnn-aarch64.c (elfNN_aarch64_check_relocs): Likewise.
	* elfnn-riscv.c (riscv_elf_check_relocs): Likewise.
	* elfxx-sparc.c (_bfd_sparc_elf_check_relocs): Likewise.
	* elfxx-tilegx.c (tilegx_elf_check_relocs): Likewise.
	* elf64-mmix.c (_bfd_mmix_after_linker_allocation): Cast size_t args
	and use %lu for error message.
	* elflink.c (elf_link_adjust_relocs): Delete extra error message arg.
	* mmo.c (mmo_scan): Make stab_loc a file_ptr.  Cast expression for
	error message.

	* elf32-arm.c (elf32_arm_tls_relax): Correct format string and args
	in error message.
	(elf32_arm_final_link_relocate): Likewise.
	* coff-arm.c (bfd_arm_process_before_allocation): Likewise.
	* coffcode.h (styp_to_sec_flags): Likewise.
	* cofflink.c (_bfd_coff_write_global_sym): Likewise.
	* ecoff.c (_bfd_ecoff_slurp_symbol_table): Likewise.
	* elf32-arc.c (arc_elf_merge_private_bfd_data): Likewise.
	* elf32-bfin.c (bfinfdpic_check_relocs): Likewise.
	(elf32_bfin_merge_private_bfd_data): Likewise.
	* elf32-cris.c (cris_elf_relocate_section): Likewise.
	* elf32-frv.c (frv_elf_merge_private_bfd_data): Likewise.
	* elf32-i370.c (i370_elf_merge_private_bfd_data): Likewise.
	(i370_elf_relocate_section): Likewise.
	* elf32-iq2000.c (iq2000_elf_merge_private_bfd_data): Likewise.
	* elf32-m32c.c (m32c_elf_merge_private_bfd_data): Likewise.
	* elf32-m68hc1x.c (_bfd_m68hc11_elf_merge_private_bfd_data): Likewise.
	* elf32-mcore.c (mcore_elf_relocate_section): Likewise.
	* elf32-mep.c (mep_elf_merge_private_bfd_data): Likewise.
	* elf32-mt.c (mt_elf_merge_private_bfd_data): Likewise.
	* elf64-sparc.c (elf64_sparc_merge_private_bfd_data): Likewise.
	* elfxx-mips.c (mips_elf_merge_obj_e_flags): Likewise.
	(_bfd_mips_elf_merge_private_bfd_data): Likewise.
	* ieee.c (ieee_write_id, read_id): Likewise.
	* mach-o.c (bfd_mach_o_write_contents): Likewise.
	(bfd_mach_o_layout_commands, bfd_mach_o_read_section_32): Likewise.
	(bfd_mach_o_read_section_64, bfd_mach_o_read_symtab_symbol): Likewise.
	(bfd_mach_o_read_command, bfd_mach_o_header_p): Likewise.
	* peXXigen.c (_bfd_XXi_swap_aouthdr_in): Likewise.
	* stabs.c (_bfd_link_section_stabs): Likewise.

	* coff-arm.c (coff_arm_relocate_section): Use L modifier in error
	format.
	* coff-mcore.c (coff_mcore_relocate_section): Likewise.
	* coff-ppc.c (coff_ppc_relocate_section): Likewise.
	* coff-rs6000.c (xcoff_reloc_type_toc): Likewise.
	* coff-sh.c (sh_relax_section): Likewise.
	(sh_relax_delete_bytes, sh_swap_insns): Likewise.
	* coff-tic80.c (coff_tic80_relocate_section): Likewise.
	* coffcode.h (coff_slurp_reloc_table): Likewise.
	* coffgen.c (_bfd_coff_get_external_symbols): Likewise.
	(_bfd_coff_read_string_table): Likewise.
	* cofflink.c (_bfd_coff_generic_relocate_section): Likewise.
	* compress.c (bfd_get_full_section_contents): Likewise.
	* dwarf2.c (read_formatted_entries, decode_line_info): Likewise.
	* elf-m10300.c (mn10300_elf_relocate_section): Likewise.
	* elf.c (bfd_elf_string_from_elf_section): Likewise.
	* elf32-arc.c (arc_special_overflow_checks): Likewise.
	* elf32-arm.c (elf32_arm_tls_relax): Likewise.
	(elf32_arm_final_link_relocate, elf32_arm_relocate_section): Likewise.
	(elf32_arm_write_section): Likewise.
	* elf32-bfin.c (bfin_relocate_section): Likewise.
	(bfinfdpic_relocate_section): Likewise.
	* elf32-hppa.c (hppa_build_one_stub): Likewise.
	(final_link_relocate, elf32_hppa_relocate_section): Likewise.
	* elf32-i386.c (elf_i386_tls_transition): Likewise.
	(elf_i386_relocate_section): Likewise.
	* elf32-ip2k.c (ip2k_final_link_relocate): Likewise.
	* elf32-lm32.c (lm32_elf_finish_dynamic_sections): Likewise.
	* elf32-m32r.c (m32r_elf_relocate_section): Likewise.
	* elf32-m68k.c (elf_m68k_relocate_section): Likewise.
	* elf32-metag.c (elf_metag_relocate_section): Likewise.
	* elf32-nds32.c (unrecognized_reloc_msg): Likewise.
	(nds32_elf_relax_longcall1, nds32_elf_relax_longcall2): Likewise.
	(nds32_elf_relax_longcall3, nds32_elf_relax_longjump1): Likewise.
	(nds32_elf_relax_longjump2, nds32_elf_relax_longjump3): Likewise.
	(nds32_elf_relax_longcall4, nds32_elf_relax_longcall5): Likewise.
	(nds32_elf_relax_longcall6, nds32_elf_relax_longjump4): Likewise.
	(nds32_elf_relax_longjump5, nds32_elf_relax_longjump6): Likewise.
	(nds32_elf_relax_longjump7, nds32_elf_relax_loadstore): Likewise.
	(nds32_elf_relax_ptr, nds32_elf_ex9_build_hash_table): Likewise.
	* elf32-nios2.c (nios2_elf32_relocate_section): Likewise.
	* elf32-rx.c (UNSAFE_FOR_PID): Likewise.
	* elf32-s390.c (invalid_tls_insn, elf_s390_relocate_section): Likewise.
	* elf32-score.c (s3_bfd_score_elf_check_relocs): Likewise.
	* elf32-score7.c (s7_bfd_score_elf_check_relocs): Likewise.
	* elf32-sh.c (sh_elf_relax_section): Likewise.
	(sh_elf_relax_delete_bytes, sh_elf_swap_insns): Likewise.
	(sh_elf_relocate_section): Likewise.
	* elf32-sh64.c (shmedia_prepare_reloc): Likewise.
	* elf32-spu.c (spu_elf_relocate_section): Likewise.
	* elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise.
	* elf32-tilepro.c (tilepro_elf_relocate_section): Likewise.
	* elf32-v850.c (v850_elf_relax_section): Likewise.
	* elf32-vax.c (elf_vax_check_relocs): Likewise.
	(elf_vax_relocate_section): Likewise.
	* elf32-xtensa.c (elf_xtensa_relocate_section): Likewise.
	(extend_ebb_bounds_forward, extend_ebb_bounds_backward): Likewise.
	(compute_text_actions, compute_ebb_proposed_actions): Likewise.
	(do_fix_for_relocatable_link): Likewise.
	* elf64-alpha.c (elf64_alpha_relax_got_load): Likewise.
	(elf64_alpha_relax_with_lituse): Likewise.
	* elf64-hppa.c (elf64_hppa_finish_dynamic_symbol): Likewise.
	(elf_hppa_final_link_relocate): Likewise.
	* elf64-ia64-vms.c (elf64_ia64_relax_section): Likewise.
	(elf64_ia64_choose_gp, elf64_ia64_relocate_section): Likewise.
	(elf64_vms_link_add_object_symbols): Likewise.
	* elf64-mmix.c (mmix_elf_perform_relocation): Likewise.
	(mmix_final_link_relocate): Likewise.
	* elf64-s390.c (invalid_tls_insn): Likewise.
	(elf_s390_relocate_section): Likewise.
	* elf64-sh64.c (sh_elf64_relocate_section): Likewise.
	* elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
	(elf_x86_64_relocate_section): Likewise.
	* elfcode.h (elf_slurp_symbol_table): Likewise.
	* elfcore.h (elf_core_file_p): Likewise.
	* elflink.c (elf_link_read_relocs_from_section): Likewise.
	* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Likewise.
	(elfNN_aarch64_relocate_section): Likewise.
	* elfnn-ia64.c (elfNN_ia64_relax_section): Likewise.
	(elfNN_ia64_choose_gp, elfNN_ia64_relocate_section): Likewise.
	* elfnn-riscv.c (riscv_elf_relocate_section): Likewise.
	* elfxx-mips.c (_bfd_mips_elf_check_relocs): Likewise.
	(_bfd_mips_elf_relocate_section): Likewise.
	(_bfd_mips_elf_finish_dynamic_symbol, mips_finish_exec_plt): Likewise.
	* elfxx-sparc.c (_bfd_sparc_elf_relocate_section): Likewise.
	* elfxx-tilegx.c (tilegx_elf_relocate_section): Likewise.
	* ieee.c (ieee_slurp_external_symbols): Likewise.
	* ihex.c (ihex_write_object_content): Likewise.
	* mach-o.c (bfd_mach_o_build_exec_seg_command): Likewise.
	* merge.c (_bfd_merged_section_offset): Likewise.
	* mmo.c (mmo_write_loc_chunk): Likewise.
	(mmo_write_object_contents): Likewise.
	* peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Likewise.
	* stabs.c (_bfd_link_section_stabs): Likewise.
	* xcofflink.c (xcoff_link_add_symbols, xcoff_find_tc0): Likewise.
ld/
	* testsuite/ld-arc/nps-1b.err: Update.
	* testsuite/ld-x86-64/ilp32-11.d: Update.
2017-07-12 14:03:48 +09:30
Alan Modra 7dba9362c1 Rewrite __start and __stop symbol handling
This arranges for __start and __stop symbols to be defined before
garbage collection, for all target formats.  That should allow the
COFF and PE --gc-sections to keep a singleton orphan input section,
a feature lost by 2017-06-13 commit cbd0eecf26.  The fancier ELF
treatment of keeping all input sections associated with a __start or
__stop symbol, from 2015-10-23 commit 1cce69b9dc, is retained.

.startof. and .sizeof. symbols are deliberately not defined before
garbage collection, so these won't affect garbage collection of
sections.

The patch also ensures __start, __stop, .startof. and .sizeof. symbols
are defined before target size_dynamic_sections is called, albeit
with a preliminary value, so that target code doesn't need to cope
with a symbol changing from undefined at size_dynamic_sections to
defined at relocate_section.

Also, a number of problems with the testcases have been fixed.

	PR ld/20022
	PR ld/21557
	PR ld/21562
	PR ld/21571
include/
	* bfdlink.h (struct bfd_link_hash_entry): Delete undef.section.
bfd/
	* targets.c (struct bfd_target): Add _bfd_define_start_stop.
	(BFD_JUMP_TABLE_LINK): Likewise.
	* elf-bfd.h (bfd_elf_define_start_stop): Declare.
	* elflink.c (_bfd_elf_gc_mark_rsec): Update comment.
	(bfd_elf_define_start_stop): New function.
	* linker.c (bfd_generic_define_start_stop): New function.
	* coff64-rs6000.c (rs6000_xcoff64_vec, rs6000_xcoff64_aix_vec): Init
	new field.
	* aout-adobe.c (aout_32_bfd_define_start_stop): Define.
	* aout-target.h (MY_bfd_define_start_stop): Define.
	* aout-tic30.c (MY_bfd_define_start_stop): Define.
	* binary.c (binary_bfd_define_start_stop): Define.
	* bout.c (b_out_bfd_define_start_stop): Define.
	* coff-alpha.c (_bfd_ecoff_bfd_define_start_stop): Define.
	* coff-mips.c (_bfd_ecoff_bfd_define_start_stop): Define.
	* coff-rs6000.c (_bfd_xcoff_bfd_define_start_stop): Define.
	* coffcode.h (coff_bfd_define_start_stop): Define.
	* elfxx-target.h (bfd_elfNN_bfd_define_start_stop): Define.
	* i386msdos.c (msdos_bfd_define_start_stop): Define.
	* i386os9k.c (os9k_bfd_define_start_stop): Define.
	* ieee.c (ieee_bfd_define_start_stop): Define.
	* ihex.c (ihex_bfd_define_start_stop): Define.
	* libbfd-in.h (_bfd_nolink_bfd_define_start_stop): Define.
	* mach-o-target.c (bfd_mach_o_bfd_define_start_stop): Define.
	* mmo.c (mmo_bfd_define_start_stop): Define.
	* nlm-target.h (nlm_bfd_define_start_stop): Define.
	* oasys.c (oasys_bfd_define_start_stop): Define.
	* pef.c (bfd_pef_bfd_define_start_stop): Define.
	* plugin.c (bfd_plugin_bfd_define_start_stop): Define.
	* ppcboot.c (ppcboot_bfd_define_start_stop): Define.
	* som.c (som_bfd_define_start_stop): Define.
	* srec.c (srec_bfd_define_start_stop): Define.
	* tekhex.c (tekhex_bfd_define_start_stop): Define.
	* versados.c (versados_bfd_define_start_stop): Define.
	* vms-alpha.c (vms_bfd_define_start_stop): Define.
	(alpha_vms_bfd_define_start_stop): Define.
	* xsym.c (bfd_sym_bfd_define_start_stop): Define.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
ld/
	* emultempl/elf32.em (gld${EMULATION_NAME}_after_open): Don't set
	__start/__stop syms here.
	* ldlang.c (lang_set_startof): Delete.
	(start_stop_syms, start_stop_count, start_stop_alloc): New vars.
	(lang_define_start_stop, lang_init_start_stop, foreach_start_stop,
	undef_start_stop, lang_undef_start_stop, lang_init_startof_sizeof,
	set_start_stop, lang_finalize_start_stop): New functions.
	(lang_process): Call _start_stop functions.
	* testsuite/ld-elf/pr21562a.d: Use xfail rather than notarget.
	Correct typos and list of xfail targets.
	* testsuite/ld-elf/pr21562b.d: Likewise.
	* testsuite/ld-elf/pr21562c.d: Likewise.
	* testsuite/ld-elf/pr21562d.d: Likewise.
	* testsuite/ld-elf/pr21562e.d: Likewise.
	* testsuite/ld-elf/pr21562f.d: Likewise.
	* testsuite/ld-elf/pr21562g.d: Likewise.
	* testsuite/ld-elf/pr21562h.d: Likewise.
	* testsuite/ld-elf/pr21562i.d: Likewise.
	* testsuite/ld-elf/pr21562j.d: Likewise.
	* testsuite/ld-elf/pr21562k.d: Likewise.
	* testsuite/ld-elf/pr21562l.d: Likewise.
	* testsuite/ld-elf/pr21562m.d: Likewise.
	* testsuite/ld-elf/pr21562n.d: Likewise.
	* testsuite/ld-elf/sizeofa.d: Likewise.  Adjust to pass for generic ELF.
	* testsuite/ld-elf/sizeofb.d: Likewise.
	* testsuite/ld-elf/startofa.d: Likewise.
	* testsuite/ld-elf/startofb.d: Likewise.
2017-06-16 23:38:28 +09:30
Alan Modra dae82561a2 Use %A and %B in more error messages
* aoutx.h: Use %B and %A in error messages throughout file.
	* aout-cris.c: Likewise.
	* archive.c: Likewise.
	* binary.c: Likewise.
	* coff-rs6000.c: Likewise.
	* coff-tic4x.c: Likewise.
	* coffcode.h: Likewise.
	* coffgen.c: Likewise.
	* cofflink.c: Likewise.
	* coffswap.h: Likewise.
	* cpu-arm.c: Likewise.
	* elf-eh-frame.c: Likewise.
	* elf-m10300.c: Likewise.
	* elf.c: Likewise.
	* elf32-arc.c: Likewise.
	* elf32-arm.c: Likewise.
	* elf32-bfin.c: Likewise.
	* elf32-frv.c: Likewise.
	* elf32-iq2000.c: Likewise.
	* elf32-m32c.c: Likewise.
	* elf32-microblaze.c: Likewise.
	* elf32-nds32.c: Likewise.
	* elf32-rl78.c: Likewise.
	* elf32-rx.c: Likewise.
	* elf32-score.c: Likewise.
	* elf32-score7.c: Likewise.
	* elf32-sh64.c: Likewise.
	* elf32-v850.c: Likewise.
	* elf32-vax.c: Likewise.
	* elf32-visium.c: Likewise.
	* elf64-ia64-vms.c: Likewise.
	* elf64-mmix.c: Likewise.
	* elf64-sh64.c: Likewise.
	* elfcode.h: Likewise.
	* elfnn-aarch64.c: Likewise.
	* elfnn-ia64.c: Likewise.
	* elfxx-mips.c: Likewise.
	* hpux-core.c: Likewise.
	* ieee.c: Likewise.
	* ihex.c: Likewise.
	* linker.c: Likewise.
	* merge.c: Likewise.
	* mmo.c: Likewise.
	* oasys.c: Likewise.
	* pdp11.c: Likewise.
	* peXXigen.c: Likewise.
	* rs6000-core.c: Likewise.
	* vms-alpha.c: Likewise.
	* xcofflink.c: Likewise.
2017-04-13 17:07:24 +09:30
Alan Modra 2571583aed Update year range in copyright notice of all files. 2017-01-02 14:08:56 +10:30
Nick Clifton 695344c018 Add c-format tags to translatable strings with more than one argument-using formatting token.
* aout-adobe.c: Add missing c-format tags for translatable strings.
	* aout-cris.c: Likewise.
	* aoutx.h: Likewise.
	* bfd.c: Likewise.
	* binary.c: Likewise.
	* cache.c: Likewise.
	* coff-alpha.c: Likewise.
	* coff-arm.c: Likewise.
	* coff-i860.c: Likewise.
	* coff-mcore.c: Likewise.
	* coff-ppc.c: Likewise.
	* coff-rs6000.c: Likewise.
	* coff-sh.c: Likewise.
	* coff-tic4x.c: Likewise.
	* coff-tic54x.c: Likewise.
	* coff-tic80.c: Likewise.
	* coff64-rs6000.c: Likewise.
	* coffcode.h: Likewise.
	* coffgen.c: Likewise.
	* cofflink.c: Likewise.
	* coffswap.h: Likewise.
	* cpu-arm.c: Likewise.
	* dwarf2.c: Likewise.
	* ecoff.c: Likewise.
	* elf-attrs.c: Likewise.
	* elf-eh-frame.c: Likewise.
	* elf-ifunc.c: Likewise.
	* elf-m10300.c: Likewise.
	* elf-s390-common.c: Likewise.
	* elf.c: Likewise.
	* elf32-arc.c: Likewise.
	* elf32-arm.c: Likewise.
	* elf32-avr.c: Likewise.
	* elf32-bfin.c: Likewise.
	* elf32-cr16.c: Likewise.
	* elf32-cr16c.c: Likewise.
	* elf32-cris.c: Likewise.
	* elf32-crx.c: Likewise.
	* elf32-d10v.c: Likewise.
	* elf32-d30v.c: Likewise.
	* elf32-epiphany.c: Likewise.
	* elf32-fr30.c: Likewise.
	* elf32-frv.c: Likewise.
	* elf32-gen.c: Likewise.
	* elf32-hppa.c: Likewise.
	* elf32-i370.c: Likewise.
	* elf32-i386.c: Likewise.
	* elf32-i960.c: Likewise.
	* elf32-ip2k.c: Likewise.
	* elf32-iq2000.c: Likewise.
	* elf32-lm32.c: Likewise.
	* elf32-m32c.c: Likewise.
	* elf32-m32r.c: Likewise.
	* elf32-m68hc11.c: Likewise.
	* elf32-m68hc12.c: Likewise.
	* elf32-m68hc1x.c: Likewise.
	* elf32-m68k.c: Likewise.
	* elf32-mcore.c: Likewise.
	* elf32-mep.c: Likewise.
	* elf32-metag.c: Likewise.
	* elf32-microblaze.c: Likewise.
	* elf32-moxie.c: Likewise.
	* elf32-msp430.c: Likewise.
	* elf32-mt.c: Likewise.
	* elf32-nds32.c: Likewise.
	* elf32-nios2.c: Likewise.
	* elf32-or1k.c: Likewise.
	* elf32-pj.c: Likewise.
	* elf32-ppc.c: Likewise.
	* elf32-rl78.c: Likewise.
	* elf32-rx.c: Likewise.
	* elf32-s390.c: Likewise.
	* elf32-score.c: Likewise.
	* elf32-score7.c: Likewise.
	* elf32-sh-symbian.c: Likewise.
	* elf32-sh.c: Likewise.
	* elf32-sh64.c: Likewise.
	* elf32-spu.c: Likewise.
	* elf32-tic6x.c: Likewise.
	* elf32-tilepro.c: Likewise.
	* elf32-v850.c: Likewise.
	* elf32-vax.c: Likewise.
	* elf32-visium.c: Likewise.
	* elf32-xgate.c: Likewise.
	* elf32-xtensa.c: Likewise.
	* elf64-alpha.c: Likewise.
	* elf64-gen.c: Likewise.
	* elf64-hppa.c: Likewise.
	* elf64-ia64-vms.c: Likewise.
	* elf64-mmix.c: Likewise.
	* elf64-ppc.c: Likewise.
	* elf64-s390.c: Likewise.
	* elf64-sh64.c: Likewise.
	* elf64-sparc.c: Likewise.
	* elf64-x86-64.c: Likewise.
	* elfcode.h: Likewise.
	* elfcore.h: Likewise.
	* elflink.c: Likewise.
	* elfnn-aarch64.c: Likewise.
	* elfnn-ia64.c: Likewise.
	* elfxx-mips.c: Likewise.
	* elfxx-sparc.c: Likewise.
	* elfxx-tilegx.c: Likewise.
	* ieee.c: Likewise.
	* ihex.c: Likewise.
	* libbfd.c: Likewise.
	* linker.c: Likewise.
	* m68klinux.c: Likewise.
	* mach-o.c: Likewise.
	* merge.c: Likewise.
	* mmo.c: Likewise.
	* oasys.c: Likewise.
	* pdp11.c: Likewise.
	* pe-mips.c: Likewise.
	* peXXigen.c: Likewise.
	* pei-x86_64.c: Likewise.
	* peicode.h: Likewise.
	* ppcboot.c: Likewise.
	* reloc.c: Likewise.
	* sparclinux.c: Likewise.
	* srec.c: Likewise.
	* stabs.c: Likewise.
	* vms-alpha.c: Likewise.
	* vms-lib.c: Likewise.
	* xcofflink.c: Likewise.
2016-10-19 14:37:21 +01:00
Alan Modra 4eca02287c Remove syntactic sugar
Now that _bfd_error_handler is not a function pointer.

	* aout-adobe.c: Replace (*_bfd_error_handler) (...) with
	_bfd_error_handler (...) throughout.
	* aout-cris.c, * aoutx.h, * archive.c, * bfd.c, * binary.c,
	* cache.c, * coff-alpha.c, * coff-arm.c, * coff-h8300.c,
	* coff-i860.c, * coff-mcore.c, * coff-ppc.c, * coff-rs6000.c,
	* coff-sh.c, * coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c,
	* coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c,
	* coffswap.h, * cpu-arm.c, * cpu-m68k.c, * cpu-sh.c, * dwarf2.c,
	* ecoff.c, * elf-eh-frame.c, * elf-m10300.c, * elf.c, * elf32-arc.c,
	* elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c,
	* elf32-cris.c, * elf32-crx.c, * elf32-dlx.c, * elf32-frv.c,
	* elf32-hppa.c, * elf32-i370.c, * elf32-i386.c, * elf32-lm32.c,
	* elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c,
	* elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c,
	* elf32-mips.c, * elf32-nds32.c, * elf32-nios2.c, * elf32-or1k.c,
	* elf32-pj.c, * elf32-ppc.c, * elf32-rl78.c, * elf32-s390.c,
	* elf32-score.c, * elf32-score7.c, * elf32-sh.c, * elf32-sh64.c,
	* elf32-sparc.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilepro.c,
	* elf32-v850.c, * elf32-vax.c, * elf32-xtensa.c, * elf64-alpha.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-x86-64.c, * elfcode.h, * elfcore.h, * elflink.c,
	* elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfxx-mips.c,
	* elfxx-sparc.c, * elfxx-tilegx.c, * hpux-core.c, * i386linux.c,
	* ieee.c, * ihex.c, * libbfd.c, * linker.c, * m68klinux.c,
	* mach-o.c, * merge.c, * mmo.c, * oasys.c, * osf-core.c, * pdp11.c,
	* pe-mips.c, * peXXigen.c, * pef.c, * plugin.c, * reloc.c,
	* rs6000-core.c, * sco5-core.c, * som.c, * sparclinux.c, * srec.c,
	* stabs.c, * syms.c, * vms-alpha.c, * vms-lib.c, * vms-misc.c,
	* xcofflink.c: Likewise.
2016-09-30 15:17:44 +09:30
Trevor Saunders 28cc9170c3 add casts to avoid arithmetic on void *
arithmetic on void * is undefined in ISO C, so we should avoid it.  In
GNU C sizeof void * is defined as 1, and that is pretty clearly what
this code wants, so change it to do arithmetic on bfd_byte *.
Unfortunately most of the argument types come from virtual function
interfaces so changing the types to bfd_byte * isn't trivial though it
might make the code clearer.  So for the moment its easiest to leave the
variable types as void * and cast before doing arithmetic.

bfd/ChangeLog:

2016-04-26  Trevor Saunders  <tbsaunde+binutils@tbsaunde.org>

	* elf32-rx.c (rx_set_section_contents): Avoid arithmetic on void *.
	* mmo.c (mmo_get_section_contents): Likewise.
	(mmo_set_section_contents): Likewise.
2016-04-26 20:09:57 -04:00
Nick Clifton 4f3b23b390 Add support for non-ELF targets to check their relocs.
bfd	* aout-adobe.c: Use _bfd_generic_link_check_relocs.
	* aout-target.h: Likewise.
	* aout-tic30.c: Likewise.
	* binary.c: Likewise.
	* bout.c: Likewise.
	* coff-alpha.c: Likewise.
	* coff-rs6000.c: Likewise.
	* coff64-rs6000.c: Likewise.
	* coffcode.h: Likewise.
	* i386msdos.c: Likewise.
	* i386os9k.c: Likewise.
	* ieee.c: Likewise.
	* ihex.c: Likewise.
	* libbfd-in.h: Likewise.
	* libecoff.h: Likewise.
	* mach-o-target.c: Likewise.
	* mmo.c: Likewise.
	* nlm-target.h: Likewise.
	* oasys.c: Likewise.
	* pef.c: Likewise.
	* plugin.c: Likewise.
	* ppcboot.c: Likewise.
	* som.c: Likewise.
	* srec.c: Likewise.
	* tekhex.c: Likewise.
	* versados.c: Likewise.
	* vms-alpha.c: Likewise.
	* xsym.c: Likewise.
	* elfxx-target.h: Use _bfd_elf_link_check_relocs.
	* linker.c (bfd_link_check_relocs): New function.
	(_bfd_generic_link_check_relocs): New function.
	* targets.c (BFD_JUMP_TABLE_LINK): Add initialization of
	_bfd_link_check_relocs field.
	(struct bfd_target)L Add _bfd_link_check_relocs field.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.

ld	* ldlang.c (lang_check_relocs): Use bfd_link_check_relocs in
	prefernce to _bfd_elf_link_check_relocs.  Drop test for ELF
	targets.  Do not stop the checks when problems are encountered.

include	* bfdlink.h: Add prototype for bfd_link_check_relocs.
2016-04-21 15:43:00 +01:00
Alan Modra 6f2750feaf Copyright update for binutils 2016-01-01 23:00:01 +10:30
Hans-Peter Nilsson c287bfe429 bfd/mmo.c: handle "objcopy --extract-symbols" generating and reading back.
bfd:
	* mmo.c (struct mmo_data_struct): New members
	symbol_consistency_override_calculated and ignore_symbol_consistency.
	(mmo_section_has_contents, mmo_ignore_symbol_consistency): New
	functions.
	(mmo_create_symbol): Check with mmo_ignore_symbol_consistency if to
	report an error for unexpected value of Main.
	(mmo_write_symbols_and_terminator): Similar.
2015-10-22 16:17:32 +02:00
Hans-Peter Nilsson f9c62303d8 Correct printed value of Main in mmo.c consistency error message. 2015-10-20 06:56:33 +02:00
Hans-Peter Nilsson 11509220a0 bfd/mmo.c (MMIX): Fix massive gcc LTO testsuite failures.
* mmo.c (mmo_write_symbols_and_terminator): Skip symbol-type
	assignment loop for bfd plugin objects.
2015-07-29 05:40:30 +02:00
Alan Modra b90efa5b79 ChangeLog rotatation and copyright year update 2015-01-02 00:53:45 +10:30
H.J. Lu 60bb06bc89 Use get_symbol_version_string in BFD_JUMP_TABLE_SYMBOLS
This patch adds get_symbol_version_string to BFD_JUMP_TABLE_SYMBOLS so
that we can use bfd_get_symbol_version_string in objdump for non-ELF
targets.

bfd/

	* targets.c (BFD_JUMP_TABLE_SYMBOLS): Use
	NAME##_get_symbol_version_string.
	(bfd_get_symbol_version_string): New.
	* aout-adobe.c (aout_32_get_symbol_version_string): Define using
	_bfd_nosymbols define.
	* aout-target.h (MY_get_symbol_version_string): Likewise.
	* aout-tic30.c (MY_get_symbol_version_string): Likewise.
	* binary.c (binary_get_symbol_version_string): Likewise.
	* bout.c (aout_32_get_symbol_version_string): Likewise.
	* coff-rs6000.c (_bfd_xcoff_get_symbol_version_string): Likewise.
	* i386msdos.c (msdos_get_symbol_version_string): Likewise.
	* i386os9k.c (aout_32_get_symbol_version_string): Likewise.
	* ieee.c (ieee_get_symbol_version_string): Likewise.
	* ihex.c (ihex_get_symbol_version_string): Likewise.
	* libecoff.h (_bfd_ecoff_get_symbol_version_string): Likewise.
	* mach-o-target.c (bfd_mach_o_get_symbol_version_string): Likewise.
	* mmo.c (mmo_get_symbol_version_string): Likewise.
	* nlm-target.h (nlm_get_symbol_version_string): Likewise.
	* oasys.c (oasys_get_symbol_version_string): Likewise.
	* pef.c (bfd_pef_get_symbol_version_string): Likewise.
	* plugin.c (bfd_plugin_get_symbol_version_string): Likewise.
	* ppcboot.c (ppcboot_get_symbol_version_string): Likewise.
	* som.c (som_get_symbol_version_string): Likewise.
	* srec.c (srec_get_symbol_version_string): Likewise.
	* tekhex.c (tekhex_get_symbol_version_string): Likewise.
	* versados.c (versados_get_symbol_version_string): Likewise.
	* vms-alpha.c (alpha_vms_get_symbol_version_string): Likewise.
	* xsym.c (bfd_sym_get_symbol_version_string): Likewise.

	* coff64-rs6000.c (rs6000_xcoff64_vec): Use
	coff_get_symbol_version_string.
	(rs6000_xcoff64_aix_vec): Likewise.

	* elf-bfd.h (bfd_elf_get_symbol_version_string): Renamed to ...
	(_bfd_elf_get_symbol_version_string): This.
	* elf.c: Likewise.
	(bfd_elf_print_symbol): Updated.
	* elfxx-target.h (bfd_elfNN_get_symbol_version_string): Define.

	* libbfd-in.h (_bfd_nosymbols_get_symbol_version_string): Define.
	* libcoff-in.h (coff_get_symbol_version_string): Likewise.
	* bfd-in2.h: Regenerated.
	* libbfd.h: Likewise.
	* libcoff.h: Likewise.

binutils/

	* objdump.c (objdump_print_symname): Replace
	bfd_elf_get_symbol_version_string with
	bfd_get_symbol_version_string.
2014-11-25 09:28:32 -08:00
Alan Modra 9c461f7dba Define bfd_find_line entry of BFD_JUMP_TABLE_SYMBOLS using NAME.
In https://www.sourceware.org/ml/binutils/2005-06/msg00082.html
HJ implemented bfd_find_line for DWARF2, but cheated a little in not
using the usual NAME##_find_line, saving quite a lot of boring
editing.  However that shortcut probably contributed to
bfd_find_nearest_line_discriminator being implemented the same way,
and missing support for some targets.

	* targets.c (BFD_JUMP_TABLE_SYMBOLS): Use NAME##_find_line.
	* aout-adobe.c (aout_32_find_line): Define.
	(aout_32_bfd_make_debug_symbol, aout_32_bfd_reloc_type_lookup,
	aout_32_bfd_reloc_name_lookup): Define using _bfd_nosymbols define.
	* aout-target.h (MY_find_line): Define.
	* aout-tic30.c (MY_find_line): Define.
	* binary.c (binary_find_line): Define.
	* bout.c (aout_32_find_line): Define.
	* coff-rs6000.c (_bfd_xcoff_find_line): Define.
	* coff64-rs6000.c (rs6000_xcoff64_vec): Use coff_find_line.
	(rs6000_xcoff64_aix_vec): Likewise.
	* elf-bfd.h (_bfd_generic_find_line): Don't define.
	* elfxx-target.h (bfd_elfNN_find_line): Define.
	* i386msdos.c (msdos_find_line): Define.
	* i386os9k.c (aout_32_find_line): Define.
	* ieee.c (ieee_find_nearest_line, ieee_find_inliner_info): Delete func.
	(ieee_find_nearest_line, ieee_find_line,
	ieee_find_inliner_info): Define.
	* ihex.c (ihex_find_line): Define.
	* libbfd-in.h (_bfd_nosymbols_find_line): Define.
	(_bfd_generic_find_line): Don't define.
	* libbfd.c (_bfd_generic_find_line): Delete.
	* libcoff-in.h (coff_find_line): Define.
	* libecoff.h (_bfd_ecoff_find_line): Define.
	* mach-o.h (bfd_mach_o_find_line): Define.
	* mmo.c (mmo_find_line): Define.
	* nlm-target.h (nlm_find_line): Define.
	* oasys.c (oasys_find_nearest_line, oasys_find_inliner_info): Delete.
	(oasys_find_nearest_line, oasys_find_line,
	oasys_find_inliner_info): Define.
	* pef.c (bfd_pef_find_line): Define.
	* plugin.c (bfd_plugin_find_line): Define.
	* ppcboot.c (ppcboot_find_line): Define.
	* som.c (som_find_line): Define.
	* srec.c (srec_find_line): Define.
	* tekhex.c (tekhex_find_line): Define.
	* versados.c (versados_find_line): Define.
	* vms-alpha.c (alpha_vms_find_line): Define.
	* xsym.c (bfd_sym_find_line): Define.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
	* libcoff.h: Regenerate.
2014-10-15 22:55:25 +10:30
Alan Modra caa4096e84 Don't call bfd_link_hash_table_free
Freeing the linker hash table is a royal pain.  It can't be freed
before the _bfd_write_contents call in bfd_close, because some target
bfd_write_contents functions access the hash table.  It can't be freed
after bfd_close either, since bfd_alloc memory holding side data
structures disappears (PR17047).  Clearly the only place it can be freed
is actually in bfd_close.  This patch doesn't do that, but kills off
the existing means of freeing the hash table via a bfd target xvec call.

bfd/
	PR 17047
	* targets.c (BFD_JUMP_TABLE): Delete NAME##_bfd_link_hash_table_free.
	(struct bfd_target <_bfd_link_hash_table_free>): Delete.
	* bfd.c (bfd_link_hash_table_free): Don't define.
	* aout-adobe.c, * aout-target.h, * aout-tic30.c, * binary.c, * bout.c,
	* coff64-rs6000.c, * coffcode.h, * elf-m10300.c, * elf32-arm.c,
	* elf32-avr.c, * elf32-hppa.c, * elf32-i386.c, * elf32-m68hc11.c,
	* elf32-m68hc12.c, * elf32-m68k.c, * elf32-metag.c, * elf32-nios2.c,
	* elf32-sparc.c, * elf32-xgate.c, * elf64-ia64-vms.c, * elf64-ppc.c,
	* elf64-sparc.c, * elf64-x86-64.c, * elfnn-aarch64.c, * elfnn-ia64.c,
	* elfxx-target.h, * i386msdos.c, * i386os9k.c, * ieee.c, * ihex.c,
	* libbfd-in.h, * libecoff.h, * mach-o-target.c, * mmo.c,
	* nlm-target.h, * oasys.c, * pef.c, * plugin.c, * ppcboot.c, * som.c,
	* srec.c, * tekhex.c, * verilog.c, * versados.c, * vms-alpha.c,
	* xsym.c: Don't define various link_hash_table_free defines, and
	remove from bfd_target vars.  Temporarily reference some of the
	target link_hash_table_free functions to avoid warnings.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.
ld/
	PR 17047
	* ldlang.c (output_bfd_hash_table_free_fn): Delete.
	(open_output): Don't set it..
	* ldmain.c (ld_cleanup): ..or call it.
2014-06-13 19:11:29 +09:30
Hans-Peter Nilsson 52f4ea798a mmo.c: Update URLs in documentation comments. 2014-05-08 00:48:19 +02:00
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
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 4b95cf5c0c Update copyright years 2014-03-05 22:16:15 +10:30
Nick Clifton a253d456e1 * coffcode.h: Added a cast to void when a bfd_set_section_*()
macro's return value is ignored.
	* elf32-hppa.c: Likewise.
	* elf32-tic6x.c: Likewise.
	* mach-o.c: Likewise.
	* mmo.c: Likewise.
	* opncls.c: Likewise.
	* peicode.h: Likewise.
	* elf32-m32r.c: Check return value of bfd_set_section_*().
	* elfnn-ia64.c: Likewise.
	* elfxx-mips.c: Likewise.
	* vms-alpha.c: Likewise.
2013-04-17 14:16:01 +00:00
Hans-Peter Nilsson ed905580d3 * mmo.c (mmo_write_chunk): Break out abfd->tdata.mmo_data to new
local variable mmop.
2013-04-14 14:53:01 +00:00
Alan Modra c9ba0c87bf * bfd.c (struct bfd_preserve, bfd_preserve_save, bfd_preserve_restore,
bfd_preserve_finish): Move to..
	* format.c: ..here, splitting out..
	(bfd_reinit): ..this.  New function.
	(bfd_check_format_matches): Use bfd_preserve_save/restore to
	keep bfd state for a match.
	* elfcode.h (elf_object_p): Don't use bfd_preserve_save/restore.
	* elfcore.h (elf_core_file_p): Likewise.
	* mach-o.c (bfd_mach_o_header_p): Likewise.
	* pef.c (bfd_pef_object_p, bfd_pef_xlib_object_p): Likewise.
	* xsym.c (bfd_sym_object_p): Likewise.
	* mmo.c (mmo_scan): Clear abfd->symcount.
	* opncls.c (_bfd_new_bfd): Use a smaller section hash table.
	* section.c (bfd_section_list_clear): Clear section_htab.count.
	* bfd-in2.h: Regenerate.
2013-01-26 02:08:01 +00:00
H.J. Lu 68ffbac672 Remove trailing white spaces in bfd
* aout0.c: Remove trailing white spaces.
	* archive.c: Likewise.
	* archures.c: Likewise.
	* bfd-in.h: Likewise.
	* bfd-in2.h: Likewise.
	* coff-alpha.c: Likewise.
	* coff-i860.c: Likewise.
	* coff-mips.c: Likewise.
	* coff-ppc.c: Likewise.
	* coff-tic80.c: Likewise.
	* coff-x86_64.c: Likewise.
	* coff-z80.c: Likewise.
	* coffcode.h: Likewise.
	* coffgen.c: Likewise.
	* cofflink.c: Likewise.
	* compress.c: Likewise.
	* corefile.c: Likewise.
	* cpu-arm.c: Likewise.
	* cpu-avr.c: Likewise.
	* cpu-bfin.c: Likewise.
	* cpu-cr16.c: Likewise.
	* cpu-cr16c.c: Likewise.
	* cpu-crx.c: Likewise.
	* cpu-h8300.c: Likewise.
	* cpu-i386.c: Likewise.
	* cpu-lm32.c: Likewise.
	* cpu-m68k.c: Likewise.
	* cpu-moxie.c: Likewise.
	* cpu-msp430.c: Likewise.
	* cpu-sh.c: Likewise.
	* cpu-xc16x.c: Likewise.
	* dwarf2.c: Likewise.
	* ecofflink.c: Likewise.
	* ecoffswap.h: Likewise.
	* elf-ifunc.c: Likewise.
	* elf-m10300.c: Likewise.
	* elf-vxworks.c: Likewise.
	* elf32-avr.c: Likewise.
	* elf32-avr.h: Likewise.
	* elf32-cr16.c: Likewise.
	* elf32-cr16c.c: Likewise.
	* elf32-cris.c: Likewise.
	* elf32-crx.c: Likewise.
	* elf32-frv.c: Likewise.
	* elf32-hppa.c: Likewise.
	* elf32-i860.c: Likewise.
	* elf32-ip2k.c: Likewise.
	* elf32-iq2000.c: Likewise.
	* elf32-m32c.c: Likewise.
	* elf32-m68hc1x.c: Likewise.
	* elf32-msp430.c: Likewise.
	* elf32-mt.c: Likewise.
	* elf32-ppc.c: Likewise.
	* elf32-rl78.c: Likewise.
	* elf32-s390.c: Likewise.
	* elf32-score.h: Likewise.
	* elf32-sh-symbian.c: Likewise.
	* elf32-sh.c: Likewise.
	* elf32-spu.c: Likewise.
	* elf32-tic6x.c: Likewise.
	* elf32-v850.c: Likewise.
	* elf32-xc16x.c: Likewise.
	* elf32-xtensa.c: Likewise.
	* elf64-alpha.c: Likewise.
	* elf64-hppa.c: Likewise.
	* elf64-ppc.c: Likewise.
	* elf64-s390.c: Likewise.
	* elfcore.h: Likewise.
	* elflink.c: Likewise.
	* elfxx-mips.c: Likewise.
	* elfxx-sparc.c: Likewise.
	* elfxx-tilegx.c: Likewise.
	* ieee.c: Likewise.
	* libcoff.h: Likewise.
	* libpei.h: Likewise.
	* libxcoff.h: Likewise.
	* linker.c: Likewise.
	* mach-o-i386.c: Likewise.
	* mach-o-target.c: Likewise.
	* mach-o.c: Likewise.
	* mach-o.h: Likewise.
	* mmo.c: Likewise.
	* opncls.c: Likewise.
	* pdp11.c: Likewise.
	* pe-x86_64.c: Likewise.
	* peXXigen.c: Likewise.
	* pef-traceback.h: Likewise.
	* pei-x86_64.c: Likewise.
	* peicode.h: Likewise.
	* plugin.c: Likewise.
	* reloc.c: Likewise.
	* riscix.c: Likewise.
	* section.c: Likewise.
	* som.c: Likewise.
	* syms.c: Likewise.
	* tekhex.c: Likewise.
	* ticoff.h: Likewise.
	* vaxbsd.c: Likewise.
	* xcofflink.c: Likewise.
	* xtensa-isa.c: Likewise.
2013-01-10 20:03:55 +00:00
Catherine Moore ae17ab41b7 include/ChangeLog
2011-07-11  Catherine Moore  <clm@codesourcery.com>

	* bfdlink.h (flag_type): New enumeration.
	(flag_info_list): New structure.
	(flag_info): New structure.

bfd/ChangeLog
2011-07-11  Catherine Moore  <clm@codesourcery.com>

	* aout-adobe.c (aout_32_bfd_lookup_section_flags): New definition.
	* aout-target.h (MY_bfd_lookup_section_flags): New definition.
	* aout-tic30.c (MY_bfd_lookup_section_flags): New definition.
        * bfd-in2.h: Regenerated.
	* bfd.c (bfd_lookup_section_flags): New definition.
	* binary.c (binary_bfd_lookup_section_flags): New definition.
	* bout.c (b_out_bfd_lookup_section_flags): New definition.
	* coff-alpha.c (_bfd_ecoff_bfd_lookup_section_flags): New definition.
	* coff-mips.c (_bfd_ecoff_bfd_lookup_section_flags): New definition.
	* coff-rs6000.c (rs6000coff_vec): Include
	bfd_generic_lookup_section_flags.
	(pmac_xcoff_vec): Likewise.
	* coffcode.h (coff_bfd_lookup_section_flags): New definition.
	* coff64-rs6000.c (rs6000coff64_vec): Include
	bfd_generic_lookup_section_flags.
	(aix5coff64_vec): Likewise.
	* ecoff.c (bfd_debug_section): Initialize flag_info field.
	* elf-bfd.h (elf_backend_lookup_section_flags_hook): Declare.
	(bfd_elf_lookup_section_flags): Declare.
	* elflink.c (bfd_elf_lookup_section_flags): New function.
	* elfxx-target.h (bfd_elfNN_bfd_lookup_section_flags): Define.
	(elf_backend_lookup_section_flags_hook): Define.
	(elf_backend_data): Add elf_backend_lookup_section_flags_hook.
	* i386msdos.c (msdos_bfd_lookup_section_flags): New define.
	* i386os9k.c (os9k_bfd_lookup_section_flags): New define.
	* ieee.c (ieee_bfd_lookup_section_flags): New define.
	* ihex.c (ihex_bfd_lookup_section_flags): New define.
	* libbfd-in.h (_bfd_nolink_bfd_lookup_section_flags): Declare.
	(bfd_generic_lookup_section_flags): Declare.
	* libbfd.h: Regenerated.
	* mach-o-target.c (bfd_mach_o_bfd_lookup_section_flags): New.
	* mmo.c (mmo_bfd_lookup_section_flags): New definition.
	* nlm-target.h (nlm_bfd_lookup_section_flags): New definition.
	* oasys.c (oasys_bfd_lookup_section_flags): New definition.
	* pef.c (bfd_pef_bfd_lookup_section_flags): New definition.
	* plugin.c (bfd_plugin_bfd_lookup_section_flags): New definition.
	* ppcboot.c (ppcboot_bfd_lookup_section_flags): New definition.
	* reloc.c (bfd_generic_lookup_section_flags): New function.
	* som.c (som_bfd_lookup_section_flags): New definition.
	* srec.c (srec_bfd_lookup_section_flags): New definition.
	* targets.c (flag_info): Declare.
	(NAME##_bfd_lookup_section_flags): Add to LINK jump table.
	(_bfd_lookup_section_flags): New.
	* tekhex.c (tekhex_bfd_lookup_section_flags): New definition.
	* versados.c (versados_bfd_lookup_section_flags): New definition.
	* vms-alpha.c (alpha_vms_bfd_lookup_section_flag): New definition.
	* xsym.c (bfd_sym_bfd_lookup_section_flags): New definition.

ld/ChangeLog
2011-07-11  Catherine Moore  <clm@codesourcery.com>

	* ld.h (section_flag_list): Add field to struct wildcard_spec.
	* ld.texinfo (INPUT_SECTION_FLAGS): Document.
	* ldgram.y (flag_info_list, flag_info): Add to union.
	(INPUT_SECTION_FLAGS): New token.
	(wildcard_spec): Initialize section_flag_list to NULL for
	each alternative.
	(sect_flag_list, sect_flags): New rules.
	(input_section_spec_no_keep): Add alternatives to recognize
	sect_flags.
	* ldlang.c (walk_wild_consider_section): Initialize
	section_flag_info field of the section struct.
	(lang_add_section): Check input section flags.
	(lang_add_wild): Initialize section_flag_list field of
	the statement struct.
	* ldlang.h (lang_input_statement_struct): Add section_flag_list field.
	(lang_wild_statement_struct): Likewise.
	* ldlex.l (INPUT_SECTION_FLAGS): New token.
	* mri.c (mri_draw_tree): Initialize section_flag_list to NULL.
	* NEWS: Announce INPUT_SECTION_FLAGS enhancement.

ld/testsuite/ChangeLog
2011-07-11 Catherine Moore  <clm@cm00re.com>

	* ld-scripts/section-flags-1.s: New.
	* ld-scripts/section-flags-1.t: New.
	* ld-scripts/section-flags-2.s: New.
	* ld-scripts/section-flags-2.t: New.
	* ld-scripts/section-flags.exp: New.
2011-07-11 15:03:09 +00:00
Alan Modra 0aabe54e62 * targets.c (bfd_target): Make ar_max_namelen an unsigned char.
Add match_priority.
	* configure.in: Bump bfd version.
	* elfcode.h (elf_object_p): Delete hacks preventing match of
	EM_NONE and ELFOSABI_NONE targets when a better match exists.
	* elfxx-target.h (elf_match_priority): Define and use.
	* format.c (bfd_check_format_matches): Use target match_priority
	to choose best of multiple matching targets.  In cases with multiple
	matches rerun _bfd_check_format if we don't choose the last match.
	* aout-adobe.c, * aout-arm.c, * aout-target.h, * aout-tic30.c,
	* binary.c, * bout.c, * coff-alpha.c, * coff-i386.c, * coff-i860.c,
	* coff-i960.c, * coff-ia64.c, * coff-mips.c, * coff-or32.c,
	* coff-ppc.c, * coff-rs6000.c, * coff-sh.c, * coff-tic30.c,
	* coff-tic54x.c, * coff-x86_64.c, * coff64-rs6000.c, * coffcode.h,
	* i386msdos.c, * i386os9k.c, * ieee.c, * ihex.c, * mach-o-target.c,
	* mipsbsd.c, * mmo.c, * nlm-target.h, * oasys.c, * pdp11.c,
	* pe-mips.c, * pef.c, * plugin.c, * ppcboot.c, * som.c, * srec.c,
	* tekhex.c, * trad-core.c, * verilog.c, * versados.c, * vms-alpha.c,
	* vms-lib.c, * xsym.c: Init match_priority field.
	* configure: Regenerate.
	* bfd-in2.h: Regenerate.
2011-06-06 01:26:05 +00:00
Alan Modra c7e2358a88 fix set but unused variable warnings 2010-06-27 04:07:55 +00:00
Paul Brook 1338dd10ef 2009-11-23 Paul Brook <paul@codesourcery.com>
ld/
	* ldexp.c: Copy symbol type for simple assignments.

	bfd/
	* libbfd-in.h (_bfd_generic_copy_link_hash_symbol_type): Add
	prototype.
	* elf-bfd.h (_bfd_elf_copy_link_hash_symbol_type): Add prototype.
	* linker.c (_bfd_generic_copy_link_hash_symbol_type): New function.
	* elflink.c (_bfd_elf_copy_link_hash_symbol_type): New function.
	* targets.c (BFD_JUMP_TABLE_LINK, struct bfd_target): Add
	_copy_link_hash_symbol_type.
	* bfd/coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Add
	_bfd_generic_copy_link_hash_symbol_type.
	* bfd/coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Add
	_bfd_generic_copy_link_hash_symbol_type.
	* aout-adobe.c (aout_32_bfd_copy_link_hash_symbol_type): Define.
	* aout-target.h (MY_bfd_copy_link_hash_symbol_type): Define.
	* aout-tic30.c (MY_bfd_copy_link_hash_symbol_type): Define.
	* binary.c (binary_bfd_copy_link_hash_symbol_type): Define.
	* bout.c (b_out_bfd_copy_link_hash_symbol_type): Define.
	* coffcode.h (coff_bfd_copy_link_hash_symbol_type): Define.
	* elfxx-target.h (bfd_elfNN_bfd_copy_link_hash_symbol_type): Define.
	* i386msdos.c (msdos_bfd_copy_link_hash_symbol_type): Define.
	* i386os9k.c (os9k_bfd_copy_link_hash_symbol_type): Define.
	* ieee.c (ieee_bfd_copy_link_hash_symbol_type): Define.
	* ihex.c (ihex_bfd_copy_link_hash_symbol_type): Define.
	* libecoff.h (_bfd_ecoff_bfd_copy_link_hash_symbol_type): Define.
	* mach-o.c (bfd_mach_o_bfd_copy_link_hash_symbol_type): Define.
	* mmo.c (mmo_bfd_copy_link_hash_symbol_type): Define.
	* nlm-target.h (nlm_bfd_copy_link_hash_symbol_type): Define.
	* oasys.c (oasys_bfd_copy_link_hash_symbol_type): Define.
	* pef.c (bfd_pef_bfd_copy_link_hash_symbol_type): Define.
	* ppcboot.c (ppcboot_bfd_copy_link_hash_symbol_type): Define.
	* som.c (som_bfd_copy_link_hash_symbol_type): Define.
	* srec.c (srec_bfd_copy_link_hash_symbol_type): Define.
	* tekhex.c (tekhex_bfd_copy_link_hash_symbol_type): Define.
	* versados.c (versados_bfd_copy_link_hash_symbol_type): Define.
	* vms.c (vms_bfd_copy_link_hash_symbol_type): Define.
	* xsym.c (bfd_sym_bfd_copy_link_hash_symbol_type): Define.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Regenerate.

	ld/testsuite
	* ld-arm/script-type.sym: New test.
	* ld-arm/script-type.s: New test.
	* ld-arm/script-type.s: New test.
2009-11-23 14:41:33 +00:00
Alan Modra aa820537ea update copyright dates 2009-09-02 07:25:43 +00:00
Richard Sandiford 3023e3f66a bfd/
* aout-adobe.c (aout_32_bfd_define_common_symbol): Define.
	* aout-target.h (MY_bfd_define_common_symbol): Likewise.
	* aout-tic30.c (MY_bfd_define_common_symbol): Likewise.
	* binary.c (binary_bfd_define_common_symbol): Likewise.
	* bout.c (b_out_bfd_define_common_symbol): Likewise.
	* coff-alpha.c (_bfd_ecoff_bfd_define_common_symbol): Likewise.
	* coff-mips.c (_bfd_ecoff_bfd_define_common_symbol): Likewise.
	* coffcode.h (coff_bfd_define_common_symbol): Likewise.
	* elfxx-target.h (bfd_elfNN_bfd_define_common_symbol): Likewise.
	* i386msdos.c (msdos_bfd_define_common_symbol): Likewise.
	* i386os9k.c (os9k_bfd_define_common_symbol): Likewise.
	* ieee.c (ieee_bfd_define_common_symbol): Likewise.
	* ihex.c (ihex_bfd_define_common_symbol): Likewise.
	* libbfd-in.h (_bfd_nolink_bfd_define_common_symbol): Likewise.
	* mach-o.c (bfd_mach_o_bfd_define_common_symbol): Likewise.
	* mmo.c (mmo_bfd_define_common_symbol): Likewise.
	* nlm-target.h (nlm_bfd_define_common_symbol): Likewise.
	* oasys.c (oasys_bfd_define_common_symbol): Likewise.
	* pef.c (bfd_pef_bfd_define_common_symbol): Likewise.
	* ppcboot.c (ppcboot_bfd_define_common_symbol): Likewise.
	* som.c (som_bfd_define_common_symbol): Likewise.
	* srec.c (srec_bfd_define_common_symbol): Likewise.
	* tekhex.c (tekhex_bfd_define_common_symbol): Likewise.
	* versados.c (versados_bfd_define_common_symbol): Likewise.
	* vms.c (vms_bfd_define_common_symbol): Likewise.
	* xcoff-target.h (_bfd_xcoff_bfd_define_common_symbol): Likewise.
	* xsym.c (bfd_sym_bfd_define_common_symbol): Likewise.
	* coff-rs6000.c (rs6000coff_vec): Add _bfd_xcoff_define_common_symbol.
	(pmac_xcoff_vec): Likewise.
	* coff64-rs6000.c (rs6000coff64_vec): Likewise.
	(aix5coff64_vec): Likewise.
	* linker.c (bfd_generic_define_common_symbol): New function.
	* targets.c (BFD_JUMP_TABLE_LINK): Add NAME##_bfd_define_common_symbol.
	(_bfd_define_common_symbol): New field.
	* libcoff-in.h (_bfd_xcoff_define_common_symbol): Declare.
	* xcofflink.c (_bfd_xcoff_define_common_symbol): New function.
	(xcoff_build_ldsyms): Don't set XCOFF_DEF_REGULAR for common
	symbols here.
	* bfd-in2.h: Regenerate.
	* libbfd.h: Likewise.
	* libcoff.h: Likewise.

ld/
	* ldlang.c (lang_one_common): Use bfd_define_common_symbol.

ld/testsuite/
	* ld-powerpc/aix-export-2.s, ld-powerpc/aix-export-2.nd: New test.
	* ld-powerpc/aix52.exp: Run it.
2009-04-16 23:07:00 +00:00