deliverable/binutils-gdb.git
6 years agoExtend the assembler so that it can automatically generate GNU Build attribute notes...
Nick Clifton [Thu, 26 Apr 2018 14:12:42 +0000 (15:12 +0100)] 
Extend the assembler so that it can automatically generate GNU Build attribute notes if none are present in the input files.

gas * as.c (flag_generate_build_notes): New variable.
(show_usage): Add entry for --generate-missing-build-notes.
(parse_args): Parse --generate-missing-build-notes.
* as.h: Export flag_generate_build_notes.
* symbols.c (save_symbol_name): Ensure that the name parameter is
not NULL.
* write.c (create_obj_attrs_section): Reformat.
(create_note_reloc): New function - creates a relocation for a
field in a GNU Build attribute note.
(maybe_generate_build_notes): New function - created GNU Build
attribute notes if none are present in the output file.
(write_object_file): Call maybe_generate_build_notes.
* configure.ac (--enable-generate-build-notes): New option.
* NEWS: Announce the new feature.
* doc/as.textinfo: Document the new option.
* config.in: Regenerate.
* configure: Regenerate.

binutils* readelf.c (is_32bit_abs_reloc): Support R_PARISC_DIR32 as a
32-bit absolute reloc for the HPPA target.
* testsuite/binutils-all/note-5.d: New test.
* testsuite/binutils-all/note-5.s: Source file for new test.
* testsuite/binutils-all/objcopy.exp: Run new test.

6 years ago[ld/testsuite] Fix pr2404 output.
Christophe Lyon [Thu, 26 Apr 2018 13:44:33 +0000 (13:44 +0000)] 
[ld/testsuite] Fix pr2404 output.

2018-04-26  Christophe Lyon  <christophe.lyon@linaro.org>

* testsuite/ld-elf/pr2404b.c (main): Adjust printf to account for
new variable name.
* testsuite/ld-elf/pr2404.out: Adjust expected output accordingly.

6 years agoFix resolving GNU ifunc bp locations when inferior runs resolver
Pedro Alves [Thu, 26 Apr 2018 12:01:27 +0000 (13:01 +0100)] 
Fix resolving GNU ifunc bp locations when inferior runs resolver

I noticed that if you set a breakpoint on an ifunc before the ifunc is
resolved, and then let the program call the ifunc, thus resolving it,
GDB end up with a location for that original breakpoint that is
pointing to the ifunc target, but it is left pointing to the first
address of the function, instead of after its prologue.  After
prologue is what you get if you create a new breakpoint at that point.

1) With no debug info for the target function:

  1.a) Set before resolving, and then program continued passed resolving:

    Num     Type           Disp Enb Address            What
    1       breakpoint     keep y   0x0000000000400753 <final>

  1.b) Breakpoint set after inferior resolved ifunc:

    Num     Type           Disp Enb Address            What
    2       breakpoint     keep y   0x0000000000400757 <final+4>

2) With debug info for the target function:

   1.a) Set before resolving, and then program continued passed resolving:

     Num     Type           Disp Enb Address            What
     1       breakpoint     keep y   0x0000000000400753 in final at gdb/testsuite/gdb.base/gnu-ifunc-final.c:20

   1.b) Breakpoint set after inferior resolved ifunc:

     Num     Type           Disp Enb Address            What
     2       breakpoint     keep y   0x000000000040075a in final at gdb/testsuite/gdb.base/gnu-ifunc-final.c:21

The problem is that elf_gnu_ifunc_resolver_return_stop (called by the
internal breakpoint that traps the resolver returning) does not agree
with linespec.c:minsym_found.  It does not skip to the function's
start line (i.e., past the prologue).  We can now use the
find_function_start_sal overload added by the previous commmit to fix
this.

New tests included, which fail before the patch, and pass afterwards.

gdb/ChangeLog:
2018-04-26  Pedro Alves  <palves@redhat.com>

* elfread.c (elf_gnu_ifunc_resolver_return_stop): Use
find_function_start_sal instead of find_pc_line.

gdb/testsuite/ChangeLog:
2018-04-26  Pedro Alves  <palves@redhat.com>

* gdb.base/gnu-ifunc.exp (set-break): Test that GDB resolves
ifunc breakpoint locations correctly of ifunc breakpoints set
while the program resolves the ifunc.

6 years agoExtend GNU ifunc testcases
Pedro Alves [Thu, 26 Apr 2018 12:01:27 +0000 (13:01 +0100)] 
Extend GNU ifunc testcases

This patch extends/rewrites the gdb.base/gnu-ifunc.exp testcase to
cover the many different fixes in earlier patches.  (This was actually
what encovered most of the problems.)

The current testcase uses an ifunc symbol with the same name as the
ifunc resolver symbol and makes sure to compile the ifunc resolver
without debug info.  That does not model how ifuncs are implemented in
gcc/ifunc nowadays.  Instead, what we have is that the glibc ifunc
resolvers nowadays are written in C and end up with debug info.

Also, in some cases the ifunc target is written in assembly, but in
other cases it's written in C.  In the case of target function written
in C, if the target function has debug info, when we set a break on
the ifunc, we want to set it past the prologue of the target function.
Currently GDB gets that wrong.

To make sure we cover all the different scenarios, the testcase is
tweaked to cover all the different combinations of

 - An ifunc resolver with the same name as the user-visible symbol vs
   an ifunc resolver with a different name as the user-visible symbol.

 - ifunc resolver compiled with and without debug info.

 - ifunc target function compiled with and without debug info.

The testcase currently sets breakpoints on ifuncs, calls ifunc
functions, steps into ifunc functions, etc.  After this series, this
all works and the testcase passes cleanly.

While working on this, I noticed that "b gnu_ifunc" before and after
the inferior resolved the ifunc would end up with a breakpoint with
different locations.  That's now covered by new tests inside the new
"set-break" procedure.

It also tests other things like making sure we can't call an ifunc
without a return-type case if we don't know the type of the target.
And making sure that we pass enough arguments when we do know the
type.

gdb/testsuite/ChangeLog:
2018-04-26  Pedro Alves  <palves@redhat.com>

* gdb.base/gnu-ifunc-final.c: New file.
* gdb.base/gnu-ifunc.c (final): Delete, moved to gnu-ifunc-final.c.
* gdb.base/gnu-ifunc.exp (executable): Delete.
(staticexecutable): Adjust.
(lib_opts, exec_opts): Delete.
(make_binsuffix, build, set-break): New procedures.
(misc_tests): New, with tests factored out from the top level.
(top level): Test different combinations of ifunc resolver name,
resolver with and with debug info, and ifunc target with and
without debug info.  Wrap static tests with with_target_prefix.

6 years agoPPC64: always make synthetic .text symbols for GNU ifunc symbols
Pedro Alves [Thu, 26 Apr 2018 12:01:27 +0000 (13:01 +0100)] 
PPC64: always make synthetic .text symbols for GNU ifunc symbols

If you create an ifunc using GCC's __attribute__ ifunc, like:

 extern int gnu_ifunc (int arg);
 static int gnu_ifunc_target (int arg) { return 0; }
 __typeof (gnu_ifunc) *gnu_ifunc_resolver (unsigned long hwcap) { return gnu_ifunc_target; }
 __typeof (gnu_ifunc) gnu_ifunc __attribute__ ((ifunc ("gnu_ifunc_resolver")));

then you end up with two (function descriptor) symbols, one for the
ifunc itself, and another for the resolver:

   (...)
   12: 0000000000020060    104 FUNC    GLOBAL DEFAULT       18 gnu_ifunc_resolver
   (...)
   16: 0000000000020060    104 GNU_IFUNC GLOBAL DEFAULT       18 gnu_ifunc
   (...)

Both ifunc and resolver symbols have the same address/value, so
ppc64_elf_get_synthetic_symtab only creates a synthetic text symbol
for one of them.  In the case above, it ends up being created for the
resolver, only:

  (gdb) maint print msymbols
  (...)
  [ 7] t 0x980 .frame_dummy section .text
  [ 8] T 0x9e4 .gnu_ifunc_resolver section .text
  [ 9] T 0xa58 __glink_PLTresolve section .text
  (...)

GDB needs to know when a program stepped into an ifunc resolver, so
that it can know whether to step past the resolver into the target
function without the user noticing.  The way GDB does it is my
checking whether the current PC points to an ifunc symbol (since
resolver and ifunc have the same address by design).

