]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
8 years agoS/390: Fix segfault when linking -shared -nostartfiles
Andreas Krebbel [Tue, 1 Aug 2017 08:56:59 +0000 (10:56 +0200)] 
S/390: Fix segfault when linking -shared -nostartfiles

Regression-tested on s390x.

bfd/ChangeLog:

2017-08-01  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

Backport from mainline
2017-07-28  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* elf32-s390.c (elf_s390_finish_dynamic_sections): Add NULL
pointer check for htab->elf.irelplt.
* elf64-s390.c (elf_s390_finish_dynamic_sections): Likewise.

8 years agoS/390: Support z14 as CPU name.
Andreas Krebbel [Tue, 1 Aug 2017 08:56:59 +0000 (10:56 +0200)] 
S/390: Support z14 as CPU name.

With IBM z14 officially announced I can add z14 as CPU name.

No regressions with that patch on s390x.

gas/ChangeLog:

2017-08-01  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

Backport from mainline
2017-07-21  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* config/tc-s390.c (s390_parse_cpu): Add z14 as alternate CPU
name.
* doc/as.texinfo: Add z14 to CPU string list.
* doc/c-s390.texi: Likewise.

opcodes/ChangeLog:

2017-08-01  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

Backport from mainline
2017-07-21  Andreas Krebbel  <krebbel@linux.vnet.ibm.com>

* s390-mkopc.c (main): Enable z14 as CPU string in the opcode
table.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 1 Aug 2017 00:01:47 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoPR 21847, PowerPC64 --plt-localentry again
Alan Modra [Mon, 31 Jul 2017 00:48:46 +0000 (10:18 +0930)] 
PR 21847, PowerPC64 --plt-localentry again

This makes ld warn about --plt-localentry if a version of glibc
without the necessary ld.so checks is detected, and revises the
documentation.

bfd/
* elf64-ppc.c (ppc64_elf_tls_setup): Warn on --plt-localentry
without ld.so checks.
gold/
* powerpc.cc (Target_powerpc::scan_relocs): Warn on --plt-localentry
without ld.so checks.
ld/
* ld.texinfo (plt-localentry): Revise.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 31 Jul 2017 00:01:19 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 30 Jul 2017 00:01:47 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoPR 21847, Don't default PowerPC64 to --plt-localentry
Alan Modra [Sat, 29 Jul 2017 03:03:35 +0000 (12:33 +0930)] 
PR 21847, Don't default PowerPC64 to --plt-localentry

The big comment in ppc64_elf_tls_setup says why.  I've also added some
code to the bfd linker that catches the -lpthread -lc symbol
differences and disable generation of optimized call stubs even when
--plt-localentry is activated.  Gold doesn't yet have that.

PR 21847
bfd/
* elf64-ppc.c (struct ppc_link_hash_entry): Add non_zero_localentry.
(ppc64_elf_merge_symbol): Set non_zero_localentry.
(is_elfv2_localentry0): Test non_zero_localentry.
(ppc64_elf_tls_setup): Default to --no-plt-localentry.
gold/
* powerpc.cc (Target_powerpc::scan_relocs): Default to
--no-plt-localentry.
ld/
* ld.texinfo (plt-localentry): Document.

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 29 Jul 2017 00:01:49 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agogold: Add put_ch_reserved to 64-bit Chdr_write
H.J. Lu [Fri, 28 Jul 2017 20:39:42 +0000 (13:39 -0700)] 
gold: Add put_ch_reserved to 64-bit Chdr_write

The 64-bit ELF compression header has a reserved field.  It should be
cleared to avoid random bits in it.

elfcpp/

PR gold/21857
* elfcpp.h (Chdr_write): Add put_ch_reserved.
(Chdr_write<64, true>::put_ch_reserved): New.
(Chdr_write<64, false>::put_ch_reserved): Likewise.

gold/

PR gold/21857
* compressed_output.cc (Output_compressed_section::set_final_data_size):
Call put_ch_reserved to clear the reserved field for 64-bit ELF.

(cherry picked from commit 49ba15a23a9d3d8a109ce2fd5053822eee7f1fdf)

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 28 Jul 2017 00:01:34 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoMove AVR .progmemx.* sections to higher memory.
Georg-Johann Lay [Thu, 27 Jul 2017 13:20:50 +0000 (14:20 +0100)] 
Move AVR .progmemx.* sections to higher memory.

PR ld/21849
* scripttempl/avr.sc: Split .progmemx.* from .progmem.* and locate
former at a higher address.

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 27 Jul 2017 00:01:59 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoGold: Fix mips.cc for GCC 4.2
H.J. Lu [Wed, 26 Jul 2017 17:39:20 +0000 (10:39 -0700)] 
Gold: Fix mips.cc for GCC 4.2

GCC 4.2 fails to compile "(uint64_t) 0x800080008000" with

error: integer constant is too large for ‘long’ type

This patch adds "llu" suffix to 0x800080008000 for GCC 4.2.

* mips.cc (Mips_relocate_functions): Add "llu" suffix to
0x800080008000.

(cherry picked from commit 104f0515d038716599728f8e2b58aefe3fc188aa)

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 26 Jul 2017 00:01:32 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoUpdated French translation for the BFD library.
Nick Clifton [Tue, 25 Jul 2017 08:48:28 +0000 (09:48 +0100)] 
Updated French translation for the BFD library.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 25 Jul 2017 00:03:01 +0000 (00:03 +0000)] 
Automatic date update in version.in

8 years agoBump version to 2.29.0
Tristan Gingold [Mon, 24 Jul 2017 10:53:49 +0000 (12:53 +0200)] 
Bump version to 2.29.0

bfd/
2017-07-24  Tristan Gingold  <gingold@adacore.com>

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

binutils/
2017-07-24  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

gas/
2017-07-24  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

gprof/
2017-07-24  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

ld/
2017-07-24  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

opcodes/
2017-07-24  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

8 years agoBump version to 2.29 binutils-2_29
Tristan Gingold [Mon, 24 Jul 2017 10:30:28 +0000 (12:30 +0200)] 
Bump version to 2.29

bfd/
2017-07-24  Tristan Gingold  <gingold@adacore.com>

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

binutils/
2017-07-24  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

gas/
2017-07-24  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

gprof/
2017-07-24  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

ld/
2017-07-24  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

opcodes/
2017-07-24  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 24 Jul 2017 00:01:49 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoCorrect eh_frame info for __glink_PLTresolve
Alan Modra [Sun, 23 Jul 2017 10:33:40 +0000 (20:03 +0930)] 
Correct eh_frame info for __glink_PLTresolve

My PPC64_OPT_LOCALENTRY patch of June 1, git commit f378ab099d, and
the later gold change, git commit 7ee7ff7015, added an insn in
__glink_PLTresolve which needs a corresponding adjustment in the
eh_frame info for asynchronous exceptions to unwind correctly.

It would have been OK for both ABIs to use +5 for the advance before
restore of LR, since we can put the DW_CFA_restore_extended on any
insn after the actual restore and before the r12/r0 copy is clobbered,
but it's slightly better to delay as much as possible.  There are
then more addresses where fewer CFA program insns are executed.

bfd/
* elf64-ppc.c (ppc64_elf_size_stubs): Correct advance to
restore of LR.
gold/
* powerpc.cc (glink_eh_frame_fde_64v2): Correct advance to
restore of LR.
(glink_eh_frame_fde_64v1): Advance to restore of LR at latest
possible insn.

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 23 Jul 2017 00:01:28 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 22 Jul 2017 00:01:49 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoUpdated French translation for the binutils subdirectory.
Nick Clifton [Fri, 21 Jul 2017 15:02:44 +0000 (16:02 +0100)] 
Updated French translation for the binutils subdirectory.

* po/fr.po: Updated French translation.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 21 Jul 2017 00:01:23 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoUpdate German translation for the opcodes library.
Nick Clifton [Thu, 20 Jul 2017 10:49:12 +0000 (11:49 +0100)] 
Update German translation for the opcodes library.

* po/de.po: Updated German translation.

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 20 Jul 2017 00:01:56 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 19 Jul 2017 00:01:49 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoUpdate translations.
Nick Clifton [Tue, 18 Jul 2017 13:41:22 +0000 (14:41 +0100)] 
Update translations.

bfd * po/es.po: Updated translation.
* po/fi.po: Likewise.
* po/fr.po: Likewise.
* po/id.po: Likewise.
* po/ja.po: Likewise.
* po/ro.po: Likewise.
* po/ru.po: Likewise.
* po/sr.po: Likewise.
* po/sv.po: Likewise.
* po/tr.po: Likewise.
* po/uk.po: Likewise.
* po/vi.po: Likewise.
* po/zh_CN.po: Likewise.

