Commit Graph

14318 Commits

Author SHA1 Message Date
GDB Administrator bdd2279f13 Automatic date update in version.in 2018-03-08 00:00:42 +00:00
Renlin Li 0c1ded8dc0 [PR20402][LD][AARCH64]Don't emit RELATIVE relocation for absolute symbols which are resolved at static linking time.
For absolute symbols which are forced local or not dynamic, the ABS relocation
should be resolved at static linking time.

Originally, an RELATIVE/ABS relocation will be generated even for absolution
symbols for the dynamic linker to resolve.

bfd/

2018-03-07  Renlin Li  <renlin.li@arm.com>

	PR ld/20402
	* elfnn-aarch64.c (elfNN_aarch64_final_link_relocate): Check absolute symbol,
	and don't emit relocation in specific case.

ld/

2018-03-07  Renlin Li  <renlin.li@arm.com>

	PR ld/20402
	* testsuite/ld-aarch64/aarch64-elf.exp: Run new test.
	* testsuite/ld-aarch64/pr20402.s: New.
	* testsuite/ld-aarch64/pr20402.d: New.
2018-03-07 14:47:27 +00:00
Alan Modra 0118219e18 mips64 rtype_to_howto error status
* elf64-mips.c (mips_elf64_rtype_to_howto): Return NULL on error.
	(mips_elf64_slurp_one_reloc_table): Pass on error.
