Commit Graph

94068 Commits

Author SHA1 Message Date
Nick Clifton 0df8ad28f0 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.
2018-04-26 15:12:42 +01:00
Christophe Lyon aa68434129 [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.
2018-04-26 13:44:33 +00:00
Pedro Alves 79188d8d27 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.
2018-04-26 13:12:09 +01:00
Pedro Alves c7075ad503 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.
2018-04-26 13:11:09 +01:00
Pedro Alves bfa5bd2ab3 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.
2018-04-26 13:09:40 +01:00
Pedro Alves f50776aad5 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.
2018-04-26 13:09:16 +01:00
Pedro Alves 20944a6e20 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.
2018-04-26 13:08:47 +01:00
Pedro Alves 1adeb82266 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.
2018-04-26 13:08:01 +01:00
Pedro Alves 42ddae103c 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.
2018-04-26 13:07:47 +01:00
Pedro Alves a0aca7b0e1 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.
2018-04-26 13:07:25 +01:00
Pedro Alves 76af0f2635 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.
2018-04-26 13:06:53 +01:00
Pedro Alves 3467ec66bc 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.
2018-04-26 13:06:21 +01:00
Pedro Alves 28f4fa4d05 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.
2018-04-26 13:05:58 +01:00
Pedro Alves ca31ab1d67 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.
2018-04-26 13:05:29 +01:00
Pedro Alves 8388016d7f 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.
2018-04-26 13:04:48 +01:00
Pedro Alves a376e11d84 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 bf223d3e80
  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.
2018-04-26 13:04:09 +01:00
Pedro Alves 02e169e2da 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.
2018-04-26 13:02:26 +01:00
Jan Beulich e2195274d4 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.
2018-04-26 08:55:02 +02:00
Jan Beulich 7a69eac330 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.
2018-04-26 08:53:20 +02:00
Jan Beulich 1d3f82868d 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.
2018-04-26 08:49:41 +02:00
Jan Beulich 59ef5df41e 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.
2018-04-26 08:48:56 +02:00
Jan Beulich 6e041cf4b0 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.
2018-04-26 08:48:01 +02:00
Jan Beulich 1adf7f5604 x86: don't recognize bnd<N> as registers without CpuMPX
This is just like for all other extended/optional register sets.
2018-04-26 08:46:39 +02:00
Jan Beulich 0e0eea7820 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.
2018-04-26 08:45:35 +02:00
Jan Beulich bed3d976b7 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.
2018-04-26 08:31:14 +02:00
Jan Beulich 48db9223e9 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.
2018-04-26 08:30:45 +02:00
Jan Beulich 2f1bada2dc x86: drop VexImmExt
It's only used in assertions, and hence not really needed for correct
code generation.
2018-04-26 08:30:06 +02:00
Jan Beulich dcd7e32376 x86: tighten assertion in build_modrm_byte()
All VEX3SOURCES cases should have VexW set, and all should have a SIMD
register destination.
2018-04-26 08:29:09 +02:00
Jan Beulich 6b8d358865 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.
2018-04-26 08:28:38 +02:00
GDB Administrator c47b0ff06d Automatic date update in version.in 2018-04-26 00:00:46 +00:00
Christophe Lyon f1ac0afe48 [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.
2018-04-25 21:13:14 +00:00
Christophe Lyon 59029f57eb [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.
2018-04-25 21:01:53 +00:00
Christophe Lyon 4b86cbe91c [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.
2018-04-25 21:00:02 +00:00
Christophe Lyon f350fc2e37 [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.
2018-04-25 20:59:27 +00:00
Christophe Lyon fac7bd6475 [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.
2018-04-25 20:58:52 +00:00
Christophe Lyon 29e9b073e3 [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.
2018-04-25 20:58:17 +00:00
Christophe Lyon cb10292c2a [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.
2018-04-25 20:57:39 +00:00
Christophe Lyon 5c5a4843ec [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.
2018-04-25 20:57:02 +00:00
Christophe Lyon 7801f98f84 [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.
2018-04-25 20:54:13 +00:00
Christophe Lyon e8b09b8710 [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.
2018-04-25 20:53:01 +00:00
Christophe Lyon 188fd7aea6 [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.
2018-04-25 20:51:53 +00:00
Christophe Lyon 18a2033805 [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.
2018-04-25 20:49:57 +00:00
Christophe Lyon 617a5ada88 [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.
2018-04-25 20:47:43 +00:00
Pedro Alves 249b573352 Fix new inferior events output
Since f67c0c9171 ("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.
2018-04-25 17:28:25 +01:00
Jan Beulich bacd145775 x86: drop redundant AVX512VL shift templates
These were wrongly left in place by commit ed438a93f1 ("x86: fold
certain AVX512 rotate and shift templates").
2018-04-25 16:26:10 +02:00
Tamar Christina 10bba94bd4 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.
2018-04-25 13:38:35 +01:00
Nick Clifton 1e84581ff0 Updated Spanish translation for the gas directory. 2018-04-25 10:05:12 +01:00
Alan Modra d99b4b92c8 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.
2018-04-25 17:25:57 +09:30
Cary Coutant 651d162038 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.
2018-04-24 22:13:56 -07:00
Alan Modra 2ac93be706 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.
2018-04-25 09:38:17 +09:30