* po/hr.po: New translation.
* configure.ac (ALL_LINGUAS): Add hr.
* configure: Regenerate.

gold * po/es.po: Updated translation.
* po/fi.po: Likewise.
* po/fr.po: Likewise.
* po/id.po: Likewise.
* po/it.po: Likewise.
* po/vi.po: Likewise.
* po/zh_CN.po: Likewise.

* po/ja.po: New translation.
* po/sv.po: Likewise.
* po/uk.po: Likewise.

ld * po/bg.po: Updated translation.
* po/da.po: Likewise.
* po/es.po: Likewise.
* po/fi.po: Likewise.
* po/fr.po: Likewise.
* po/id.po: Likewise.
* po/it.po: Likewise.
* po/ja.po: Likewise.
* po/tr.po: Likewise.
* po/uk.po: Likewise.
* po/vi.po: Likewise.
* po/zh_CN.po: Likewise.
* po/zh_TW.po: Likewise.

* po/ru.po: New translation.
* po/de.po: Likewise.
* configure.ac (ALL_LINGUAS): Add ru and de.
* configure: Regenerate.

binutils* po/bg.po: Updated translation.
* po/ca.po: Likewise.
* po/da.po: Likewise.
* po/es.po: Likewise.
* po/fi.po: Likewise.
* po/fr.po: Likewise.
* po/hr.po: Likewise.
* po/id.po: Likewise.
* po/it.po: Likewise.
* po/ja.po: Likewise.
* po/ro.po: Likewise.
* po/ru.po: Likewise.
* po/sk.po: Likewise.
* po/sr.po: Likewise.
* po/sv.po: Likewise.
* po/tr.po: Likewise.
* po/uk.po: Likewise.
* po/vi.po: Likewise.
* po/zh_CN.po: Likewise.
* po/zh_TW.po: Likewise.

gas * po/es.po: Updated translation.
* po/fi.po: Likewise.
* po/fr.po: Likewise.
* po/id.po: Likewise.
* po/ja.po: Likewise.
* po/ru.po: Likewise.
* po/sv.po: Likewise.
* po/tr.po: Likewise.
* po/uk.po: Likewise.
* po/zh_CN.po: Likewise.

gprof * po/bg.po: Updated translation.
* po/da.po: Likewise.
* po/de.po: Likewise.
* po/eo.po: Likewise.
* po/es.po: Likewise.
* po/fi.po: Likewise.
* po/fr.po: Likewise.
* po/ga.po: Likewise.
* po/hu.po: Likewise.
* po/id.po: Likewise.
* po/it.po: Likewise.
* po/ja.po: Likewise.
* po/ms.po: Likewise.
* po/nl.po: Likewise.
* po/pt_BR.po: Likewise.
* po/ro.po: Likewise.
* po/ru.po: Likewise.
* po/sr.po: Likewise.
* po/sv.po: Likewise.
* po/tr.po: Likewise.
* po/uk.po: Likewise.
* po/vi.po: Likewise.

opcodes * po/da.po: Updated translation.
* po/de.po: Likewise.
* po/es.po: Likewise.
* po/fi.po: Likewise.
* po/fr.po: Likewise.
* po/id.po: Likewise.
* po/it.po: Likewise.
* po/nl.po: Likewise.
* po/pt_BR.po: Likewise.
* po/ro.po: Likewise.
* po/sv.po: Likewise.
* po/tr.po: Likewise.
* po/uk.po: Likewise.
* po/vi.po: Likewise.
* po/zh_CN.po: Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 18 Jul 2017 00:01:41 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoSupport single digit GCC version
H.J. Lu [Tue, 11 Jul 2017 15:37:48 +0000 (08:37 -0700)] 
Support single digit GCC version

On Fedora 26, "g++ -dumpversion" displays "7", instead of "7.1.1".
Update selective.exp to support single digit GCC version.  Also
remove duplicated [4-9] version check.

* testsuite/ld-selective/selective.exp: Support single digit
GCC version.

(cherry picked from commit 61a0857c0fb512ce6a2ba4315a37fcce744f6045)

8 years agox86-64: Limit PIC check to shared library build
H.J. Lu [Mon, 17 Jul 2017 19:17:59 +0000 (12:17 -0700)] 
x86-64: Limit PIC check to shared library build

When building an executable, undefined symbols are error and undefined
weak symbols are resolved to zero.  We only need to check PIC for
building a shared library.

bfd/

PR ld/21782
* elf64-x86-64.c (elf_x86_64_relocate_section): Limit PIC check
to shared library.

ld/

PR ld/21782
* testsuite/ld-x86-64/pie3-nacl.d: New file.
* testsuite/ld-x86-64/pie3.d: Likewise.
* testsuite/ld-x86-64/pie3.s: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run pie3 and pie3-nacl.

(cherry picked from commit c5bb8910e80c6cd80c63541f86471c18375c8198)

8 years agoCorrect previous fix to ar, so that it now only comaplains about a lack of input...
Nick Clifton [Mon, 17 Jul 2017 09:53:53 +0000 (10:53 +0100)] 
Correct previous fix to ar, so that it now only comaplains about a lack of input files if not running in MRI mode.

PR 21433
* ar.c (main): Skip check for no files on the command line when
running in MRI mode.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 17 Jul 2017 00:01:53 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years ago__tls_get_addr_opt GOT entries
Alan Modra [Sun, 16 Jul 2017 02:20:52 +0000 (11:50 +0930)] 
__tls_get_addr_opt GOT entries

My 2017-01-24 patch (commit f0158f44) wrongly applied an optimization
of GOT entries for the __tls_get_addr_opt stub, to shared libraries.

When the TLS segment layout is known, as it is for the executable and
shared libraries loaded at initial program start, powerpc supports a
__tls_get_addr optimization.  On the first call to __tls_get_addr for
a given __tls_index GOT entry, the DTPMOD word is set to zero and the
DTPREL word to the thread pointer offset to the thread variable.  This
allows the __tls_get_addr_opt stub to return that value immediately
without making a call into glibc for any subsequent __tls_get_addr
calls using that __tls_index GOT entry.

That's all fine, but I thought I'd be clever and when the thread
variable is local, set up the GOT entry as if __tls_get_addr had
already been called.  Which is good only for the executable, since ld
cannot know the TLS layout for shared libraries.

Of course, if this only applies to executables there isn't much point
to the optimization.  Normally, GD and LD code in an executable will
be converted to IE or LE, losing the __tls_get_addr call.  So the only
time it will trigger is with --no-tls-optimize.  Thus, revert all
support.

* elf64-ppc.c (ppc64_elf_relocate_section): Don't optimize
__tls_index GOT entries when using __tls_get_addr_opt stub.
* elf32-ppc.c (ppc_elf_relocate_section): Likewise.

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 16 Jul 2017 00:01:42 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 15 Jul 2017 00:01:53 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoPR ld/21529: Use a linker script to limit output with the test case
Maciej W. Rozycki [Fri, 14 Jul 2017 10:53:08 +0000 (11:53 +0100)] 
PR ld/21529: Use a linker script to limit output with the test case