2018-03-07 16:56:31 +10:30
GDB Administrator 1ab3e66438 Automatic date update in version.in 2018-03-07 00:00:35 +00:00
GDB Administrator 52bc7e85d9 Automatic date update in version.in 2018-03-06 00:00:25 +00:00
GDB Administrator 5e3290e973 Automatic date update in version.in 2018-03-05 00:00:35 +00:00
GDB Administrator 72f53f22df Automatic date update in version.in 2018-03-04 00:00:48 +00:00
James Cowgill dfb93f1158 PR ld/21900: MIPS: Fix relocation processing with undefined symbols
Currently, when `mips_elf_calculate_relocation' is asked to relocate an
undefined symbol, it reports an error or a warning and immediately
returns without performing the relocation.  This is fine if the link
fails, but if unresolved_syms_in_objects == RM_GENERATE_WARNING, the
link will continue and output some unrelocated code, which is a
regression from commit e7e2196da3 ("MIPS/BFD: Correctly report
undefined relocations").

Fix this by continuing after calling the `undefined_symbol' hook unless
this is an error condition.

	bfd/
	PR ld/21900
	* elfxx-mips.c (mips_elf_calculate_relocation): Only return
	after calling `undefined_symbol' hook if this is an error
	condition.  Assume the value of 0 for the symbol requested
	otherwise.

	ld/
	PR ld/21900
	* testsuite/ld-mips-elf/undefined-warn.d: New test.
	* testsuite/ld-mips-elf/undefined.s: Add padding at the end.
	* testsuite/ld-mips-elf/mips-elf.exp: Run the new test.
2018-03-03 15:49:21 +00:00
GDB Administrator 5c1f594e58 Automatic date update in version.in 2018-03-03 00:00:25 +00:00
Jim Wilson 9a2ebffd4d Ensure 8-byte alignment for AArch64 stubs.
PR 22903
bfd	* elfnn-aarch64.c (_bfd_aarch64_resize_stubs): Add 8 bytes for branch
	and nop instead of 4.
	(elfNN_arch64_build_stubs): Add nop after branch.  Increase size by
	8 instead of 4.

ld	* emultempl/aarch64elf.em (elf${ELFSIZE}_aarch64_add_stub_section):
	Give stub_sec 8 byte alignment.
	* emulparams/aarch64cloudabi.sh (NOP): Set to 0x1f2003d5.
	* emulparams/aarch64elf.sh (NOP): Likewise.
	* emulparams/aarch64elf32.sh (NOP): Likewise.
	* emulparams/aarch64fbsd.sh (NOP): Likewise.
	* emulparams/aarch64linux.sh (NOP): Likewise.
	* emulparams/aarch64linux32.sh (NOP): Likewise.
	* testsuite/ld-aarch64/erratum835769.d: Adjust for added nop.
	* testsuite/ld-aarch64/erratum843419.d: Likewise.
	* testsuite/ld-aarch64/farcall-b-defsym.d: Likewise.
	* testsuite/ld-aarch64/farcall-b-none-function.d: Likewise.
	* testsuite/ld-aarch64/farcall-b-plt.d: Likewise.
	* testsuite/ld-aarch64/farcall-b-section.d: Likewise.
	* testsuite/ld-aarch64/farcall-b.d: Likewise.
	* testsuite/ld-aarch64/farcall-back.d: Likewise.
	* testsuite/ld-aarch64/farcall-bl-defsym.d: Likewise.
	* testsuite/ld-aarch64/farcall-bl-none-function.d: Likewise.
	* testsuite/ld-aarch64/farcall-bl-plt.d: Likewise.
	* testsuite/ld-aarch64/farcall-bl-section.d: Likewise.
	* testsuite/ld-aarch64/farcall-bl.d: Likewise.
2018-03-02 10:49:20 +00:00
GDB Administrator ed2592386c Automatic date update in version.in 2018-03-02 00:00:32 +00:00
Jim Wilson 788af978df RISC-V: Fix symbol size bug when relaxation deletes bytes.
bfd/
	PR 22756
	* elfnn-riscv.c (riscv_relax_delete_bytes): When adjust st_size, use
	else if instead of if.
2018-03-01 14:17:57 -08:00
GDB Administrator ca8e0133c4 Automatic date update in version.in 2018-03-01 00:00:38 +00:00
Alan Modra 5224fa0399 correct ft32 reloc range test
* elf32-ft32.c (ft32_info_to_howto_rela): Correct range test.
2018-03-01 09:12:50 +10:30
Nick Clifton 12c963421d Catch integer overflows/underflows when parsing corrupt DWARF FORM blocks.
PR 22895
	PR 22893
	* dwarf2.c (read_n_bytes): Replace size parameter with dwarf_block
	pointer.  Drop unused abfd parameter.  Check the size of the block
	before initialising the data field.  Return the end pointer if the
	size is invalid.
	(read_attribute_value): Adjust invocations of read_n_bytes.
2018-02-28 11:53:06 +00:00
Alan Modra 116acb2c26 PR22887, null pointer dereference in aout_32_swap_std_reloc_out
PR 22887
	* aoutx.h (swap_std_reloc_in): Correct r_index bound check.
2018-02-28 22:20:35 +10:30
Nick Clifton eef104664e Fix potential integer overflow when reading corrupt dwarf1 debug information.
PR 22894
	* dwarf1.c (parse_die): Check the length of form blocks before
	advancing the data pointer.
2018-02-28 10:13:54 +00:00
Alan Modra 0d329c0a83 Nonsense error messages on invalid aout string offset
translate_symbol_table returns false on detecting an out of range name
string offset, hooray for error checking, but doesn't set bfd_error or
print a useful error.  bfd_error therefore contains whatever it had
previously, in my testing, bfd_error_system_call.  So the error
printed depended on errno.

	PR 22887
	* aoutx.h (translate_symbol_table): Print an error message and set
	bfd_error on finding an invalid name string offset.
2018-02-28 17:25:02 +10:30
GDB Administrator 0b25598b35 Automatic date update in version.in 2018-02-28 00:00:38 +00:00
H.J. Lu f6aec96dce ld: Add --enable-separate-code
This patch adds --enable-separate-code to ld configure to turn on
-z separate-code by default and enables it by default for Linux/x86.
This avoids mixing code pages with data to improve cache performance
as well as security.

To reduce x86-64 executable and shared object sizes, the maximum page
size is reduced from 2MB to 4KB when -z separate-code is turned on by
default.  Note: -z max-page-size= can be used to set the maximum page
size.

We compared SPEC CPU 2017 performance before and after this change on
Skylake server.  There are no any significant performance changes.
Everything is mostly below +/-1%.

bfd/

	* config.in: Regenerated.
	* configure: Likewise.
	* configure.ac: Add --enable-separate-code.
	(DEFAULT_LD_Z_SEPARATE_CODE): New AC_DEFINE_UNQUOTED.  Default
	to 1 for Linux/x86 targets,
	* elf64-x86-64.c (ELF_MAXPAGESIZE): Set to 0x1000 if
	DEFAULT_LD_Z_SEPARATE_CODE is 1.

ld/

	* NEWS: Mention --enable-separate-code.
	* configure.ac: Add --enable-separate-code.
	(DEFAULT_LD_Z_SEPARATE_CODE): New AC_DEFINE_UNQUOTED.
	* configure.tgt: Default ac_default_ld_z_separate_code to 1 for
	Linux/x86 targets.
	* config.in: Regenerated.
	* configure: Likewise.
	* emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set
	link_info.separate_code DEFAULT_LD_Z_SEPARATE_CODE.
2018-02-27 11:34:29 -08:00
Nick Clifton e8f5af786c Use standardized error message for unrecognized relocs.
bfd	* aout-cris.c (swap_ext_reloc_out): Standadize error/warning
	message.
	* elf-hppa.h (elf_hppa_info_to_howto_rel): Likewise.
	* elf32-i386.c (elf_i386_reloc_type_lookup): Likewise.
	* elf32-xtensa.c (elf_xtensa_reloc_type_lookup): Likewise.
	* elf64-ppc.c (ppc64_elf_reloc_type_lookup): Likewise.
	* elf64-s390.c (elf_s390_reloc_type_lookup): Likewise.
	* elf64-sh64.c (sh_elf64_info_to_howto): Likewise.
	* elfxx-ia64.c (ia64_elf_reloc_type_lookup): Likewise.
	* elfxx-sparc.c (_bfd_sparc_elf_reloc_type_lookup): Likewise.
	* elfxx-tilegx.c (tilegx_reloc_type_lookup): Likewise.
2018-02-27 12:16:04 +00:00
Nick Clifton f3185997ac Have info_to_howto functions return a success/fail status. Check this result. Stop strip from completeing if one of these functions fails.
bfd	PR 22875
	* elf-bfd.h (struct elf_backend_data): Change the return type of
	the elf_info_to_howto and elf_info_to_howto_rel function pointers
	to bfd_boolean.
	* elfcode.h (elf_slurp_reloc_table_from_section): Check the return value from the info_to_howto function and fail if that function failed.
	* elf32-h8300.c (elf32_h8_relocate_section): Check return value from the info_to_howto function.
	(elf32_h8_relax_section): Likewise.
	* elf32-lm32.c (lm32_elf_relocate_section): Likewise.
	* elf32-m68hc1x.c (elf32_m68hc11_relocate_section): Likewise.
	* elf32-score.c (s3_bfd_score_elf_relocate_section): Likewise.
	* elf32-score7.c (s7_bfd_score_elf_relocate_section): Likewise.
	* elf32-tic6x.c (elf32_tic6x_relocate_section): Likewise.
	* elf64-ia64-vms.c (elf64_ia64_relocate_section): Likewise.
	* elf64-sparc.c (elf64_sparc_slurp_one_reloc_table): Likewise.
	* elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
	* elfnn-ia64.c (elfNN_ia64_relocate_section): Likewise.
	* elfnn-riscv.c (riscv_elf_check_relocs): Likewise.
	(riscv_elf_relocate_section): Likewise.
	* elf-hppa.h (elf_hppa_info_to_howto): Change return type to
	bfd_boolean.  Issue an error message, set an error value and
	return FALSE if the reloc is not recognized.
	(elf_hppa_info_to_howto_rel): Likewise.
	* elf-m10200.c (mn10200_info_to_howto): Likewise.
	* elf-m10300.c (mn10300_info_to_howto): Likewise.
	* elf.c (_bfd_elf_no_info_to_howto): Likewise.
	* elf32-arc.c (arc_info_to_howto_rel): Likewise.
	* elf32-arm.c (elf32_arm_info_to_howto): Likewise.
	* elf32-avr.c (avr_info_to_howto_rela): Likewise.
	* elf32-bfin.c (bfin_info_to_howto): Likewise.
	* elf32-cr16.c (elf_cr16_info_to_howto): Likewise.
	* elf32-cr16c.c (elf_cr16c_info_to_howto): Likewise.
	* elf32-cris.c (elf_cr16c_info_to_howto_rel, cris_info_to_howto_rela): Likewise.
	* elf32-crx.c (elf_crx_info_to_howto): Likewise.
	* elf32-d10v.c (d10v_info_to_howto_rel): Likewise.
	* elf32-d30v.c (d30v_info_to_howto_rel, d30v_info_to_howto_rela): Likewise.
	* elf32-dlx.c (dlx_rtype_to_howto, elf32_dlx_info_to_howto, elf32_dlx_info_to_howto_rel): Likewise.
	* elf32-epiphany.c (epiphany_info_to_howto_rela): Likewise.
	* elf32-fr30.c (fr30_info_to_howto_rela): Likewise.
	* elf32-frv.c (frv_info_to_howto_rela, 	frvfdpic_info_to_howto_rel): Likewise.
	* elf32-ft32.c (ft32_info_to_howto_rela): Likewise.
	* elf32-gen.c (elf_generic_info_to_howto, elf_generic_info_to_howto_rel): Likewise.
	* elf32-h8300.c (elf32_h8_info_to_howto, elf32_h8_info_to_howto_rel): Likewise.
	* elf32-i370.c (i370_elf_info_to_howto): Likewise.
	* elf32-i386.c (elf_i386_reloc_type_lookup, elf_i386_rtype_to_howto, elf_i386_info_to_howto_rel): Likewise.
	* elf32-i860.c (lookup_howto, elf32_i860_info_to_howto_rela): Likewise.
	* elf32-i960.c (elf32_i960_info_to_howto_rel): Likewise.
	* elf32-ip2k.c (ip2k_info_to_howto_rela): Likewise.
	* elf32-iq2000.c (iq2000_info_to_howto_rela): Likewise.
	* elf32-lm32.c (lm32_info_to_howto_rela): Likewise.
	* elf32-m32c.c (m32c_info_to_howto_rela): Likewise.
	* elf32-m32r.c (m32r_info_to_howto_rel, m32r_info_to_howto): Likewise.
	* elf32-m68hc11.c (m68hc11_info_to_howto_rel): Likewise.
	* elf32-m68hc12.c (m68hc11_info_to_howto_rel): Likewise.
	* elf32-m68k.c (rtype_to_howto): Likewise.
	* elf32-mcore.c (mcore_elf_info_to_howto): Likewise.
	* elf32-mep.c (mep_info_to_howto_rela): Likewise.
	* elf32-metag.c (metag_info_to_howto_rela): Likewise.
	* elf32-microblaze.c (microblaze_elf_info_to_howto): Likewise.
	* elf32-mips.c (mips_info_to_howto_rel, mips_info_to_howto_rela): Likewise.
	* elf32-moxie.c (moxie_info_to_howto_rela): Likewise.
	* elf32-msp430.c (msp430_info_to_howto_rela): Likewise.
	* elf32-mt.c (mt_info_to_howto_rela): Likewise.
	* elf32-nds32.c (nds32_info_to_howto_rel, nds32_info_to_howto): Likewise.
	* elf32-nios2.c (nios2_elf32_info_to_howto): Likewise.
	* elf32-or1k.c (or1k_info_to_howto_rela): Likewise.
	* elf32-pj.c (pj_elf_info_to_howto): Likewise.
	* elf32-ppc.c (ppc_elf_info_to_howto): Likewise.
	* elf32-pru.c (pru_elf32_info_to_howto): Likewise.
	* elf32-rl78.c (rl78_info_to_howto_rela): Likewise.
	* elf32-rx.c (rx_info_to_howto_rela): Likewise.
	* elf32-s390.c (elf_s390_info_to_howto): Likewise.
	* elf32-score.c (s3_bfd_score_info_to_howto, _bfd_score_info_to_howto): Likewise.
	* elf32-score7.c (s7_bfd_score_info_to_howto): Likewise.
	* elf32-sh.c (sh_elf_info_to_howto): Likewise.
	* elf32-spu.c (spu_elf_info_to_howto): Likewise.
	* elf32-tic6x.c (elf32_tic6x_info_to_howto, elf32_tic6x_info_to_howto_rel): Likewise.
	* elf32-tilepro.c (tilepro_info_to_howto_rela): Likewise.
	* elf32-v850.c (v850_elf_info_to_howto_rel, v850_elf_info_to_howto_rela, v800_elf_info_to_howto): Likewise.
	* elf32-vax.c (rtype_to_howto): Likewise.
	* elf32-visium.c (visium_info_to_howto_rela): Likewise.
	* elf32-wasm32.c (elf32_wasm32_rtype_to_howto, elf32_wasm32_info_to_howto_rela): Likewise.
	* elf32-xc16x.c (elf32_xc16x_info_to_howto): Likewise.
	* elf32-xgate.c (xgate_info_to_howto_rel): Likewise.
	* elf32-xstormy16.c (xstormy16_info_to_howto_rela): Likewise.
	* elf32-xtensa.c (elf_xtensa_info_to_howto_rela): Likewise.
	* elf64-alpha.c (elf64_alpha_info_to_howto): Likewise.
	* elf64-gen.c (elf_generic_info_to_howto, elf_generic_info_to_howto_rel): Likewise.
	* elf64-ia64-vms.c (elf64_ia64_info_to_howto): Likewise.
	* elf64-mips.c (mips_elf64_info_to_howto_rela): Likewise.
	* elf64-mmix.c (mmix_info_to_howto_rela): Likewise.
	* elf64-ppc.c (ppc64_elf_info_to_howto): Likewise.
	* elf64-s390.c (elf_s390_reloc_type_lookup): Likewise.
	* elf64-sh64.c (elf_s390_info_to_howto, sh_elf64_info_to_howto): Likewise.
	* elf64-x86-64.c (elf_x86_64_info_to_howto): Likewise.
	* elfn32-mips.c (mips_info_to_howto_rel, mips_info_to_howto_rela): Likewise.
	* elfnn-aarch64.c (elfNN_aarch64_info_to_howto): Likewise.
	* elfnn-ia64.c (elfNN_ia64_info_to_howto): Likewise.
	* elfnn-riscv.c (riscv_info_to_howto_rela): Likewise.
	* elfxx-ia64.c (ia64_elf_reloc_type_lookup): Likewise.
	* elfxx-sparc.c (_bfd_sparc_elf_info_to_howto): Likewise.
	* elfxx-tilegx.c (tilegx_info_to_howto_rela): Likewise.
	* elf32-score.h (s7_bfd_score_info_to_howto): Update prototype.
	* elfxx-sparc.h (_bfd_sparc_elf_info_to_howto): Update prototype.
	* elfxx-tilegx.h (tilegx_info_to_howto_rela): Update prototype.
	* elfxx-target.h (elf_info_to_howto, elf_info_to_howto_rel): Default to NULL.

binutils PR 22875
	* objcopy.c (copy_object): Check the error status after marking symbols used in relocations.
	* testsuite/binutils-all/strip-13.s: New test source file.
	* testsuite/binutils-all/strip-13.s: New test driver file.
	* testsuite/binutils-all/objcopy.exp: Run the new test.
2018-02-27 10:15:13 +00:00
GDB Administrator b643315dec Automatic date update in version.in 2018-02-27 00:00:26 +00:00
Jim Wilson 1f4bace8d6 ChangeLog entry for previous commit. 2018-02-26 14:09:12 -08:00
Jim Wilson 6f6372fadc IA-64: Fix linker error with --no-keep-memory.
bfd/
	PR 15904
	* elfnn-ia64.c (elfNN_ia64_relax_section): After ia64_elf_relax_brl
	call, set changed_contents and changed_relocs.  Likewise after
	successful ia64_elf_relax_br call.
2018-02-26 14:05:13 -08:00
Alan Modra 6838f2bed6 Segfault on phdrs allocated but not created
A number of ARM tests show results like:
ld-new: no address assigned to the veneers output section .gnu.sgstubs
ld-new: can not size stub section: invalid operation
ld-new: warning: cannot find entry symbol _start; defaulting to 0000000000010074
ld-new: tmpdir/cmse-veneers-no-gnu_sgstubs: warning: allocated section `.text' not in segment
Segmentation fault
PASS: Secure gateway veneers: no .gnu.sgstubs section