The problem is then that ppc64_elf_get_synthetic_symtab never creates
the synchetic symbol for the ifunc, so GDB stops stepping at the
resolver (in a test added by the following patch):

  (gdb) step
  gnu_ifunc_resolver (hwcap=21) at gdb/testsuite/gdb.base/gnu-ifunc-lib.c:33
  33      {
  (gdb) FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=1: resolver_debug=1: final_debug=0: step

After this commit, we get:

  [ 8] i 0x9e4 .gnu_ifunc section .text
  [ 9] T 0x9e4 .gnu_ifunc_resolver section .text

And stepping an ifunc call takes to the final function:
  (gdb) step
  0x00000000100009e8 in .final ()
  (gdb) PASS: gdb.base/gnu-ifunc.exp: resolver_attr=1: resolver_debug=1: final_debug=0: step

An alternative to touching bfd I considered was for GDB to check
whether there's an ifunc data symbol / function descriptor that points
to the current PC, whenever the program stops, but discarded it
because we'd have to do a linear scan over .opd over an over to find a
matching function descriptor for the current PC.  At that point I
considered caching that info, but quickly dismissed it as then that
has no advantage (memory or performance) over just creating the
synthetic ifunc text symbol in the first place.

I ran the binutils and ld testsuites on PPC64 ELFv1 (machine gcc110 on
the GCC compile farm), and saw no regressions.  This commit is part of
a GDB patch series that includes GDB tests that fail without this fix.

bfd/ChangeLog:
2018-04-26  Pedro Alves  <palves@redhat.com>

* elf64-ppc.c (ppc64_elf_get_synthetic_symtab): Don't consider
ifunc and non-ifunc symbols duplicates.

6 years agoFor PPC64/ELFv1: Introduce mst_data_gnu_ifunc
Pedro Alves [Thu, 26 Apr 2018 12:01:27 +0000 (13:01 +0100)] 
For PPC64/ELFv1: Introduce mst_data_gnu_ifunc

Running the new tests added later in the series on PPC64 (ELFv1)
revealed that the current ifunc support needs a bit of a design rework
to work properly on PPC64/ELFv1, as most of the new tests fail.  The
ifunc support only kind of works today if the ifunc symbol and the
resolver have the same name, as is currently tested by the
gdb.base/gnu-ifunc.exp testcase, which is unlike how ifuncs are
written nowadays.

The crux of the problem is that ifunc symbols are really function
descriptors, not text symbols:

   44: 0000000000020060    104 FUNC    GLOBAL DEFAULT       18 gnu_ifunc_resolver
   54: 0000000000020060    104 GNU_IFUNC GLOBAL DEFAULT     18 gnu_ifunc

But, currently GDB only knows about ifunc symbols that are text
symbols.  GDB's support happens to work in practice for PPC64 when the
ifunc and resolver are one and only, like in the current
gdb.base/gnu-ifunc.exp testcase:

   15: 0000000000020060    104 GNU_IFUNC GLOBAL DEFAULT       18 gnu_ifunc

because in that case, the synthetic ".gnu_ifunc" entry point text
symbol that bfd creates from the actual GNU ifunc "gnu_ifunc" function
(descriptor) symbol ends up with the the "is a gnu ifunc" flag set /
copied over:

  (gdb) maint print msymbols
  ...
  [ 8] i 0x9c4 .gnu_ifunc section .text                <<< mst_text_gnu_ifunc
  ...
  [29] D 0x20060 gnu_ifunc section .opd  crtstuff.c    <<< mst_data

But, if the resolver gets a distinct symbol/name from the ifunc
symbol, then we end up with this:

  (gdb) maint print msymbols
  [ 8] T 0x9e4 .gnu_ifunc_resolver section .text               <<< mst_text
  ...
  [29] D 0x20060 gnu_ifunc section .opd  crtstuff.c            <<< mst_data
  [30] D 0x20060 gnu_ifunc_resolver section .opd  crtstuff.c   <<< mst_data

I have a follow up bfd patch that turns that into:

   (gdb) maint print msymbols
+  [ 8] i 0x9e4 .gnu_ifunc section .text               <<< mst_text_gnu_ifunc
   [ 8] T 0x9e4 .gnu_ifunc_resolver section .text      <<< mst_text
   ...
   [29] D 0x20060 gnu_ifunc section .opd  crtstuff.c
   [30] D 0x20060 gnu_ifunc_resolver section .opd  crtstuff.c

but that won't help everything.  We still need this patch.

Specifically, when we do a symbol lookup by name, like e.g., to call a
function (see c-exp.y hunk), e.g., "p gnu_ifunc()", then we need to
know that the found "gnu_ifunc" minimal symbol is an ifunc in order to
do some special processing.  But, on PPC, that lookup by name finds
the function descriptor symbol, which presently is just a mst_data
symbol, while at present, we look for mst_text_gnu_ifunc symbols to
decide whether to do special GNU ifunc processing.  In most of those
places, we could try to resolve the function descriptor with
gdbarch_convert_from_func_ptr_addr, and then lookup the minimal symbol
at the resolved PC, see if that finds a minimal symbol of type
mst_text_gnu_ifunc.  If so, then we could assume that the original
mst_dadta / function descriptor "gnu_ifunc" symbol was an ifunc.  I
tried it, and it mostly works, even if it's not the most efficient.

However, there's one case that can't work with such a design -- it's
that of the user calling the ifunc resolver directly to debug it, like
"p gnu_ifunc_resolver(0)", expecting that to return the function
pointer of the final function (which is exercised by the new tests
added later).  In this case, with the not-fully-working solution, we'd
resolve the function descriptor, find that there's an
mst_text_gnu_ifunc symbol for the resolved address, and proceed
calling the function as if we tried to call "gnu_ifunc", the
user-visible GNU ifunc symbol, instead of the resolver.  I.e., it'd be
impossible to call the resolver directly as a normal function.

Introducing mst_data_gnu_ifunc eliminates the need for several
gdbarch_convert_from_func_ptr_addr calls, and, fixes the "call
resolver directly" use case mentioned above too.  It's the cleanest
approach I could think of.

In sum, we make GNU ifunc function descriptor symbols get a new
"mst_data_gnu_ifunc" minimal symbol type instead of the bare mst_data
type.  So when symbol lookup by name finds such a minimal symbol, we
know we found an ifunc symbol, without resolving the entry/text
symbol.  If the user calls the the resolver symbol instead, like "p
gnu_ifunc_resolver(0)", then we'll find the regular mst_data symbol
for "gnu_ifunc_resolver", and we'll call the resolver function as just
another regular function.

With this, most of the GNU ifunc tests added by a later patch pass on
PPC64 too.  The following bfd patch fixes the remaining issues.

gdb/ChangeLog:
2018-04-26  Pedro Alves  <palves@redhat.com>

* breakpoint.c (set_breakpoint_location_function): Handle
mst_data_gnu_ifunc.
* c-exp.y (variable production): Handle mst_data_gnu_ifunc.
* elfread.c (elf_symtab_read): Give data symbols with
BSF_GNU_INDIRECT_FUNCTION set mst_data_gnu_ifunc type.
(elf_rel_plt_read): Update comment.
* linespec.c (convert_linespec_to_sals): Handle
mst_data_gnu_ifunc.
(minsym_found): Handle mst_data_gnu_ifunc.
* minsyms.c (msymbol_is_function, minimal_symbol_reader::record)
(find_solib_trampoline_target): Handle mst_data_gnu_ifunc.
* parse.c (find_minsym_type_and_address): Handle
mst_data_gnu_ifunc.
* symmisc.c (dump_msymbols): Handle mst_data_gnu_ifunc.
* symtab.c (find_gnu_ifunc): Handle mst_data_gnu_ifunc.
* symtab.h (minimal_symbol_type) <mst_text_gnu_ifunc>: Update
comment.
<mst_data_gnu_ifunc>: New enumerator.

6 years agoFix stepping past GNU ifunc resolvers (introduce lookup_msym_prefer)
Pedro Alves [Thu, 26 Apr 2018 12:01:27 +0000 (13:01 +0100)] 
Fix stepping past GNU ifunc resolvers (introduce lookup_msym_prefer)

When we're stepping (with "step"), we want to skip trampoline-like
functions automatically, including GNU ifunc resolvers.  That is done
by infrun.c calling into:

  in_solib_dynsym_resolve_code
    -> svr4_in_dynsym_resolve_code
      -> in_gnu_ifunc_stub

A problem here is that if there's a regular text symbol at the same
address as the ifunc symbol, the minimal symbol lookup in
in_gnu_ifunc_stub may miss the GNU ifunc symbol:

(...)
    41: 000000000000071a    53 FUNC    GLOBAL DEFAULT   11 gnu_ifunc_resolver
(...)
    50: 000000000000071a    53 IFUNC   GLOBAL DEFAULT   11 gnu_ifunc
(...)

This causes this FAIL in the tests added later in the series:

 (gdb) PASS: gdb.base/gnu-ifunc.exp: resolver_attr=1: resolver_debug=0: final_debug=0: resolver received HWCAP
 set step-mode on
 (gdb) PASS: gdb.base/gnu-ifunc.exp: resolver_attr=1: resolver_debug=0: final_debug=0: set step-mode on
 step
 0x00007ffff7bd371a in gnu_ifunc_resolver () from build/gdb/testsuite/outputs/gdb.base/gnu-ifunc/gnu-ifunc-lib-1-0-0.so
 (gdb) FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=1: resolver_debug=0: final_debug=0: step

Above, GDB simply thought that it stepped into a regular function, so
it stopped stepping, while it should have continued stepping past the
resolver.

The fix is to teach minimal symbol lookup to prefer GNU ifunc symbols
if desired.

gdb/ChangeLog:
2018-04-26  Pedro Alves  <palves@redhat.com>

* minsyms.c (lookup_minimal_symbol_by_pc_section_1): Rename to ...
(lookup_minimal_symbol_by_pc_section): ... this.  Replace
'want_trampoline' parameter by a lookup_msym_prefer parameter.
Handle it.
(lookup_minimal_symbol_by_pc_section): Delete old implementation.
(lookup_minimal_symbol_by_pc): Adjust.
(in_gnu_ifunc_stub): Prefer GNU ifunc symbols.
(lookup_solib_trampoline_symbol_by_pc): Adjust.
* minsyms.h (lookup_msym_prefer): New enum.
(lookup_minimal_symbol_by_pc_section): Replace 'want_trampoline'
parameter by a lookup_msym_prefer parameter.

6 years agoFor PPC64: elf_gnu_ifunc_record_cache: handle plt symbols in .text section
Pedro Alves [Thu, 26 Apr 2018 12:01:27 +0000 (13:01 +0100)] 
For PPC64: elf_gnu_ifunc_record_cache: handle plt symbols in .text section

elf_gnu_ifunc_record_cache doesn't ever record anything on PPC64
(tested on gcc110 on the compile farm, CentOS 7.4, ELFv1), because
that expects to find PLT symbols in the .plt section, while there we
get:

  (gdb) info symbol 'gnu_ifunc@plt'
  gnu_ifunc@plt in section .text
                           ^^^^^

I guess that may be related to the comment in ppc-linux-tdep.c that
says "For secure PLT, stub is in .text".

In any case, this commit fixes the issue by making the function look
at the symbol name instead of at the section.

gdb/ChangeLog:
2018-04-26  Pedro Alves  <palves@redhat.com>

* elfread.c (elf_gnu_ifunc_record_cache): Check if the symbol name
ends in "@plt" instead of looking at the symbol's section.

6 years agoFactor out minsym_found/find_function_start_sal overload
Pedro Alves [Thu, 26 Apr 2018 12:01:26 +0000 (13:01 +0100)] 
Factor out minsym_found/find_function_start_sal overload

I need to make the ifunc resolving code in elfread.c skip the target
function's prologue like minsym_found does.  I thought of factoring
that out to a separate function, but turns out there's already a
comment in find_function_start_sal that says that should agree with
minsym_found...

Instead of making sure the code agrees with a comment, factor out the
common code to a separate function and use it from both places.

Note that the current find_function_start_sal does a bit more than
minsym_found's equivalent (the "We always should ..." bit), though
that's probably a latent bug.

gdb/ChangeLog:
2018-04-26  Pedro Alves  <palves@redhat.com>

* linespec.c (minsym_found): Use find_function_start_sal CORE_ADDR
overload.
* symtab.c (find_function_start_sal(CORE_ADDR, obj_section *,bool)):
New, factored out from ...
(find_function_start_sal(symbol *, int)): ... this.  Reimplement
and use bool.
* symtab.h (find_function_start_sal(CORE_ADDR, obj_section *,bool)):
New.
(find_function_start_sal(symbol *, int)): Change boolean parameter
type to bool.

6 years agoEliminate find_pc_partial_function_gnu_ifunc
Pedro Alves [Thu, 26 Apr 2018 12:01:26 +0000 (13:01 +0100)] 
Eliminate find_pc_partial_function_gnu_ifunc

Not used anywhere any longer.

If this is ever reinstated, note that this case:

  cache_pc_function_is_gnu_ifunc = TYPE_GNU_IFUNC (SYMBOL_TYPE (f));

was incorrect in that regular symbols never have type marked as GNU
ifunc type, only minimal symbols.  At some point I had some fix that
checking the matching minsym here.  But in the end I ended up just
eliminating need for this function, so that fix was not necessary.

gdb/ChangeLog:
2018-04-26  Pedro Alves  <palves@redhat.com>

* blockframe.c (cache_pc_function_is_gnu_ifunc): Delete.  Remove
all references.
(find_pc_partial_function_gnu_ifunc): Rename to ...
(find_pc_partial_function): ... this, and remove references to
'is_gnu_ifunc_p'.
(find_pc_partial_function): Delete old implementation.
* symtab.h (find_pc_partial_function_gnu_ifunc): Delete.

6 years agoBreakpoints, don't skip prologue of ifunc resolvers with debug info
Pedro Alves [Thu, 26 Apr 2018 12:01:26 +0000 (13:01 +0100)] 
Breakpoints, don't skip prologue of ifunc resolvers with debug info

Without this patch, some of the tests added to gdb.base/gnu-ifunc.exp
by a following patch fail like so:

  FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=1: resolved_debug=0: set-break: before resolving: break gnu_ifunc
  FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=1: resolved_debug=0: set-break: before resolving: info breakpoints
  FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=1: resolved_debug=0: set-break: after resolving: break gnu_ifunc
  FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=1: resolved_debug=0: set-break: after resolving: info breakpoints
  FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=1: resolved_debug=1: set-break: before resolving: break gnu_ifunc
  FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=1: resolved_debug=1: set-break: before resolving: info breakpoints
  FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=1: resolved_debug=1: set-break: after resolving: break gnu_ifunc
  FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=1: resolved_debug=1: set-break: after resolving: info breakpoints

All of them trigger iff:

 - you have debug info for the ifunc resolver.
 - the resolver and the user-visible symbol have the same name.

If you have an ifunc that has a resolver with the same name as the
user visible symbol, debug info for the resolver masks out the ifunc
minsym.  When you set a breakpoint by name on the user visible symbol,
GDB finds the DWARF symbol for the resolver, and thinking that it's a
regular function, sets a breakpoint location past its prologue.

Like so, location 1.2, before the ifunc is resolved by the inferior:

  (gdb) break gnu_ifunc
  Breakpoint 2 at 0x7ffff7bd36ea (2 locations)
  (gdb) info breakpoints
  Num     Type           Disp Enb Address            What
  1       breakpoint     keep y   <MULTIPLE>
  1.1                         y     0x00007ffff7bd36ea <gnu_ifunc>
  1.2                         y     0x00007ffff7bd36f2 in gnu_ifunc at src/gdb/testsuite/gdb.base/gnu-ifunc-lib.c:34
  (gdb)

And like so, location 2.2, if you set the breakpoint after the ifunc
is resolved by the inferior (to "final"):

  (gdb) break gnu_ifunc
  Breakpoint 5 at 0x400757 (2 locations)
  (gdb) info breakpoints
  Num     Type           Disp Enb Address            What
  2       breakpoint     keep y   <MULTIPLE>
  2.1                         y     0x000000000040075a in final at src/gdb/testsuite/gdb.base/gnu-ifunc-resd.c:21
  2.2                         y     0x00007ffff7bd36f2 in gnu_ifunc at src/gdb/testsuite/gdb.base/gnu-ifunc-lib.c:34
  (gdb)

I don't think this is right because when users set a breakpoint at an
ifunc, they don't care about debugging the resolver.  Instead what you
should is a single location for the ifunc in the first case, and a
single location of the ifunc target in the second case.

gdb/ChangeLog:
2018-04-26  Pedro Alves  <palves@redhat.com>

* linespec.c (struct bound_minimal_symbol_search_key): New.
(convert_linespec_to_sals): Sort minimal symbols earlier.  Don't
skip first line if we found a GNU ifunc minimal symbol by name.
(compare_msymbols): Change parameters to work with a destructured
lhs minsym.
(compare_msymbols_for_qsort, compare_msymbols_for_bsearch): New
functions.

6 years agoFix setting breakpoints on ifunc functions after they're already resolved
Pedro Alves [Thu, 26 Apr 2018 12:01:26 +0000 (13:01 +0100)] 
Fix setting breakpoints on ifunc functions after they're already resolved

This fixes setting breakpoints on ifunc functions by name after the
ifunc has already been resolved.

In that case, if you have debug info for the ifunc resolver, without
the fix, then gdb puts a breakpoint past the prologue of the resolver,
instead of setting a breakpoint at the ifunc target:

  break gnu_ifunc
  Breakpoint 4 at 0x7ffff7bd36f2: file src/gdb/testsuite/gdb.base/gnu-ifunc-lib.c, line 34.
  (gdb) continue
  Continuing.
  [Inferior 1 (process 13300) exited normally]
  (gdb)

above we should have stopped at "final", but didn't because we never
resolved the ifunc to the final location.

If you don't have debug info for the resolver, GDB manages to resolve
the ifunc target, but, it should be setting a breakpoint after the
prologue of the final function, and instead what you get is that GDB
sets a breakpoint on the first address of the target function.  With
the gnu-ifunc.exp tests added by a later patch, we get, without the
fix:

  (gdb) break gnu_ifunc
  Breakpoint 4 at 0x400753
  (gdb) continue
  Continuing.

  Breakpoint 4, final (arg=1) at src/gdb/testsuite/gdb.base/gnu-ifunc-final.c:20
  20 {

vs, fixed:

  (gdb) break gnu_ifunc
  Breakpoint 4 at 0x40075a: file src/gdb/testsuite/gdb.base/gnu-ifunc-final.c, line 21.
  (gdb) continue
  Continuing.

  Breakpoint 4, final (arg=2) at src/gdb/testsuite/gdb.base/gnu-ifunc-final.c:21
  21   return arg + 1;
  (gdb)

Fix the problems above by moving the ifunc target resolving to
linespec.c, before we skip a function's prologue.  We need to save
something in the sal, so that set_breakpoint_location_function knows
that it needs to create a bp_gnu_ifunc_resolver bp_location.  Might as
well just save a pointer to the minsym.

gdb/ChangeLog:
2018-04-26  Pedro Alves  <palves@redhat.com>

* breakpoint.c (set_breakpoint_location_function): Don't resolve
ifunc targets here.  Instead, if we have an ifunc minsym, use its
address/name.
(add_location_to_breakpoint): Store the minsym and the objfile in
the breakpoint location.
* breakpoint.h (bp_location) <msymbol, objfile>: New fields.
* linespec.c (minsym_found): Resolve GNU ifunc targets here.
Record the minsym in the sal.
* symtab.h (symtab_and_line) <msymbol>: New field.

6 years agoFix elf_gnu_ifunc_resolve_by_got buglet
Pedro Alves [Thu, 26 Apr 2018 12:01:26 +0000 (13:01 +0100)] 
Fix elf_gnu_ifunc_resolve_by_got buglet

The next patch will add a call to elf_gnu_ifunc_resolve_by_got that
trips on a latent buglet -- the function is writing to its output
parameter even if the address wasn't found, confusing the caller.  The
function's intro comment says:

  /* Try to find the target resolved function entry address of a STT_GNU_IFUNC
     function NAME.  If the address is found it is stored to *ADDR_P (if ADDR_P
     is not NULL) and the function returns 1.  It returns 0 otherwise.

So fix the function accordingly.

gdb/ChangeLog:
2018-04-26  Pedro Alves  <palves@redhat.com>

* elfread.c (elf_gnu_ifunc_resolve_by_got): Don't write to *ADDR_P
unless we actually resolved the ifunc.

6 years agoCalling ifunc functions when resolver has debug info, user symbol same name
Pedro Alves [Thu, 26 Apr 2018 12:01:26 +0000 (13:01 +0100)] 
Calling ifunc functions when resolver has debug info, user symbol same name

If the GNU ifunc resolver has the same name as the user visible
symbol, and the resolver has debug info, then the DWARF info for the
resolver masks the ifunc minsym.  In that scenario, if you try calling
the ifunc from GDB, you call the resolver instead.  With the
gnu-ifunc.exp testcase added in a following patch, you'd see:

  (gdb) p gnu_ifunc (3)
  $1 = (int (*)(int)) 0x400753 <final>
  (gdb) FAIL: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=1: resolved_debug=0: p gnu_ifunc (3)
                                                       ^^^^^^^^^^^^^^^^

That is, we called the ifunc resolver manually, which returned a
pointer to the ifunc target function ("final").  The "final" symbol is
the function that GDB should have called automatically,

  ~~~~~~~~~~~~
  int
  final (int arg)
  {
    return arg + 1;
  }
  ~~~~~~~~~

which is what happens if you don't have debug info for the resolver:

  (gdb) p gnu_ifunc (3)
  $1 = 4
  (gdb) PASS: gdb.base/gnu-ifunc.exp: resolver_attr=0: resolver_debug=0: resolved_debug=1: p gnu_ifunc (3)
                                                       ^^^^^^^^^^^^^^^^

or if the resolver's symbol has a different name from the ifunc (as is
the case with modern uses of ifunc via __attribute__ ifunc, such as
glibc uses):

  (gdb) p gnu_ifunc (3)
  $1 = 4
  (gdb) PASS: gdb.base/gnu-ifunc.exp: resolver_attr=1: resolver_debug=1: resolved_debug=0: p gnu_ifunc (3)
                                      ^^^^^^^^^^^^^^^

in which case after this patch, you can still call the resolver
directly if you want:

  (gdb) p gnu_ifunc_resolver (3)
  $1 = (int (*)(int)) 0x400753 <final>

gdb/ChangeLog:
2018-04-26  Pedro Alves  <palves@redhat.com>

* c-exp.y (variable production): Prefer ifunc minsyms over
regular function symbols.
* symtab.c (find_gnu_ifunc): New function.
* minsyms.h (lookup_msym_prefer): New enum.
(lookup_minimal_symbol_by_pc_section): Replace 'want_trampoline'
parameter by a lookup_msym_prefer parameter.
* symtab.h (find_gnu_ifunc): New declaration.

6 years agoCalling ifunc functions when target has no debug info but resolver has
Pedro Alves [Thu, 26 Apr 2018 12:01:26 +0000 (13:01 +0100)] 
Calling ifunc functions when target has no debug info but resolver has

After the previous patch, on Fedora 27 (glibc 2.26), if you try
calling strlen in the inferior, you now get:

  (top-gdb) p strlen ("hello")
  '__strlen_avx2' has unknown return type; cast the call to its declared return type

This is correct, because __strlen_avx2 is written in assembly.

We can improve on this though -- if the final ifunc resolved/target
function has no debug info, but the ifunc _resolver_ does have debug
info, we can try extracting the final function's type from the type
that the resolver returns.  E.g.,:

  typedef size_t (*strlen_t) (const char*);

  size_t my_strlen (const char *) { /* some implementation */ }
  strlen_t strlen_resolver (unsigned long hwcap) { return my_strlen; }

  extern size_t strlen (const char *s);
  __typeof (strlen) strlen __attribute__ ((ifunc ("strlen_resolver")));

In the strlen example above, the resolver returns strlen_t, which is a
typedef for pointer to a function that returns size_t.  "strlen_t" is
the type of both the user-visible "strlen", and of the the target
function that implements it.

This patch teaches GDB to extract that type.

This is done for actual inferior function calls (in infcall.c), and
for ptype (in eval_call).  By the time we get to either of these
places, we've already lost the original symbol/minsym, and only have
values and types to work with.  Hence the changes to c-exp.y and
evaluate_var_msym_value, to ensure that we propagate the ifunc
minsymbol's info.

The change to make ifunc symbols have no/unknown return type exposes a
latent problem -- gdb.compile/compile-ifunc.exp calls a no-debug-info
function, but we did not warn about it.  The test is fixed by this
commit too.

gdb/ChangeLog:
2018-04-26  Pedro Alves  <palves@redhat.com>

* blockframe.c (find_gnu_ifunc_target_type): New function.
(find_function_type): New.
* eval.c (evaluate_var_msym_value): For GNU ifunc types, always
return a value with a memory address.
(eval_call): For calls to GNU ifunc functions, try to find the
type of the target function from the type that the resolver
returns.
* gdbtypes.c (objfile_type): Don't install a return type for ifunc
symbols.
* infcall.c (find_function_return_type): Delete.
(find_function_addr): Add 'function_type' parameter.  For calls to
GNU ifunc functions, try to find the type of the target function
from the type that the resolver returns, and return it via
FUNCTION_TYPE.
(call_function_by_hand_dummy): Adjust to use the function type
returned by find_function_addr.
(find_function_addr): Add 'function_type' parameter and move
description here.
* symtab.h (find_function_type, find_gnu_ifunc_target_type): New
declarations.

gdb/testsuite/ChangeLog:
2018-04-26  Pedro Alves  <palves@redhat.com>

* gdb.compile/compile-ifunc.exp: Also expect "function has unknown
return type" warnings.

6 years agoFix calling ifunc functions when resolver has debug info and different name
Pedro Alves [Thu, 26 Apr 2018 12:01:26 +0000 (13:01 +0100)] 
Fix calling ifunc functions when resolver has debug info and different name

Currently, on Fedora 27 (glibc 2.26), if you try to call strlen in the
inferior you get:

 (gdb) p strlen ("hello")
 $1 = (size_t (*)(const char *)) 0x7ffff554aac0 <__strlen_avx2>

strlen is an ifunc function, and what we see above is the result of
calling the ifunc resolver in the inferior.  That returns a pointer to
the actual target function that implements strlen on my machine.  GDB
should have turned around and called the resolver automatically
without the user noticing.

This is was caused by commit:

  commit bf223d3e808e6fec9ee165d3d48beb74837796de
  Date: Mon Aug 21 11:34:32 2017 +0100

      Handle function aliases better (PR gdb/19487, errno printing)

which added the find_function_alias_target call to c-exp.y, to try to
find an alias with debug info for a minsym.  For ifunc symbols, that
finds the ifunc's resolver if it has debug info (in the example it's
called "strlen_ifunc"), with the result that GDB calls that as a
regular function.