Complement commit d9409498813c ("Add a testcase for PR ld/21529") and
use a linker script to prevent an inter-segment gap arranged by the
default linker script associated with some targets such as `rx-elf':

$ ld -e main -o tmpdir/dump-elf tmpdir/pr21529.o
$ readelf -l tmpdir/dump-elf
Elf file type is EXEC (Executable file)
Entry point 0x10000004
There are 2 program headers, starting at offset 52

Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x001000 0x10000000 0x10000000 0x00008 0x00008 R E 0x1000
  LOAD           0x001ffc 0xbffffffc 0xbffffffc 0x00004 0x00004 RW  0x1000

 Section to Segment mapping:
  Segment Sections...
   00     .text
   01     .stack
$

and converted to padding with the use of the binary BFD for output from
producing unreasonably large files.

ld/
* testsuite/ld-unique/pr21529.ld: New test linker script.
* testsuite/ld-unique/pr21529.d: Use it.

(cherry picked from commit 211b0bed95b3f6b177a541ec52302b8febd6b49c)

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 14 Jul 2017 00:01:31 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Thu, 13 Jul 2017 00:01:50 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoFixing for PR gold/21491 - Errata workaround can produce broken images.
Han Shen [Mon, 10 Jul 2017 22:23:05 +0000 (15:23 -0700)] 
Fixing for PR gold/21491 - Errata workaround can produce broken images.

The problem is caused by the fact that gold is relocating the stubs
for an entire output section when it processes the relocations for a
particular input section that happened to be designated as the stub
table "owner". The Relocate_task for that input section may or may not
run before the Relocate_task for another input section that contains
the code that needs the erratum fix, but doesn't "own" the stub
table. If it runs before (or might even race with) that other task, it
ends up with a copy of the unrelocated original instruction.

In other words - when calling fix_errata() from
do_relocate_sections(), gold is going through the list of errata stubs
that are associated only with that object. This routine updates the
stored original instruction and replaces it in the output view with a
branch to the stub. Later, as gold is going through the object file's
input sections, it then checks for stub tables "owned" by each input
section, and writes out all the stubs from that stub table, regardless
of what object file each stub is associated with.

Fixed by relocating the erratum stub only after the corresponding
errata spot is fixed. That is to have fix_errata() call
Stub_table::relocate_erratum_stub() for each stub.

gold/ChangeLog
2017-07-06  Han Shen  <shenhan@google.com>

PR gold/21491

* aarch64.cc (Erratum_stub::invalidate_erratum_stub): New method.
(Erratum_stub::is_invalidated_erratum_stub): New method.
(Stub_table::relocate_reloc_stub): Renamed from "relocate_stub".
(Stub_table::relocate_reloc_stubs): Renamed from "relocate_stubs".
(Stub_table::relocate_erratum_stub): New method.
(AArch64_relobj::fix_errata_and_relocate_erratum_stubs): Renamed from
"fix_errata".
(Target_aarch64::relocate_reloc_stub): Renamed from "relocate_stub".

8 years agoFix compile time warnings when using gcc 7.1.1
Nick Clifton [Wed, 12 Jul 2017 11:19:30 +0000 (12:19 +0100)] 
Fix compile time warnings when using gcc 7.1.1

bfd * elf32-xtensa.c (elf_xtensa_get_plt_section): Increase length of
plt_name buffer.
(elf_xtensa_get_gotplt_section): Increase length of got_name
buffer.
* mach-o-arm.c (bfd_mach_o_arm_canonicalize_one_reloc): Add a
default return of FALSE.
* mach-o-i386.c (bfd_mach_o_i386_canonicalize_one_reloc): Add a
default return of FALSE.

binutils * dwarf.c (dwarf_vmatoa_1): Do not pass a NULL string pointer to
sprintf.
* srconv.c (walk_tree_type): Initialise the spare field of the
IT_dty structure.

gas * config/tc-pru.c (md_assemble): Add continue statement after
handling 'E' operand character.
* config/tc-v850.c (md_assemble): Initialise the 'insn' variable.

8 years agoAutomatic date update in version.in
GDB Administrator [Wed, 12 Jul 2017 00:01:33 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years ago[AArch64] Use "#pass" instead of "#..." to filter multiple lines
Jiong Wang [Tue, 11 Jul 2017 10:33:53 +0000 (11:33 +0100)] 
[AArch64] Use "#pass" instead of "#..." to filter multiple lines

ld/
* testsuite/ld-aarch64/dt_textrel.d: Use "#pass" instead of ".*" to
filter out remaining lines.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 11 Jul 2017 00:01:40 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoFix compile time warning when building for powerpc-aix target.
Nick Clifton [Mon, 10 Jul 2017 12:19:16 +0000 (13:19 +0100)] 
Fix compile time warning when building for powerpc-aix target.

* coffcode.h (coff_slurp_symbol_table): Do not include an entry
for C_AIX_WEAKEXT if it has the same value as C_WEAKEXT.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 10 Jul 2017 00:01:37 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 9 Jul 2017 00:01:33 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 8 Jul 2017 00:01:35 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoMIPS/LD: Fix a segfault from ELF `e_flags' access with non-ELF output BFD
Maciej W. Rozycki [Fri, 7 Jul 2017 16:58:03 +0000 (17:58 +0100)] 
MIPS/LD: Fix a segfault from ELF `e_flags' access with non-ELF output BFD

Fix a commit 861fb55ab50a ("Defer allocation of R_MIPS_REL32 GOT
slots"), <https://sourceware.org/ml/binutils/2008-08/msg00096.html>,
regression and a more recent:

FAIL: ld-unique/pr21529

new LD test case failure, observed with all the relevant MIPS targets
whenever the linker is invoked with one or more ELF inputs and the
output format set to `binary'.

The culprit is a segmentation fault caused in `mips_before_allocation'
by a null pointer dereference, where an attempt is made to access the
ELF file header's `e_flags' member, for the purpose of determining
whether to produce a PLT and copy relocations, without first checking
that the output BFD is ELF.  The `e_flags' member is stored in BFD's
private data pointed to by `tdep', which in the case of the `binary' BFD
is null, causing the segmentation fault.  With other non-ELF BFDs such
as SREC `tdep' is not null and consequently no crash may happen and in
that case random data will be interpreted as it was `e_flags'.