The PASS despite the segv shows the danger of using "#..." to match
error output.  This patch doesn't try to fix the testuite, but does
prevent the segfault.

	* elf.c (assign_file_positions_except_relocs): Don't segfault
	when actual number of phdrs is less than allocated.  Delete
	outdated comment.  Formatting.
2018-02-26 10:51:12 +10:30
GDB Administrator 128a19de3d Automatic date update in version.in 2018-02-26 00:00:31 +00: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 6e05870c97 BFD messages
bfd/
	* archive.c, * bfd.c, * linker.c, * reloc.c, * stabs.c,
	* syms.c: Standardize error/warning messages.
binutils/
	* testsuite/binutils-all/mips/mips-reginfo-n32.d,
	* testsuite/binutils-all/mips/mips-reginfo.d: Update.
gas/
	* testsuite/gas/mips/reginfo-2.l: Update.
ld/
	* testsuite/ld-arm/cmse-implib-errors.out,
	* testsuite/ld-arm/cmse-new-earlier-later-implib.out,
	* testsuite/ld-arm/cmse-new-implib-not-sg-in-implib.out,
	* testsuite/ld-arm/cmse-new-wrong-implib.out,
	* testsuite/ld-arm/cmse-veneers-no-gnu_sgstubs.out,
	* testsuite/ld-arm/cmse-veneers-wrong-entryfct.out,
	* testsuite/ld-cris/badgotr1.d,
	* testsuite/ld-cris/tls-err-24.d,
	* testsuite/ld-cris/tls-err-25.d,
	* testsuite/ld-cris/tls-err-26.d,
	* testsuite/ld-cris/tls-err-27.d,
	* testsuite/ld-cris/tls-err-28.d,
	* testsuite/ld-cris/tls-err-40.d,
	* testsuite/ld-cris/tls-err-44.d,
	* testsuite/ld-cris/tls-err-48.d,
	* testsuite/ld-cris/tls-err-52.d,
	* testsuite/ld-cris/tls-err-53.d,
	* testsuite/ld-cris/tls-err-55.d,
	* testsuite/ld-cris/tls-err-56.d,
	* testsuite/ld-cris/tls-err-62.d,
	* testsuite/ld-cris/tls-err-65.d,
	* testsuite/ld-cris/tls-err-77.d,
	* testsuite/ld-elf/empty-implib.out,
	* testsuite/ld-elf/indirect.exp: Update.