After this commit, we get now get:

  (top-gdb) p strlen ("hello")
  '__strlen_avx2' has unknown return type; cast the call to its declared return type

Which is correct, because __strlen_avx2 is written in assembly.
That'll be improved in a following patch, though.

gdb/ChangeLog:
2018-04-26  Pedro Alves  <palves@redhat.com>

* c-exp.y (variable production): Skip finding an alias for ifunc
symbols.

6 years agoFix breakpoints in ifunc after inferior resolved it (@got.plt symbol creation)
Pedro Alves [Thu, 26 Apr 2018 12:02:26 +0000 (13:02 +0100)] 
Fix breakpoints in ifunc after inferior resolved it (@got.plt symbol creation)

Setting a breakpoint on an ifunc symbol after the ifunc has already
been resolved by the inferior should result in creating a breakpoint
location at the ifunc target.  However, that's not what happens on
current Fedora:

  (gdb) n
  53        i = gnu_ifunc (1);    /* break-at-call */
  (gdb)
  54        assert (i == 2);
  (gdb) b gnu_ifunc
  Breakpoint 2 at gnu-indirect-function resolver at 0x7ffff7bd36ee
  (gdb) info breakpoints
  Num     Type                   Disp Enb Address            What
  2       STT_GNU_IFUNC resolver keep y   0x00007ffff7bd36ee <gnu_ifunc+4>

The problem is that elf_gnu_ifunc_resolve_by_got never manages to
resolve an ifunc target.  The reason is that GDB never actually
creates the internal got.plt symbols:

 (gdb) p 'gnu_ifunc@got.plt'
 No symbol "gnu_ifunc@got.plt" in current context.

and this is because GDB expects that rela.plt has relocations for
.plt, while it actually has relocations for .got.plt:

 Relocation section [10] '.rela.plt' for section [22] '.got.plt' at offset 0x570 contains 2 entries:
   Offset              Type            Value               Addend Name
   0x0000000000601018  X86_64_JUMP_SLOT 000000000000000000      +0 __assert_fail
   0x0000000000601020  X86_64_JUMP_SLOT 000000000000000000      +0 gnu_ifunc

Using an older system on the GCC compile farm (machine gcc15, an
x86-64 running Debian 6.0.8, with GNU ld 2.20.1), we see that it used
to be that we'd get a .rela.plt section for .plt:

 Relocation section [ 9] '.rela.plt' for section [11] '.plt' at offset 0x578 contains 3 entries:
   Offset              Type            Value               Addend Name
   0x0000000000600cc0  X86_64_JUMP_SLOT 000000000000000000      +0 __assert_fail
   0x0000000000600cc8  X86_64_JUMP_SLOT 000000000000000000      +0 __libc_start_main
   0x0000000000600cd0  X86_64_JUMP_SLOT 000000000000000000      +0 gnu_ifunc

Those offsets did point into .got.plt, as seen with objdump -h:

  20 .got.plt      00000030  0000000000600ca8  0000000000600ca8  00000ca8  2**3
         CONTENTS, ALLOC, LOAD, DATA

I also tested on gcc110 on the compile farm (PPC64 running CentOS
7.4.1708, with GNU ld 2.25.1), and there we see instead:

 Relocation section [ 9] '.rela.plt' for section [23] '.plt' at offset 0x5d0 contains 4 entries:
   Offset              Type            Value               Addend Name
   0x0000000010020148  PPC64_JMP_SLOT  000000000000000000      +0 __libc_start_main
   0x0000000010020160  PPC64_JMP_SLOT  000000000000000000      +0 __gmon_start__
   0x0000000010020178  PPC64_JMP_SLOT  000000000000000000      +0 __assert_fail
   0x0000000010020190  PPC64_JMP_SLOT  000000000000000000      +0 gnu_ifunc

But note that those offsets point into .plt, not .got.plt, as seen
with objdump -h:

 22 .plt          00000078  0000000010020130  0000000010020130  00010130  2**3
                  ALLOC

This commit makes us support all the different combinations above.

With that addressed, we now get:

 (gdb) p 'gnu_ifunc@got.plt'
 $1 = (<text from jump slot in .got.plt, no debug info>) 0x400753 <final>

And setting a breakpoint on the ifunc finds the ifunc target:

 (gdb) b gnu_ifunc
 Breakpoint 2 at 0x400753
 (gdb) info breakpoints
 Num     Type           Disp Enb Address            What
 2       breakpoint     keep y   0x0000000000400753 <final>

gdb/ChangeLog:
2018-04-26  Pedro Alves  <palves@redhat.com>

* elfread.c (elf_rel_plt_read): Look for relocations for .got.plt too.

6 years agox86: fold various non-memory operand AVX512VL templates
Jan Beulich [Thu, 26 Apr 2018 06:55:02 +0000 (08:55 +0200)] 
x86: fold various non-memory operand AVX512VL templates

There's little point carrying up to three templates per insn flavor
when the sole difference is operand size and the dependency on AVX512VL
being enabled. Instead the need for AVX512VL can be derived from an
operand allowing for ZMMword as well as one or both or XMMword and
YMMword (irrespective of whether this is a register or memory operand).
Without further abstraction to deal with the different Disp8MemShift
values between the templates, only a limited set (mostly ones only
allowing for non-memory operands) can be folded, which is being done
here.

Also drop IgnoreSize wherever possible from anything that's being
touched anyway.

6 years agox86: also optimize zeroing-masking variants of insns
Jan Beulich [Thu, 26 Apr 2018 06:53:20 +0000 (08:53 +0200)] 
x86: also optimize zeroing-masking variants of insns

When zeroing an element of a register it doesn't matter whether the zero
results from the actual operation (xor, sub, or nand) or from the
zeroing-masking taking effect due to a clear mask register bit.

6 years agox86: properly force / avoid forcing EVEX encoding
Jan Beulich [Thu, 26 Apr 2018 06:49:41 +0000 (08:49 +0200)] 
x86: properly force / avoid forcing EVEX encoding

Pseudo prefixes are supposed to be a hint only - when the specific
encoding can't be used to encode an insn, silently override it. But
this overriding must only happen after the respective check, to
avoid forcing EVEX encoding because of something that isn't a valid
register name in the given context.

6 years agox86: CpuXSAVE is a prereq for various other features
Jan Beulich [Thu, 26 Apr 2018 06:48:56 +0000 (08:48 +0200)] 
x86: CpuXSAVE is a prereq for various other features

All of AVX, LWP, MPX, and PKU require XSAVE, and hence it as well as
XRSTOR should be enabled when enabling these ISA extensions. Leverage
these implications to shorten some of the cpu_flag_init[] entries.

6 years agox86: drop CpuRegMMX, CpuReg[XYZ]MM, and CpuRegMask
Jan Beulich [Thu, 26 Apr 2018 06:48:01 +0000 (08:48 +0200)] 
x86: drop CpuRegMMX, CpuReg[XYZ]MM, and CpuRegMask

It's not clear to me why they had been introduced - the respective
comments in opcodes/i386-gen.c are certainly wrong: ymm<N> registers
are very well supported (and necessary) with just AVX512F.

6 years agox86: don't recognize bnd<N> as registers without CpuMPX
Jan Beulich [Thu, 26 Apr 2018 06:46:39 +0000 (08:46 +0200)] 
x86: don't recognize bnd<N> as registers without CpuMPX

This is just like for all other extended/optional register sets.

6 years agox86: x87-related adjustments
Jan Beulich [Thu, 26 Apr 2018 06:45:35 +0000 (08:45 +0200)] 
x86: x87-related adjustments

Neither 287 wrt 8087 nor 387 wrt 287 are proper supersets - in each case
some insns get removed from the ISA (they become NOPs, but code intended
for newer co-processors should not use them).

Furthermore with .no87, ST should not be recognized as a register name.

6 years agox86: fix indentation in build_modrm_byte()
Jan Beulich [Thu, 26 Apr 2018 06:31:14 +0000 (08:31 +0200)] 
x86: fix indentation in build_modrm_byte()

The VEX3SOURCES code was (originally) written with just space
indentation, which is not in line with general coding style as well as
the style later in the function.

6 years agox86: move and fold common code in build_modrm_byte()
Jan Beulich [Thu, 26 Apr 2018 06:30:45 +0000 (08:30 +0200)] 
x86: move and fold common code in build_modrm_byte()

The source and reg_slot calculations in the VEX3SOURCES only depend on
the number of immediate operands.

6 years agox86: drop VexImmExt
Jan Beulich [Thu, 26 Apr 2018 06:30:06 +0000 (08:30 +0200)] 
x86: drop VexImmExt

It's only used in assertions, and hence not really needed for correct
code generation.

6 years agox86: tighten assertion in build_modrm_byte()
Jan Beulich [Thu, 26 Apr 2018 06:29:09 +0000 (08:29 +0200)] 
x86: tighten assertion in build_modrm_byte()

All VEX3SOURCES cases should have VexW set, and all should have a SIMD
register destination.

6 years agox86: drop dead code from build_modrm_byte()
Jan Beulich [Thu, 26 Apr 2018 06:28:38 +0000 (08:28 +0200)] 
x86: drop dead code from build_modrm_byte()

There are no templates with VexImmExt and ImmExt set at the same time.
There are also no VEX3SOURCES templates with CpuFMA. I assume both are
left-overs from the implementation of an early specification which was
later revised.

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 26 Apr 2018 00:00:46 +0000 (00:00 +0000)] 
Automatic date update in version.in

6 years ago[ARM] FDPIC: Update testsuite so that many tests pass with arm*-uclinuxfdpiceabi.
Christophe Lyon [Wed, 18 Apr 2018 20:55:29 +0000 (20:55 +0000)] 
[ARM] FDPIC: Update testsuite so that many tests pass with arm*-uclinuxfdpiceabi.

2018-04-25  Christophe Lyon  <christophe.lyon@st.com>

binutils/
* testsuite/binutils-all/elfedit-2.d: Accept arm*-*-uclinuxfdpiceabi.
* testsuite/binutils-all/elfedit-3.d: Likewise.
* testsuite/binutils-all/objcopy.exp: Likewise.
* testsuite/binutils-all/strip-3.d: Likewise.
* testsuite/lib/binutils-common.exp: Likewise.

ld/
* testsuite/ld-arm/export-class.exp: Accept arm*-*-uclinuxfdpiceabi.
* testsuite/ld-discard/discard.exp: Likewise.
* testsuite/ld-elf/binutils.exp: Likewise.
* testsuite/ld-elf/commonpage1.d: Likewise.
* testsuite/ld-elf/compress1c.d: Likewise.
* testsuite/ld-elf/compressed1b.d: Likewise.
* testsuite/ld-elf/compressed1c.d: Likewise.
* testsuite/ld-elf/compressed1e.d: Likewise.
* testsuite/ld-elf/dynamic1.d: Likewise.
* testsuite/ld-elf/dynsym1.d: Likewise.
* testsuite/ld-elf/ehdr_start-missing.d: Likewise.
* testsuite/ld-elf/ehdr_start-shared.d: Likewise.
* testsuite/ld-elf/ehdr_start-userdef.d: Likewise.
* testsuite/ld-elf/ehdr_start-weak.d: Likewise.
* testsuite/ld-elf/ehdr_start.d: Likewise.
* testsuite/ld-elf/exclude3b.d: Likewise.
* testsuite/ld-elf/export-class.exp: Likewise.
* testsuite/ld-elf/global1.d: Likewise.
* testsuite/ld-elf/hash.d: Likewise.
* testsuite/ld-elf/header.d: Likewise.
* testsuite/ld-elf/loadaddr1.d: Likewise.
* testsuite/ld-elf/loadaddr2.d: Likewise.
* testsuite/ld-elf/loadaddr3a.d: Likewise.
* testsuite/ld-elf/loadaddr3b.d: Likewise.
* testsuite/ld-elf/local1.d: Likewise.
* testsuite/ld-elf/maxpage1.d: Likewise.
* testsuite/ld-elf/maxpage2.d: Likewise.
* testsuite/ld-elf/maxpage3a.d: Likewise.
* testsuite/ld-elf/mbind1a.d: Likewise.
* testsuite/ld-elf/mbind1b.d: Likewise.
* testsuite/ld-elf/mbind1c.d: Likewise.
* testsuite/ld-elf/multibss1.d: Likewise.
* testsuite/ld-elf/noload-2.d: Likewise.
* testsuite/ld-elf/now-1.d: Likewise.
* testsuite/ld-elf/now-2.d: Likewise.
* testsuite/ld-elf/now-3.d: Likewise.
* testsuite/ld-elf/now-4.d: Likewise.
* testsuite/ld-elf/pie.d: Likewise.
* testsuite/ld-elf/pr12975.d: Likewise.
* testsuite/ld-elf/pr13177.d: Likewise.
* testsuite/ld-elf/pr13195.d: Likewise.
* testsuite/ld-elf/pr16322.d: Likewise.
* testsuite/ld-elf/pr16498a.d: Likewise.
* testsuite/ld-elf/pr16498b.d: Likewise.
* testsuite/ld-elf/pr17615.d: Likewise.
* testsuite/ld-elf/pr19162.d: Likewise.
* testsuite/ld-elf/pr19539.d: Likewise.
* testsuite/ld-elf/pr19617a.d: Likewise.
* testsuite/ld-elf/pr19617b.d: Likewise.
* testsuite/ld-elf/pr19617c.d: Likewise.
* testsuite/ld-elf/pr19698.d: Likewise.
* testsuite/ld-elf/pr19789.d: Likewise.
* testsuite/ld-elf/pr20513c.d: Likewise.
* testsuite/ld-elf/pr20513d.d: Likewise.
* testsuite/ld-elf/pr21384.d: Likewise.
* testsuite/ld-elf/pr21389a.d: Likewise.
* testsuite/ld-elf/pr21389b.d: Likewise.
* testsuite/ld-elf/pr21389c.d: Likewise.
* testsuite/ld-elf/pr21562a.d: Likewise.
* testsuite/ld-elf/pr21562b.d: Likewise.
* testsuite/ld-elf/pr21562c.d: Likewise.
* testsuite/ld-elf/pr21562d.d: Likewise.
* testsuite/ld-elf/pr21562e.d: Likewise.
* testsuite/ld-elf/pr21562f.d: Likewise.
* testsuite/ld-elf/pr21562g.d: Likewise.
* testsuite/ld-elf/pr21562h.d: Likewise.
* testsuite/ld-elf/pr21562i.d: Likewise.
* testsuite/ld-elf/pr21562j.d: Likewise.
* testsuite/ld-elf/pr21562k.d: Likewise.
* testsuite/ld-elf/pr21562l.d: Likewise.
* testsuite/ld-elf/pr21562m.d: Likewise.
* testsuite/ld-elf/pr21562n.d: Likewise.
* testsuite/ld-elf/pr21903a.d: Likewise.
* testsuite/ld-elf/pr21903b.d: Likewise.
* testsuite/ld-elf/pr21903d.d: Likewise.
* testsuite/ld-elf/pr22269a.d: Likewise.
* testsuite/ld-elf/pr22269b.d: Likewise.
* testsuite/ld-elf/pr22393-1a.d: Likewise.
* testsuite/ld-elf/pr22393-1b.d: Likewise.
* testsuite/ld-elf/pr22393-1c.d: Likewise.
* testsuite/ld-elf/pr22393-1d.d: Likewise.
* testsuite/ld-elf/pr22393-1e.d: Likewise.
* testsuite/ld-elf/pr22393-1f.d: Likewise.
* testsuite/ld-elf/pr22423.d: Likewise.
* testsuite/ld-elf/rpath-1.d: Likewise.
* testsuite/ld-elf/rpath-2.d: Likewise.
* testsuite/ld-elf/runpath-1.d: Likewise.
* testsuite/ld-elf/runpath-2.d: Likewise.
* testsuite/ld-elf/seg.d: Likewise.
* testsuite/ld-elf/sizeofb.d: Likewise.
* testsuite/ld-elf/startofb.d: Likewise.
* testsuite/ld-elf/strtab.d: Likewise.
* testsuite/ld-elf/textaddr1.d: Likewise.
* testsuite/ld-elf/textaddr2.d: Likewise.
* testsuite/ld-elf/textaddr3.d: Likewise.
* testsuite/ld-elf/textaddr4.d: Likewise.
* testsuite/ld-elf/textaddr5.d: Likewise.
* testsuite/ld-elf/textaddr6.d: Likewise.
* testsuite/ld-elf/textaddr7.d: Likewise.
* testsuite/ld-elf/tls.exp: Likewise.
* testsuite/ld-elf/tls_common.exp: Likewise.
* testsuite/ld-elf/unknown2.d: Likewise.
* testsuite/ld-gc/abi-note.d: Likewise.
* testsuite/ld-gc/pr11218.d: Likewise.
* testsuite/ld-gc/pr19167.d: Likewise.
* testsuite/ld-gc/pr20022.d: Likewise.
* testsuite/ld-gc/start.d: Likewise.
* testsuite/ld-gc/stop.d: Likewise.
* testsuite/ld-scripts/phdrs2.exp: Likewise.
* testsuite/ld-scripts/rgn-at5.d: Likewise.
* testsuite/ld-undefined/entry-3.d: Likewise.
* testsuite/ld-undefined/entry-4.d: Likewise.