Disable the access to `e_flags' then and all the associated checks and
consequently never produce a PLT and copy relocations if output is not a
MIPS ELF BFD, matching `_bfd_mips_elf_merge_private_bfd_data' that does
not process `e_flags' in that case either and therefore does not let us
decide here anyway if all the input objects included in the link are
suitable for use with a PLT and copy relocations.

ld/
* emultempl/mipself.em (mips_before_allocation): Avoid ELF
processing if not MIPS ELF.
* testsuite/ld-mips-elf/binary.d: New test.
* testsuite/ld-mips-elf/binary.ld: New test linker script.
* testsuite/ld-mips-elf/binary.s: New test source.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new test.

(cherry picked from commit e54cb31aa33a124f746ff40c134e20e6d2bc6c34)

8 years agoMake ppc476 testcases more robust
Alan Modra [Fri, 7 Jul 2017 14:19:42 +0000 (23:49 +0930)] 
Make ppc476 testcases more robust

* testsuite/ld-powerpc/ppc476-shared.lnk: Align .bss.
* testsuite/ld-powerpc/ppc476-shared.d: Adjust.
* testsuite/ld-powerpc/ppc476-shared2.d: Adjust.

8 years agoMove print_insn_XXX to an opcodes internal header, again
Alan Modra [Fri, 7 Jul 2017 02:44:53 +0000 (12:14 +0930)] 
Move print_insn_XXX to an opcodes internal header, again

88c1242dc0a changed some generated files rather than the source.

* cgen-dis.in: Include disassemble.h, not dis-asm.h.
* m32c-dis.c: Regenerate.
* mep-dis.c: Regenerate.

8 years agoAdd some missing xcoff support
Alan Modra [Fri, 7 Jul 2017 01:01:27 +0000 (10:31 +0930)] 
Add some missing xcoff support

* coffcode.h (coff_slurp_symbol_table): Handle C_AIX_WEAKEXT.

8 years agoApply ld/Makefile.in patch to the correct file
Alan Modra [Fri, 7 Jul 2017 01:00:53 +0000 (10:30 +0930)] 
Apply ld/Makefile.in patch to the correct file

Makefile.in is generated.

* Makefile.am (eelf64_s390.c): Depend on emultempl/s390.em.

8 years agoAnother _doprnt fix for %L handling
Alan Modra [Fri, 7 Jul 2017 00:49:08 +0000 (10:19 +0930)] 
Another _doprnt fix for %L handling

* bfd.c (_doprnt): Replace "L" with "ll" when printing bfd_vma
as long long.  Move code replacing "ll" with "I64", and simplify.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 7 Jul 2017 00:01:32 +0000 (00:01 +0000)] 
Automatic date update in version.in

8 years agoConvert 'L' to 'l' when setting wide_width to 1
H.J. Lu [Thu, 6 Jul 2017 13:52:13 +0000 (06:52 -0700)] 
Convert 'L' to 'l' when setting wide_width to 1

When setting wide_width to 1, convert 'L' to 'l'.  Otherwise, %Lx/%Lu/%Ld
will be passed to fprintf which will treat the argument as long long.

* bfd.c (_doprnt): Convert 'L' to 'l' when setting wide_width
to 1.

(cherry picked from commit a0b7b105236d5bc65e8d3a35f1b4f34bcc5e3705)

8 years agoFix build with GCC 4.2
H.J. Lu [Wed, 5 Jul 2017 16:04:51 +0000 (09:04 -0700)] 
Fix build with GCC 4.2

Fix GCC 4.2 warnings like:

cc1: warnings being treated as errors
binutils-gdb/bfd/dwarf2.c:1844: warning: declaration of ‘time’ shadows a global declaration
/usr/include/time.h:187: warning: shadowed declaration is here
binutils-gdb/bfd/dwarf2.c: In function ‘line_info_add_file_name’:
binutils-gdb/bfd/dwarf2.c:1854: warning: declaration of ‘time’ shadows a global declaration
/usr/include/time.h:187: warning: shadowed declaration is here

bfd/

* dwarf2.c (line_info_add_include_dir_stub): Replace time with
xtime.
(line_info_add_file_name): Likewise.
(decode_line_info): Likewise.

binutils/

* dwarf.c (display_debug_names): Replace index with xindex.

(cherry picked from commit 1d827a720c9659cc8d54059ccc3efae24b875c03)

8 years ago[Patch ARM] Support MVFR2 VFP Coprocessor register for ARMv8-A
Ramana Radhakrishnan [Tue, 4 Jul 2017 15:18:47 +0000 (16:18 +0100)] 
[Patch ARM] Support MVFR2 VFP Coprocessor register for ARMv8-A

This patch adds support mvfr2 control registers for armv8-a as
this was missed from the original port to armv8-a (documented
at G6.2.109 in (Issue B.a) of the ARM-ARM. This was discovered
by an internal user of the GNU toolchain.

I'd like to backport this to the binutils 2.28 and binutils 2.29
release branch if possible (with suitable testing and basically
checking removing the armv8-r parts).

Tristan - are you ok with the backports ?

Applied to trunk.

regards Ramana

2017-07-04  Ramana Radhakrishnan  <ramana.radhakrishnan@arm.com>

        * gas/config/tc-arm.c (arm_regs): Add MVFR2.
        (do_vmrs): Constraint for MVFR2 and armv8.
        (do_vmsr): Likewise.
        * gas/testsuite/gas/arm/armv8-a+fp.d: Update.
        * gas/testsuite/gas/arm/armv8-ar+fp.s: Likewise.
        * gas/testsuite/gas/arm/armv8-r+fp.d: Likewise.
        * gas/testsuite/gas/arm/vfp-bad.s: Likewise.
        * gas/testsuite/gas/arm/vfp-bad.l: Likewise.
        * opcodes/arm-dis.c: Support MVFR2 in disassembly
        with vmrs and vmsr.

8 years agoBump release.
Tristan Gingold [Tue, 4 Jul 2017 09:24:31 +0000 (11:24 +0200)] 
Bump release.

bfd/
2017-07-04  Tristan Gingold  <gingold@adacore.com>

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

binutils/
2017-07-04  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

gas/
2017-07-04  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

gprof/
2017-07-04  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

ld/
2017-07-04  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

opcodes/
2017-07-04  Tristan Gingold  <gingold@adacore.com>

* configure: Regenerate.

8 years agoAdd markers.
Tristan Gingold [Tue, 4 Jul 2017 09:06:02 +0000 (11:06 +0200)] 
Add markers.

binutils/
2017-07-04  Tristan Gingold  <gingold@adacore.com>

* NEWS: Add marker for 2.29.

gas/
2017-07-04  Tristan Gingold  <gingold@adacore.com>

* NEWS: Add marker for 2.29.

ld/
2017-07-04  Tristan Gingold  <gingold@adacore.com>

* NEWS: Add marker for 2.29.

8 years ago[AArch64] Remove useless and incorrect assertion
Jiong Wang [Mon, 3 Jul 2017 16:15:26 +0000 (17:15 +0100)] 
[AArch64] Remove useless and incorrect assertion

The outer caller elf_link_output_extsym in elflink.c is a traverse function on
all external symbol, and it will only call *finish_dynamic_symbol if some
conditions is meet.  It is executed conditionally.

If the condition to trigger that assertion is satisified, it then won't satify
the outer check in finish_dynamic_symbol, so *finish_dynamic_symbol won't be
called that the assertion is expected to be dead code.

If elf_link_output_extsym is a traverse function that unconditionally called
on external symbols decided to be exported, then an assertion to make sure these
symbols are in sane status might make sense.

bfd/
        * elfnn-aarch64.c (elfNN_aarch64_finish_dynamic_symbol): Remove the
        sanity check at the head of this function.

8 years ago[binutils patch] DWARF-5: Extend bfd/dwarf2.c parse_comp_unit()
Jan Kratochvil [Tue, 4 Jul 2017 08:09:27 +0000 (10:09 +0200)] 
[binutils patch] DWARF-5: Extend bfd/dwarf2.c parse_comp_unit()

bfd/
2017-07-04  Jan Kratochvil  <jan.kratochvil@redhat.com>

* dwarf2.c (struct dwarf2_debug): Add fields dwarf_line_str_buffer and
dwarf_line_str_size.
(struct attr_abbrev): Add field implicit_const.
(dwarf_debug_sections): Add .debug_line_str.
(enum dwarf_debug_section_enum): Add debug_line_str and debug_max.
(dwarf_debug_section_assert): Add static assertion.
(read_indirect_line_string): New.
(read_abbrevs): Support DW_FORM_implicit_const.
(is_str_attr): Support DW_FORM_line_strp.
(read_attribute_value): Support DW_FORM_line_strp and
DW_FORM_implicit_const.
(read_attribute): Support DW_FORM_implicit_const.
(line_info_add_include_dir, line_info_add_include_dir_stub):
(line_info_add_file_name, read_formatted_entries): New.
(decode_line_info, parse_comp_unit): Support DWARF 5.
(_bfd_dwarf2_cleanup_debug_info): Free dwarf_line_str_buffer.

8 years agoAutomatic date update in version.in
GDB Administrator [Tue, 4 Jul 2017 00:00:43 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agobfd: partial revert commit EC1ACAB (prevent all but undef weak symbols to become...
Egeyar Bagcioglu [Mon, 3 Jul 2017 18:06:35 +0000 (20:06 +0200)] 
bfd: partial revert commit EC1ACAB (prevent all but undef weak symbols to become dynamic in sparc).

bfd/ChangeLog:

2017-07-03  Egeyar Bagcioglu  <egeyar.bagcioglu@oracle.com>

        * elfxx-sparc.c (_bfd_sparc_elf_finish_dynamic_symbol): Remove the
        abort statement that was put for symbols that are not dynamic.

8 years agoRegenerate pot files.
Tristan Gingold [Mon, 3 Jul 2017 15:02:01 +0000 (17:02 +0200)] 
Regenerate pot files.

8 years agostrings: remove section/file size check
Alan Modra [Mon, 3 Jul 2017 12:30:32 +0000 (22:00 +0930)] 
strings: remove section/file size check

This reverts most of 06803313754, 2005-07-05 Dmitry V. Levin change
adding a check that section size doesn't exceed file size.  As we've
seen recently with mmo tests, decoded section size can easily exceed
file size with formats that encode section data.

I've also changed "strings" to use bfd_malloc_and_get_section, so that
"strings" won't die on a malloc failure.  I think it's better to
continue on looking at other sections after failing to dump a section
with fuzzed size.

The testcases at https://bugzilla.altlinux.org/show_bug.cgi?id=5871
on a 32-bit host now produce
$ strings -d --target=a.out-i386 /tmp/bfdkiller.dat
strings: error: /tmp/bfdkiller.dat(.text) is too large (0xffffffff bytes)
strings: /tmp/bfdkiller.dat: Reading section .text failed: Memory exhausted
strings: /tmp/bfdkiller.dat: Reading section .data failed: File truncated
org.ec
$ strings -d --target=a.out-i386 /tmp/eclipse-state
strings: /tmp/eclipse-state: Reading section .text failed: File truncated
org.eclipse.osgi
System Bundle
[snip]

* strings.c (filename_and_size_t): Delete.
(strings_a_section): Don't check section size against file size.
Use bdf_malloc_and_get_section.  Report an error on failures.
Replace arg param with filename and got_a_section param.
(got_a_section): Move to..
(strings_object_file): ..an auto var here.  Iterate over sections
rather than calling bfd_map_over_sections.  Adjust strings_a_section
call.

8 years agoSupport %Lx, %Lu, %Ld in _bfd_error_handler format
Alan Modra [Mon, 3 Jul 2017 12:29:45 +0000 (21:59 +0930)] 
Support %Lx, %Lu, %Ld in _bfd_error_handler format

One way to print 64-bit bfd_vma or bfd_size_type values on 32-bit
hosts is to cast the value to long long and use the 'll' modifier in
printf format strings.  However, that's awkward because we also
support the Microsoft C library printf that uses 'I64' as a modifier
instead, and having variants of translated strings would not endear us
to the translation project.  So, rewrite the 'll' modifier in
_doprint for Microsoft.  Even with that capability it's not so nice
for 32-bit code to need casts to long long, so this patch makes 'L' a
modifier for bfd_vma rather than an alias for 'll'.

I've then used the new 'L' modifier to fix selected format strings.

* bfd.c (_doprnt): Rewrite "ll" and "L" modifiers to "I64" for
__MSVCRT__.  Support "L" modifier for bfd_vma.  Formatting.
* elf.c (setup_group): Use "Lx" to print sh_size.
(_bfd_elf_setup_sections): Remove unnecessary cast and print
unknown section type in hex.
(copy_special_section_fields): Style fix.
(bfd_section_from_shdr): Correct format for sh_link.  Use a
common error message for all the variants of unrecognized
section types.
(assign_file_positions_for_load_sections): Use "Lx" for lma
adjust error message.
(assign_file_positions_for_non_load_sections): Formatting.
(rewrite_elf_program_header): Formatting.  Use "Lx" for
bfd_vma values in error messages.
* elfcode.h (elf_slurp_reloc_table_from_section): Cast
ELF_R_SYM value to type expected by format.
* elflink.c (elf_link_read_relocs_from_section): Use "Lx"
in error messages.
(elf_link_add_object_symbols): Use "Lu" for symbol sizes.
(elf_link_input_bfd): Use "Lx" for r_info.
(bfd_elf_gc_record_vtinherit): Use "Lx" for offset.

8 years agoBFD long long cleanup
Alan Modra [Mon, 3 Jul 2017 12:29:30 +0000 (21:59 +0930)] 
BFD long long cleanup

long long isn't supposed to be used without a configure test, to
support ancient compilers.  Probably not terribly important nowadays.

* bfd.c (bfd_scan_vma): Don't use long long unless HAVE_LONG_LONG.
* coff-rs6000.c (FMT20): Handle hosts with 64-bit long and
Microsoft C library variant of long long format specifier.
(PRINT20): Cast value to bfd_uint64_t not long long.
* coffcode.h (coff_print_aux): Use BFD_VMA_FMT.
* coff-x86_64.c (coff_amd64_reloc): Use bfd_uint64_t rather than
long long.  Don't cast to bfd_vma.
* elf32-score.c (score3_bfd_getl48): Likewise.
* vms-alpha.c (_bfd_vms_slurp_eisd): Likewise.

8 years agoMiscellaneous format string fixes
Alan Modra [Mon, 3 Jul 2017 12:26:29 +0000 (21:56 +0930)] 
Miscellaneous format string fixes

* elf.c (_bfd_elf_print_private_bfd_data): Use BFD_VMA_FMT to
print d_tag.
(bfd_elf_print_symbol): Don't cast symbol->flags.
(_bfd_elf_symbol_from_bfd_symbol): Likewise.
* elf32-ppc.c (ppc_elf_begin_write_processing): Correct
_bfd_error_handler argument order.
(ppc_elf_merge_private_bfd_data): Don't cast flags.

8 years agoMissing config for bfd.c:_doprnt
Alan Modra [Mon, 3 Jul 2017 12:25:57 +0000 (21:55 +0930)] 
Missing config for bfd.c:_doprnt

This function uses HAVE_LONG_LONG and HAVE_LONG_DOUBLE

* configure.ac: Invoke AC_CHECK_TYPES for long long.  Invoke
AC_TYPE_LONG_DOUBLE.
* configure: Regenerate.
* config.in: Regenerate.

8 years agoDisable symver test on hppa64-hpux
Alan Modra [Mon, 3 Jul 2017 12:25:21 +0000 (21:55 +0930)] 
Disable symver test on hppa64-hpux

The syntax for common symbols is different on that target.

* testsuite/gas/elf/symver.d: Don't run on hppa64-hpux.

8 years ago[GOLD] undef after using DW_IDX and friends
Alan Modra [Mon, 3 Jul 2017 12:16:59 +0000 (21:46 +0930)] 
[GOLD] undef after using DW_IDX and friends

* dwarf.h (DW_FIRST_IDX, DW_IDX, DW_IDX_DUP, DW_END_IDX): Undef
after using.

8 years agoRepair include/dwarf2.def breakage
Alan Modra [Mon, 3 Jul 2017 10:00:24 +0000 (19:30 +0930)] 
Repair include/dwarf2.def breakage

* dwarf.h (DW_FIRST_IDX, DW_IDX, DW_IDX_DUP, DW_END_IDX): Define.

8 years agobuffer.h: Fix spelling mistakes
Simon Marchi [Mon, 3 Jul 2017 11:59:00 +0000 (13:59 +0200)] 
buffer.h: Fix spelling mistakes

gdb/ChangeLog:

* buffer.h (buffer_finish): Fix spelling mistakes.

8 years agoAutomatic date update in version.in
GDB Administrator [Mon, 3 Jul 2017 00:00:39 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoDWARF-5: readelf: .debug_names
Jan Kratochvil [Sun, 2 Jul 2017 20:15:05 +0000 (22:15 +0200)] 
DWARF-5: readelf: .debug_names

Display DWARF-5 .debug_names (standardized .gdb_index).

binutils/ChangeLog
2017-07-02  Jan Kratochvil  <jan.kratochvil@redhat.com>

* dwarf.c: Include assert.h.
(MAX, MIN, get_IDX_name, display_debug_names): New.
(debug_displays): Add .debug_names.
* dwarf.h: (enum dwarf_section_display_enum): Add debug_names.
* readelf.c (process_section_headers): Add ".debug_names".

8 years agoImport include/+libiberty/ r249883 from upstream GCC.
Jan Kratochvil [Sun, 2 Jul 2017 20:09:52 +0000 (22:09 +0200)] 
Import include/+libiberty/ r249883 from upstream GCC.

include/ChangeLog
2017-07-02  Jan Kratochvil  <jan.kratochvil@redhat.com>

* dwarf2.def (DW_IDX_compile_unit, DW_IDX_type_unit, DW_IDX_die_offset)
(DW_IDX_parent, DW_IDX_type_hash, DW_IDX_lo_user, DW_IDX_hi_user)
(DW_IDX_GNU_internal, DW_IDX_GNU_external): New.
* dwarf2.h (DW_IDX, DW_IDX_DUP, DW_FIRST_IDX, DW_END_IDX): New.
(enum dwarf_name_index_attribute): Remove.
(get_DW_IDX_name): New declaration.

libiberty/ChangeLog
2017-07-02  Jan Kratochvil  <jan.kratochvil@redhat.com>

* dwarfnames.c (DW_FIRST_IDX, DW_END_IDX, DW_IDX, DW_IDX_DUP): New.

8 years agoAutomatic date update in version.in
GDB Administrator [Sun, 2 Jul 2017 00:00:47 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoUse bfd_malloc_and_get_section
Alan Modra [Sat, 1 Jul 2017 12:28:10 +0000 (21:58 +0930)] 
Use bfd_malloc_and_get_section

It's nicer than xmalloc followed by bfd_get_section_contents, since
xmalloc exits on failure and needs a check that its size_t arg doesn't
lose high bits when converted from bfd_size_type.

PR binutils/21665
* objdump.c (strtab): Make var a bfd_byte*.
(disassemble_section): Don't limit malloc size.  Instead, use
bfd_malloc_and_get_section.
(read_section_stabs): Use bfd_malloc_and_get_section.  Return
bfd_byte*.
(find_stabs_section): Remove now unnecessary cast.
* objcopy.c (copy_object): Use bfd_malloc_and_get_section.  Free
contents on error return.
* nlmconv.c (copy_sections): Use bfd_malloc_and_get_section.

8 years agoSetup .dir-locals.el to use C-style comments by default
Eli Zaretskii [Sat, 1 Jul 2017 15:45:57 +0000 (18:45 +0300)] 
Setup .dir-locals.el to use C-style comments by default

gdb/ChangeLog:
2017-07-01  Eli Zaretskii  <eliz@gnu.org>

* .dir-locals.el: Automatically switch to C-style comments in
versions of Emacs that support the feature.

8 years agoAutomatic date update in version.in
GDB Administrator [Sat, 1 Jul 2017 00:00:41 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoMIPS/GAS: Use a switch on relaxation type in microMIPS fixup creation
Maciej W. Rozycki [Fri, 30 Jun 2017 23:42:19 +0000 (00:42 +0100)] 
MIPS/GAS: Use a switch on relaxation type in microMIPS fixup creation

Use a switch on the relaxation type rather than a chain of conditionals
in microMIPS fixup creation, improving source code structure and aiding
the compiler with code generation.

gas/
* config/tc-mips.c (md_convert_frag): Use a switch on the
microMIPS relaxation type rather than a chain of conditionals.

8 years agoMIPS/GAS: Use frag symbol/offset directly in fixup creation
Maciej W. Rozycki [Fri, 30 Jun 2017 23:42:19 +0000 (00:42 +0100)] 
MIPS/GAS: Use frag symbol/offset directly in fixup creation

There is no need to use a helper expression in the creation of fixups
made from a frag's symbol and offset, because a simple `symbol+offset'
expression can be handled directly, with the use of a `fix_new' rather
than a `fix_new_exp' call.  Rewrite `md_convert_frag' using `fix_new'
then and remove all the unneeded helper expressions, simplifying code.

gas/
* config/tc-mips.c (md_convert_frag): Rewrite `fix_new_exp'
calls in terms of `fix_new'.

8 years agoMIPS/GAS: Use non-zero frag offset directly in PIC branch relaxation
Maciej W. Rozycki [Fri, 30 Jun 2017 23:42:19 +0000 (00:42 +0100)] 
MIPS/GAS: Use non-zero frag offset directly in PIC branch relaxation

Use frag symbols with a non-zero offset directly in `fix_new_exp' calls
made in PIC branch relaxation.  There is no need here to make a helper
symbol to hold the result of a `symbol+offset' calculation requested as
only branches to local symbols are relaxed and in this case the LO16
part of the PIC address load sequence will have the offset accounted for
in calculation against the local GOT entry retrieved as the GOT16 high
part.  Consequently actual code produed is identical whether a helper
symbol is used or the original `symbol+offset' expression used directly.
Verify that this is indeed the case with GAS and LD tests.