2018-02-26 09:33:15 +10:30
Alan Modra 59d08d6ce8 AOUT/COFF/PE messages
Capitalization, full-stops and unnecessary trailing \n fixes.

	* aout-adobe.c, * aout-cris.c, * i386linux.c, * m68klinux.c,
	* sparclinux.c, * coff-alpha.c, * coff-arm.c, * coff-mcore.c,
	* coffcode.h, * coffgen.c, * cofflink.c, * ecoff.c, * pe-mips.c,
	* peXXigen.c, * peicode.h: Standardize error/warning messages.
2018-02-26 09:32:35 +10:30
Alan Modra 90b6238f06 ARM and AArch64 messages
More standarization of error/warning messages.  The ARM backend has
some multi-line error messages, which don't fit particularly well with
the GNU coding standard insistence that error messages shouldn't be
capitalized or have a full-stop.  I've replaced the line breaks with
semicolons.

So for instance the following
  system/path/to/ld: myobject.o: invalid special symbol `foo'.
  system/path/to/ld: It must be a global or weak function symbol.
becomes
  system/path/to/ld: myobject.o: invalid special symbol `foo'; it must be a global or weak function symbol

bfd/
	* elf32-arm.c, * elfnn-aarch64.c: Standardize error/warning messages.
ld/
	* testsuite/ld-aarch64/reloc-overflow-bad.d,
	* testsuite/ld-arm/attr-merge-9.out,
	* testsuite/ld-arm/attr-merge-arch-2.d,
	* testsuite/ld-arm/attr-merge-unknown-1.d,
	* testsuite/ld-arm/attr-merge-unknown-2.d,
	* testsuite/ld-arm/attr-merge-unknown-2r.d,
	* testsuite/ld-arm/attr-merge-unknown-3.d,
	* testsuite/ld-arm/cmse-implib-errors.out,
	* testsuite/ld-arm/cmse-new-earlier-later-implib.out,
	* testsuite/ld-arm/cmse-new-implib-no-output.out,
	* testsuite/ld-arm/cmse-new-implib-not-sg-in-implib.out,
	* testsuite/ld-arm/cmse-new-implib.out,
	* testsuite/ld-arm/cmse-new-wrong-implib.out,
	* testsuite/ld-arm/cmse-veneers-no-gnu_sgstubs.out,
	* testsuite/ld-arm/cmse-veneers-wrong-entryfct.out,
	* testsuite/ld-arm/group-relocs-alu-bad-2.d,
	* testsuite/ld-arm/group-relocs-alu-bad.d,
	* testsuite/ld-arm/group-relocs-ldc-bad-2.d,
	* testsuite/ld-arm/group-relocs-ldc-bad.d,
	* testsuite/ld-arm/group-relocs-ldr-bad-2.d,
	* testsuite/ld-arm/group-relocs-ldr-bad.d,
	* testsuite/ld-arm/group-relocs-ldrs-bad-2.d,
	* testsuite/ld-arm/group-relocs-ldrs-bad.d,
	* testsuite/ld-arm/stm32l4xx-cannot-fix-far-ldm.d: Update.