6 years ago[ARM] FDPIC: Implement Thumb-only PLT for FDPIC.
Christophe Lyon [Tue, 20 Mar 2018 09:56:17 +0000 (10:56 +0100)] 
[ARM] FDPIC: Implement Thumb-only PLT for FDPIC.

2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
Mickaël Guêné  <mickael.guene@st.com>

bfd/
* elf32-arm.c (elf32_arm_fdpic_thumb_plt_entry): New.
(elf32_arm_plt_needs_thumb_stub_p): Handle thumb-only case.
(elf32_arm_populate_plt_entry): Likewise.
(elf32_arm_output_plt_map_1): Likewise.
(elf32_arm_output_arch_local_syms): Likewise.

ld/testsuite/
* arm-elf.exp: Execute the new FDPIC Thumb-only tests.
* fdpic-main-m.d: New test.
* fdpic-main-m.s: New.
* fdpic-main-m.sym: New.
* fdpic-shared-m.d: New test.
* fdpic-shared-m.s: New.
* fdpic-shared-m.sym: New.

6 years ago[ARM] FDPIC: New tests.
Christophe Lyon [Tue, 20 Mar 2018 09:56:10 +0000 (10:56 +0100)] 
[ARM] FDPIC: New tests.

2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
Mickaël Guêné  <mickael.guene@st.com>

ld/
* testsuite/ld-arm/arm-elf.exp: Execute the new FDPIC tests.
* testsuite/ld-arm/fdpic-main.d: New test.
* testsuite/ld-arm/fdpic-main.ld: New.
* testsuite/ld-arm/fdpic-main.r: New.
* testsuite/ld-arm/fdpic-main.s: New.
* testsuite/ld-arm/fdpic-main.sym: New.
* testsuite/ld-arm/fdpic-shared.d: New test.
* testsuite/ld-arm/fdpic-shared.ld: New.
* testsuite/ld-arm/fdpic-shared.r: New.
* testsuite/ld-arm/fdpic-shared.s: New.
* testsuite/ld-arm/fdpic-shared.sym: New.

6 years ago[ARM] FDPIC: Fix ld testcase not to conflict with uclibc's includes.
Christophe Lyon [Tue, 20 Mar 2018 09:56:02 +0000 (10:56 +0100)] 
[ARM] FDPIC: Fix ld testcase not to conflict with uclibc's includes.

2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
Mickaël Guêné  <mickael.guene@st.com>

ld/
* testsuite/ld-elf/pr2404b.c (main): Rename time variable into
time1.

6 years ago[ARM] FDPIC: Make _GLOBAL_OFFSET_TABLE_ a relative symbol
Christophe Lyon [Tue, 20 Mar 2018 09:55:53 +0000 (10:55 +0100)] 
[ARM] FDPIC: Make _GLOBAL_OFFSET_TABLE_ a relative symbol

2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
Mickaël Guêné  <mickael.guene@st.com>

bfd/
* elf32-arm.c (elf32_arm_finish_dynamic_symbol): Handle
_GLOBAL_OFFSET_TABLE_ in FDPIC mode.

6 years ago[ARM] FDPIC: Translate R_ARM_TARGET2 relocation into R_ARM_GOT32 relocation for FDPIC...
Christophe Lyon [Tue, 20 Mar 2018 09:55:45 +0000 (10:55 +0100)] 
[ARM] FDPIC: Translate R_ARM_TARGET2 relocation into R_ARM_GOT32 relocation for FDPIC platform

2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
Mickaël Guêné  <mickael.guene@st.com>

bfd/
* elf32-arm.c (bfd_elf32_arm_set_target_params): Handle FDPIC case
for R_ARM_TARGET2.

6 years ago[ARM] FDPIC: Add stack segment
Christophe Lyon [Tue, 20 Mar 2018 09:55:37 +0000 (10:55 +0100)] 
[ARM] FDPIC: Add stack segment

The size of the stack segment defaults to 32KB, and can be overridden
by defining the __stacksize symbol.

2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
Mickaël Guêné  <mickael.guene@st.com>

bfd/
* elf32-arm.c (DEFAULT_STACK_SIZE): New.
(elf32_arm_always_size_sections): Create stack segment.

6 years ago[ARM] Add TLS relocations for FDPIC.
Christophe Lyon [Tue, 20 Mar 2018 09:55:29 +0000 (10:55 +0100)] 
[ARM] Add TLS relocations for FDPIC.

Define and handle TLS relocations for FDPIC in BFD and gas.

In gas, the new relocations are rejected if the --fdpic option was not
specified.

We also define the __tdata_start symbol to mark the start of the
.tdata section. This allows FDPIC static binaries to find the start of
.tdata section, since phdr->p_vaddr of TLS segment is not a valid
value for FDPIC.

2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
Mickaël Guêné  <mickael.guene@st.com>

bfd/:
* bfd-in2.h (BFD_RELOC_ARM_TLS_GD32_FDPIC)
(BFD_RELOC_ARM_TLS_LDM32_FDPIC, BFD_RELOC_ARM_TLS_IE32_FDPIC): New
relocations.
* elf32-arm.c (elf32_arm_howto_table_2): Add R_ARM_TLS_GD32_FDPIC,
R_ARM_TLS_LDM32_FDPIC, R_ARM_TLS_IE32_FDPIC relocations.
(elf32_arm_reloc_map): Add R_ARM_TLS_GD32_FDPIC,
R_ARM_TLS_LDM32_FDPIC, R_ARM_TLS_IE32_FDPIC.
(struct elf32_arm_link_hash_table): Update comment.
(elf32_arm_final_link_relocate): Handle TLS FDPIC relocations.
(IS_ARM_TLS_RELOC): Likewise.
(elf32_arm_check_relocs): Likewise.
(allocate_dynrelocs_for_symbol): Likewise.
(elf32_arm_size_dynamic_sections): Update comment.
* reloc.c: Add BFD_RELOC_ARM_TLS_GD32_FDPIC,
BFD_RELOC_ARM_TLS_LDM32_FDPIC, BFD_RELOC_ARM_TLS_IE32_FDPIC.

gas/
* config/tc-arm.c (reloc_names): Add TLSGD_FDPIC, TLSLDM_FDPIC,
GOTTPOFF_FDIC relocations.
(md_apply_fix): Handle the new TLS FDPIC relocations.
(tc_gen_reloc): Likewise.
(arm_fix_adjustable): Likewise.

include/
* elf/arm.h: Add R_ARM_TLS_GD32_FDPIC, R_ARM_TLS_LDM32_FDPIC,
R_ARM_TLS_IE32_FDPIC.

ld/
* scripttempl/elf.sc: Define __tdata_start for .tdata section.

6 years ago[ARM] Implement PLT for FDPIC.
Christophe Lyon [Tue, 20 Mar 2018 09:55:20 +0000 (10:55 +0100)] 
[ARM] Implement PLT for FDPIC.

FDPIC requires special PLT entries, defined in this patch.

Note that lazy binding is not supported because of a race condition
for lack of an atomic 64-bits load instruction.

2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
Mickaël Guêné  <mickael.guene@st.com>

bfd/
* elf32-arm.c (elf32_arm_fdpic_plt_entry): New.
(elf32_arm_create_dynamic_sections): Handle FDPIC.
(elf32_arm_allocate_plt_entry): Likewise.
(elf32_arm_populate_plt_entry): Likewise.
(elf32_arm_output_plt_map_1): Likewise.

6 years ago[ARM] Implement FDPIC relocations.
Christophe Lyon [Tue, 20 Mar 2018 09:55:09 +0000 (10:55 +0100)] 
[ARM] Implement FDPIC relocations.

This is the main BFD patch, that enables the linker to actually handle
the FDPIC relocations.

2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
Mickaël Guêné  <mickael.guene@st.com>

bfd/
* elf32-arm.c (struct fdpic_local): New.
(elf_arm_obj_tdata): Add local_fdpic_cnts field.
(elf32_arm_local_fdpic_cnts): New.
(struct fdpic_global): New.
(elf32_arm_link_hash_entry): Add fdpic_cnts field.
(elf32_arm_link_hash_table): Add srofixup field.
(arm_elf_add_rofixup): New.
(arm_elf_fill_funcdesc): New.
(elf32_arm_link_hash_newfunc): Handle fdpic_cnts.
(elf32_arm_allocate_local_sym_info): Likewise.
(create_got_section): Create .rofixup section.
(elf32_arm_copy_indirect_symbol): Handle fdpic_cnts.
(bfd_elf32_arm_set_target_params): Handle FDPIC.
(elf32_arm_final_link_relocate): Likewise.
(elf32_arm_check_relocs): Likewise.
(allocate_dynrelocs_for_symbol): Likewise.
(elf32_arm_size_dynamic_sections): Likewise.
(elf32_arm_finish_dynamic_sections): Likewise.
(elf32_arm_output_arch_local_syms): Likewise.
(elf32_arm_fdpic_omit_section_dynsym): New.

ld/
* emulparams/armelf_linux_fdpiceabi.sh: Add .rofixup section.

6 years ago[ARM] Add FDPIC relocations definitions
Christophe Lyon [Tue, 20 Mar 2018 09:54:59 +0000 (10:54 +0100)] 
[ARM] Add FDPIC relocations definitions

Add FDPIC relocation definitions in BFD and gas.
Gas rejects them if the --fdpic option was not specified.

2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
Mickaël Guêné  <mickael.guene@st.com>

bfd/
* bfd-in2.c (BFD_RELOC_ARM_GOTFUNCDESC)
(BFD_RELOC_ARM_GOTOFFFUNCDESC, BFD_RELOC_ARM_FUNCDESC)
(BFD_RELOC_ARM_FUNCDESC_VALUE): New.
* elf32-arm.c (elf32_arm_howto_table_2): Add R_ARM_GOTFUNCDESC,
R_ARM_GOTOFFFUNCDESC, R_ARM_FUNCDESC, R_ARM_FUNCDESC_VALUE.
(elf32_arm_howto_from_type): Take new members of
elf32_arm_howto_table_2 into account.
(elf32_arm_reloc_map): Add BFD_RELOC_ARM_GOTFUNCDESC,
BFD_RELOC_ARM_GOTOFFFUNCDESC, BFD_RELOC_ARM_FUNCDESC,
BFD_RELOC_ARM_FUNCDESC_VALUE.
* reloc.c: Add BFD_RELOC_ARM_GOTFUNCDESC,
BFD_RELOC_ARM_GOTOFFFUNCDESC, BFD_RELOC_ARM_FUNCDESC,
BFD_RELOC_ARM_FUNCDESC_VALUE.

gas/
* config/tc-arm.c (reloc_names): Add gotfuncdesc, gotofffuncdesc,
funcdesc.
(md_apply_fix): Support the new relocations.
(tc_gen_reloc): Likewise.
* testsuite/gas/arm/reloc-fdpic.d: New.
* testsuite/gas/arm/reloc-fdpic.s: New.

include/
* elf/arm.h (R_ARM_GOTFUNCDESC, R_ARM_GOTOFFFUNCDESC)
(R_ARM_FUNCDESC)
(R_ARM_FUNCDESC_VALUE): Define new relocations.

6 years ago[ARM] Add FDPIC OSABI flag support.
Christophe Lyon [Tue, 20 Mar 2018 09:54:50 +0000 (10:54 +0100)] 
[ARM] Add FDPIC OSABI flag support.

ELF files targetting ARM FDPIC use the ELFOSABI_ARM_FDPIC flag.
Set it appropriately in file generators (eg. gas), and handle it in
readers (eg. readelf).

2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
Mickaël Guêné  <mickael.guene@st.com>

bfd/
* elf32-arm.c (elf32_arm_print_private_bfd_data): Support
EF_ARM_PIC and ELFOSABI_ARM_FDPIC.
(elf32_arm_post_process_headers): Support ELFOSABI_ARM_FDPIC.
(ELF_OSABI): Define to ELFOSABI_ARM_FDPIC.

binutils/
* readelf.c (decode_ARM_machine_flags): Support EF_ARM_PIC.
(get_osabi_name): Support ELFOSABI_ARM_FDPIC.

gas/
* config/tc-arm.c (arm_fdpic): New.
(elf32_arm_target_format): Support FDPIC.
(OPTION_FDPIC): New.
(md_longopts): Support FDPIC.
(md_parse_option): Likewise.
(md_show_usage): Likewise.

include/
* elf/arm.h (EF_ARM_FDPIC): New.

6 years ago[ARM] Add armelf_linux_fdpiceabi and armelfb_linux_fdpiceabi BFD backends
Christophe Lyon [Tue, 20 Mar 2018 09:54:26 +0000 (10:54 +0100)] 
[ARM] Add armelf_linux_fdpiceabi and armelfb_linux_fdpiceabi BFD backends

Initial definition of these new backends.

2018-04-25  Christophe Lyon  <christophe.lyon@st.com>
Mickaël Guêné  <mickael.guene@st.com>

bfd/
* config.bfd (arm*-*-linux-*): Add arm_elf32_fdpic_be_vec and
arm_elf32_fdpic_le_vec to targ_selvecs. Accept
arm*-*-uclinuxfdpiceabi.
* configure.ac: Add support for arm_elf32_fdpic_be_vec and
arm_elf32_fdpic_le_vec.
* configure: Regenerate.
* elf32-arm.c (struct elf32_arm_link_hash_table): Add fdpic_p.
(elf32_arm_link_hash_table_create): Initialize fdpic_p.
(TARGET_LITTLE_SYM, TARGET_LITTLE_NAME, TARGET_BIG_SYM)
(TARGET_BIG_NAME, elf_match_priority): Define for FDPIC targets.
(elf32_arm_fdpic_link_hash_table_create): New.
* targets.c (_bfd_target_vector): Add arm_elf32_fdpic_be_vec and
arm_elf32_fdpic_le_vec.

ld/
* Makefile.am (ALL_EMULATION_SOURCES): Add
earmelf_linux_fdpiceabi.c and earmelfb_linux_fdpiceabi.c.
(earmelf_linux_fdpiceabi.c, earmelfb_linux_fdpiceabi.c): New rules.
* Makefile.in: Regenerate.
* configure.tgt (arm*-*-uclinuxfdpiceabi): Handle new target.
* emulparams/armelf_linux_fdpiceabi.sh: New.
* emulparams/armelfb_linux_fdpiceabi.sh: New.