gas/
* config/tc-mips.c (md_convert_frag): Don't make a helper
expression symbol for `fix_new_exp' called with a non-zero
offset.
* testsuite/gas/mips/relax-offset.d: New test.
* testsuite/gas/mips/mips1@relax-offset.d: New test.
* testsuite/gas/mips/r3000@relax-offset.d: New test.
* testsuite/gas/mips/r3900@relax-offset.d: New test.
* testsuite/gas/mips/micromips@relax-offset.d: New test.
* testsuite/gas/mips/relax-offset.l: New stderr output.
* testsuite/gas/mips/relax-offset.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.

ld/
* testsuite/ld-mips-elf/relax-offset.dd: New test.
* testsuite/ld-mips-elf/relax-offset.gd: New test.
* testsuite/ld-mips-elf/relax-offset-umips.dd: New test.
* testsuite/ld-mips-elf/relax-offset-umips.gd: New test.
* testsuite/ld-mips-elf/relax-offset.ld: New test linker script.
* testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
(prune_warnings): New temporary procedure.

8 years agoAdd support for a __gcc_isr pseudo isntruction to the AVR assembler.
Georg-Johann Lay [Fri, 30 Jun 2017 15:37:39 +0000 (16:37 +0100)] 
Add support for a __gcc_isr pseudo isntruction to the AVR assembler.

    PR gas/21683
include * opcode/avr.h (AVR_INSN): Add one for __gcc_isr.

gas * doc/c-avr.texi (AVR Options) <-mgcc-isr>: Document it.
    (AVR Pseudo Instructions): New node.
    * config/tc-avr.h (md_pre_output_hook): Define to avr_pre_output_hook.
    (md_undefined_symbol): Define to avr_undefined_symbol.
    (avr_pre_output_hook, avr_undefined_symbol): New protos.
    * config/tc-avr.c (struc-symbol.h): Include it.
    (ISR_CHUNK_Done, ISR_CHUNK_Prologue, ISR_CHUNK_Epilogue): New enums.
    (avr_isr, avr_gccisr_opcode)
    (avr_no_sreg_hash, avr_no_sreg): New static variables.
    (avr_opt_s) <have_gccisr>: Add field.
    (avr_opt): Add initializer for have_gccisr.
    (enum options) <OPTION_HAVE_GCCISR>: Add enum.
    (md_longopts) <"mgcc-isr">: Add entry.
    (md_show_usage): Document -mgcc-isr.
    (md_parse_option) [OPTION_HAVE_GCCISR]: Handle it.
    (md_undefined_symbol): Remove.
    (avr_undefined_symbol, avr_pre_output_hook): New fuctions.
    (md_begin) <avr_no_sreg_hash, avr_gccisr_opcode>: Initialize them.
    (avr_operand) <pregno>: Add argument and set *pregno if function
    is called for a register constraint.
    [N]: Handle constraint.
    (avr_operands) <avr_operand>: Pass 5th parameter to calls.
    [avr_opt.have_gccisr]: Call avr_update_gccisr.  Call
    avr_gccisr_operands instead of avr_operands.
    (avr_update_gccisr, avr_emit_insn, avr_patch_gccisr_frag)
    (avr_gccisr_operands, avr_check_gccisr_done): New static functions.
    * testsuite/gas/avr/gccisr-01.d: New test.
    * testsuite/gas/avr/gccisr-01.s: New test.
    * testsuite/gas/avr/gccisr-02.d: New test.
    * testsuite/gas/avr/gccisr-02.s: New test.
    * testsuite/gas/avr/gccisr-03.d: New test.
    * testsuite/gas/avr/gccisr-03.s: New test.

8 years agoMIPS/GAS: Update `match_float_constant' and `match_operand' descriptions
Maciej W. Rozycki [Fri, 30 Jun 2017 14:39:26 +0000 (15:39 +0100)] 
MIPS/GAS: Update `match_float_constant' and `match_operand' descriptions