2018-02-26 09:31:52 +10:30
Alan Modra 2c1c967956 MIPS messages
More standardization of messages.

bfd/
	* elfxx-mips.c: Standardize error/warning messages.
binutils/
	* testsuite/binutils-all/mips/mips-reginfo-n32.d,
	* testsuite/binutils-all/mips/mips-reginfo.d: Update.
gas/
	* testsuite/gas/mips/reginfo-2.l: Update.
ld/
	* testsuite/ld-mips-elf/attr-gnu-4-12.d,
	* testsuite/ld-mips-elf/attr-gnu-4-13.d,
	* testsuite/ld-mips-elf/attr-gnu-4-14.d,
	* testsuite/ld-mips-elf/attr-gnu-4-16.d,
	* testsuite/ld-mips-elf/attr-gnu-4-17.d,
	* testsuite/ld-mips-elf/attr-gnu-4-18.d,
	* testsuite/ld-mips-elf/attr-gnu-4-19.d,
	* testsuite/ld-mips-elf/attr-gnu-4-21.d,
	* testsuite/ld-mips-elf/attr-gnu-4-23.d,
	* testsuite/ld-mips-elf/attr-gnu-4-24.d,
	* testsuite/ld-mips-elf/attr-gnu-4-25.d,
	* testsuite/ld-mips-elf/attr-gnu-4-26.d,
	* testsuite/ld-mips-elf/attr-gnu-4-27.d,
	* testsuite/ld-mips-elf/attr-gnu-4-28.d,
	* testsuite/ld-mips-elf/attr-gnu-4-29.d,
	* testsuite/ld-mips-elf/attr-gnu-4-31.d,
	* testsuite/ld-mips-elf/attr-gnu-4-32.d,
	* testsuite/ld-mips-elf/attr-gnu-4-34.d,
	* testsuite/ld-mips-elf/attr-gnu-4-35.d,
	* testsuite/ld-mips-elf/attr-gnu-4-36.d,
	* testsuite/ld-mips-elf/attr-gnu-4-37.d,
	* testsuite/ld-mips-elf/attr-gnu-4-38.d,
	* testsuite/ld-mips-elf/attr-gnu-4-39.d,
	* testsuite/ld-mips-elf/attr-gnu-4-41.d,
	* testsuite/ld-mips-elf/attr-gnu-4-42.d,
	* testsuite/ld-mips-elf/attr-gnu-4-43.d,
	* testsuite/ld-mips-elf/attr-gnu-4-45.d,
	* testsuite/ld-mips-elf/attr-gnu-4-46.d,
	* testsuite/ld-mips-elf/attr-gnu-4-47.d,
	* testsuite/ld-mips-elf/attr-gnu-4-48.d,
	* testsuite/ld-mips-elf/attr-gnu-4-49.d,
	* testsuite/ld-mips-elf/attr-gnu-4-52.d,
	* testsuite/ld-mips-elf/attr-gnu-4-53.d,
	* testsuite/ld-mips-elf/attr-gnu-4-54.d,
	* testsuite/ld-mips-elf/attr-gnu-4-58.d,
	* testsuite/ld-mips-elf/attr-gnu-4-59.d,
	* testsuite/ld-mips-elf/attr-gnu-4-61.d,
	* testsuite/ld-mips-elf/attr-gnu-4-62.d,
	* testsuite/ld-mips-elf/attr-gnu-4-63.d,
	* testsuite/ld-mips-elf/attr-gnu-4-64.d,
	* testsuite/ld-mips-elf/attr-gnu-4-68.d,
	* testsuite/ld-mips-elf/attr-gnu-4-69.d,
	* testsuite/ld-mips-elf/attr-gnu-4-71.d,
	* testsuite/ld-mips-elf/attr-gnu-4-72.d,
	* testsuite/ld-mips-elf/attr-gnu-4-73.d,
	* testsuite/ld-mips-elf/attr-gnu-4-74.d,
	* testsuite/ld-mips-elf/attr-gnu-4-78.d,
	* testsuite/ld-mips-elf/attr-gnu-4-79.d,
	* testsuite/ld-mips-elf/attr-gnu-4-81.d,
	* testsuite/ld-mips-elf/attr-gnu-4-89.d,
	* testsuite/ld-mips-elf/attr-gnu-8-12.d,
	* testsuite/ld-mips-elf/attr-gnu-8-21.d,
	* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n32.d,
	* testsuite/ld-mips-elf/bal-jalx-pic-micromips-n64.d,
	* testsuite/ld-mips-elf/bal-jalx-pic-micromips.d,
	* testsuite/ld-mips-elf/bal-jalx-pic-n32.d,
	* testsuite/ld-mips-elf/bal-jalx-pic-n64.d,
	* testsuite/ld-mips-elf/bal-jalx-pic.d,
	* testsuite/ld-mips-elf/mode-change-error-1.d,
	* testsuite/ld-mips-elf/unaligned-branch-2.d,
	* testsuite/ld-mips-elf/unaligned-branch-ignore-2.d,
	* testsuite/ld-mips-elf/unaligned-branch-ignore-micromips.d,
	* testsuite/ld-mips-elf/unaligned-branch-ignore-mips16.d,
	* testsuite/ld-mips-elf/unaligned-branch-ignore-r6-1.d,
	* testsuite/ld-mips-elf/unaligned-branch-micromips.d,
	* testsuite/ld-mips-elf/unaligned-branch-mips16.d,
	* testsuite/ld-mips-elf/unaligned-branch-r6-1.d,
	* testsuite/ld-mips-elf/unaligned-branch-r6-2.d,
	* testsuite/ld-mips-elf/unaligned-branch.d,
	* testsuite/ld-mips-elf/unaligned-jalx-1.d,
	* testsuite/ld-mips-elf/unaligned-jalx-3.d,
	* testsuite/ld-mips-elf/unaligned-jalx-addend-1.d,
	* testsuite/ld-mips-elf/unaligned-jalx-addend-3.d,
	* testsuite/ld-mips-elf/unaligned-jalx-addend-micromips-1.d,
	* testsuite/ld-mips-elf/unaligned-jalx-addend-mips16-1.d,
	* testsuite/ld-mips-elf/unaligned-jalx-micromips-1.d,
	* testsuite/ld-mips-elf/unaligned-jalx-mips16-1.d,
	* testsuite/ld-mips-elf/unaligned-jump-micromips.d,
	* testsuite/ld-mips-elf/unaligned-jump-mips16.d,
	* testsuite/ld-mips-elf/unaligned-jump.d: Update.