6 years agoFix new inferior events output
Pedro Alves [Wed, 25 Apr 2018 16:28:25 +0000 (17:28 +0100)] 
Fix new inferior events output

Since f67c0c917150 ("Enable 'set print inferior-events' and improve
detach/fork/kill/exit messages"), when detaching a remote process, we
get, for detach against a remote target:

 (gdb) detach
 Detaching from program: ...., process 5388
 Ending remote debugging.
 [Inferior 1 (Thread 5388.5388) detached]
              ^^^^^^^^^^^^^^^^

That is incorrect, for it is printing a thread id as string while we
should be printing the process id instead.  I.e., either one of:

 [Inferior 1 (process 5388) detached]
 [Inferior 1 (Remote target) detached]

depending on remote stub support for the multi-process extensions.

Similarly, after killing a process, we're printing thread ids while we
should be printing process ids.  E.g., on native GNU/Linux:

 (gdb) k
 Kill the program being debugged? (y or n) y
 [Inferior 1 (Thread 0x7ffff7faa8c0 (LWP 30721)) has been killed]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

while it should have been:

 Kill the program being debugged? (y or n) y
 [Inferior 1 (process 30721) has been killed]
              ^^^^^^^^^^^^^

There's a wording inconsistency between detach and kill:

 [Inferior 1 (process 30721) has been killed]
 [Inferior 1 (process 30721) detached]

Given we were already saying "detached" instead of "has been
detached", and we used to say just "exited", and given that the "has
been" doesn't really add any information, this commit changes the
message to just "killed":

 [Inferior 1 (process 30721) killed]

gdb/ChangeLog:
2018-04-25  Pedro Alves  <palves@redhat.com>

* infcmd.c (kill_command): Print the pid as string, not the whole
thread's ptid.  Add comment.  s/has been killed/killed/ in output
message.
* remote.c (remote_detach_1): Print the pid as string, not the
whole thread's ptid.

gdb/testsuite/ChangeLog:
2018-04-25  Pedro Alves  <palves@redhat.com>

* gdb.base/hook-stop.exp: Expect "killed" instead of "has been
killed".
* gdb.base/kill-after-signal.exp: Likewise.
* gdb.threads/kill.exp: Likewise.

6 years agox86: drop redundant AVX512VL shift templates
Jan Beulich [Wed, 25 Apr 2018 14:26:10 +0000 (16:26 +0200)] 
x86: drop redundant AVX512VL shift templates

These were wrongly left in place by commit ed438a93f1 ("x86: fold
certain AVX512 rotate and shift templates").

6 years agoFix the mask for the sqrdml(a|s)h instructions.
Tamar Christina [Wed, 25 Apr 2018 12:37:30 +0000 (13:37 +0100)] 
Fix the mask for the sqrdml(a|s)h instructions.

Rn is supposed to have a 5 bit range but instead was given 4 bits
causing these instructions to disassemble as unknown instructions.

opcodes/

* aarch64-tbl.h (sqrdmlah, sqrdmlsh): Fix masks.

gas/

* testsuite/gas/aarch64/rdma.s: Test for larger register numbers.
* testsuite/gas/aarch64/rdma.d: Update results.
* testsuite/gas/aarch64/rdma-directive.d: Likewise.

6 years agoUpdated Spanish translation for the gas directory.
Nick Clifton [Wed, 25 Apr 2018 09:05:12 +0000 (10:05 +0100)] 
Updated Spanish translation for the gas directory.

6 years agoSilence gcc-8 warnings
Alan Modra [Wed, 25 Apr 2018 03:57:22 +0000 (13:27 +0930)] 
Silence gcc-8 warnings

This seems to work with gcc-8 and a bunch of prior gcc versions I tested.

* elf-linux-core.h: Disable gcc-8 string truncation warning.
* elf.c (elfcore_write_prpsinfo): Likewise.

6 years agoFix bug with relocation addends and merge sections with --icf.
Cary Coutant [Wed, 25 Apr 2018 04:57:37 +0000 (21:57 -0700)] 
Fix bug with relocation addends and merge sections with --icf.

During --icf processing, gold was incorrectly processing the relocation
addend for references to items in a merge section. PC-relative references
and other forms of reference with a biased base address require a
non-section local symbol, where the addend is purely the bias.

gold/
PR gold/20642
PR gold/22820
* gc.h (gc_process_relocs): Flag STT_SECTION symbols in symvec.
* icf.cc (get_section_contents): For merge sections, ignore the
addend for relocations against non-section symbols.

6 years agoRemove arm-aout and arm-coff support
Alan Modra [Mon, 16 Apr 2018 11:03:36 +0000 (20:33 +0930)] 
Remove arm-aout and arm-coff support

This also removes arm-netbsd (not arm-netbsdelf!), arm-openbsd, and
arm-riscix.  Those targets weren't on the obsolete list but they are
all aout, and it doesn't make all that much sense to remove arm-aout
without removing them too.

bfd/
* Makefile.am: Remove arm-aout and arm-coff support.
* config.bfd: Likewise.
* configure.ac: Likewise.
* targets.c: Likewise.
* aout-arm.c: Delete.
* armnetbsd.c: Delete.
* riscix.c: Delete.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
binutils/
* testsuite/binutils-all/arm/objdump.exp: Remove arm-aout and
arm-coff support.
* testsuite/binutils-all/objcopy.exp: Likewise.
* testsuite/lib/binutils-common.exp: Likewise.
gas/
* Makefile.am: Remove arm-aout and arm-coff support.
* config/tc-arm.c: Likewise.
* config/tc-arm.h: Likewise.
* configure.tgt: Likewise.
* testsuite/gas/aarch64/codealign.d: Likewise.
* testsuite/gas/aarch64/mapping.d: Likewise.
* testsuite/gas/aarch64/mapping2.d: Likewise.
* testsuite/gas/arm/adds-thumb1-reloc-local-armv7-m.d: Likewise.
* testsuite/gas/arm/adds-thumb1-reloc-local.d: Likewise.
* testsuite/gas/arm/addsw-bad.d: Likewise.
* testsuite/gas/arm/align.d: Likewise.
* testsuite/gas/arm/align64.d: Likewise.
* testsuite/gas/arm/arch7.d: Likewise.
* testsuite/gas/arm/arch7a-mp.d: Likewise.
* testsuite/gas/arm/arch7em.d: Likewise.
* testsuite/gas/arm/archv8m-main-dsp-5.d: Likewise.
* testsuite/gas/arm/arm-it-auto-2.d: Likewise.
* testsuite/gas/arm/arm-it-auto-3.d: Likewise.
* testsuite/gas/arm/arm-it-auto.d: Likewise.
* testsuite/gas/arm/arm-it-bad-2.d: Likewise.
* testsuite/gas/arm/arm-it.d: Likewise.
* testsuite/gas/arm/armv7e-m+fpv5-d16.d: Likewise.
* testsuite/gas/arm/armv7e-m+fpv5-sp-d16.d: Likewise.
* testsuite/gas/arm/armv8-2-fp16-scalar-thumb.d: Likewise.
* testsuite/gas/arm/armv8-2-fp16-scalar.d: Likewise.
* testsuite/gas/arm/armv8-2-fp16-simd-thumb.d: Likewise.
* testsuite/gas/arm/armv8-2-fp16-simd.d: Likewise.
* testsuite/gas/arm/armv8-a+crypto.d: Likewise.
* testsuite/gas/arm/armv8-a+fp.d: Likewise.
* testsuite/gas/arm/armv8-a+ras.d: Likewise.
* testsuite/gas/arm/armv8-a+rdma-warning.d: Likewise.
* testsuite/gas/arm/armv8-a+rdma.d: Likewise.
* testsuite/gas/arm/armv8-a+simd.d: Likewise.
* testsuite/gas/arm/armv8-a-barrier-thumb.d: Likewise.
* testsuite/gas/arm/armv8-r+fp.d: Likewise.
* testsuite/gas/arm/armv8-r+simd.d: Likewise.
* testsuite/gas/arm/armv8-r-barrier-thumb.d: Likewise.
* testsuite/gas/arm/armv8_1-a+simd.d: Likewise.
* testsuite/gas/arm/armv8_2+rdma.d: Likewise.
* testsuite/gas/arm/armv8_2-a.d: Likewise.
* testsuite/gas/arm/armv8_3-a-fp.d: Likewise.
* testsuite/gas/arm/armv8_3-a-simd.d: Likewise.
* testsuite/gas/arm/armv8a-automatic-hlt.d: Likewise.
* testsuite/gas/arm/armv8a-automatic-lda.d: Likewise.
* testsuite/gas/arm/attr-syntax.d: Likewise.
* testsuite/gas/arm/automatic-bw.d: Likewise.
* testsuite/gas/arm/automatic-cbz.d: Likewise.
* testsuite/gas/arm/automatic-clrex.d: Likewise.
* testsuite/gas/arm/automatic-lda.d: Likewise.
* testsuite/gas/arm/automatic-ldaex.d: Likewise.
* testsuite/gas/arm/automatic-ldaexb.d: Likewise.
* testsuite/gas/arm/automatic-ldrex.d: Likewise.
* testsuite/gas/arm/automatic-ldrexd.d: Likewise.
* testsuite/gas/arm/automatic-movw.d: Likewise.
* testsuite/gas/arm/automatic-sdiv.d: Likewise.
* testsuite/gas/arm/automatic-strexb.d: Likewise.
* testsuite/gas/arm/barrier-bad-thumb.d: Likewise.
* testsuite/gas/arm/barrier-bad.d: Likewise.
* testsuite/gas/arm/barrier-thumb.d: Likewise.
* testsuite/gas/arm/barrier.d: Likewise.
* testsuite/gas/arm/bignum1.d: Likewise.
* testsuite/gas/arm/blx-bad.d: Likewise.
* testsuite/gas/arm/blx-bl-convert.d: Likewise.
* testsuite/gas/arm/blx-local.s: Likewise.
* testsuite/gas/arm/crc32-armv8-a-bad.d: Likewise.
* testsuite/gas/arm/crc32-armv8-a.d: Likewise.
* testsuite/gas/arm/crc32-armv8-r-bad.d: Likewise.
* testsuite/gas/arm/crc32-armv8-r.d: Likewise.
* testsuite/gas/arm/dis-data.d: Likewise.
* testsuite/gas/arm/dis-data2.d: Likewise.
* testsuite/gas/arm/dis-data3.d: Likewise.
* testsuite/gas/arm/eabi_attr_1.d: Likewise.
* testsuite/gas/arm/fp-save.d: Likewise.
* testsuite/gas/arm/group-reloc-alu-encoding-bad.d: Likewise.
* testsuite/gas/arm/group-reloc-alu-parsing-bad.d: Likewise.
* testsuite/gas/arm/group-reloc-alu.d: Likewise.
* testsuite/gas/arm/group-reloc-ldc-encoding-bad.d: Likewise.
* testsuite/gas/arm/group-reloc-ldc-parsing-bad.d: Likewise.
* testsuite/gas/arm/group-reloc-ldc.d: Likewise.
* testsuite/gas/arm/group-reloc-ldr-encoding-bad.d: Likewise.
* testsuite/gas/arm/group-reloc-ldr-parsing-bad.d: Likewise.
* testsuite/gas/arm/group-reloc-ldr.d: Likewise.
* testsuite/gas/arm/group-reloc-ldrs-encoding-bad.d: Likewise.
* testsuite/gas/arm/group-reloc-ldrs-parsing-bad.d: Likewise.
* testsuite/gas/arm/group-reloc-ldrs.d: Likewise.
* testsuite/gas/arm/insn-error-a.d: Likewise.
* testsuite/gas/arm/insn-error-t.d: Likewise.
* testsuite/gas/arm/inst-po-2.d: Likewise.
* testsuite/gas/arm/inst-po-3.d: Likewise.
* testsuite/gas/arm/inst-po-be.d: Likewise.
* testsuite/gas/arm/inst-po.d: Likewise.
* testsuite/gas/arm/ldconst.d: Likewise.
* testsuite/gas/arm/ldgesb-bad.d: Likewise.
* testsuite/gas/arm/ldgesh-bad.d: Likewise.
* testsuite/gas/arm/ldst-offset0.d: Likewise.
* testsuite/gas/arm/local_function.d: Likewise.
* testsuite/gas/arm/local_label_coff.d: Likewise.
* testsuite/gas/arm/local_label_elf.d: Likewise.
* testsuite/gas/arm/mapping.d: Likewise.
* testsuite/gas/arm/mapping2.d: Likewise.
* testsuite/gas/arm/mapping3.d: Likewise.
* testsuite/gas/arm/mapping4.d: Likewise.
* testsuite/gas/arm/mapshort-elf.d: Likewise.
* testsuite/gas/arm/mask_1-armv8-a.d: Likewise.
* testsuite/gas/arm/mask_1-armv8-r.d: Likewise.
* testsuite/gas/arm/movs-thumb1-reloc-local-armv7-m.d: Likewise.
* testsuite/gas/arm/movs-thumb1-reloc-local.d: Likewise.
* testsuite/gas/arm/movw-local.d: Likewise.
* testsuite/gas/arm/mrs-msr-thumb-v6t2.d: Likewise.
* testsuite/gas/arm/mrs-msr-thumb-v7-m.d: Likewise.
* testsuite/gas/arm/mrs-msr-thumb-v7e-m.d: Likewise.
* testsuite/gas/arm/msr-imm-bad.d: Likewise.
* testsuite/gas/arm/msr-reg-bad.d: Likewise.
* testsuite/gas/arm/msr-reg-thumb.d: Likewise.
* testsuite/gas/arm/nomapping.d: Likewise.
* testsuite/gas/arm/nops.d: Likewise.
* testsuite/gas/arm/pic.d: Likewise.
* testsuite/gas/arm/pinsn.d: Likewise.
* testsuite/gas/arm/plt-1.d: Likewise.
* testsuite/gas/arm/pr21458.d: Likewise.
* testsuite/gas/arm/pr9722.d: Likewise.
* testsuite/gas/arm/strex-t.d: Likewise.
* testsuite/gas/arm/t2-branch-global.d: Likewise.
* testsuite/gas/arm/target-reloc-1.d: Likewise.
* testsuite/gas/arm/thumb-b-bad.d: Likewise.
* testsuite/gas/arm/thumb-w-bad.d: Likewise.
* testsuite/gas/arm/thumb-w-good.d: Likewise.
* testsuite/gas/arm/thumb.d: Likewise.
* testsuite/gas/arm/thumb2_it.d: Likewise.
* testsuite/gas/arm/thumb2_it_auto.d: Likewise.
* testsuite/gas/arm/thumb2_it_search.d: Likewise.
* testsuite/gas/arm/thumb2_ldmstm.d: Likewise.
* testsuite/gas/arm/thumb2_ldr_immediate_armv6.d: Likewise.
* testsuite/gas/arm/thumb2_ldr_immediate_armv6t2.d: Likewise.
* testsuite/gas/arm/thumb2_ldr_immediate_highregs_armv6t2.d: Likewise.
* testsuite/gas/arm/thumb2_pool.d: Likewise.
* testsuite/gas/arm/thumb2_vpool.d: Likewise.
* testsuite/gas/arm/thumb2_vpool_be.d: Likewise.
* testsuite/gas/arm/thumb32.d: Likewise.
* testsuite/gas/arm/thumbver.d: Likewise.
* testsuite/gas/arm/tls.d: Likewise.
* testsuite/gas/arm/tls_vxworks.d: Likewise.
* testsuite/gas/arm/undefined.d: Likewise.
* testsuite/gas/arm/undefined_coff.d: Likewise.
* testsuite/gas/arm/unwind.d: Likewise.
* testsuite/gas/arm/v4bx.d: Likewise.
* testsuite/gas/arm/vcmp-noprefix-imm.d: Likewise.
* testsuite/gas/arm/vcvt-bad.d: Likewise.
* testsuite/gas/arm/vfma1.d: Likewise.
* testsuite/gas/arm/vldconst.d: Likewise.
* testsuite/gas/arm/vldconst_be.d: Likewise.
* testsuite/gas/arm/vldm-arm.d: Likewise.
* testsuite/gas/arm/vldr.d: Likewise.
* testsuite/gas/arm/weakdef-1.d: Likewise.
* testsuite/gas/arm/weakdef-2.d: Likewise.
* config/te-riscix.h: Delete.
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
ld/
* Makefile.am: Remove arm-aout and arm-coff support.
* configure.tgt: Likewise.
* testsuite/ld-arm/attr-merge-div-00.d: Likewise.
* testsuite/ld-arm/attr-merge-div-01-m3.d: Likewise.
* testsuite/ld-arm/attr-merge-div-01.d: Likewise.
* testsuite/ld-arm/attr-merge-div-02.d: Likewise.
* testsuite/ld-arm/attr-merge-div-10-m3.d: Likewise.
* testsuite/ld-arm/attr-merge-div-10.d: Likewise.
* testsuite/ld-arm/attr-merge-div-11.d: Likewise.
* testsuite/ld-arm/attr-merge-div-12.d: Likewise.
* testsuite/ld-arm/attr-merge-div-120.d: Likewise.
* testsuite/ld-arm/attr-merge-div-20.d: Likewise.
* testsuite/ld-arm/attr-merge-div-21.d: Likewise.
* testsuite/ld-arm/attr-merge-div-22.d: Likewise.
* testsuite/ld-arm/attr-merge-hardfp-use-1.d: Likewise.
* testsuite/ld-arm/attr-merge-hardfp-use-2.d: Likewise.
* testsuite/ld-arm/attr-merge-nosection-1.d: Likewise.
* testsuite/ld-arm/attr-merge-unknown-2.d: Likewise.
* testsuite/ld-arm/attr-merge-unknown-2r.d: Likewise.
* testsuite/ld-arm/attr-merge-unknown-3.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-1.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-10.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-10r.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-11.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-11r.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-12.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-12r.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-13.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-13r.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-14.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-14r.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-1r.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-2.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-2r.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-3.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-3r.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-4.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-4r.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-5.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-5r.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-6.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-6r.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-7.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-7r.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-8.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-8r.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-9.d: Likewise.
* testsuite/ld-arm/attr-merge-vfp-9r.d: Likewise.
* testsuite/ld-arm/attr-merge-wchar-00-nowarn.d: Likewise.
* testsuite/ld-arm/attr-merge-wchar-00.d: Likewise.
* testsuite/ld-arm/attr-merge-wchar-02-nowarn.d: Likewise.
* testsuite/ld-arm/attr-merge-wchar-02.d: Likewise.
* testsuite/ld-arm/attr-merge-wchar-04-nowarn.d: Likewise.
* testsuite/ld-arm/attr-merge-wchar-04.d: Likewise.
* testsuite/ld-arm/attr-merge-wchar-20-nowarn.d: Likewise.
* testsuite/ld-arm/attr-merge-wchar-20.d: Likewise.
* testsuite/ld-arm/attr-merge-wchar-22-nowarn.d: Likewise.
* testsuite/ld-arm/attr-merge-wchar-22.d: Likewise.
* testsuite/ld-arm/attr-merge-wchar-24-nowarn.d: Likewise.
* testsuite/ld-arm/attr-merge-wchar-40-nowarn.d: Likewise.
* testsuite/ld-arm/attr-merge-wchar-40.d: Likewise.
* testsuite/ld-arm/attr-merge-wchar-42-nowarn.d: Likewise.
* testsuite/ld-arm/attr-merge-wchar-44-nowarn.d: Likewise.
* testsuite/ld-arm/attr-merge-wchar-44.d: Likewise.
* testsuite/ld-arm/eabi-hard-float.d: Likewise.
* testsuite/ld-arm/eabi-soft-float-ABI4.d: Likewise.
* testsuite/ld-arm/eabi-soft-float-r.d: Likewise.
* testsuite/ld-arm/eabi-soft-float.d: Likewise.
* testsuite/ld-arm/gc-hidden-1.d: Likewise.
* emulparams/armaoutb.sh: Delete.
* emulparams/armaoutl.sh: Delete.
* emulparams/armcoff.sh: Delete.
* emulparams/armnbsd.sh: Delete.
* emulparams/riscix.sh: Delete.
* scripttempl/armaout.sc: Delete.
* scripttempl/armcoff.sc: Delete.
* scripttempl/riscix.sc: Delete.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.

6 years agoAutomatic date update in version.in
GDB Administrator [Wed, 25 Apr 2018 00:00:32 +0000 (00:00 +0000)] 
Automatic date update in version.in

6 years agoFix internal error caused by conflicting default version definitions.
Cary Coutant [Mon, 23 Apr 2018 16:27:35 +0000 (09:27 -0700)] 
Fix internal error caused by conflicting default version definitions.

gold/
PR gold/16504
* dynobj.cc (Versions::symbol_section_contents): Don't set
VERSYM_HIDDEN flag for undefined symbols.
* symtab.cc (Symbol_table::add_from_object): Don't override default
version definition with a different default version.
* symtab.h (Symbol::from_dyn): New method.
* testsuite/plugin_test.c (struct sym_info): Add ver field.
(claim_file_hook): Pass symbol version to plugin API.
(parse_readelf_line): Parse symbol version.
* testsuite/Makefile.am (ver_test_pr16504): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/ver_test_pr16504.sh: New test script.
* testsuite/ver_test_pr16504_a.c: New source file.
* testsuite/ver_test_pr16504_a.script: New version script.
* testsuite/ver_test_pr16504_b.c: New source file.
* testsuite/ver_test_pr16504_b.script: New version script.

6 years agoEnable 'set print inferior-events' and improve detach/fork/kill/exit messages
Sergio Durigan Junior [Wed, 31 Jan 2018 00:09:42 +0000 (19:09 -0500)] 
Enable 'set print inferior-events' and improve detach/fork/kill/exit messages

This patch aims to turn 'set print inferior-events' always on, and do
some cleanup on the messages printed by GDB when various inferior
events happen (attach, detach, fork, kill, exit).

To make sure that the patch is correct, I've tested it with a handful
of combinations of 'set follow-fork-mode', 'set detach-on-fork' and
'set print inferior-events'.  In the end, I decided to make my
hand-made test into an official testcase.  More on that below.

Using the following program as an example:

  #include <unistd.h>
  int main ()
  {
    fork ();
    return 0;
  }

We see the following outputs from the patched GDB:

- With 'set print inferior-events on':

    (gdb) r
    Starting program: a.out
    [Detaching after fork from child process 27749]
    [Inferior 1 (process 27745) exited normally]
    (gdb)

- With 'set print inferior-events off':

    (gdb) r
    Starting program: a.out
    [Inferior 1 (process 27823) exited normally]
    (gdb)

  Comparing this against an unpatched GDB:

- With 'set print inferior-events off' and 'set follow-fork-mode
  child':

    (gdb) r
    Starting program: a.out
    [Inferior 2 (process 5993) exited normally]
    (gdb)

  Compare this against an unpatched GDB:

    (unpatched-gdb) r
    Starting program: a.out
    [New process 5702]
    [Inferior 2 (process 5702) exited normally]
    (unpatched-gdb)

  It is possible to notice that, in this scenario, the patched GDB
  will lose the '[New process %d]' message.

- With 'set print inferior-events on', 'set follow-fork-mode child'
  and 'set detach-on-fork on':

    (gdb) r
    Starting program: a.out
    [Attaching after process 27905 fork to child process 27909]
    [New inferior 2 (process 27909)]
    [Detaching after fork from parent process 27905]
    [Inferior 1 (process 27905) detached]
    [Inferior 2 (process 27909) exited normally]
    (gdb)

  Compare this output with an unpatched GDB, using the same settings:

    (unpatched-gdb) r
    Starting program: a.out
    [New inferior 28033]
    [Inferior 28029 detached]
    [New process 28033]
    [Inferior 2 (process 28033) exited normally]
    [Inferior 28033 exited]
    (unpatched-gdb)

As can be seen above, I've also made a few modifications to messages
that are printed when 'set print inferior-events' is on.  For example,
a few of the messages did not contain the '[' and ']' as
prefix/suffix, which led to a few inconsistencies like:

  Attaching after process 22995 fork to child process 22999.
  [New inferior 22999]
  Detaching after fork from child process 22999.
  [Inferior 22995 detached]
  [Inferior 2 (process 22999) exited normally]

So I took the opportunity and included the square brackets where
applicable.  I have also made the existing messages more uniform, by
always printing "Inferior %d (process %d)..." where applicable.  This
makes it easier to identify the inferior number and the PID number
from the messages.

As suggested by Pedro, the "[Inferior %d exited]" message from
'exit_inferior' has been removed, because it got duplicated when
'inferior-events' is on.  I'm also using the
'add_{thread,inferior}_silent' versions (instead of their verbose
counterparts) on some locations, also to avoid duplicated messages.
For example, a patched GDB with 'set print inferior-events on', 'set
detach-on-fork on' and 'set follow-fork-mode child', but using
'add_thread', would print:

  (gdb) run
  Starting program: a.out
  [Attaching after process 25088 fork to child process 25092.]
  [New inferior 25092]   <--- duplicated
  [Detaching after fork from child process 25092.]
  [Inferior 25088 detached]
  [New process 25092]    <--- duplicated
  [Inferior 2 (process 25092) exited normally]

But if we use 'add_thread_silent' (with the same configuration as
before):

  (gdb) run
  Starting program: a.out
  [Attaching after process 31606 fork to child process 31610]
  [New inferior 2 (process 31610)]
  [Detaching after fork from parent process 31606]
  [Inferior 1 (process 31606) detached]
  [Inferior 2 (process 31610) exited normally]

As for the tests, the configuration options being exercised are:

- follow-fork-mode: child/parent
- detach-on-fork: on/off
- print inferior-events: on/off

It was also necessary to perform adjustments on several testcases,
because the expected messages changed considerably.

Built and regtested on BuildBot, without regressions.

gdb/ChangeLog:
2018-04-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
    Sergio Durigan Junior  <sergiodj@redhat.com>
    Pedro Alves  <palves@redhat.com>

* infcmd.c (kill_command): Print message when inferior has
been killed.
* inferior.c (print_inferior_events): Remove 'static'.  Set as
'1'.
(add_inferior): Improve message printed when
'print_inferior_events' is on.
(exit_inferior): Remove message printed when
'print_inferior_events' is on.
(detach_inferior): Improve message printed when
'print_inferior_events' is on.
(initialize_inferiors): Use 'add_inferior_silent' to set
'current_inferior_'.
* inferior.h (print_inferior_events): Declare here as
'extern'.
* infrun.c (follow_fork_inferior): Print '[Attaching...]' or
'[Detaching...]' messages when 'print_inferior_events' is on.
Use 'add_thread_silent' instead of 'add_thread'.  Add '[' and ']'
as prefix/suffix for messages.  Remove periods.  Fix erroneous
'Detaching after fork from child...', replace it by '... from
parent...'.
(handle_vfork_child_exec_or_exit): Add '[' and ']' as
prefix/suffix when printing 'Detaching...' messages.  Print
them when 'print_inferior_events' is on.
* remote.c (remote_detach_1): Print message when detaching
from inferior and '!is_fork_parent'.

gdb/testsuite/ChangeLog:
2018-04-24  Jan Kratochvil  <jan.kratochvil@redhat.com>
    Sergio Durigan Junior  <sergiodj@redhat.com>
    Pedro Alves  <palves@redhat.com>

* gdb.base/attach-non-pgrp-leader.exp: Adjust 'Detaching...'
regexps to expect for '[Inferior ... detached]' as well.
* gdb.base/attach.exp: Likewise.
* gdb.base/catch-syscall.exp (check_for_program_end): Adjust
"gdb_continue_to_end".
(test_catch_syscall_with_wrong_args): Likewise.
* gdb.base/foll-fork.exp: Adjust regexps to match '[' and
']'.  Don't set 'verbose' on.
* gdb.base/foll-vfork.exp: Likewise.
* gdb.base/fork-print-inferior-events.c: New file.
* gdb.base/fork-print-inferior-events.exp: New file.
* gdb.base/hook-stop.exp: Adjust regexps to expect for new
'[Inferior ... has been killed]' message.
* gdb.base/kill-after-signal.exp: Likewise.
* gdb.base/solib-overlap.exp: Adjust regexps to expect for new
detach message.
* gdb.threads/kill.exp: Adjust regexps to expect for new kill
message.
* gdb.threads/clone-attach-detach.exp: Adjust 'Detaching...'
regexps to expect for '[Inferior ... detached]' as well.
* gdb.threads/process-dies-while-detaching.exp: Likewise.

6 years agoFix an illegal memory access when trying to copy an ELF binary with corrupt section...
Nick Clifton [Tue, 24 Apr 2018 15:57:04 +0000 (16:57 +0100)] 
Fix an illegal memory access when trying to copy an ELF binary with corrupt section symbols.

PR 23113
* elf.c (ignore_section_sym): Check for the output_section pointer
being NULL before dereferencing it.

6 years agoFix an illegal memory access when copying a PE format file with corrupt debug informa...
Nick Clifton [Tue, 24 Apr 2018 15:31:27 +0000 (16:31 +0100)] 
Fix an illegal memory access when copying a PE format file with corrupt debug information.

PR 23110
* peXXigen.c (_bfd_XX_bfd_copy_private_bfd_data_common): Check for
a negative PE_DEBUG_DATA size before iterating over the debug data.

6 years agoinfo-shared.exp: Replace libs=-ldl with shlib_load
Simon Marchi [Tue, 24 Apr 2018 14:14:14 +0000 (10:14 -0400)] 
info-shared.exp: Replace libs=-ldl with shlib_load

As reported in PR 23104, -ldl doesn't work on FreeBSD.  Replace it with
shlib_load, which adds the right flags for dynamic library loading based
on the current target platform.

The test still passes on Linux, and should now pass on FreeBSD, though I
did not test personally.

gdb/testsuite/ChangeLog:

PR gdb/23104
* gdb.base/info-shared.exp: Replace libs=-ldl with shlib_load.

6 years agoReindent cli-out.h
Tom Tromey [Sun, 22 Apr 2018 23:57:32 +0000 (17:57 -0600)] 
Reindent cli-out.h

I noticed that cli-out.h had incorrect indentation in some spots.
This fixes it.

ChangeLog
2018-04-24  Tom Tromey  <tom@tromey.com>

* cli-out.h: Reindent.

6 years agoRemove cli_ui_out::out_field_fmt
Tom Tromey [Sun, 22 Apr 2018 23:54:20 +0000 (17:54 -0600)] 
Remove cli_ui_out::out_field_fmt

I noticed that cli_ui_out::out_field_fmt is only used by a single
caller, and it can easily be replaced by fputs_filtered.  So, this
patch removes it.

ChangeLog
2018-04-24  Tom Tromey  <tom@tromey.com>

* cli-out.c (cli_ui_out::out_field_fmt): Remove.
(cli_ui_out::do_field_string): Use fputs_filtered.
* cli-out.h (class cli_ui_out) <out_field_fmt>: Remove.

6 years agoAutomatic date update in version.in
GDB Administrator [Tue, 24 Apr 2018 00:00:42 +0000 (00:00 +0000)] 
Automatic date update in version.in

6 years agoRemove a cleanup from scm-frame.c
Tom Tromey [Sat, 21 Apr 2018 22:38:33 +0000 (16:38 -0600)] 
Remove a cleanup from scm-frame.c

This removes a cleanup from scm-frame.c, replacing it with
unique_xmalloc_ptr and a new scope.  I believe this also fixes a
latent bug involving calling do_cleanups twice for a single cleanup.

Regression tested using the gdb.guile test suite on x86-64 Fedora 26.

ChangeLog
2018-04-23  Tom Tromey  <tom@tromey.com>

* guile/scm-frame.c (gdbscm_frame_read_var): Use
gdb::unique_xmalloc_ptr.

6 years agoRegenerate gdb/configure and gdbserver/configure
Tom Tromey [Mon, 23 Apr 2018 15:21:18 +0000 (09:21 -0600)] 
Regenerate gdb/configure and gdbserver/configure

Pedro pointed out that gdb/configure and gdbserver/configure weren't
updated after some recent *.m4 changes.

This patch rebuilds those files.  Tested by rebuilding.  Pedro
approved this in the thread where he raised this issue, so I'm pushing
it in.

ChangeLog
2018-04-23  Tom Tromey  <tom@tromey.com>

* configure: Rebuild.

gdbserver/ChangeLog
2018-04-23  Tom Tromey  <tom@tromey.com>

* configure: Rebuild.

6 years agoRevert bfd part of "Silence gcc-8 warnings"
Alan Modra [Mon, 23 Apr 2018 14:17:22 +0000 (23:47 +0930)] 
Revert bfd part of "Silence gcc-8 warnings"

The gcc warning has been fixed, and the patch regressed builds with
some older versions of gcc.

* elf-linux-core.h: Revert last change.
* elf.c: Likewise.

6 years agoPrevent an illegal memory access in gprof by ensuring that string tables for aout...
Nick Clifton [Mon, 23 Apr 2018 11:52:42 +0000 (12:52 +0100)] 
Prevent an illegal memory access in gprof by ensuring that string tables for aout format files are always zero-terminated.

PR 23056
* aoutx.h (aout_get_external_symbols): Allocate an extra byte at
the end of the string table, and zero it.

6 years agoSilence gcc-8 warnings
Alan Modra [Mon, 23 Apr 2018 00:12:44 +0000 (09:42 +0930)] 
Silence gcc-8 warnings

All of these warnings were false positives.  -Wstringop-truncation is
particularly annoying when it warns about strncpy used quite correctly.

bfd/
* elf-linux-core.h (swap_linux_prpsinfo32_ugid32_out): Disable
gcc-8 string truncation warning.
(swap_linux_prpsinfo32_ugid16_out): Likewise.
(swap_linux_prpsinfo64_ugid32_out): Likewise.
(swap_linux_prpsinfo64_ugid16_out): Likewise.
* elf.c (elfcore_write_prpsinfo): Likewise.
gas/
* stabs.c (generate_asm_file): Use memcpy rather than strncpy.
Remove call to strlen inside loop.
* config/tc-cr16.c (getreg_image): Warning fix.
* config/tc-crx.c (getreg_image): Warning fix.

6 years agoAutomatic date update in version.in
GDB Administrator [Mon, 23 Apr 2018 00:00:25 +0000 (00:00 +0000)] 
Automatic date update in version.in

6 years agoFixed test case to compile & run on FreeBSD
Rajendra SY [Sun, 22 Apr 2018 22:19:26 +0000 (18:19 -0400)] 
Fixed test case to compile & run on FreeBSD

Problems:
1. linking -dl lib on FreeBSD platform
2. backtrace from ld-elf shows r_debug_state() instead of _dl_debug_state()

Cause:
1. There is no dl library on FreeBSD platform test has to ignore linking "-ldl"
2. The stop due to a shared library event shows backtrace frame #0
   function as r_debug_state()

gdb/ChangeLog:

PR gdb/23095
* gdb/testsuite/gdb.base/break-probes.exp: Pass shlib_load to
prepare_for_testing.  Set normal_bp to r_debug_state if target
is bsd.

6 years agoAutomatic date update in version.in
GDB Administrator [Sun, 22 Apr 2018 00:01:03 +0000 (00:01 +0000)] 
Automatic date update in version.in

6 years agoFreeBSD: Fix 'Couldn't get registers: Device busy' error (PR gdb/23077)
Pedro Alves [Sat, 21 Apr 2018 17:19:30 +0000 (18:19 +0100)] 
FreeBSD: Fix 'Couldn't get registers: Device busy' error (PR gdb/23077)

As Rajendra SY reported at
<https://sourceware.org/ml/gdb-patches/2018-04/msg00399.html>, several
attach-related tests are failing on FreeBSD.  The "attach" command
errors with "Couldn't get registers: Device busy".

When the "attach" command is executed, it calls target_attach ->
inf_ptrace_attach, which just does the ptrace(PT_ATTACH), it does not
wait for the child to stop with SIGSTOP.  Afterwards, the command is
complete and we go back to the event loop.  The event loop wakes up
and we end up in target_wait -> fbsd_wait, and handle the SIGSTOP
stop.

At the end of execute_command, though, before going back to the event
loop, we check if the frame language changed via
check_frame_language_change().  That reads the current PC, which is
what leads to the registers read that fails.

The problem is that we fail to mark the attached-to thread as
executing between the initial attach, and the subsequent target_wait.
Until we see the thread stop with SIGSTOP, we shouldn't try to read
registers off of it.  I guess there may a timing issue here - if
you're "lucky", the thread may stop before gdb reads its registers,
masking the problem.

With that fixed, check_frame_language_change() becomes a nop until the
thread is marked not-executing again, after target_wait is called and
we go through handle_inferior_event -> normal_stop.

We haven't seen the problem on Linux because there, the target_attach
implementation waits for the thread to stop before returning.  Still,
that's supposedly hidden from the core, since the Linux target, like
most targets, is a '!to_attach_no_wait' target.

This fixes:
 FAIL: gdb.base/attach.exp: attach1, after setting file
 FAIL: gdb.base/attach.exp: attach2, with no file
 FAIL: gdb.base/attach.exp: load file manually, after attach2 (re-read) (got interactive prompt)
 FAIL: gdb.base/attach.exp: attach when process' a.out not in cwd

 FAIL: gdb.base/dprintf-detach.exp: bai=on ds=gdb dd=on: re-attach to inferior
 FAIL: gdb.base/dprintf-detach.exp: bai=on ds=gdb dd=off: re-attach to inferior
 FAIL: gdb.base/dprintf-detach.exp: bai=on ds=call dd=on: re-attach to inferior
 FAIL: gdb.base/dprintf-detach.exp: bai=on ds=call dd=off: re-attach to inferior
 FAIL: gdb.base/dprintf-detach.exp: bai=on ds=agent dd=on: re-attach to inferior
 FAIL: gdb.base/dprintf-detach.exp: bai=on ds=agent dd=off: re-attach to inferior
 FAIL: gdb.base/dprintf-detach.exp: bai=off ds=gdb dd=on: re-attach to inferior
 FAIL: gdb.base/dprintf-detach.exp: bai=off ds=gdb dd=off: re-attach to inferior
 FAIL: gdb.base/dprintf-detach.exp: bai=off ds=call dd=on: re-attach to inferior
 FAIL: gdb.base/dprintf-detach.exp: bai=off ds=call dd=off: re-attach to inferior
 FAIL: gdb.base/dprintf-detach.exp: bai=off ds=agent dd=on: re-attach to inferior
 FAIL: gdb.base/dprintf-detach.exp: bai=off ds=agent dd=off: re-attach to inferior

gdb/ChangeLog:
2018-04-21  Pedro Alves  <palves@redhat.com>
    Rajendra SY  <rajendra.sy@gmail.com>

* inf-ptrace.c (inf_ptrace_attach): Mark the thread as executing.
* remote.c (extended_remote_attach): In all-stop mode, mark the
thread as executing.

6 years agoTest that gcc -B picks up new ld
Alan Modra [Sat, 21 Apr 2018 02:36:57 +0000 (12:06 +0930)] 
Test that gcc -B picks up new ld

gcc configured using --with-ld always uses that particular version of
ld if it exists.  This patch adds a check that the ld version reported
directly from ld-new matches that reported via gcc.  I chose to
compare the ld --version output rather than a more strict test (for
example by gcc --print-prog-name=ld), because the version test allows
a user to run the ld testsuite after installing a new ld (in the place
expected by gcc).

Sample output:

Running target unix
Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
Using /home/alan/src/binutils-gdb/ld/testsuite/config/default.exp as tool-and-target-specific interface file.
ERROR: ************************************************************************
ERROR: Your compiler driver ignores -B when choosing ld.
ERROR: You will not be testing the new ld in many of the following tests.
ERROR: It seems you will be testing /usr/bin/x86_64-w64-mingw32-ld instead.
ERROR: ************************************************************************
WARNING: Assuming target board is the local machine (which is probably wrong).
You may need to set your DEJAGNU environment variable.
Running /home/alan/src/binutils-gdb/ld/testsuite/ld-aarch64/aarch64-elf.exp ...

* testsuite/lib/ld-lib.exp (run_host_cmd): Check that gcc -B
works.

6 years agoAutomatic date update in version.in
GDB Administrator [Sat, 21 Apr 2018 00:00:36 +0000 (00:00 +0000)] 
Automatic date update in version.in

6 years agoRISC-V: Add new option -mrelax/-mno-relax.
Jim Wilson [Fri, 20 Apr 2018 22:30:18 +0000 (15:30 -0700)] 
RISC-V: Add new option -mrelax/-mno-relax.

gas/
* config/tc-riscv.c (options): Add OPTION_RELAX and
OPTION_NO_RELAX.
(md_longopts): New option -mrelax and -mno-relax.
(md_parse_option): Handle -mrelax and -mno-relax.
* doc/c-riscv.texi: Document for -mrelax and -mno-relax.
* testsuite/gas/riscv/no-relax-reloc.d: New.
* testsuite/gas/riscv/no-relax-reloc.s: New.
* testsuite/gas/riscv/relax-reloc.d: New.
* testsuite/gas/riscv/relax-reloc.s: New.

6 years agoImprove on-line help for thread_apply_command and thread_apply_all_command.
Philippe Waroquiers [Fri, 20 Apr 2018 04:23:37 +0000 (06:23 +0200)] 
Improve on-line help for thread_apply_command and thread_apply_all_command.

Add a Usage: line for thread_apply_command, in particular to mention
the thread ID list.

In thread_apply_command and thread_apply_all_command help, use
uppercase for arg names, as this style seems to be more standard.

2018-04-20  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* thread.c (_initialize_thread): improve on-line help for
thread_apply_command and thread_apply_all_command.

6 years agoPR22978, TLS local-dynamic incorrectly linked on hppa-linux
Alan Modra [Thu, 19 Apr 2018 01:49:35 +0000 (11:19 +0930)] 
PR22978, TLS local-dynamic incorrectly linked on hppa-linux

We were emitting dynamic relocs on the second word of a TLS GD GOT
entry pair (the dtprel offset), without the addend necessary when no
symbol is present on the dynamic reloc.  Unfortunately the simple
solution of providing the proper addend doesn't work due to an hppa
glibc ld.so bug that ignores such addends.  So instead optimize the
relocs.  The dtprel offset is known at link time for locally defined
symbols (the only case where we'll end up with no symbol on a dynamic
reloc) so we can omit the dynamic reloc in that case.

Furthermore, we can omit a dynamic reloc on the first word of a TLS GD
GOT entry pair (the module id) if the symbol is local and we are
producing an executable.  Similarly, a tprel reloc on a TLS IE GOT
entry is not needed for local symbols in an executable.  So the
condition for TLS GOT relocs can become bfd_link_dll(info) rather than
bfd_link_pic(info) as needed for normal GOT relocs.

This all presumes hppa ld.so doesn't need to differentiate TLS GD GOT
pairs from TLS LD GOT pairs, which is currently true.

PR 22978
* elf32-hppa.c (got_relocs_needed): Add extra param to special
case both dtprel and tprel relocs.
(allocate_dynrelocs): Adjust conditions for got relocs.
(elf32_hppa_relocate_section): Likewise for local sym got relocs.
Emit dynamic relocs on TLS GOT entries for shared libraries,
not when pic.  Omit dynamic reloc on dtprel entry when local,
and on tprel entry when local and executable.

6 years agoUpdated Spanish translation for gas sub-directory
Nick Clifton [Fri, 20 Apr 2018 10:18:53 +0000 (11:18 +0100)] 
Updated Spanish translation for gas sub-directory

6 years agoAdd test case for a known hang in infrun
Richard Bunt [Fri, 20 Apr 2018 03:02:35 +0000 (23:02 -0400)] 
Add test case for a known hang in infrun

The hang occurs when GDB tries to call inferior functions on two
different threads with scheduler-locking turned on. The first call works
fine, with the call to infrun_async(1) causing the signal_handler to be
marked and the event to be handled, but then the event loop resets the
"ready" member to zero, while leaving infrun_is_async set to 1. As a
result, GDB hangs if the user switches to another thread and calls a
second function because calling infrun_async(1) a second time has no
effect, meaning the inferior call events are never handled.

The added test case provokes the above issue.

gdb/testsuite/ChangeLog:

* gdb.threads/multiple-successive-infcall.c: New test.
* gdb.threads/multiple-successive-infcall.exp: New file.

6 years agoAutomatic date update in version.in
GDB Administrator [Fri, 20 Apr 2018 00:00:25 +0000 (00:00 +0000)] 
Automatic date update in version.in

6 years ago[OB PATCH] Fix some comments in thread.c
Philippe Waroquiers [Thu, 19 Apr 2018 20:48:41 +0000 (22:48 +0200)] 
[OB PATCH] Fix some comments in thread.c

Fix some typos.
Remove obsolete comment about dispatch to thread_apply_command,
rather tell that thread_command either switches to a thread,
or prints the current thread.

2018-04-19  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* thread.c (thread_apply_all_command): Fix comment.
(thread_command): Fix comment.

6 years agoFix dependency tracking in gdbserver subdirectories
Simon Marchi [Thu, 19 Apr 2018 17:19:41 +0000 (13:19 -0400)] 
Fix dependency tracking in gdbserver subdirectories

The dependency tracking (the thing that knows which source file included
which other source file during last build to know what to rebuild when
an included file changes) is broken for gdbserver subdirectories (arch
and common).

The dependency tracking files are created in the form

  arch/.deps/i386.Po

but we try to include

  .deps/arch/i386.Po

An easy smoke test is too "touch" the gdb/features/i386/32bit-core.c
file in the source directory and try to rebuild gdbserver.  This file is
included by gdb/arch/i386.c, so it should cause
gdb/gdbserver/arch/i386.o in the build directory to be rebuilt.  It
currently isn't rebuilt, but is with this patch applied.

This patch copies the technique used in GDB to transform the dep file
paths to the proper form.

Also, while testing using the depcomp method of dependency tracking (by
just hacking the condition), I noticed that depcomp was not found.  The
path to depcomp seems to be missing a "..".

gdb/gdbserver/ChangeLog:

* Makefile.in (depcomp): Add "..".
(all_deps_files): New and use it.

6 years agoFix second bug where --icf=safe triggers segfault when linking ARM.
Cary Coutant [Thu, 19 Apr 2018 17:20:08 +0000 (10:20 -0700)] 
Fix second bug where --icf=safe triggers segfault when linking ARM.

When checking a R_ARM_TARGET[12] relocation, we need a valid target
pointer, but the garbage collection code was passing a NULL instead.
The previous fix for this bug fixed the call to
scan.global_reloc_may_be_function_pointer, but missed the similar
call to scan.local_reloc_may_be_function_pointer.

gold/
PR gold/23046
* gc.h (gc_process_relocs): Pass target to
scan.local_reloc_may_be_function_pointer.

6 years agoPR22537, Segmentation fault with static PIE
Alan Modra [Thu, 19 Apr 2018 04:43:41 +0000 (14:13 +0930)] 
PR22537, Segmentation fault with static PIE

The only stub type that makes sense for undefined symbols, or those
defined in shared libraries, is a plt call stub.  This patch arranges
to have "destination" set to -1 on such symbols, making for an easy
test in hppa_type_of_stub.

PR 22537
* elf32-hppa.c (elf32_hppa_size_stubs): Init "destination" to -1.
(hppa_type_of_stub): Don't return a long branch stub for
symbols other than those defined statically.

6 years agoReinstate mips ecoff support
Alan Modra [Wed, 18 Apr 2018 22:29:56 +0000 (07:59 +0930)] 
Reinstate mips ecoff support

* Makefile.am: Revert 2018-04-18 coff-mips changes.
* config.bfd: Add back mips_ecoff_le_vec and mips_ecoff_be_vec
to selvecs for mips targets change 2018-04-18.
* configure.ac: Reinstate mips_ecoff_le_vec, mips_ecoff_be_vec
and  mips_ecoff_bele_vec.
* targets.c: Likewise.
* coff-mips.c: Resurrect.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.

6 years agoAutomatic date update in version.in
GDB Administrator [Thu, 19 Apr 2018 00:00:27 +0000 (00:00 +0000)] 
Automatic date update in version.in

6 years agoRemove xml files from gdbserver
Alan Hayward [Wed, 18 Apr 2018 20:01:22 +0000 (21:01 +0100)] 
Remove xml files from gdbserver

For ports which use new target descriptions, remove
the xml files from being built into gdbserver.

gdbserver/
* configure.srv (aarch64*-*-linux*): Don't include xml.
(i[34567]86-*-cygwin*): Likewise.
(i[34567]86-*-linux*): Likewise.
(i[34567]86-*-lynxos*): Likewise.
(i[34567]86-*-mingw32ce*): Likewise.
(i[34567]86-*-mingw*): Likewise.
(i[34567]86-*-nto*): Likewise.
(tic6x-*-uclinux): Likewise.
(x86_64-*-linux*): Likewise.
(x86_64-*-mingw*): Likewise.
(x86_64-*-cygwin*): Likewise.

6 years agoRemove xml file references from target descriptions
Alan Hayward [Wed, 18 Apr 2018 19:49:37 +0000 (20:49 +0100)] 
Remove xml file references from target descriptions

gdb/
* common/tdesc.h (tdesc_create_feature): Remove xml filename
parameter.
* features/aarch64-core.c (create_feature_aarch64_core):
Regenerate.
* features/aarch64-fpu.c (create_feature_aarch64_fpu):
Likewise.
* features/i386/32bit-avx.c (create_feature_i386_32bit_avx):
Likewise.
* features/i386/32bit-avx512.c
(create_feature_i386_32bit_avx512): Likewise.
* features/i386/32bit-core.c (create_feature_i386_32bit_core):
Likewise.
* features/i386/32bit-linux.c (create_feature_i386_32bit_linux):
Likewise.
* features/i386/32bit-mpx.c (create_feature_i386_32bit_mpx):
Likewise.
* features/i386/32bit-pkeys.c (create_feature_i386_32bit_pkeys):
Likewise.
* features/i386/32bit-sse.c (create_feature_i386_32bit_sse):
Likewise.
* features/i386/64bit-avx.c (create_feature_i386_64bit_avx):
Likewise.
* features/i386/64bit-avx512.c
(create_feature_i386_64bit_avx512): Likewise.
* features/i386/64bit-core.c (create_feature_i386_64bit_core):
Likewise.
* features/i386/64bit-linux.c (create_feature_i386_64bit_linux):
Likewise.
* features/i386/64bit-mpx.c (create_feature_i386_64bit_mpx):
Likewise.
* features/i386/64bit-pkeys.c (create_feature_i386_64bit_pkeys):
Likewise.
* features/i386/64bit-segments.c
(create_feature_i386_64bit_segments): Likewise.
* features/i386/64bit-sse.c (create_feature_i386_64bit_sse):
Likewise.
* features/i386/x32-core.c
(create_feature_i386_x32_core): Likewise.
* features/tic6x-c6xp.c (create_feature_tic6x_c6xp): Likewise.
* features/tic6x-core.c (create_feature_tic6x_core): Likewise.
* features/tic6x-gp.c (create_feature_tic6x_gp): Likewise.
* target-descriptions.c: In generated code, don't pass xml
filename.

gdbserver/
* tdesc.c: Remove xml parameter.

6 years agoCreate xml from target descriptions
Alan Hayward [Wed, 18 Apr 2018 19:09:12 +0000 (20:09 +0100)] 
Create xml from target descriptions

Add a print_xml_feature visitor class which turns a
target description into xml. Both gdb and gdbserver can do this.

gdb/
* common/tdesc.c (print_xml_feature::visit_pre): Add xml parsing.
(print_xml_feature::visit_post): Likewise.
(print_xml_feature::visit): Likewise.
* common/tdesc.h (tdesc_get_features_xml): Use const tdesc.
(print_xml_feature): Add new class.
* regformats/regdat.sh: Null xmltarget on feature targets.
* target-descriptions.c (struct target_desc): Add xmltarget.
(maintenance_check_tdesc_xml_convert): Add unittest function.
(tdesc_get_features_xml): Add function to get xml.
(maintenance_check_xml_descriptions): Test xml generation.
* xml-tdesc.c (string_read_description_xml): Add function.
* xml-tdesc.h (string_read_description_xml): Add declaration.

gdbserver/
* gdb/gdbserver/server.c (get_features_xml): Remove cast.
* tdesc.c (void target_desc::accept): Fill in function.
(tdesc_get_features_xml): Remove old xml creation.
(print_xml_feature::visit_pre): Add xml vistor.
* tdesc.h (struct target_desc): Make xmltarget mutable.
(tdesc_get_features_xml): Remove declaration.

6 years agoAdd feature reference in .dat files
Alan Hayward [Wed, 18 Apr 2018 19:06:14 +0000 (20:06 +0100)] 
Add feature reference in .dat files

For all targets which use the newer style target descriptions, add a
"feature" marker in the dat files.
Update regdat.sh to parse feature, but do not use it (yet).

gdb/
* features/Makefile: Add feature marker to targets with new style
target descriptions.
* regformats/aarch64.dat: Regenerate.
* regformats/i386/amd64-avx-avx512-linux.dat: Likewise.
* regformats/i386/amd64-avx-linux.dat: Likewise.
* regformats/i386/amd64-avx-mpx-avx512-pku-linux.dat: Likewise.
* regformats/i386/amd64-avx-mpx-linux.dat: Likewise.
* regformats/i386/amd64-linux.dat: Likewise.
* regformats/i386/amd64-mpx-linux.dat: Likewise.
* regformats/i386/amd64.dat: Likewise.
* regformats/i386/i386-avx-avx512-linux.dat: Likewise.
* regformats/i386/i386-avx-linux.dat: Likewise.
* regformats/i386/i386-avx-mpx-avx512-pku-linux.dat: Likewise.
* regformats/i386/i386-avx-mpx-linux.dat: Likewise.
* regformats/i386/i386-linux.dat: Likewise.
* regformats/i386/i386-mmx-linux.dat: Likewise.
* regformats/i386/i386-mpx-linux.dat: Likewise.
* regformats/i386/i386.dat: Likewise.
* regformats/i386/x32-avx-avx512-linux.dat: Likewise.
* regformats/i386/x32-avx-linux.dat: Likewise.
* regformats/i386/x32-linux.dat: Likewise.
* regformats/tic6x-c62x-linux.dat: Likewise.
* regformats/tic6x-c64x-linux.dat: Likewise.
* regformats/tic6x-c64xp-linux.dat: Likewise.
* regformats/regdat.sh: Parse feature marker.

6 years agoAdd tdesc osabi and architecture functions
Alan Hayward [Wed, 18 Apr 2018 10:51:21 +0000 (11:51 +0100)] 
Add tdesc osabi and architecture functions

gdb/
* common/tdesc.h (tdesc_architecture_name): Add new declaration.
(tdesc_osabi_name): Likewise.
* target-descriptions.c (tdesc_architecture_name): Add new function.
(tdesc_osabi_name): Likewise.

gdbserver/
* tdesc.c (tdesc_architecture_name): Add new function.
(tdesc_osabi_name): Likewise.
(tdesc_get_features_xml): Use new functions.

6 years agoCommonise tdesc types and makes use of them in gdbserver tdesc
Alan Hayward [Wed, 18 Apr 2018 10:47:55 +0000 (11:47 +0100)] 
Commonise tdesc types and makes use of them in gdbserver tdesc

gdb/
* common/tdesc.c (tdesc_predefined_type): Move to here.
(tdesc_named_type): Likewise.
(tdesc_create_vector): Likewise.
(tdesc_create_struct): Likewise.
(tdesc_set_struct_size): Likewise.
(tdesc_create_union): Likewise.
(tdesc_create_flags): Likewise.
(tdesc_create_enum): Likewise.
(tdesc_add_field): Likewise.
(tdesc_add_typed_bitfield): Likewise.
(tdesc_add_bitfield): Likewise.
(tdesc_add_flag): Likewise.
(tdesc_add_enum_value): Likewise.
* common/tdesc.h (struct tdesc_type_builtin): Likewise.
(struct tdesc_type_vector): Likewise.
(struct tdesc_type_field): Likewise.
(struct tdesc_type_with_fields): Likewise.
(tdesc_create_enum): Add declaration.
(tdesc_add_typed_bitfield): Likewise.
(tdesc_add_enum_value): Likewise.
* target-descriptions.c (tdesc_type_field): Move from here.
(tdesc_type_builtin): Likewise.
(tdesc_type_vector): Likewise.
(tdesc_type_with_fields): Likewise.
(tdesc_predefined_types): Likewise.
(tdesc_named_type): Likewise.
(tdesc_create_vector): Likewise.
(tdesc_create_struct): Likewise.
(tdesc_set_struct_size): Likewise.
(tdesc_create_union): Likewise.
(tdesc_create_flags): Likewise.
(tdesc_create_enum): Likewise.
(tdesc_add_field): Likewise.
(tdesc_add_typed_bitfield): Likewise.
(tdesc_add_bitfield): Likewise.
(tdesc_add_flag): Likewise.
(tdesc_add_enum_value): Likewise.
* gdb/target-descriptions.h (tdesc_create_enum): Likewise.
(tdesc_add_typed_bitfield): Likewise.
(tdesc_add_enum_value): Likewise.

gdbserver/
* tdesc.c (tdesc_create_flags): Remove.
(tdesc_add_flag): Likewise.
(tdesc_named_type): Likewise.
(tdesc_create_union): Likewise.
(tdesc_create_struct): Likewise.
(tdesc_create_vector): Likewise.
(tdesc_add_bitfield): Likewise.
(tdesc_add_field): Likewise.
(tdesc_set_struct_size): Likewise.

6 years agoCommonise tdesc_feature and makes use of it in gdbserver tdesc
Alan Hayward [Wed, 18 Apr 2018 10:39:53 +0000 (11:39 +0100)] 
Commonise tdesc_feature and makes use of it in gdbserver tdesc

gdb/
* common/tdesc.c (tdesc_feature::accept): Move to here.
(tdesc_feature::operator==): Likewise.
(tdesc_create_reg): Likewise.
* common/tdesc.h (tdesc_type_kind): Likewise.
(struct tdesc_type): Likewise.
(struct tdesc_feature): Likewise.
* regformats/regdat.sh: Create a feature.
* target-descriptions.c (tdesc_type_kind): Move from here.
(tdesc_type): Likewise.
(tdesc_type_up): Likewise.
(tdesc_feature): Likewise.
(tdesc_create_reg): Likewise.

gdbserver/
* tdesc.c (~target_desc): Remove implictly deleted items.
(init_target_desc): Iterate all features.
(tdesc_get_features_xml): Use vector.
(tdesc_create_feature): Create feature.
* tdesc.h (tdesc_feature) Remove
(target_desc): Add features.

6 years agoCommonise tdesc_reg and makes use of it in gdbserver tdesc
Alan Hayward [Wed, 18 Apr 2018 10:28:51 +0000 (11:28 +0100)] 
Commonise tdesc_reg and makes use of it in gdbserver tdesc

gdb/
* Makefile.in: Add arch/tdesc.c
* common/tdesc.c: New file.
* common/tdesc.h (tdesc_element_visitor): Move to here.
(tdesc_element): Likewise.
(tdesc_reg): Likewise.
(tdesc_reg_up): Likewise.
* regformats/regdef.h (reg): Add offset to constructors.
* target-descriptions.c (tdesc_element_visitor): Move from here.
(tdesc_element): Likewise.
(tdesc_reg): Likewise.
(tdesc_reg_up): Likewise.

gdbserver/
* Makefile.in: Add common/tdesc.c
* tdesc.c (init_target_desc): init all reg_defs from register vector.
(tdesc_create_reg): Create tdesc_reg.
* tdesc.h (tdesc_feature): Add register vector.

6 years agoPrevent an assertion failure in readelf & objdump when parsing corrupt DWARF information.
Nick Clifton [Wed, 18 Apr 2018 11:03:03 +0000 (12:03 +0100)] 
Prevent an assertion failure in readelf & objdump when parsing corrupt DWARF information.

PR 23062
* dwarf.c (read_and_display_attr_value): Replace assertions with
test and warning message.

6 years agoUpdated Spanish translation for gprof directory
Nick Clifton [Wed, 18 Apr 2018 11:02:17 +0000 (12:02 +0100)] 
Updated Spanish translation for gprof directory

6 years agoUpdated Spanish translations for the gold and gprof sub-directories
Nick Clifton [Wed, 18 Apr 2018 09:48:56 +0000 (10:48 +0100)] 
Updated Spanish translations for the gold and gprof sub-directories

6 years agoRemove mips aout, coff, and pe support
Alan Modra [Wed, 18 Apr 2018 06:09:34 +0000 (15:39 +0930)] 
Remove mips aout, coff, and pe support

include/coff/mips.h needs to stay for ecoff debug support.

include/
* coff/mipspe.h: Delete.
bfd/
* Makefile.am: Remove mips aout, coff, and pe support.
* config.bfd: Likewise.
* configure.ac: Likewise.
* targets.c: Likewise.
* coff-mips.c: Delete
* mipsbsd.c: Delete
* pe-mips.c: Delete
* pei-mips.c: Delete
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.

6 years agox86: Don't define elf32_bed/elf64_bed variables
H.J. Lu [Wed, 18 Apr 2018 01:15:13 +0000 (18:15 -0700)] 
x86: Don't define elf32_bed/elf64_bed variables

Define elf32_bed and elf64_bed before including "elf32-target.h" and
"elf64-target.h" to avoid local elf32_bed and elf64_bed variables.

* elf32-i386.c (elf32_bed): Define before including
"elf32-target.h".
* elf64-x86-64.c (elf64_bed): Define before including
"elf64-target.h".
(elf32_bed): Define before including "elf32-target.h".

6 years agoelf32_bed/elf64_bed
H.J. Lu [Wed, 18 Apr 2018 00:42:19 +0000 (17:42 -0700)] 
elf32_bed/elf64_bed

6 years agox86: Use a normal input file with compatible relocation
H.J. Lu [Wed, 18 Apr 2018 01:11:21 +0000 (18:11 -0700)] 
x86: Use a normal input file with compatible relocation

Use a normal input file with compatible relocation to hold linker
created sections,

PR ld/23055
* elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Use a
normal input file with compatible relocation.

6 years agovarious i386-aout and i386-coff target removal
Alan Modra [Mon, 16 Apr 2018 12:44:01 +0000 (22:14 +0930)] 
various i386-aout and i386-coff target removal

Also tidies some other aout leftovers in binutils-common.exp.

bfd/
* Makefile.am: Remove support for assorted i386 aout and coff targets.
* config.bfd: Likewise.
* configure.ac: Likewise.
* doc/bfdint.texi: Likewise.
* targets.c: Likewise.
* freebsd.h: Delete.
* i386dynix.c: Delete.
* i386freebsd.c: Delete.
* i386linux.c: Delete.
* i386mach3.c: Delete.
* i386netbsd.c: Delete.
* i386os9k.c: Delete.
* Makefile.in: Regenerate.
* configure: Regenerate.
* po/SRC-POTFILES.in: Regenerate.
binutils/
* testsuite/lib/binutils-common.exp: Remove support for assorted
aout targets.
gas/
* Makefile.am: Remove support for assorted i386 aout and coff targets.
* config/obj-elf.c: Likewise.
* config/tc-i386.h: Likewise.
* configure.ac: Likewise.
* configure.tgt: Likewise.
* config/te-dynix.h: Delete.
* config/te-i386aix.h: Delete.
* config/te-mach.h: Delete.
* Makefile.in: Regenerate.
* config.in: Regenerate.
* configure: Regenerate.
* po/POTFILES.in: Regenerate.
include/
* aout/dynix3.h: Delete.
ld/
* Makefile.am: Remove support for assorted i386 aout and coff targets.
* configure.tgt: Likewise.
* testsuite/ld-discard/discard.exp: Likewise.
* testsuite/ld-elf/binutils.exp: Likewise.
* testsuite/ld-elf/tls.exp: Likewise.
* testsuite/ld-elf/tls_common.exp: Likewise.
* testsuite/ld-elfvers/vers.exp: Likewise.
* testsuite/ld-elfvsb/elfvsb.exp: Likewise.
* testsuite/ld-elfweak/elfweak.exp: Likewise.
* testsuite/ld-gc/abi-note.d: Likewise.
* testsuite/ld-gc/pr19167.d: Likewise.
* testsuite/ld-gc/pr20022.d: Likewise.
* testsuite/ld-gc/start.d: Likewise.
* testsuite/ld-gc/stop.d: Likewise.
* testsuite/ld-i386/i386.exp: Likewise.
* testsuite/ld-ifunc/binutils.exp: Likewise.
* testsuite/ld-ifunc/ifunc.exp: Likewise.
* testsuite/ld-linkonce/linkonce.exp: Likewise.
* testsuite/ld-plugin/lto.exp: Likewise.
* testsuite/ld-scripts/empty-address-2a.d: Likewise.
* testsuite/ld-scripts/empty-address-2b.d: Likewise.
* testsuite/ld-scripts/phdrs2.exp: Likewise.
* testsuite/ld-scripts/section-match-1.d: Likewise.
* testsuite/ld-shared/shared.exp: Likewise.
* testsuite/ld-size/size.exp: Likewise.
* testsuite/ld-sparc/sparc.exp: Likewise.
* emulparams/i386coff.sh: Delete.
* emulparams/i386linux.sh: Delete.
* emulparams/i386mach.sh: Delete.
* emulparams/i386nbsd.sh: Delete.
* emulparams/vsta.sh: Delete.
* scripttempl/i386coff.sc: Delete.
* Makefile.in: Regenerate.
* po/BLD-POTFILES.in: Regenerate.

6 years agoTidy gas/configure.tgt
Alan Modra [Tue, 17 Apr 2018 07:44:45 +0000 (17:14 +0930)] 
Tidy gas/configure.tgt

Should have been removed with m68k bsd support.

* configure.tgt: Remove *-*-bsd* entry.

6 years agoCorrect ChangeLog dates for git commit 3f0a5f17d7f
Alan Modra [Wed, 18 Apr 2018 00:00:17 +0000 (09:30 +0930)] 
Correct ChangeLog dates for git commit 3f0a5f17d7f

This page took 0.0741 seconds and 4 git commands to generate.