platform/upstream/binutils.git
9 years agoAutomatic date update in version.in
GDB Administrator [Sun, 23 Nov 2014 00:00:59 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Sat, 22 Nov 2014 00:00:56 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoAutomatic date update in version.in
GDB Administrator [Fri, 21 Nov 2014 00:00:52 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoPPC gold doesn't check for overflow properly
Alan Modra [Thu, 20 Nov 2014 21:45:04 +0000 (08:15 +1030)]
PPC gold doesn't check for overflow properly

* powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
for undefined weaks.

9 years agoPPC gold doesn't check for overflow properly
Alan Modra [Thu, 20 Nov 2014 08:31:23 +0000 (19:01 +1030)]
PPC gold doesn't check for overflow properly

Corrects overflow test for rel14, addr14, rel24, addr24 branch relocs,
and prints an information message to give a hint as to how a branch
that can't reach a stub might be cured.

bfd/
* elf64-ppc.c (group_sections): Init stub14_group_size from
--stub-group-size parameter divided by 1024.
gold/
* powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
from --stub-group-size parameter divided by 1024.
(Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
template parameter.  Update all uses.
(Target_powerpc::Relocate::relocate): Rename has_plt_value to
has_stub_value.  Set for long branches.  Don't report overflow for
branch to undefined weak symbols.  Print info message on
overflowing branch to stub.

9 years agoppc476 workaround sizing
Alan Modra [Thu, 20 Nov 2014 10:37:58 +0000 (21:07 +1030)]
ppc476 workaround sizing

* elf32-ppc.c (ppc_elf_relax_section): Correct ppc476 workaround
alignment calculation.

9 years agoAutomatic date update in version.in
GDB Administrator [Thu, 20 Nov 2014 00:00:47 +0000 (00:00 +0000)]
Automatic date update in version.in

9 years agoDefault powerpc64 to --plt-thread-safe for Go
Alan Modra [Wed, 19 Nov 2014 22:22:46 +0000 (08:52 +1030)]
Default powerpc64 to --plt-thread-safe for Go

Go is multi-threaded, so use thread-safe plt stubs.  __go_go doesn't
actually start threads, but is a convenient libgo function with a
reasonably unique name that is called by all Go executables.  (Threads
are started by a static function of libgo, runtime_newosproc, called
by a whole lot of global functions, including runtime_starttheworld
and runtime_main.)

bfd/
* elf64-ppc.c (ppc64_elf_size_stubs): Add __go_go to thread_starters.
gold/
* powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.

9 years agodaily update
Alan Modra [Wed, 19 Nov 2014 00:00:16 +0000 (10:30 +1030)]
daily update

9 years agoAlways run mpx3 and mpx4 tests in 64-bit
H.J. Lu [Tue, 18 Nov 2014 13:55:32 +0000 (05:55 -0800)]
Always run mpx3 and mpx4 tests in 64-bit

* ld-x86-64/mpx.exp: Always run mpx3 and mpx4 tests in 64-bit.

9 years agoAdd -z bndplt to generate BND prefix in PLT entries
Igor Zamyatin [Tue, 18 Nov 2014 07:52:36 +0000 (10:52 +0300)]
Add -z bndplt to generate BND prefix in PLT entries

This patch adds "-z bndplt" option Linux/x86-64 linker to generate BND
prefix in PLT entries.  It also updated Linux/x86-64 assembler not to
generate R_X86_64_PLT32_BND nor R_X86_64_PC32_BND relocations.

bfd/

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

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

gas/

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

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

include/

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

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

ld/

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

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

ld/testsuite/

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

* ld-x86-64/bnd-ifunc-1.d: Add bndplt option.
* ld-x86-64/bnd-ifunc-2.d: Likewise.
* ld-x86-64/bnd-plt-1.d: Likewise.  Update dissassembly sections.
* ld-x86-64/mpx.exp: Handle mpx3 and mpx4 tests.
* ld-x86-64/mpx1a.rd: Remove _BND from relocation name.
* ld-x86-64/mpx1c.rd: Likewise.
* ld-x86-64/mpx2a.rd: Likewise.
* ld-x86-64/mpx2c.rd: Likewise.
* ld-x86-64/mpx3.dd: New file.
* ld-x86-64/mpx3a.s: Likewise.
* ld-x86-64/mpx3b.s: Likewise.
* ld-x86-64/mpx4.dd: Likewise.
* ld-x86-64/mpx4a.s: Likewise.
* ld-x86-64/mpx4b.s: Likewise.

9 years ago[AArch64] Add xgene2.
Philipp Tomsich [Tue, 18 Nov 2014 11:24:14 +0000 (11:24 +0000)]
[AArch64] Add xgene2.

Conflicts:
gas/doc/c-aarch64.texi

9 years ago[AArch64] Add xgene1.
Philipp Tomsich [Tue, 18 Nov 2014 11:19:05 +0000 (11:19 +0000)]
[AArch64] Add xgene1.

The name xgene1 superceeds xgene-1.  We retain support for the
original xgene-1 for compatibility but drop it from documentation.

Conflicts:
gas/config/tc-aarch64.c

9 years ago[AArch64] Enable CRC feature in GAS for cortex-a53 and cortex-a57.
Marcus Shawcroft [Tue, 18 Nov 2014 14:00:56 +0000 (14:00 +0000)]
[AArch64] Enable CRC feature in GAS for cortex-a53 and cortex-a57.

9 years agoRevert "[AArch64] Enable CRC feature in GAS for cortex-a53 and cortex-a57."
Marcus Shawcroft [Tue, 18 Nov 2014 13:59:37 +0000 (13:59 +0000)]
Revert "[AArch64] Enable CRC feature in GAS for cortex-a53 and cortex-a57."

This reverts commit 9224a67a27a5adb4524a5d9b730045205ec04e9a.

9 years agodaily update
Alan Modra [Tue, 18 Nov 2014 00:00:21 +0000 (10:30 +1030)]
daily update

9 years agoMerge branch 'binutils-2_25-branch' of ssh://sourceware.org/git/binutils-gdb into...
Nick Clifton [Mon, 17 Nov 2014 17:04:16 +0000 (17:04 +0000)]
Merge branch 'binutils-2_25-branch' of ssh://sourceware.org/git/binutils-gdb into binutils-2_25-branch

Conflicts:
gas/ChangeLog

9 years agoApplies a series of patches for PR 17512 and 17533 which fix invalid memory accesses.
Nick Clifton [Mon, 17 Nov 2014 16:59:09 +0000 (16:59 +0000)]
Applies a series of patches for PR 17512 and 17533 which fix invalid memory accesses.

2014-11-13  Nick Clifton  <nickc@redhat.com>

PR binutils/17512
* config/obj-coff.c (coff_obj_symbol_new_hook): Set the is_sym
field.

2014-11-14  Nick Clifton  <nickc@redhat.com>

PR binutils/17512
* dwarf.c (get_encoded_value): Add an 'end' parameter.  Change the
'data' parameter to a double pointer and return the updated value.
(decode_location_expression): Update call to get_encoded_value.
(frame_need_space): Handle the case where one or both of the
mallocs fails.
(read_cie): Initialise the cie pointer, even if the read fails.
(display_debug_frames): Warn if the calculated block_end is before
the start of the block.  Break the loop if the CIE could not be
read.  Update call to get_encoded_value.  Warn if the read CFA
expressions are too big.

2014-11-13  Nick Clifton  <nickc@redhat.com>

PR binutils/17531
* readelf.c (process_version_sections): If the read of the version
def information fails, make sure that the external verdef data is
not used.
(get_dynamic_data): Do not attempt to allocate memory for more
dynamic data than there is in the file.  If the read fails, free
the allocated buffer.
(process_symbol_table): Do not print dynamic information if we
were unable to read the dynamic symbol table.
(print_gnu_note): Do not print the note if the descsz is too
small.

2014-11-12  Nick Clifton  <nickc@redhat.com>

PR binutils/17512
* dwarf.c (read_and_display_attr_value): Check that we do not read
past end.
(display_debug_pubnames_worker): Add range checks.
(process_debug_info): Check for invalid pointer sizes.
(display_loc_list): Likewise.
(display_loc_list_dwo): Likewise.
(display_debug_ranges): Likewise.
(display_debug_aranges): Check for invalid address size.
(read_cie): Add range checks.  Replace call strchr with while loop.
* objdump.c (dump_dwarf): Replace abort with a warning message.
(print_section_stabs): Improve range checks.
* rdcoff.c (coff_get_slot): Use long for indx parameter type.
Add check for an excesively large index.
* rddbg.c (read_section_stabs_debugging_info): Zero terminate the
string table.  Avoid walking off the end of the stabs data.
* stabs.c (parse_stab_string): Add check for a NULL name.

2014-11-11  Nick Clifton  <nickc@redhat.com>

PR binutils/17531
* binutils/readelf.c (dynamic_nent): Change type to size_t.
(slurp_rela_relocs): Use size_t type for nrelas.
(slurp_rel_relocs): Likewise.
(get_program_headers): Improve out of memory error message.
(get_32bit_section_headers): Likewise.
(get_32bit_section_headers): Likewise.
(get_64bit_section_headers): Likewise.
(get_32bit_elf_symbols): Likewise.
(get_64bit_elf_symbols): Likewise.
(process_section_groups): Likewise.
(get_32bit_dynamic_section): Likewise.
(get_64bit_dynamic_section): Likewise.
(process_dynamic_section): Likewise.
(process_version_sections): Likewise.
(get_symbol_index_type): Likewise.
(process_mips_specific): Likewise.
(process_corefile_note_segment): Likewise.
(process_version_sections): Use size_t type for total.
(get_dynamic_data): Change type of number parameter to size_t.
Improve out of memory error messages.
(process_symbol_table): Change type of nbuckets and nchains to
size_t.  Skip processing of sections headers if there are none.
Improve out of memory error messages.

2014-11-11  Nick Clifton  <nickc@redhat.com>

PR binutils/17531
* readelf.c (display_arm_attribute): Avoid reading off the end of
the buffer when processing a Tag_nodefaults.

2014-11-10  Nick Clifton  <nickc@redhat.com>

PR binutils/17531
* readelf.c (ia64_process_unwind): Replace assertion with an error
message.  Add range checking for group section indicies.
(hppa_process_unwind): Replace assertion with an error message.
(process_syminfo): Likewise.
(decode_arm_unwind_bytecode): Add range checking.
(dump_section_as_strings): Add more string range checking.
(display_tag_value): Likewise.
(display_arm_attribute): Likewise.
(display_gnu_attribute): Likewise.
(display_tic6x_attribute): Likewise.
(display_msp430x_attribute): Likewise.

2014-11-10  Nick Clifton  <nickc@redhat.com>

PR binutils/17552
* objcopy.c (copy_archive): Clean up temporary files even if an
error occurs.

2014-11-07  Nick Clifton  <nickc@redhat.com>

PR binutils/17531
* readelf.c (get_data): Avoid allocating memory when we know that
the read will fail.
(find_section_by_type): New function.
(get_unwind_section_word): Check for invalid symbol indicies.
Check for invalid reloc types.
(get_32bit_dynamic_section): Add range checks.
(get_64bit_dynamic_section): Add range checks.
(process_dynamic_section): Check for a corrupt time value.
(process_symbol_table): Add range checks.
(dump_section_as_strings): Add string length range checks.
(display_tag_value): Likewise.
(display_arm_attribute): Likewise.
(display_gnu_attribute): Likewise.
(display_tic6x_attribute): Likewise.
(display_msp430x_attribute): Likewise.
(process_mips_specific): Add range check.

2014-11-06  Nick Clifton  <nickc@redhat.com>

PR binutils/17552, binutils/17533
* bucomm.c (is_valid_archive_path): New function.  Returns false
for absolute pathnames and pathnames that include /../.
* bucomm.h (is_valid_archive_path): Add prototype.
* ar.c (extract_file): Use new function to check for valid
pathnames when extracting files from an archive.
* objcopy.c (copy_archive): Likewise.
* doc/binutils.texi: Update documentation to mention the
limitation on pathname of archive members.

2014-11-05  Nick Clifton  <nickc@redhat.com>

PR binutils/17531
* readelf.c (printable_section_name): New function.
(printable_section_name_from_index): New function.
(dump_relocations): Use new function.
(process_program_headers, get_32bit_elf_symbols,
(get_64bit_elf_symbols, process_section_headers,
(process_section_groups, process_relocs, ia64_process_unwind,
(hppa_process_unwind, get_unwind_section_word, decode_arm_unwind,
(arm_process_unwind, process_version_sections,
(process_symbol_table, apply_relocations, get_section_contents,
(dump_section_as_strings, dump_section_as_bytes,
(display_debug_section, process_attributes, process_mips_specific,
(process_mips_specific process_gnu_liblist): Likewise.
(get_unwind_section_word): Check for a missing symbol table.
Replace aborts with error messages.
(arm_process_unwind): Check for a missing string table.
(process_attributes): Check for an attribute length that is too
small.
(process_mips_specific): Check for a corrupt GOT symbol offset.

2014-11-05  Nick Clifton  <nickc@redhat.com>

PR binutils/17533
* bucomm.c (is_valid_archive_path): New function.
* bucomm.h (is_valid_archive_path): Prototype it.
* ar.c (extract_file): Call is_valid_archive_path to verify a
member filename before extracting it.
* objcopy.c (copy_archive): Likewise.

2014-11-04  Nick Clifton  <nickc@redhat.com>

PR binutils/17531
* readelf.c (get_data): If the reason parameter is null, do not
print any error messages.
(get_32bit_section_headers): Verify section header entry size
before reading in the section headers.
(get_64bit_section_headers): Likewise.
(process_section_headers): Pass FALSE to get_section_headers.
(get_file_header): Pass TRUE to get_section_headers.
(process_dynamic_section): Change an assert to an error message.
(process_symbol_table): Handle corrupt histograms.
(get_32bit_program_headers): Verify program header entry size
before reading in the program headers.
(get_64bit_program_headers): Likewise.
(get_unwind_section_word): Do nothing if no section was provided.
Fail if the offset is outside of the section.
(print_dynamic_symbol): Catch out of range symbol indicies.
(process_mips_specific): Likewise.
(process_attributes): Make sure that there is enough space left in
the section before attempting to read the length of the next
attribute.

2014-11-03  Nick Clifton  <nickc@redhat.com>

PR binutils/17512
* objdump.c (slurp_symtab): Fail gracefully if the table could not
be read.
(dump_relocs_in_section): Likewise.

2014-11-14  Nick Clifton  <nickc@redhat.com>

PR binutils/17597
* opncls.c (bfd_get_debug_link_info): Avoid reading off the end of
the section.
(bfd_get_alt_debug_link_info): Likewise.

2014-11-14  Nick Clifton  <nickc@redhat.com>

PR binutils/17512
* ieee.c (ieee_archive_p) Skip processing if no bytes are read at
all.
(ieee_object_p): Likewise.

2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>

* coffcode.h (coff_slurp_line_table): Add cast to unsigned int.

2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>

* coffcode.h (coff_pointerize_aux_hook): Fix a typo.

2014-11-13  Nick Clifton  <nickc@redhat.com>

PR binutils/17512
* coffcode.h (coff_ptr_struct): Add is_sym field.
(coff_new_section_hook): Set the is_sym field.
(coff_pointerize_aux_hook): Check the is_sym field.
(coff_print_aux): Likewise.
(coff_compute_section_file_positions): Likewise.
(coff_write_object_contents): Likewise.
(coff_slurp_line_table): Likewise.
(coff_slurp_symbol_table): Likewise.
(CALC_ADDEND): Likewise.
* coffgen.c (coff_renumber_symbols): Likewise.
(coff_mangle_symbols): Likewise.
(coff_fix_symbol_name): Likewise.
(coff_write_symbol): Likewise.
(coff_write_alien_symbol): Likewise.
(coff_write_native_symbol): Likewise.
(coff_write_symbols): Likewise.
(coff_write_linenumbers): Likewise.
(coff_pointerize_aux): Likewise.
(coff_get_normalized_symtab): Likewise.
(coff_get_symbol_info): Likewise.
(bfd_coff_get_syment): Likewise.
(bfd_coff_get_auxent): Likewise.
(coff_print_symbol): Likewise.
(coff_find_nearest_line_with_names): Likewise.
(bfd_coff_set_symbol_class): Likewise.
(coff_make_empty_symbol): Set the is_sym field.
(coff_bfd_make_debug_symbol): Likewise.
* peicode.h (pe_ILF_make_a_symbol): Likewise.
* libcoff.h: Regenerate.
* libcoff-in.h: Regenerate.

2014-11-12  Nick Clifton  <nickc@redhat.com>

PR binutils/17512
* coffcode.h (coff_slurp_line_table): Set the line number of
corrupt entries to -1.
(coff_slurp_symbol_table): Alway initialise the value of the
symbol.
* coffgen.c (coff_print_symbol): Check that the combined pointer
is valid.
(coff_print_symbol): Do not print negative line numbers.
* peXXigen.c (pe_print_idata): Add range checking displaying
member names.

2014-11-12  Alan Modra  <amodra@gmail.com>

PR binutils/17512
* coffcode.h (coff_slurp_line_table): Drop line number info
not preceded by a valid function entry.  Revert last change.

2014-11-11  Nick Clifton  <nickc@redhat.com>

PR binutils/17512
* coffcode.h (coff_slurp_line_table): Initialise the parts of the
line number cache that would not be initialised by the copy from
the new line number table.
(coff_classify_symbol): Allow for _bfd_coff_internal_syment_name
returning NULL.
* coffgen.c (coff_get_normalized_symbols): Get the external
symbols before allocating space for the internal symbols, in case
the get fails.
* elf.c (_bfd_elf_slurp_version_tables): Only allocate a verref
array if one is needed.  Likewise with the verdef array.
* peXXigen.c (_bfd_XXi_swap_sym_in): Replace abort()'s with error
messages.
(_bfd_XXi_swap_aux_in): Make sure that all fields of the aux
structure are initialised.
(pe_print_edata): Avoid reading off the end of the data buffer.

2014-11-11  Alan Modra  <amodra@gmail.com>

PR binutils/17512
* coffcode.h (coff_slurp_line_table): Use updated lineno_count
when building func_table.

2014-11-11  Alan Modra  <amodra@gmail.com>

PR binutils/17512
* coffcode.h (coff_slurp_line_table): Don't bfd_zalloc, just
memset the particular bits we need.  Update src after hitting loop
"continue".  Don't count lineno omitted due to invalid symbols in
nbr_func, and update lineno_count.  Init entire terminating
lineno.  Don't both allocating terminator in n_lineno_cache.
Redirect sym->lineno pointer to where n_lineno_cache will be
copied, and free n_lineno_cache.
* pe-mips.c (NUM_HOWTOS): Typo fix.

2014-11-10  Nick Clifton  <nickc@redhat.com>

PR binutils/17521
* coff-i386.c (NUM_HOWTOS): New define.
(RTYPE2HOWTO): Use it.
(coff_i386_rtype_to_howto): Likewise.
(coff_i386_reloc_name_lookup): Likewise.
(CALC_ADDEND): Check that reloc r_type field is valid.
* coff-x86_64.c (NUM_HOWTOS): New define.
(RTYPE2HOWTO): Use it.
(coff_amd64_rtype_to_howto): Likewise.
(coff_amd64_reloc_name_lookup): Likewise.
(CALC_ADDEND): Check that reloc r_type field is valid.
* coffcode.h (coff_slurp_line_table): Check for symbol table
indexing underflow.
(coff_slurp_symbol_table): Use zalloc to ensure that all table
entries are initialised.
* coffgen.c (_bfd_coff_read_string_table): Initialise unused bits
in the string table.  Also ensure that the table is 0 terminated.
(coff_get_normalized_symtab): Check for symbol table indexing
underflow.
* opncls.c (bfd_alloc): Catch the case where a small negative size
can result in only 1 byte being allocated.
(bfd_alloc2): Use bfd_alloc.
* pe-mips.c (NUM_HOWTOS): New define.
(coff_mips_reloc_name_lookup): Use it.
(CALC_ADDEND): Check that reloc r_type field is valid.
* peXXigen.c (_bfd_XXi_swap_aouthdr_in): Initialise unused entries
in the DataDirectory.
(pe_print_idata): Avoid reading beyond the end of the data block
wen printing strings.
(pe_print_edata): Likewise.
Check for table indexing underflow.
* peicode.h (pe_mkobject): Initialise the pe_opthdr field.
(pe_bfd_object_p): Allocate and initialize enough space to hold a
PEAOUTHDR, even if the opt_hdr field specified less.

2014-11-08  Alan Modra  <amodra@gmail.com>

* peXXigen.c (pe_print_idata): Revert last patch, cast lhs instead.

2014-11-07  H.J. Lu  <hongjiu.lu@intel.com>

* peXXigen.c (pe_print_idata): Cast to unsigned long in range
checks.

2014-11-07  Alan Modra  <amodra@gmail.com>

* tekhex.c (tekhex_set_arch_mach): Ignore unknown arch errors.

2014-11-07  Alan Modra  <amodra@gmail.com>

* tekhex.c (CHUNK_SPAN): Define.
(struct data_struct <chunk_init>): Use one byte per span, update
all code accessing this field.
(find_chunk): Add create param, don't create new entry unless set.
(insert_byte): Don't save zeros.
(first_phase): Set section SEC_CODE or SEC_DATA flag depending
on symbol type.  Create an alternate section if both types of
symbol are given.  Attach type '2' and '6' symbols to absolute
section.
(move_section_contents): Fix caching of chunk.  Don't create chunk
when reading, or for writing zeros.
(tekhex_set_section_contents): Don't create initial chunks.
(tekhex_write_object_contents): Use CHUNK_SPAN.

2014-11-07  Alan Modra  <amodra@gmail.com>

* aoutx.h (aout_get_external_symbols): Tidy allocation of symbol buffer.

2014-11-07  Alan Modra  <amodra@gmail.com>

* archive.c (_bfd_slurp_extended_name_table): Revert bfd_get_size check.
* coffcode.h (coff_set_alignment_hook): Likewise.
(coff_slurp_line_table): Likewise.
* coffgen.c (coff_get_normalized_symtab): Likewise.
(_bfd_coff_get_external_symbols): Likewise.
* elf.c (bfd_elf_get_str_section): Likewise.
* tekhex.c (first_phase): Likewise.

2014-11-06  Nick Clifton  <nickc@redhat.com>

* aoutx.h (slurp_symbol_table): Revert previous delta.
(slurp_reloc_table): Likewise.
* compress.c (bfd_get_full_section_contents): Remove file size
test.
* coffgen.c (coff_get_normalized_symtab): Allow zero-sized symtabs
and do not complain about linker generated files.

2014-11-04  Nick Clifton  <nickc@redhat.com>

PR binutils/17512
* coffcode.h (handle_COMDAT): Replace abort with BFD_ASSERT.
Replace another abort with an error message.
(coff_slurp_line_table): Add more range checking.
* peXXigen.c (pe_print_debugdata): Add range checking.

2014-11-05  Nick Clifton  <nickc@redhat.com>

PR binutils/17512
* coffcode.h (coff_set_alignment_hook): Warn if the file lies
about the number of relocations it contains.
(coff_sort_func_alent): Return 0 if the pointers are NULL.
(coff_slurp_line_table): Add more range checks.  Do not free new
tables created when sorting line numbers.
* peXXigen.c (pe_print_idata): Add range checks.
(pe_print_edata): Likewise.
(rsrc_print_resource_entries): Likewise.  Avoid printing control
characters.  Terminate priniting if corruption is detected.
(rsrc_print_resource_directory): Terminate printing if an unknown
directory type is encountered.
(pe_print_debugdata): Fix off-by-one error.
(rsrc_count_entries): Add range checking.
(rsrc_parse_entry): Likewise.

2014-11-04  Nick Clifton  <nickc@redhat.com>

PR binutils/17512
* compress.c (bfd_get_full_section_contents): Improve test for
linker created objects.

PR binutils/17533
* archive.c (_bfd_slurp_extended_name_table): Handle archives with
corrupt extended name tables.

2014-11-03  Nick Clifton  <nickc@redhat.com>

PR binutils/17512
* aoutx.h (slurp_symbol_table): Check that computed table size is
not bigger than the file from which is it being read.
(slurp_reloc_table): Likewise.
* coffcode.h (coff_slurp_line_table): Remove unneeded local
'warned'.  Do not try to print the details of a symbol with an
invalid index.
* coffgen.c (make_a_sectiobn_from_file): Check computed string
index against length of string table.
(bfd_coff_internal_syment_name): Check read in string offset
against length of string table.
(build_debug_section): Return a pointer to the section used.
(_bfd_coff_read_string_table): Store the length of the string
table in the coff_tdata structure.
(bfd_coff_free_symbols): Set the length of the string table to
zero when it is freed.
(coff_get_normalized_symtab): Check offsets against string table
or data table lengths as appropriate.
* cofflink.c (_bfd_coff_link_input_bfd): Check offset against
length of string table.
* compress.c (bfd_get_full_section_contents): Check computed size
against the size of the file.
* libcoff-in.h (obj_coff_strings_len): Define.
(struct coff_tdata): Add strings_len field.
* libcoff.h: Regenerate.
* peXXigen.c (pe_print_debugdata): Do not attempt to print the
data if the debug section is too small.
* xcofflink.c (xcoff_link_input_bfd):  Check offset against
length of string table.

2014-10-31  Nick Clifton  <nickc@redhat.com>

PR binutils/17512
* coffgen.c (_bfd_coff_get_external_symbols): Do not try to load a
symbol table bigger than the file.
* elf.c (bfd_elf_get_str_section): Do not try to load a string
table bigger than the file.
* tekhex.c (first_phase): Check that the section range is sane.

9 years agoAdd AVX512VBMI instructions
Ilya Tocar [Mon, 17 Nov 2014 12:41:32 +0000 (15:41 +0300)]
Add AVX512VBMI instructions

gas/

* config/tc-i386.c (cpu_arch): Add .avx512vbmi.
* doc/c-i386.texi: Document it.

opcodes/

* i386-dis-evex.c (evex_table): Add vpermi2b, vpermt2b, vpermb,
vpmultishiftqb.
* i386-dis.c (PREFIX enum): Add PREFIX_EVEX_0F3883, EVEX_W_0F3883_P_2.
* i386-gen.c (cpu_flag_init): Add CPU_AVX512VBMI_FLAGS.
(cpu_flags): Add CpuAVX512VBMI.
* i386-opc.h (enum): Add CpuAVX512VBMI.
(i386_cpu_flags): Add cpuavx512vbmi.
* i386-opc.tbl: Add vpmadd52luq, vpmultishiftqb, vpermb, vpermi2b,
vpermt2b.
* i386-init.h: Regenerated.
* i386-tbl.h: Likewise.

/gas/testsuite/

* gas/i386/i386.exp: Run new tests.
* gas/i386/avx512vbmi-intel.d: New file.
* gas/i386/avx512vbmi.d: Likewise.
* gas/i386/avx512vbmi.s: Likewise.
* gas/i386/avx512vbmi_vl-intel.d: Likewise.
* gas/i386/avx512vbmi_vl.d: Likewise.
* gas/i386/avx512vbmi_vl.s: Likewise.
* gas/i386/x86-64-avx512vbmi-intel.d: Likewise.
* gas/i386/x86-64-avx512vbmi.d: Likewise.
* gas/i386/x86-64-avx512vbmi.s: Likewise.
* gas/i386/x86-64-avx512vbmi_vl-intel.d: Likewise.
* gas/i386/x86-64-avx512vbmi_vl.d: Likewise.
* gas/i386/x86-64-avx512vbmi_vl.s: Likewise.

9 years agoAdd AVX512IFMA instructions
Ilya Tocar [Mon, 17 Nov 2014 11:57:33 +0000 (14:57 +0300)]
Add AVX512IFMA instructions

gas/

* config/tc-i386.c (cpu_arch): Add .avx512ifma.
* doc/c-i386.texi: Document it.

opcodes/

* i386-dis-evex.c (evex_table): Add vpmadd52luq, vpmadd52huq.
* i386-dis.c (PREFIX enum): Add PREFIX_EVEX_0F38B4,
PREFIX_EVEX_0F38B5.
* i386-gen.c (cpu_flag_init): Add CPU_AVX512IFMA_FLAGS.
(cpu_flags): Add CpuAVX512IFMA.
* i386-opc.h (enum): Add CpuAVX512IFMA.
(i386_cpu_flags): Add cpuavx512ifma.
* i386-opc.tbl: Add vpmadd52huq, vpmadd52luq.
* i386-init.h: Regenerated.
* i386-tbl.h: Likewise.

/gas/testsuite/

* gas/i386/i386.exp: Run new tests.
* gas/i386/avx512ifma-intel.d: New file.
* gas/i386/avx512ifma.d: Likewise.
* gas/i386/avx512ifma.s: Likewise.
* gas/i386/avx512ifma_vl-intel.d: Likewise.
* gas/i386/avx512ifma_vl.d: Likewise.
* gas/i386/avx512ifma_vl.s: Likewise.
* gas/i386/x86-64-avx512ifma-intel.d: Likewise.
* gas/i386/x86-64-avx512ifma.d: Likewise.
* gas/i386/x86-64-avx512ifma.s: Likewise.
* gas/i386/x86-64-avx512ifma_vl-intel.d: Likewise.
* gas/i386/x86-64-avx512ifma_vl.d: Likewise.
* gas/i386/x86-64-avx512ifma_vl.s: Likewise.

9 years agoAdd pcommit instruction
Ilya Tocar [Mon, 17 Nov 2014 11:49:47 +0000 (14:49 +0300)]
Add pcommit instruction

gas/

* config/tc-i386.c (cpu_arch): Add .pcommit.
* doc/c-i386.texi: Document it.

/opcodes

* i386-dis.c (PREFIX enum): Add PREFIX_RM_0_0FAE_REG_7.
(prefix_table): Add pcommit.
* i386-gen.c (cpu_flag_init): Add CPU_PCOMMIT_FLAGS.
(cpu_flags): Add CpuPCOMMIT.
* i386-opc.h (enum): Add CpuPCOMMIT.
(i386_cpu_flags): Add cpupcommit.
* i386-opc.tbl: Add pcommit.
* i386-init.h: Regenerated.
* i386-tbl.h: Likewise.

/gas/testsuite/

* gas/i386/i386.exp: Run new tests.
* gas/i386/pcommit-intel.d: New file.
* gas/i386/pcommit.d: Likewise.
* gas/i386/pcommit.s: Likewise.
* gas/i386/x86-64-pcommit-intel.d: Likewise.
* gas/i386/x86-64-pcommit.d: Likewise.
* gas/i386/x86-64-pcommit.s: Likewise.

9 years agoAdd clwb instruction
Ilya Tocar [Mon, 17 Nov 2014 11:19:41 +0000 (14:19 +0300)]
Add clwb instruction

gas/

* config/tc-i386.c (cpu_arch): Add .clwb.
* doc/c-i386.texi: Document it.

opcodes/
* i386-dis.c (PREFIX enum): Add PREFIX_0FAE_REG_6.
(prefix_table): Add clwb.
* i386-gen.c (cpu_flag_init): Add CPU_CLWB_FLAGS.
(cpu_flags): Add CpuCLWB.
* i386-opc.h (enum): Add CpuCLWB.
(i386_cpu_flags): Add cpuclwb.
* i386-opc.tbl: Add clwb.
* i386-init.h: Regenerated.
* i386-tbl.h: Likewise.

gas/testsuite/

* gas/i386/i386.exp: Run new tests.
* gas/i386/clwb-intel.d: New file.
* gas/i386/clwb.d: Likewise.
* gas/i386/clwb.s: Likewise.
* gas/i386/x86-64-clwb-intel.d: Likewise.
* gas/i386/x86-64-clwb.d: Likewise.
* gas/i386/x86-64-clwb.s: Likewise.

9 years agodaily update
Alan Modra [Mon, 17 Nov 2014 00:00:26 +0000 (10:30 +1030)]
daily update

9 years agoCorrect x86 assembler manual
H.J. Lu [Fri, 14 Nov 2014 16:31:37 +0000 (08:31 -0800)]
Correct x86 assembler manual

* config/tc-i386.c (cpu_arch): Re-arrange avx512* and xsave*
items.

* doc/c-i386.texi: Re-arrange avx512* and xsave*.  Add
clflushopt and se1.  Remove duplicated entries.

9 years ago[AArch64] Enable CRC feature in GAS for cortex-a53 and cortex-a57.
Marcus Shawcroft [Fri, 14 Nov 2014 12:52:17 +0000 (12:52 +0000)]
[AArch64] Enable CRC feature in GAS for cortex-a53 and cortex-a57.

Conflicts:
gas/config/tc-aarch64.c

9 years agoFix x86 non-ELF build breakage
Alan Modra [Wed, 12 Nov 2014 04:24:23 +0000 (14:54 +1030)]
Fix x86 non-ELF build breakage

PR ld/17482
* config/tc-i386.c (output_insn): Don't test x86_elf_abi when
not ELF.

9 years agodaily update
Alan Modra [Tue, 11 Nov 2014 23:00:29 +0000 (09:30 +1030)]
daily update

9 years agoUpdate French and Ukranian translations with new one supplied by the Translation...
Nick Clifton [Tue, 11 Nov 2014 16:59:06 +0000 (16:59 +0000)]
Update French and Ukranian translations with new one supplied by the Translation Project.

* po/fr.po: Updated French translation.

* po/uk.po: Updated Ukranian translation.

9 years agold -r abort in _bfd_elf_write_section_eh_frame
Alan Modra [Tue, 11 Nov 2014 09:43:03 +0000 (20:13 +1030)]
ld -r abort in _bfd_elf_write_section_eh_frame

Turning on .eh_frame processing for ld -r resulted in systemtap
tickling a ld bug.  Triggered by the zero terminator not being added
to .eh_frame in a separate file as it usually is (crtend.o), but
instead being present in the last .eh_frame section along with CIEs
and FDEs.  The 4-byte terminator makes the section size check fail
on 64-bit targets.

* elf-eh-frame (_bfd_elf_write_section_eh_frame): Adjust section
size check to account for possible zero terminator.

9 years agodaily update
Alan Modra [Mon, 10 Nov 2014 23:00:13 +0000 (09:30 +1030)]
daily update

9 years agoUpdate .MIPS.abiflags to support MIPS R6
Matthew Fortune [Tue, 4 Nov 2014 23:37:28 +0000 (23:37 +0000)]
Update .MIPS.abiflags to support MIPS R6

Backport from trunk.

bfd/

* elfxx-mips.c (update_mips_abiflags_isa): Add E_MIPS_ARCH_32R6
and E_MIPS_ARCH_64R6 support.

ld/testsuite/

* ld-mips-elf/abiflags-strip10-ph.d: New file.
* ld-mips-elf/mips-eld.exp: Run the new test.

gas/

* config/tc-mips.c (mips_elf_final_processing): Add INSN_ISA32R6
and INSN_ISA64R6 support.

gas/testsuite/

* gas/mips/elf_arch_mips32r6.d: New file.
* gas/mips/elf_arch_mips64r6.d: New file.
* gas/mips/mips.exp: Run the new tests.

9 years agodaily update
Alan Modra [Sun, 9 Nov 2014 23:00:12 +0000 (09:30 +1030)]
daily update

9 years agodaily update
Alan Modra [Sat, 8 Nov 2014 23:00:12 +0000 (09:30 +1030)]
daily update

9 years agodaily update
Alan Modra [Fri, 7 Nov 2014 23:00:34 +0000 (09:30 +1030)]
daily update

9 years agoX32: Add REX prefix to encode R_X86_64_GOTTPOFF
H.J. Lu [Fri, 7 Nov 2014 20:22:53 +0000 (12:22 -0800)]
X32: Add REX prefix to encode R_X86_64_GOTTPOFF

Structions with R_X86_64_GOTTPOFF relocation must be encoded with REX
prefix even if it isn't required by destination register.  Otherwise
linker can't safely perform IE -> LE optimization.

bfd/

PR ld/17482
* elf64-x86-64.c (elf_x86_64_relocate_section): Update comments
for IE->LE transition.

gas/

PR ld/17482
* config/tc-i386.c (output_insn): Add a dummy REX_OPCODE prefix
for structions with R_X86_64_GOTTPOFF relocation for x32 if needed.

gas/testsuite/

PR ld/17482
* gas/i386/ilp32/x32-tls.d: New file.
* gas/i386/ilp32/x32-tls.s: Likewise.

ld/testsuite/

PR ld/17482
* ld-x86-64/tlsie4.dd: Updated.

9 years agodaily update
Alan Modra [Thu, 6 Nov 2014 23:00:32 +0000 (09:30 +1030)]
daily update

9 years agodaily update
Alan Modra [Wed, 5 Nov 2014 23:00:28 +0000 (09:30 +1030)]
daily update

9 years agodaily update
Alan Modra [Tue, 4 Nov 2014 23:00:33 +0000 (09:30 +1030)]
daily update

9 years agoSet development to false.
Tristan Gingold [Tue, 4 Nov 2014 11:06:05 +0000 (12:06 +0100)]
Set development to false.

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

* development.sh: Set development to false.

9 years agodaily update
Alan Modra [Mon, 3 Nov 2014 23:00:13 +0000 (09:30 +1030)]
daily update

9 years agoImport updated translations provided by the Translation Project:
Nick Clifton [Mon, 3 Nov 2014 12:33:35 +0000 (12:33 +0000)]
Import updated translations provided by the Translation Project:

       bfd, binutils, gprof, opcodes:
        * po/fi.po: Updated Finnish translation.

        binutils:
        * po/sv.po: Updated Swedish translation.

        gprof:
        * po/hu.po: New Hungarian translation.

9 years agoFixes a snafu checking the size of a 20-bit immediate.
Nick Clifton [Mon, 3 Nov 2014 11:17:45 +0000 (11:17 +0000)]
Fixes a snafu checking the size of a 20-bit immediate.

* config/tc-msp430.c (msp430_srcoperand): Fix range test for
20-bit values.

9 years agodaily update
Alan Modra [Sun, 2 Nov 2014 23:00:27 +0000 (09:30 +1030)]
daily update

9 years agodaily update
Alan Modra [Sat, 1 Nov 2014 23:00:13 +0000 (09:30 +1030)]
daily update

9 years agodaily update
Alan Modra [Fri, 31 Oct 2014 23:00:13 +0000 (09:30 +1030)]
daily update

9 years agoImport a patch from the mainline to fix a seg-fault in the BFD library:
Nick Clifton [Fri, 31 Oct 2014 10:24:58 +0000 (10:24 +0000)]
Import a patch from the mainline to fix a seg-fault in the BFD library:

PR binutils/17512
* ihex.c (ihex_scan): Fix typo in invocation of ihex_bad_byte.
* coffgen.c (coff_get_normalized_symtab): Prevent buffer overrun.

9 years agoImport a security patch from the mainline which changes the default behaviour
Nick Clifton [Fri, 31 Oct 2014 10:21:57 +0000 (10:21 +0000)]
Import a security patch from the mainline which changes the default behaviour
of the strings program to be --all rather then --data.  This avoids using the
BFD library by default, and so avoids exposing strings to any memory bugs
present in BFD.

* strings.c: Add new command line option --data to only scan the
initialized, loadable data secions of binaries.  Choose the
default behaviour of --all or --data based upon a configure
option.
* doc/binutils.texi (strings): Update documentation.  Include
description  of why the --data option might be unsafe.
* configure.ac: Add new option --disable-default-strings-all which
restores the old behaviour of strings using --data by default.  If
the option is not used make strings use --all by default.
* NEWS: Mention the new behaviour of strings.
* configure: Regenerate.
* config.in: Regenerate.

9 years agodaily update
Alan Modra [Thu, 30 Oct 2014 23:00:13 +0000 (09:30 +1030)]
daily update

9 years agoRemove the artificial limit on code alignment through the use of the
Dr Philipp Tomsich [Thu, 30 Oct 2014 10:51:04 +0000 (10:51 +0000)]
Remove the artificial limit on code alignment through the use of the
fixed part of a fragment for output generation only, which required
MAX_MEM_FOR_RS_ALIGN_CODE to be large enough to hold the maximum pad.

* config/tc-aarch64.h (MAX_MEM_FOR_RS_ALIGN_CODE): Define to 7.
* config/tc-aarch64.c (aarch64_handle_align): Rewrite to handle
large alignments with a constant fragment size of
MAX_MEM_FOR_RS_ALIGN_CODE.

9 years ago Fix error message strings so that they can be translated properly.
Nick Clifton [Thu, 30 Oct 2014 09:56:52 +0000 (09:56 +0000)]
 Fix error message strings so that they can be translated properly.

* readelf.c (CHECK_ENTSIZE_VALUES): Rewrite error message so that
there is a single string for translation.
(dynamic_section_mips_val): Likewise.

9 years agoFix a memory leak in the recent patch to detect loops in ELF section
Nick Clifton [Thu, 30 Oct 2014 09:37:45 +0000 (09:37 +0000)]
Fix a memory leak in the recent patch to detect loops in ELF section
string indicies.

* elf.c (bfd_section_from_shdr): Fix heap use after free memory
leak.

9 years agodaily update
Alan Modra [Wed, 29 Oct 2014 23:00:20 +0000 (09:30 +1030)]
daily update

9 years agoUpdated and New translations from the Translation Project.
Nick Clifton [Wed, 29 Oct 2014 16:37:32 +0000 (16:37 +0000)]
Updated and New translations from the Translation Project.

9 years agodaily update
Alan Modra [Tue, 28 Oct 2014 23:00:37 +0000 (09:30 +1030)]
daily update

9 years agoFixes another couple of memory errors reading corrupt binaries. This time
Nick Clifton [Tue, 28 Oct 2014 15:47:13 +0000 (15:47 +0000)]
Fixes another couple of memory errors reading corrupt binaries.  This time
detected by the address sanitizer.

PR binutils/17512
* elf.c (bfd_section_from_shdr): Allocate and free the recursion
detection table on a per-bfd basis.
* peXXigen.c (pe_print_edata): Handle binaries with a truncated
export table.

9 years agoMIPS Documentation fixes
Matthew Fortune [Tue, 21 Oct 2014 10:58:19 +0000 (11:58 +0100)]
MIPS Documentation fixes

Import from trunk.

gas/
* doc/as.texinfo: Update the MIPS FP ABI descriptions.
* doc/c-mips.texi: Spell check and correct throughout.

9 years agoMIPS/GAS: Correct file option settings with `.insn'
Maciej W. Rozycki [Tue, 21 Oct 2014 22:06:23 +0000 (23:06 +0100)]
MIPS/GAS: Correct file option settings with `.insn'

Import from trunk.

This makes sure `HAVE_CODE_COMPRESSION' evaluates correctly when the
`.insn' directive is used at the beginning of a source file before any
instructions have been produced and that ELF file header's MIPS16 and
microMIPS ASE flags are set correctly in the case where no instructions
have been produced other than with the said directive.

gas/
* config/tc-mips.c (s_insn): Set file options.

gas/testsuite/
* gas/mips/insn-opts.d: New test.
* gas/mips/insn-opts.s: New test source.
* gas/mips/mips.exp: Run the new test.

9 years agoFix bad @value references in MIPS documentation
Matthew Fortune [Fri, 17 Oct 2014 19:25:09 +0000 (20:25 +0100)]
Fix bad @value references in MIPS documentation

Import from trunk.

gas/

* doc/c-mips.texi: Fix bad @value references.

9 years agoShow information about unknown ASEs and extensions in .MIPS.abiflags
Matthew Fortune [Fri, 17 Oct 2014 10:07:17 +0000 (11:07 +0100)]
Show information about unknown ASEs and extensions in .MIPS.abiflags

Import from trunk.

bfd/
* elfxx-mips.c (print_mips_ases): Print unknown ASEs.
(print_mips_isa_ext): Print the value of an unknown extension.

binutils/

* readelf.c (print_mips_ases): Print unknown ASEs.
(print_mips_isa_ext): Print the value of an unknown extension.

include/

* elf/mips.h (AFL_ASE_MASK): Define.

9 years agoImport patches from the master branch which prevent seg-faults when parsing
Nick Clifton [Tue, 28 Oct 2014 10:50:17 +0000 (10:50 +0000)]
Import patches from the master branch which prevent seg-faults when parsing
corrupt binaries.

2014-10-28  Andreas Schwab  <schwab@suse.de>
    Nick Clifton  <nickc@redhat.com>
PR binutils/17510
* srec.c (srec_bad_byte): Increase size of buf to allow for
negative values.
(srec_scan): Use an unsigned char buffer to hold header bytes.

2014-10-27  Nick Clifton  <nickc@redhat.com>
PR binutils/17512
* elf.c (bfd_section_from_shdr): Detect and warn about ELF
binaries with a group of sections linked by the string table
indicies.
* peXXigen.c (_bfd_XXi_swap_aouthdr_in): Handle corrupt binaries
with an invalid value for NumberOfRvaAndSizes.
(pe_print_edata): Detect out of range rvas and entry counts for
the Export Address table, Name Pointer table and Ordinal table.

PR binutils/17510
* elf.c (setup_group): Improve handling of corrupt group
sections.

9 years agoRelax ppc64_elf_tls_optimize assertion
Alan Modra [Tue, 21 Oct 2014 10:14:38 +0000 (20:44 +1030)]
Relax ppc64_elf_tls_optimize assertion

The code in ppc64_elf_tls_optimize looking at the .toc is only
interested in .toc entries that are addresses.  .toc can contain more
than just an array of addresses, so if we have items that aren't
8-byte aligned, ignore them.

* elf64-ppc.c (ppc64_elf_tls_optimize): Ignore relocs against toc
entries that aren't a multiple of 8 rather than failing assertion.

9 years agoppc: enable msgclr and msgsnd on Power8
Jan Beulich [Tue, 21 Oct 2014 07:56:38 +0000 (09:56 +0200)]
ppc: enable msgclr and msgsnd on Power8

According to my reading of the spec it was an oversight for them to
not having got enabled when Power8 support got added.

9 years agoAdd gcc-4.9 libgomp symbols requiring --plt-thread-safe for power7
Alan Modra [Tue, 21 Oct 2014 06:36:01 +0000 (17:06 +1030)]
Add gcc-4.9 libgomp symbols requiring --plt-thread-safe for power7

powerpc64 ld builds plt call stubs with a read barrier to provide
thread safety on lazy plt updates, necessary on multi-threaded apps
with power7 or later weakly ordered memory.  gcc-4.9 libgomp
introduced more functions that could call pthread_create, which means
we have more functions that if referenced in an executable should
cause a default of --plt-thread-safe.

bfd/
* elf64-ppc.c (ppc64_elf_size_stubs): Add gcc-4.9 libgomp functions
to thread_starter.
gold/
* powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
thread_starter.

9 years agoPowerPC64 ELFv1 function symbol definition vs LTO and discarded sections
Alan Modra [Sat, 18 Oct 2014 11:16:48 +0000 (21:46 +1030)]
PowerPC64 ELFv1 function symbol definition vs LTO and discarded sections

When functions are emitted in comdat groups, global symbols defined in
duplicates of the group are treated as if they were undefined.  That
prevents the symbols in the discarded sections from affecting the
linker's global symbol hash table or causing duplicate symbol errors.
Annoyingly, when gcc emits a function to a comdat group, it does not
put *all* of a function's code and data in the comdat group.
Typically, constant tables, exception handling info, and debug info
are emitted to normal sections outside of the group, which is a
perennial source of linker problems due to the special handling needed
to deal with the extra-group pieces that ought to be discarded.  In
the case of powerpc64-gcc, the OPD entry for a function is not put in
the group.  Since the function symbol is defined on the OPD entry this
means we need to handle symbols in .opd specially.

To see how this affects LTO in particular, consider the linker
testcase PR ld/12942 (1).  This testcase links an LTO object file
pr12942a.o with a normal (non-LTO) object pr12942b.o.  Both objects
contain a definition for _Z4testv in a comdat group.  On loading
pr12942a.o, the linker sees a comdat group (actually linkonce section)
for _Z4testv and a weak _Z4testv defined in the IR.  On loading
pr12942b.o, the linker sees the same comdat group, and thus discards
it.  However, _Z4testv is a weak symbol defined in .opd, not part of
the group, so this weak symbol overrides the weak IR symbol.  On
(re)loading the LTO version of pr12942a.o, the linker sees another
weak _Z4testv, but this one does not override the value we have from
pr12942b.o.  The result is a linker complaint about "`_Z4testv'
... defined in discarded section `.group' of tmpdir/pr12942b.o".

* elf64-ppc.c (ppc64_elf_add_symbol_hook): If function code
section for function symbols defined in .opd is discarded, let
the symbol appear to be undefined.
(opd_entry_value): Ensure the result section is that for the
function code section in the same object as the OPD entry.

9 years agoFix PR17493, attempted output of *GAS `reg' section* symbol
Alan Modra [Sat, 18 Oct 2014 00:40:53 +0000 (11:10 +1030)]
Fix PR17493, attempted output of *GAS `reg' section* symbol

The write.c change is to make gas report an error if reg_section
symbols should leak in future.  The tc-i386.c change is the real fix.

Note that the error isn't the most helpful, "redefined symbol cannot
be used on reloc", but I'm not inclined to improve what is really an
internal gas error.  reg_section symbols shouldn't leak..

gas/
PR 17493
* write.c (adjust_reloc_syms): Don't allow symbols in reg_section
to be reduced to reg_section section symbol.
* gas/config/tc-i386.c (i386_finalize_immediate): Reject all
reg_section immediates.
gas/testsuite/
* gas/i386/inval-equ-2.l: Adjust.

9 years agoFix 17492, ld segfault with --oformat=binary
Alan Modra [Thu, 16 Oct 2014 10:46:07 +0000 (21:16 +1030)]
Fix 17492, ld segfault with --oformat=binary

PR 17492
* elf32-arm.c (elf32_arm_add_symbol_hook): Only set has_gnu_symbols
on ELF output bfd.
* elf32-i386.c (elf_i386_add_symbol_hook): Likewise.
* elf32-m68k.c (elf_m68k_add_symbol_hook): Likewise.
* elf32-ppc.c (ppc_elf_add_symbol_hook): Likewise.
* elf32-sparc.c (elf32_sparc_add_symbol_hook): Likewise.
* elf64-ppc.c (ppc64_elf_add_symbol_hook): Likewise.
* elf64-sparc.c (elf64_sparc_add_symbol_hook): Likewise.
* elf64-x86-64.c (elf_x86_64_add_symbol_hook): Likewise.
* elfxx-aarch64.c (_bfd_aarch64_elf_add_symbol_hook): Likewise.
* elf-s390-common.c (elf_s390_add_symbol_hook): Likewise.  Handle
STB_GNU_UNIQUE too.

9 years agoPR17488, powerpc64-linux-ld segfault
Alan Modra [Wed, 15 Oct 2014 23:08:09 +0000 (09:38 +1030)]
PR17488, powerpc64-linux-ld segfault

For binary ouput, we don't have an ELF bfd output so can't access
elf_elfheader.  The elf64-ppc.c changes are really just a tidy,
triggered by looking at all places where the abiversion bits are
accessed.

bfd/
* elf64-ppc.c (ppc64_elf_before_check_relocs): Do .opd processing
even when output is not ppc64 ELF.  Remove redundant tests on
type of input bfd.
ld/
PR 17488
* emultempl/ppc64elf.em (gld${EMULATION_NAME}_finish): Don't attempt
to access ELF header e_flags when not ppc64 ELF output.

9 years agoMerge bfd_find_nearest_line variants
Alan Modra [Wed, 15 Oct 2014 11:22:20 +0000 (21:52 +1030)]
Merge bfd_find_nearest_line variants

When bfd_find_nearest_line_discriminator was added, not enough care
was taken to ensure all targets had a proper definition of the function.
This patch cures that by merging bfd_find_nearest_line_discriminator
and bfd_find_nearest_line target implementations.

PR 17481
* aoutx.h (NAME (aout, find_nearest_line)): Add "discriminator_ptr"
param, group "section" and "offset" params.  Zero discriminator.
* bfd.c (bfd_find_nearest_line): Implement with new
_bfd_find_nearest_line.
(bfd_find_nearest_line_discriminator): Likewise.
* coff-i386.c (_bfd_generic_find_nearest_line_discriminator): Don't
define.
* coff-rs6000.c (xcoff_find_nearest_line,
xcoff_find_nearest_line_discriminator): Delete.
(_bfd_xcoff_find_nearest_line): Don't define.
(_bfd_xcoff_find_nearest_line): Define as coff_find_nearest_line.
* coff-x86_64.c (_bfd_generic_find_nearest_line_discriminator): Don't
define.
* coff64-rs6000.c (rs6000_xcoff64_vec, rs6000_xcoff64_aix_vec): Adjust.
* coffgen.c (coff_find_nearest_line_with_names): Reorder params,
adjust _bfd_dwarf2_find_nearest_line call.
(coff_find_nearest_line): Add "discriminator_ptr" param, reorder
others.  Set discriminator.  Adjust call.
(coff_find_nearest_line_discriminator): Delete.
* dwarf1.c (_bfd_dwarf1_find_nearest_line): Reorder params.
* dwarf2.c (find_line): Rename to..
(_bfd_dwarf2_find_nearest_line): ..this, reordering params.
Simplify setting of do_line.  Delete old function.
(_bfd_dwarf2_find_line): Delete.
* ecoff.c (_bfd_ecoff_find_nearest_line): Reorder params, add
discriminator_ptr and set it.
* elf-bfd.h (_bfd_elf_find_nearest_line): Update prototype.
(_bfd_elf_find_nearest_line_discriminator): Delete.
(_bfd_elf_find_line_discriminator): Delete.
(_bfd_generic_find_nearest_line_discriminator): Don't define.
* elf.c (elf_find_function): Reorder params.
(_bfd_elf_find_nearest_line): Reorder params, add discriminator_ptr.
Adjust calls.
(_bfd_elf_find_nearest_line_discriminator): Delete.
(_bfd_elf_find_line): Adjust call.
* elf32-arm.c (arm_elf_find_function): Reorder params.
(elf32_arm_find_nearest_line): Reorder params, add discriminator_ptr.
Adjust calls.
* elf64-alpha.c (elf64_alpha_find_nearest_line): Similarly.
* elfnn-aarch64.c (aarch64_elf_find_function): Reorder params.
(elfNN_aarch64_find_nearest_line): Reorder params, add
discriminator_ptr.  Adjust calls.
* elfxx-mips.c (_bfd_mips_elf_find_nearest_line): Similarly.
* elfxx-mips.h (_bfd_mips_elf_find_nearest_line): Update prototype.
* libaout.h (NAME (aout, find_nearest_line)): Update prototype.
* libbfd-in.h (_bfd_nosymbols_find_nearest_line): Update.
(_bfd_dwarf1_find_nearest_line): Likewise.
(_bfd_dwarf2_find_nearest_line): Likewise.
(_bfd_dwarf2_find_line): Delete.
(_bfd_generic_find_nearest_line_discriminator): Delete.
* libbfd.c (_bfd_generic_find_nearest_line_discriminator): Delete.
* libcoff-in.h (coff_find_nearest_line): Update prototype.
(coff_find_nearest_line_discriminator): Delete.
(coff_find_nearest_line_with_names): Update prototype.
* libecoff.h (_bfd_ecoff_find_nearest_line): Update prototype.
* mach-o.c (bfd_mach_o_find_nearest_line): Reorder params, add
discriminator_ptr.  Adjust calls.
* mach-o.h (bfd_mach_o_find_nearest_line): Update prototype.
* pdp11.c (NAME (aout, find_nearest_line)): Reorder params, add
discriminator_ptr and set.
* som.c (som_find_nearest_line): Similarly.
* targets.c (BFD_JUMP_TABLE_SYMBOLS): Delete entry for
_bfd_find_nearest_line_discriminator.
(struct bfd_target <_bfd_find_nearest_line>): Adjust prototype.
(struct bfd_target <_bfd_find_nearest_line_discriminator>): Delete.
* vms-alpha.c (_bfd_vms_find_nearest_dst_line): Rename to..
(_bfd_vms_find_nearest_line): ..this.  Reorder params, add
"discriminator" and set.
(_bfd_vms_find_nearest_line_discriminator): Delete.
(_bfd_generic_find_nearest_line_discriminator): Don't define.
(alpha_vms_find_nearest_line): Update define.
* bfd-in2.h: Regenerate.
* libbfd.h: Regenerate.
* libcoff.h: Regenerate.

9 years agoDefine bfd_find_line entry of BFD_JUMP_TABLE_SYMBOLS using NAME
Alan Modra [Wed, 15 Oct 2014 05:10:45 +0000 (15:40 +1030)]
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.

9 years agoChangeLog typo fix
Alan Modra [Tue, 14 Oct 2014 23:21:53 +0000 (09:51 +1030)]
ChangeLog typo fix

9 years agoFix memory overflow issue about strncat
Chen Gang [Tue, 14 Oct 2014 23:18:47 +0000 (09:48 +1030)]
Fix memory overflow issue about strncat

If src contains n or more bytes, strncat() writes n+1 bytes to dest
(n from src plus the terminating null byte).   Therefore, the size of
dest must be at least strlen(dest)+n+1.

* config/tc-tic4x.c (md_assemble): Correct strncat size.

9 years agodaily update
Alan Modra [Mon, 27 Oct 2014 23:00:13 +0000 (09:30 +1030)]
daily update

9 years agodaily update
Alan Modra [Sun, 26 Oct 2014 23:00:12 +0000 (09:30 +1030)]
daily update

9 years agodaily update
Alan Modra [Sat, 25 Oct 2014 23:00:11 +0000 (09:30 +1030)]
daily update

9 years agodaily update
Alan Modra [Fri, 24 Oct 2014 23:00:35 +0000 (09:30 +1030)]
daily update

9 years ago[AArch64] Cortex-A53 erratum 835769 linker workaround
Jiong Wang [Fri, 24 Oct 2014 11:23:40 +0000 (12:23 +0100)]
[AArch64] Cortex-A53 erratum 835769 linker workaround

2014-10-24  Tejas Belagod  <tejas.belagod@arm.com>

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

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

    ld/testsuite/
     * ld-aarch64/aarch64-elf.exp (aarch64elftests): Drive erratum
     835769 tests.
     * ld-aarch64/erratum835769.d: New.
     * ld-aarch64/erratum835769.s: New.

9 years agodaily update
Alan Modra [Thu, 23 Oct 2014 23:00:26 +0000 (09:30 +1030)]
daily update

9 years agodaily update
Alan Modra [Wed, 22 Oct 2014 23:00:28 +0000 (09:30 +1030)]
daily update

9 years agodaily update
Alan Modra [Tue, 21 Oct 2014 23:00:12 +0000 (09:30 +1030)]
daily update

9 years agodaily update
Alan Modra [Mon, 20 Oct 2014 23:00:28 +0000 (09:30 +1030)]
daily update

9 years agodaily update
Alan Modra [Sun, 19 Oct 2014 23:00:15 +0000 (09:30 +1030)]
daily update

9 years agodaily update
Alan Modra [Sat, 18 Oct 2014 23:00:25 +0000 (09:30 +1030)]
daily update

9 years agodaily update
Alan Modra [Fri, 17 Oct 2014 23:00:13 +0000 (09:30 +1030)]
daily update

9 years agoBackport "Fix sysroot-tests, adding --print-sysroot" from master
Hans-Peter Nilsson [Fri, 17 Oct 2014 11:26:56 +0000 (13:26 +0200)]
Backport "Fix sysroot-tests, adding --print-sysroot" from master

9 years agoRegenerate configure (after change of version)
Tristan Gingold [Wed, 15 Oct 2014 08:15:29 +0000 (10:15 +0200)]
Regenerate configure (after change of version)

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

* configure: Regenerate.

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

* configure: Regenerate.

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

* configure: Regenerate.

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

* configure: Regenerate.

9 years agosrc-release.sh: configure using --target.
Tristan Gingold [Wed, 15 Oct 2014 07:48:50 +0000 (09:48 +0200)]
src-release.sh: configure using --target.

        * src-release.sh (do_proto_toplev): Configure with --target.

9 years agoBackport "="-ldscript-path-prefix changes from master.
Hans-Peter Nilsson [Wed, 15 Oct 2014 01:54:43 +0000 (03:54 +0200)]
Backport "="-ldscript-path-prefix changes from 

9 years agogprof: Regenerate configure
Andreas Schwab [Tue, 14 Oct 2014 18:23:24 +0000 (20:23 +0200)]
gprof: Regenerate configure

* configure: Regenerate.

9 years agobfd: bump version on the 2_25 branch
Tristan Gingold [Tue, 14 Oct 2014 08:18:23 +0000 (10:18 +0200)]
bfd: bump version on the 2_25 branch

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

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

9 years agoAdd NEWS markers for 2.25.
Tristan Gingold [Tue, 14 Oct 2014 07:49:47 +0000 (09:49 +0200)]
Add NEWS markers for 2.25.

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

* NEWS: Add marker for 2.25.

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

* NEWS: Add marker for 2.25.

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

* NEWS: Add marker for 2.25.

9 years agoAvoid undefined behaviour with signed expressions
Alan Modra [Tue, 14 Oct 2014 03:06:20 +0000 (13:36 +1030)]
Avoid undefined behaviour with signed expressions

PR 17453
bfd/
* libbfd.c (COERCE16, COERCE32, COERCE64): Use unsigned types.
(EIGHT_GAZILLION): Delete.
binutils/
* dwarf.c (read_leb128): Avoid signed overflow.
(read_debug_line_header): Likewise.
gas/
* config/tc-i386.c (fits_in_signed_long): Use unsigned param and
expression to avoid signed overflow.
(fits_in_signed_byte, fits_in_unsigned_byte, fits_in_unsigned_word,
fits_in_signed_word, fits_in_unsigned_long): Similarly.
* expr.c (operand <'-'>): Avoid signed overflow.
* read.c (s_comm_internal): Likewise.

9 years agoCorrect fscanf char field count
Alan Modra [Tue, 14 Oct 2014 03:00:57 +0000 (13:30 +1030)]
Correct fscanf char field count

%<number>s as an fscanf format does not include the trailing NULL.
PATH_MAX does include the trailing NULL.

PR 17453
* readelf.c (process_program_headers): Correct fscanf format used
for interpreter.

9 years agosparc-aout and sparc-coff breakage
Alan Modra [Mon, 13 Oct 2014 12:27:58 +0000 (22:57 +1030)]
sparc-aout and sparc-coff breakage

* config/tc-sparc.c (sparc_md_end): Fix unused variable warnings.

9 years agodaily update
Alan Modra [Mon, 13 Oct 2014 23:01:01 +0000 (09:31 +1030)]
daily update

9 years agoChange name of file name test in py-objfile.exp.
Doug Evans [Mon, 13 Oct 2014 21:50:32 +0000 (14:50 -0700)]
Change name of file name test in py-objfile.exp.

Tests should each have their own name.

gdb/testsuite/ChangeLog:

* gdb.python/py-objfile.exp: Change name of file name test.

9 years agoFix dw2-op-out-param.S CU offset values.
Doug Evans [Mon, 13 Oct 2014 21:05:34 +0000 (14:05 -0700)]
Fix dw2-op-out-param.S CU offset values.

This test will pass if the CU is the first CU in the binary.
If libc debugging info is installed it may not be, in which case
the CU offset values are wrong.

gdb/testsuite/ChangeLog:

* gdb.dwarf2/dw2-op-out-param.S: Make DW_FORM_ref4 values be the offset
from the start of the CU.

9 years agofix file paths in previous commit
Doug Evans [Mon, 13 Oct 2014 20:33:09 +0000 (13:33 -0700)]
fix file paths in previous commit

9 years agoRemove some code duplication in py-objfile.c, py-progspace.c.
Doug Evans [Mon, 13 Oct 2014 19:24:54 +0000 (12:24 -0700)]
Remove some code duplication in py-objfile.c, py-progspace.c.

gdb/ChangeLog:

* py-objfile.c (objfpy_initialize): New function.
(objfpy_new, objfile_to_objfile_object): Call it.
* py-progspace.c (pspy_initialize): New function.
(pspy_new, pspace_to_pspace_object): Call it.

9 years agoRun eh_frame optimisation for relocatable link
Alan Modra [Mon, 13 Oct 2014 04:48:21 +0000 (15:18 +1030)]
Run eh_frame optimisation for relocatable link

The idea here is to drop .eh_frame FDEs corresponding to dropped
comdat group sections or linkonce sections, but not perform changes in
encoding.

bfd/
PR 17467
* elf-eh-frame.c (ENSURE_NO_RELOCS): Don't stop at first NONE reloc.
(_bfd_elf_parse_eh_frame): When relocatable output, don't set
flags enabling conversion of CIEs and FDEs to use relative encoding.
(find_merged_cie): Similarly.
(_bfd_elf_write_section_eh_frame): Don't edit FDEs when
relocatable, except for CIE pointer.
* elflink.c (bfd_elf_reloc_symbol_deleted_p): Return true for
relocs against symbols in dropped comdat group sections.
(bfd_elf_discard_info): Do some eh_frame optimisation when
relocatable.
ld/
* ldlang.c (lang_add_section): Set up map_head.s and map_tail.s when
relocatable.

9 years agoFix "save breakpoints" for "catch" command
Jan Kratochvil [Mon, 13 Oct 2014 11:39:48 +0000 (13:39 +0200)]
Fix "save breakpoints" for "catch" command

gdb/ChangeLog
2014-10-13  Miroslav Franc  <mfranc@redhat.com>
    Jan Kratochvil  <jan.kratochvil@redhat.com>

Fix "save breakpoints" for "catch" command.
* break-catch-sig.c (signal_catchpoint_print_recreate): Add trailing
newline.

gdb/testsuite/ChangeLog
2014-10-13  Jan Kratochvil  <jan.kratochvil@redhat.com>
    Yao Qi  <yao@codesourcery.com>

Fix "save breakpoints" for "catch" command.
* gdb.base/catch-signal.exp: Add gdb_breakpoint "main".
Remove -nonewline.  Match also the added "main" line.