2018-02-26 09:31:04 +10:30
Alan Modra 9793eb7792 ELF linker messages
This fixes a number of cases where we capitalized error messages or
printed a full-stop, and corrects "Dwarf" to "DWARF".

bfd/
	* dwarf2.c, * elf-attrs.c, * elf-eh-frame.c, * elf.c, * elf32-gen.c,
	* elflink.c: Standardize error/warning messages.  Replace use of
	linker callback einfo with _bfd_error_handler when possible.
ld/
	* testsuite/ld-elf/indirect.exp,
	* testsuite/ld-elf/pr22649-2ab-mips.msg,
	* testsuite/ld-elf/pr22649-2cd-mips.msg,
	* testsuite/ld-elf/pr22649.msg,
	* testsuite/ld-elf/tls_common.exp,
	* testsuite/ld-elfcomm/elfcomm.exp,
	* testsuite/ld-arm/attr-merge-incompatible.d,
	* testsuite/ld-tic6x/attr-compatibility-gnu-other.d,
	* testsuite/ld-tic6x/attr-compatibility-other-gnu.d,
	* testsuite/ld-tic6x/attr-compatibility-other-other.d,
	* testsuite/ld-i386/warn1.d: Update expected error/warning messages.
2018-02-26 09:29:15 +10:30
Alan Modra 0aa13feeeb unrecognized/unsupported reloc message
It must get boring translating all the variants we have of
unrecognized/unsupported/invalid/unexpected reloc number.  This patch
cuts down on the number of variations.

	* aoutx.h, * coff-alpha.c, * coff-i860.c, * coff-m68k.c,
	* coff-mcore.c, * coff-ppc.c, * coff-rs6000.c, * coff-sh.c,
	* coff-tic4x.c, * coff-tic54x.c, * coff-tic80.c, * coff-w65.c,
	* elf-bfd.h, * elf-m10300.c, * elf.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-i370.c, * elf32-i386.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-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-or1k.c,
	* elf32-pj.c, * elf32-ppc.c, * elf32-rl78.c, * elf32-rx.c,
	* elf32-s390.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c,
	* elf32-v850.c, * elf32-vax.c, * elf32-visium.c, * elf32-wasm32.c,
	* elf32-xgate.c, * elf32-xtensa.c, * elf64-alpha.c,
	* elf64-ia64-vms.c, * elf64-mips.c, * elf64-mmix.c,
	* elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c,
	* elfn32-mips.c, * elfnn-aarch64.c, * elfnn-ia64.c,
	* elfnn-riscv.c, * elfxx-mips.c, * elfxx-riscv.c, * elfxx-riscv.h,
	* elfxx-sparc.c, * elfxx-sparc.h, * reloc.c: Standardize
	unrecognized/unsupported reloc message.