Complement commit a92713e60ef4 ("Preparse MIPS instructions into
tokens"), <https://sourceware.org/ml/binutils/2013-07/msg00143.html>,
and update `match_float_constant' and `match_operand' function
descriptions according to semantics changes.

gas/
* config/tc-mips.c (match_float_constant): Update description.
(match_operand): Likewise.

8 years agoMIPS/opcodes: Reorder LSA and DLSA instructions
Maciej W. Rozycki [Fri, 30 Jun 2017 14:27:18 +0000 (15:27 +0100)] 
MIPS/opcodes: Reorder LSA and DLSA instructions

Correct an issue introduced with commit 7361da2c952e ("Add support for
MIPS R6.") and move the LSA and DLSA instructions back to the MSA ASE
instruction block in the regular MIPS opcode table.  Adjust formatting
around the "MIPS r6" heading.

opcodes/
* mips-opc.c (mips_builtin_opcodes): Move "lsa" and "dlsa"
entries to the MSA ASE instruction block.

8 years agoPR cli/21688: Detect aliases when issuing python/compile/guile commands (and fix...
Sergio Durigan Junior [Fri, 30 Jun 2017 12:27:29 +0000 (08:27 -0400)] 
PR cli/21688: Detect aliases when issuing python/compile/guile commands (and fix last commit)

My last commit fixed a regression that happened when using
inline/multi-line commands for Python/Compile/Guile, but introduced
another regression: it is now not possible to use aliases for the
commands mentioned above.  The fix is to almost revert the change I've
made and go back to using the 'struct cmd_list_element *', but at the
same time make sure that we advance the 'cmd_name' variable past all
the whitespace characters after the command name.  If, after skipping
the whitespace, we encounter a '\0', it means that the command is not
inline.  Otherwise, it is.

This patch also expands the testcase in order to check for aliases and
for trailing whitespace after the command name.

gdb/ChangeLog:
2017-06-30  Sergio Durigan Junior  <sergiodj@redhat.com>
    Pedro Alves  <palves@redhat.com>

PR cli/21688
* cli/cli-script.c (command_name_equals_not_inline): Remove function.
(process_next_line): New variable 'inline_cmd'.
Adjust 'if' clauses for "python", "compile" and "guile" to use
'command_name_equals' and check for '!inline_cmd'.

gdb/testsuite/ChangeLog:
2017-06-30  Sergio Durigan Junior  <sergiodj@redhat.com>

PR cli/21688
* gdb.python/py-cmd.exp (test_python_inline_or_multiline): Add new
tests for alias commands and trailing whitespace.

8 years agoPR cli/21688: Fix multi-line/inline command differentiation
Sergio Durigan Junior [Thu, 29 Jun 2017 01:55:03 +0000 (21:55 -0400)] 
PR cli/21688: Fix multi-line/inline command differentiation

This bug is a regression caused by the following commit:

  604c4576fdcfc4e7c28f569b3748a1b6b4e0dbd4 is the first bad commit
  commit 604c4576fdcfc4e7c28f569b3748a1b6b4e0dbd4
  Author: Jerome Guitton <guitton@adacore.com>
  Date:   Tue Jan 10 15:15:53 2017 +0100

The problem happens because, on cli/cli-script.c:process_next_line,
GDB is not using the command line string to identify which command to
run, but it instead using the 'struct cmd_list_element *' that is
obtained by using the mentioned string.  The problem with that is that
the 'struct cmd_list_element *' doesn't have any information on
whether the command issued by the user is a multi-line or inline one.

A multi-line command is a command that will necessarily be composed of
more than 1 line.  For example:

  (gdb) if 1
  >python
   >print ('hello')
   >end
  >end

As can be seen in the example above, the 'python' command actually
"opens" a new command line (represented by the change in the
indentation) that will then be used to enter Python code.  OTOH, an
inline command is a command that is "self-contained" in a single line,
for example:

  (gdb) if 1
  >python print ('hello')
  >end

This Python command is a one-liner, and therefore there is no other
Python code that can be entered for this same block.  There is also no
change in the indentation.

So, the fix is somewhat simple: we have to revert the change and use
the full command line string passed to process_next_line in order to
identify whether we're dealing with a multi-line or an inline command.
This commit does just that.  As can be seen, this regression also
affects other languages, like guile or the compile framework.  To make
things clearer, I decided to create a new helper function responsible
for identifying a non-inline command.

Testcase is attached.

gdb/ChangeLog:
2017-06-30  Sergio Durigan Junior  <sergiodj@redhat.com>

PR cli/21688
* cli/cli-script.c (command_name_equals_not_inline): New function.
(process_next_line): Adjust 'if' clauses for "python", "compile"
and "guile" to use command_name_equals_not_inline.

gdb/testsuite/ChangeLog:
2017-06-30  Sergio Durigan Junior  <sergiodj@redhat.com>

PR cli/21688
* gdb.python/py-cmd.exp (test_python_inline_or_multiline): New
procedure.  Call it.

8 years agoFix failures in MMIX linker tests introduced by fix for PR 21665.
Nick Clifton [Fri, 30 Jun 2017 10:03:37 +0000 (11:03 +0100)] 
Fix failures in MMIX linker tests introduced by fix for PR 21665.

PR binutils/21665
* objdump.c (disassemble_section): Move check for an overlarge
section to just before the allocation of memory.  Do not check
section size against file size, but instead use an arbitrary 2Gb
limit.  Issue a warning message if the section is too big.

8 years agoMIPS: Add Imagination interAptiv MR2 MIPS32r3 processor support (ChangeLog)
Maciej W. Rozycki [Fri, 30 Jun 2017 06:21:56 +0000 (07:21 +0100)] 
MIPS: Add Imagination interAptiv MR2 MIPS32r3 processor support (ChangeLog)

Correct ChangeLog entry for commit 38bf472a1521 ("MIPS: Add Imagination
interAptiv MR2 MIPS32r3 processor support").

8 years agoMIPS: Add microMIPS XPA support
Maciej W. Rozycki [Fri, 30 Jun 2017 06:21:56 +0000 (07:21 +0100)] 
MIPS: Add microMIPS XPA support

Add support for the base and Virtualization ASE microMIPS instructions
as per the architecture specifications[1][2][3][4].

Most of this change by Andrew Bennett.

[1] "MIPS Architecture for Programmers Volume II-B: The microMIPS32
    Instruction Set", MIPS Technologies, Inc., Document Number: MD00582,
    Revision 5.04, January 15, 2014, Section 5.5 "Recoded 32-Bit
    Instructions", p. 340

[2] "microMIPS32 Architecture for Programmers Volume IV-i:
    Virtualization Module of the microMIPS32 Architecture", MIPS
    Technologies, Inc., Document Number: MD00848, Revision 1.06,
    December 10, 2013, Section 6.1 "Overview", pp. 133, 136

[3] "MIPS Architecture for Programmers Volume II-B: The microMIPS64
    Instruction Set", MIPS Technologies, Inc., Document Number: MD00594,
    Revision 5.04, January 15, 2014, Section 5.5 "Recoded 32-Bit
    Instructions", pp. 415, 444

[4] "microMIPS64 Architecture for Programmers Volume IV-i:
    Virtualization Module of the microMIPS64 Architecture", MIPS
    Technologies, Inc., Document Number: MD00849, Revision 1.06,
    December 10, 2013, Section 6.1 "Overview", pp. 134-135, 139-140

binutils/
* NEWS: Mention microMIPS XPA support.

opcodes/
* micromips-opc.c (XPA, XPAVZ): New macros.
(micromips_opcodes): Add "mfhc0", "mfhgc0", "mthc0" and
"mthgc0".

gas/
* config/tc-mips.c (mips_ases): Add microMIPS XPA support.
* testsuite/gas/mips/micromips@xpa.d: New test.
* testsuite/gas/mips/mips.exp: Run the new test.  Enable
`xpa-virt-err' test for `micromips'.

8 years agoMIPS: Add microMIPS R5 support
Maciej W. Rozycki [Fri, 30 Jun 2017 06:21:56 +0000 (07:21 +0100)] 
MIPS: Add microMIPS R5 support

Add base microMIPS Release 5 ISA support and the ERETNC instruction in
particular, as per the architecture specifications[1][2].

Most of this change by Andrew Bennett.

References:

[1] "MIPS Architecture for Programmers Volume II-B: The microMIPS32
    Instruction Set", MIPS Technologies, Inc., Document Number: MD00582,
    Revision 5.04, January 15, 2014, Section 5.5 "Recoded 32-Bit
    Instructions", pp. 266-267

[2] "MIPS Architecture for Programmers Volume II-B: The microMIPS64
    Instruction Set", MIPS Technologies, Inc., Document Number: MD00594,
    Revision 5.04, January 15, 2014, Section 5.5 "Recoded 32-Bit
    Instructions", pp. 326-327

binutils/
* NEWS: Mention microMIPS Release 5 ISA support.

opcodes/
* micromips-opc.c (I36): New macro.
(micromips_opcodes): Add "eretnc".

gas/
* testsuite/gas/mips/micromips@r5.d: New test.
* testsuite/gas/mips/mips.exp: Run the new test.

8 years agoMIPS: Fix XPA base and Virtualization ASE instruction handling
Maciej W. Rozycki [Fri, 30 Jun 2017 06:21:55 +0000 (07:21 +0100)] 
MIPS: Fix XPA base and Virtualization ASE instruction handling

Correct a commit 7d64c587c15f ("Add support for the MIPS eXtended
Physical Address (XPA) ASE.") bug, causing XPA base and Virtualization
ASE instructions to be wrongly always enabled with the selection of the
MIPS32r2 or higher ISA.

For example this source assembles successfully as shown below:

$ cat xpa.s
mfhc0 $2, $1
$ as -32 -mips32 -o xpa.o xpa.s
xpa.s: Assembler messages:
xpa.s:1: Error: opcode not supported on this processor: mips32 (mips32) `mfhc0 $2,$1'
$ as -32 -mips32r2 -o xpa.o xpa.s
$ objdump -d xpa.o

xpa.o:     file format elf32-tradbigmips

Disassembly of section .text:

00000000 <.text>:
   0: 40420800  mfhc0 v0,c0_random
...
$

To address this issue remove the I33 (INSN_ISA32R2) marking from all XPA
instructions in the opcode table.  Additionally, for XPA Virtualization
ASE instructions implement an XPAVZ (ASE_XPA_VIRT) combination ASE flag
and use it in place of IVIRT|XPA (ASE_VIRT|ASE_XPA).

Now the same source is correctly rejected unless the `-mxpa' option is
also used:

$ as -32 -mips32r2 -o xpa.o xpa.s
xpa.s: Assembler messages:
xpa.s:1: Error: opcode not supported on this processor: mips32r2 (mips32r2) `mfhc0 $2,$1'
$ as -32 -mips32r2 -mxpa -o xpa.o xpa.s
$

Add test cases for XPA base and XPA Virtualization ASE instructions.

Parts of this change by Andrew Bennett.

include/
* opcode/mips.h (ASE_XPA_VIRT): New macro.

opcodes/
* mips-dis.c (mips_calculate_combination_ases): Handle the
ASE_XPA_VIRT flag.
(parse_mips_ase_option): New function.
(parse_mips_dis_option): Factor out ASE option handling to the
new function.  Call `mips_calculate_combination_ases'.
* mips-opc.c (XPAVZ): New macro.
(mips_builtin_opcodes): Correct ISA and ASE flags for "mfhc0",
"mfhgc0", "mthc0" and "mthgc0".

gas/
* config/tc-mips.c (mips_set_ase): Handle the ASE_XPA_VIRT flag.
* testsuite/gas/mips/xpa.d: Remove `xpa' from `-M' in `objdump'
flags.  Add `-mvirt' to `as' flags.
* testsuite/gas/mips/xpa-err.d: New test.
* testsuite/gas/mips/xpa-virt-err.d: New test.
* testsuite/gas/mips/xpa-err.l: New stderr output.
* testsuite/gas/mips/xpa-virt-err.l: New stderr output.
* testsuite/gas/mips/xpa-err.s: New test source.
* testsuite/gas/mips/xpa-virt-err.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new tests.

binutils/
* testsuite/binutils-all/mips/mips-xpa-virt-1.d: New test.
* testsuite/binutils-all/mips/mips-xpa-virt-2.d: New test.
* testsuite/binutils-all/mips/mips-xpa-virt-3.d: New test.
* testsuite/binutils-all/mips/mips-xpa-virt-4.d: New test.
* testsuite/binutils-all/mips/mips-xpa-virt.s: New test source.
* testsuite/binutils-all/mips/mips.exp: Run the new tests.

8 years agoAutomatic date update in version.in
GDB Administrator [Fri, 30 Jun 2017 00:00:30 +0000 (00:00 +0000)] 
Automatic date update in version.in

8 years agoMIPS/opcodes: Correctly combine ASE flags for ASE_MIPS16E2_MT calculation
Maciej W. Rozycki [Thu, 29 Jun 2017 23:55:07 +0000 (00:55 +0100)] 
MIPS/opcodes: Correctly combine ASE flags for ASE_MIPS16E2_MT calculation

Correct a commit 25499ac7ee92 ("MIPS16e2: Add MIPS16e2 ASE support")
disassembler bug with the handling of the ASE_MIPS16E2_MT combination
ASE flag, where the calculation uses MIPS ABI Flags directly rather than
calculated internal ASE flags.  Consequently code does not correctly set
the ASE_MIPS16E2_MT flag when the MIPS16e2 ASE flag and the MT ASE flag
come from different sources, i.e. one from the BFD chosen and the other
one from MIPS ABI Flags.

Fix this by using internal ASE_MT and ASE_MIPS16E2 flags in a separate
subsequent step, factored out to a dedicated function for use with
future combination ASE flags.  Adjust the `mips16e2@mips16e2-mt-sub.d'
test case accordingly, where the MT flag comes from the BFD selected for
the disassembler and the MIPS16e2 flag comes from the ELF binary itself.

opcodes/
* mips-dis.c (mips_calculate_combination_ases): New function.
(mips_convert_abiflags_ases): Factor out ASE_MIPS16E2_MT
calculation to the new function.
(set_default_mips_dis_options): Call the new function.

gas/
* testsuite/gas/mips/mips16e2@mips16e2-mt-sub.d: Adjust for the
ASE_MIPS16E2_MT flag disassembler fix.
* testsuite/gas/mips/mips16e2-interaptiv-mr2@mips16e2-mt-sub.d:
Likewise.

8 years agoMIPS/GAS: Clear the ASE_MIPS16E2_MT flag for recalculation
Maciej W. Rozycki [Thu, 29 Jun 2017 23:55:07 +0000 (00:55 +0100)] 
MIPS/GAS: Clear the ASE_MIPS16E2_MT flag for recalculation

Correct a commit 25499ac7ee92 ("MIPS16e2: Add MIPS16e2 ASE support") GAS
bug with the handling of the ASE_MIPS16E2_MT combination ASE flag, which
is not correctly calculated as `.set nomips16e2' and `.set nomt'
pseudo-ops are processed.  This leads to code like:

$ cat foo.s
.set nomt
evpe
.align 4, 0
$ cat bar.s
.set nomips16e2
dvpe
.align 4, 0
$

to successfully assemble where it should not:

$ as -32 -mips32r3 -mmt -mips16 -mmips16e2 -o foo.o foo.s
$ as -32 -mips32r3 -mmt -mips16 -mmips16e2 -o bar.o bar.s
$ objdump -m mips:16 -d foo.o

foo.o:     file format elf32-tradbigmips

Disassembly of section .text:

00000000 <.text>:
   0: f027 6700  evpe
...

bar.o:     file format elf32-tradbigmips

Disassembly of section .text:

00000000 <.text>:
   0: f026 6700  dvpe
...
$

This happens because ASE_MIPS16E2_MT once set in `mips_set_ase' is never
cleared.  Fix the problem by clearing it there before it is calculated
based on the ASE_MT and ASE_MIPS16E2 flags, making assembly fail as
expected:

$ as -32 -mips32r3 -mmt -mips16 -mmips16e2 -o foo.o foo.s
foo.s: Assembler messages:
foo.s:2: Error: opcode not supported on this processor: mips32r3 (mips32r3) `evpe'
$ as -32 -mips32r3 -mmt -mips16 -mmips16e2 -o bar.o bar.s
bar.s: Assembler messages:
bar.s:2: Error: opcode not supported on this processor: mips32r3 (mips32r3) `dvpe'
$

gas/
* config/tc-mips.c (mips_set_ase): Clear the ASE_MIPS16E2_MT
flag before recalculating.
* testsuite/gas/mips/mips16e2-mt-err.d: New test.
* testsuite/gas/mips/mips16e2-mt-err.l: New stderr output.
* testsuite/gas/mips/mips16e2-mt-err.s: New test source.
* testsuite/gas/mips/mips.exp: Run the new test.

8 years agoRISC-V: Fix TLS copy relocs
Andrew Waterman [Wed, 28 Jun 2017 05:44:24 +0000 (22:44 -0700)] 
RISC-V: Fix TLS copy relocs

The dynrelro introduction wasn't implemented quite right for RISC-V,
as it didn't consider TLS copy relocs.

bfd/ChangeLog

2017-06-29  Andrew Waterman  <andrew@sifive.com>

        * elfnn-riscv.c (riscv_elf_adjust_dynamic_symbol): Fix TLS copy
        relocs.

8 years agoExpression completer should not match explicit location options
Pedro Alves [Thu, 29 Jun 2017 14:52:38 +0000 (15:52 +0100)] 
Expression completer should not match explicit location options

This commit fixes a mismatch between what "print" command completer
thinks the command understands, and what the command actually
understands.

The explicit location options are understood by commands that take
(linespecs and) explicit locations as argument.  I.e, breakpoint
commands, and "list".  For example:

 (gdb) b -source file.c -function my_func

So for those commands, it makes sense that the completer
completes:

 "b -sour[TAB]" -> "b -source "
 "b -functi[TAB]" -> "b -function "

etc.

However, completion for commands that take expressions (not
linespecs/locations) as arguments, such as the "print" command, also
completes the explicit location options, even though those switches
aren't really understood by these commands.  Instead, "-foo" is
understood as an expression applying unary minus on a symbol named
"foo" (think "print -1"):

 (gdb) p -func[TAB]
 (gdb) p -function [RET]
 No symbol "function" in current context.

The patch fixes this by having the expression_completer function
bypass the function that completes explicit locations.

New regression tests included.

gdb/ChangeLog:
2017-06-29  Pedro Alves  <palves@redhat.com>

* completer.c (expression_completer): Call
linespec_location_completer instead of location_completer.

gdb/testsuite/ChangeLog:
2017-06-29  Pedro Alves  <palves@redhat.com>

* gdb.base/printcmds.exp: Add tests.

8 years agoRemove old stale expression_completer hack
Pedro Alves [Thu, 29 Jun 2017 14:52:37 +0000 (15:52 +0100)] 
Remove old stale expression_completer hack

The code in question was introduced by:

 https://sourceware.com/ml/gdb-patches/2008-06/msg00143.html

"The fix is to make sure that the entire expression is passed to
expression_completer, then duplicate some logic there in the case
where location_completer is called."

The logic that was duplicated was much later on removed by the
original explicit locations patch:

 commit 87f0e7204722a986f79f245eee716f0870832d47
 Author:     Keith Seitz <keiths@redhat.com>
 AuthorDate: Tue Aug 11 17:09:36 2015 -0700
 Commit:     Keith Seitz <keiths@redhat.com>
 CommitDate: Tue Aug 11 17:09:36 2015 -0700

     Explicit locations: add UI features for CLI

 @@ -688,16 +880,6 @@ complete_line_internal (const char *text,
       rl_completer_word_break_characters =
 gdb_completer_file_name_break_characters;
     }
 -                 else if (c->completer == location_completer)
 -                   {
 -                     /* Commands which complete on locations want to
 -                        see the entire argument.  */
 -                     for (p = word;
 -                          p > tmp_command
 -                            && p[-1] != ' ' && p[-1] != '\t';
 -                          p--)
 -                       ;
 -                   }

However this case in expression_completer was left behind.

I couldn't come up with a test where this currently makes any
difference.

gdb/ChangeLog:
2017-06-29  Pedro Alves  <palves@redhat.com>

* completer.c (expression_completer): Remove code that recomputes
'text' from 'word'.