2018-02-26 09:28:27 +10:30
Alan Modra cf97bcb0c3 PPC error/warning messages
The GNU coding standard says error messages should be of the form
  program:sourcefile:lineno: message
or
  program: message

and
"The string message should not begin with a capital letter when it
follows a program name and/or file name, because that isn’t the
beginning of a sentence. (The sentence conceptually starts at the
beginning of the line.) Also, it should not end with a period."

This patch does that for ppc, and removes some British spelling.
I've also switched some error output from using the linker callback
einfo to _bfd_error_handler, due to improved compilation time
argument checking now done for the latter function.

bfd/
	* elf32-ppc.c: Standardize error/warning messages.  Use
	_bfd_error_handler rather than einfo when einfo features not used.
	* elf64-ppc.c: Likewise.
ld/
	* testsuite/ld-powerpc/attr-gnu-12-21.d: Update.
	* testsuite/ld-powerpc/attr-gnu-4-12.d: Update.
	* testsuite/ld-powerpc/attr-gnu-4-13.d: Update.
	* testsuite/ld-powerpc/attr-gnu-4-21.d: Update.
	* testsuite/ld-powerpc/attr-gnu-4-23.d: Update.
	* testsuite/ld-powerpc/attr-gnu-4-31.d: Update.
	* testsuite/ld-powerpc/attr-gnu-4-32.d: Update.
	* testsuite/ld-powerpc/attr-gnu-8-23.d: Update.
2018-02-26 09:27:36 +10:30
GDB Administrator 4de41a68ed Automatic date update in version.in 2018-02-25 00:00:59 +00:00
GDB Administrator d4333bab0a Automatic date update in version.in 2018-02-24 00:00:28 +00:00
Alan Modra 01f7e10cf2 PR22881, null pointer dereference in assign_file_positions_for_non_load_sections
PR 22881
	* elf.c (assign_file_positions_for_non_load_sections): Remove RELRO
	segment if no matching LOAD segment.
2018-02-23 21:40:48 +10:30
Kuan-Lin Chen e859f6558c nds32: Support target directive .ict_model. 2018-02-23 14:27:13 +08:00
Kuan-Lin Chen 9c70c5223b Fix up one ChangeLog date. 2018-02-23 14:26:24 +08:00
GDB Administrator 5bce538d6a Automatic date update in version.in 2018-02-23 00:00:35 +00:00
GDB Administrator f4a69c9aea Automatic date update in version.in 2018-02-22 00:00:27 +00:00
GDB Administrator 50a98a5b43 Automatic date update in version.in 2018-02-21 00:00:29 +00:00
Jason Duerstock 6e8d06db1a Enable link time garbage collection support for the IA64 target.
As suggested in long ago in a galaxy far, far away [1], I tried
turning it on and it seems to work, as is evidenced by the Mesa
package in Debian/ia64.  Please enable it with the following patch.
[1] https://sourceware.org/ml/binutils/2007-07/msg00241.html

bfd	* elfnn-ia64.c (elf_backend_can_gc_sections): Enable.
2018-02-20 13:21:55 +00:00
GDB Administrator afec267feb Automatic date update in version.in 2018-02-20 00:00:30 +00:00
Maciej W. Rozycki b248d650a4 Revert "_bfd_mips_elf_final_link: Notify user about wrong .reginfo size"
Revert commit 58807c48a5 ("_bfd_mips_elf_final_link: Notify user about
wrong .reginfo size") now that the size of the `.reginfo' section has
been truly fixed in `_bfd_mips_elf_section_processing', meaning that the
offending condition can be asserted again.

	bfd/
	Revert
	2018-01-12  Vlad Ivanov  <vlad@ivanov.email>

	* elfxx-mips.c (_bfd_mips_elf_final_link): Notify user when
	.reginfo section has wrong size.
2018-02-19 18:38:41 +00:00
Maciej W. Rozycki 6798f8bfa6 MIPS/BFD: Fix the size of `.reginfo' and `.MIPS.abiflags' sections
Use the SEC_FIXED_SIZE flag to actually fix the size of `.reginfo' and
`.MIPS.abiflags' sections in `_bfd_mips_elf_always_size_sections', as
originally intended, removing link failures such as:

ld: final link failed: Section has no contents

or:

ld: final link failed: Bad value

or:

ld: foo: .reginfo section size should be 24 bytes, actual size is 32

and assertion failures like:

ld: BFD (GNU Binutils) 2.30.51.20180131 assertion fail .../bfd/elfxx-mips.c:14322

in link scenarios involving a linker script that either creates an
output `.reginfo' or `.MIPS.abiflags' section from scratch or produces
either section from different sections.  If such an output section's
size turns out to be incorrect according to the psABI, then the section
is either truncated or padded out to the correct size, as relevant.

This allows people to handle these sections in a link in an unusual way,
while still addressing the issue covered by commit 58807c48a5
("_bfd_mips_elf_final_link: Notify user about wrong .reginfo size").

The original arrangement, coming from an unindentified change made to
what was called `mips_elf_always_size_sections' back then, between
commit 02650bd0a9 ("This adds ABI flags to MIPS/ELF object files.")
and commit 252b5132c7 ("19990502 sourceware import"), also missing
from BFD ChangeLog files, assumed that the output section size is not
going to change after return from `bfd_elf_size_dynamic_sections', the
caller of that function, called in turn from `ldemul_before_allocation'
via `gld${EMULATION_NAME}_before_allocation' in ld/emultempl/elf32.em,
and ultimately from `lang_process'.  This is because later on in
`lang_process' processing `lang_size_sections' is called , happily
recalculating the section size, and it has actually already been the
case at the time of commit 252b5132c7 ("19990502 sourceware import"),
so the assumption was clearly incorrect right from the beginning.

	bfd/
	* elfxx-mips.c (_bfd_mips_elf_always_size_sections): Set
	SEC_FIXED_SIZE and SEC_HAS_CONTENTS flags for `.reginfo' and
	`.MIPS.abiflags' sections.
	(_bfd_mips_elf_final_link): Avoid reading beyond `.reginfo'
	section's end.

	ld/
	* testsuite/ld-mips-elf/reginfo-0.d: New test.
	* testsuite/ld-mips-elf/reginfo-0r.d: New test.
	* testsuite/ld-mips-elf/reginfo-1.d: New test.
	* testsuite/ld-mips-elf/reginfo-1r.d: New test.
	* testsuite/ld-mips-elf/reginfo-2.d: New test.
	* testsuite/ld-mips-elf/reginfo-2r.d: New test.
	* testsuite/ld-mips-elf/mips-abiflags-0.d: New test.
	* testsuite/ld-mips-elf/mips-abiflags-0r.d: New test.
	* testsuite/ld-mips-elf/mips-abiflags-1.d: New test.
	* testsuite/ld-mips-elf/mips-abiflags-1r.d: New test.
	* testsuite/ld-mips-elf/mips-abiflags-2.d: New test.
	* testsuite/ld-mips-elf/mips-abiflags-2r.d: New test.
	* testsuite/ld-mips-elf/reginfo-0.ld: New test linker script.
	* testsuite/ld-mips-elf/reginfo-1.ld: New test linker script.
	* testsuite/ld-mips-elf/mips-abiflags-0.ld: New test linker
	script.
	* testsuite/ld-mips-elf/mips-abiflags-1.ld: New test linker
	script.
	* testsuite/ld-mips-elf/reginfo-1.s: New test source.
	* testsuite/ld-mips-elf/reginfo-2.s: New test source.
	* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2018-02-19 18:38:41 +00:00
Maciej W. Rozycki 8772de117d LD: Support fixed-size sections some psABIs may require
Define a SEC_FIXED_SIZE section flag for target backends to use for
output sections whose size has been fixed in the psABI.  The size of
such sections will not be changed anyhow by the generic linker and it is
up to the target backend to get their size right.

	bfd/
	* section.c (SEC_FIXED_SIZE): New macro.
	* bfd-in2.h: Regenerate.

	ld/
	* ldlang.c (insert_pad): Do not change output section's size if
	SEC_FIXED_SIZE is set in the flags.
	(size_input_section): Likewise.
	(lang_size_sections_1): Likewise.
	(lang_reset_memory_regions): Likewise.
2018-02-19 18:38:41 +00:00
Maciej W. Rozycki 4f7fd351a7 BFD: Remove unused SEC_HAS_GOT_REF section flag
Remove the SEC_HAS_GOT_REF section flag no longer in use since commit
a252afa4cd ("Fix linking of PIC code on PA"),
<https://sourceware.org/ml/binutils/2003-08/msg00467.html>, to make the
bit position available for reuse.

	bfd/
	* section.c (SEC_HAS_GOT_REF): Remove macro.
	* bfd-in2.h: Regenerate.
2018-02-19 18:38:41 +00:00
Alan Modra f2b740ac53 Add attribute printf to _bfd_error_handler
and fix a few stray errors.

	* elf-attrs.c (_bfd_elf_parse_attributes): Correct _bfd_error_handler
	arguments.
	* elfxx-mips.c (_bfd_mips_elf_final_link): Likewise.
	* elfnn-riscv.c (_bfd_riscv_relax_align): Likewise.
	(_bfd_riscv_relax_pc): Likewise and fix typos.
	* libbfd-in.h (_bfd_error_handler): Add attribute printf.
	* libbfd.h: Regenerate.
2018-02-19 23:55:55 +10:30