Commit Graph

112698 Commits

Author SHA1 Message Date
Mike Frysinger
681a422b85 sim: mn10300: drop unused sim-main.c
Nothing compiles or references this, so punt it.
2022-12-22 23:39:35 -05:00
Mike Frysinger
b15fa15bc4 sim: endian: move bfd.h from header to source
The bfd APIs are used only by sim-n-endian.h which is only included by
sim-endian.c, so move the bfd.h include there and out of sim-endian.h
which is included by many other modules.
2022-12-22 22:06:52 -05:00
Mike Frysinger
6cf3ddd23e sim: move bfd.h include out of sim-main.h
Not all arches include this in sim-main.h, and the ones that do don't
actually use bfd defines in the sim-main.h header.  Prune it to make
sim-main.h simpler so we can kill it off entirely in the future.

We add the include to the files that utilize e.g. bfd_vma though.
2022-12-22 22:06:12 -05:00
Mike Frysinger
4c337f2dd3 sim: mcore: replace custom "word" type with int32_t
This is a 32-bit architecture with 32-bit registers, so replace the
custom "word" long int typedef with an explicit int32_t.  This is
a correctness fix since long will be 64-bits on most 64-bit hosts.
2022-12-22 21:55:47 -05:00
Mike Frysinger
be2e4e6538 sim: moxie: replace custom "word" type with int32_t
This is a 32-bit architecture with 32-bit registers, so replace the
custom "word" int typedef with an explicit int32_t.  Practically
speaking, this produces the same code, but it should hopefully make
it easier to merge common code in the future.
2022-12-22 21:55:47 -05:00
Mike Frysinger
547eedc132 sim: cr16/d10v/mcore/moxie: clean up unused word & uword types
Nothing actually uses these, so punt them.  Some of the ports are
using local "word" types, but we'll clean those up in a follow up.
2022-12-22 21:55:47 -05:00
Mike Frysinger
3841a73a27 sim: mips: trim redundant igen settings
These variables are setting the same value as the defaults.  Trim
this redundant logic to make it easier to see the real differences
so we can try to keep unifying cases.
2022-12-22 21:29:21 -05:00
Mike Frysinger
022e1fb26c sim: mips: merge mips64* with existing multi-run build
Change the default (unhandled) mips64* targets to use the existing
mips64 multi-run build.  It already handles the formats, we just
have to list the mips8000 bfd for it.
2022-12-22 21:24:09 -05:00
Mike Frysinger
a54eee6db6 sim: mips: merge mips64vr5000 with existing multi-run build
The existing mips64vr-* multi-run build already handles mips5000
targets, so reuse that for mips64vr5* targets too.  This moves
more logic from build-time to runtime so we can have a single
binary that supports many targets.
2022-12-22 21:20:44 -05:00
Nelson Chu
fa6f3b911f RISC-V: Relax the order checking for the architecture string
* riscv-toolchain-conventions,
PR, https://github.com/riscv-non-isa/riscv-toolchain-conventions/pull/14
Issue, https://github.com/riscv-non-isa/riscv-toolchain-conventions/issues/11

* Refer to the commit afc41ffb,
RISC-V: Reorder the prefixed extensions which are out of order.

In the past we only allow to reorder the prefixed extensions.  But according
to the PR 14 in the riscv-toolchain-convention, we can also relax the order
checking to allow the whole extensions be written out of orders, including
the single standard extensions and the prefixed multi-letter extensions.
Just that we still need to follow the following rules as usual,

1. prefixed extensions need to be seperated with `_'.
2. prefixed extensions need complete <major>.<minor> version if set.

Please see the details in the march-ok-reorder gas testcase.

Passed the riscv-gnu-toolchain regressions.

bfd/
    * elfxx-riscv.c (enum riscv_prefix_ext_class): Changed RV_ISA_CLASS_UNKNOWN
    to RV_ISA_CLASS_SINGLE, since everything that does not belong to the
    multi-keyword will possible be a single extension for the current parser.
    (parse_config): Likewise.
    (riscv_get_prefix_class): Likewise.
    (riscv_compare_subsets): Likewise.
    (riscv_parse_std_ext): Removed, and merged with riscv_parse_prefixed_ext
    into riscv_parse_extensions.
    (riscv_parse_prefixed_ext): Likewise.
    (riscv_parse_subset): Only need to call riscv_parse_extensions to parse
    both single standard and prefixed extensions.
gas/
    * testsuite/gas/riscv/march-fail-order-std.d: Removed since the relaxed
    order checking.
    * testsuite/gas/riscv/march-fail-order-std.l: Likewise.
    * testsuite/gas/riscv/march-fail-order-x-std.d: Likewise.
    * testsuite/gas/riscv/march-fail-order-z-std.d: Likewise.
    * testsuite/gas/riscv/march-fail-order-zx-std.l: Likewise.
    * testsuite/gas/riscv/march-fail-unknown-std.l: Updated.
    * testsuite/gas/riscv/march-ok-reorder.d: New testcase.
2022-12-23 10:00:37 +08:00
Mike Frysinger
11e25f766e sim: drop unused SIM_ADDR type [PR sim/7504]
Now that sim APIs either use 64-bit addresses all the time, or more
appropriate target-specific types, drop this now-unused 32-bit-only
address type.

Bug: https://sourceware.org/PR7504
2022-12-22 20:10:14 -05:00
Mike Frysinger
697e27f0ee sim: mips: switch from SIM_ADDR to address_word
The latter type matches the address size configured for this sim.

Also take the opportunity to simplify printf logic by leveraging
PRI* macros.
2022-12-22 20:10:13 -05:00
Mike Frysinger
ae0faac067 sim: v850: switch from SIM_ADDR to address_word
The latter type matches the address size configured for this sim.
2022-12-22 19:46:36 -05:00
Mike Frysinger
63fd5b5dda sim: switch sim_{read,write} APIs to 64-bit all the time [PR sim/7504]
We've been using SIM_ADDR which has always been 32-bit.  This means
the upper 32-bit address range in 64-bit sims is inaccessible.  Use
64-bit addresses all the time since we want the APIs to be stable
regardless of the active arch backend (which can be 32 or 64-bit).

The length is also 64-bit because it's completely feasible to have
a program that is larger than 4 GiB in size/image/runtime.  Forcing
the caller to manually chunk those accesses up into 4 GiB at a time
doesn't seem useful to anyone.

Bug: https://sourceware.org/PR7504
2022-12-22 19:29:24 -05:00
Mike Frysinger
20fea6638f sim: use bfd_vma when reading start addr from bfd info
Since SIM_ADDR is always 32-bit, it might truncate the address with
64-bit ELFs.  Since we load that addr from the bfd, use the bfd_vma
type which matches the bfd_get_start_address API.
2022-12-22 19:29:10 -05:00
Mike Frysinger
7dc3ab9125 sim: m32r: include sim-hw.h for sim_hw_parse 2022-12-22 19:13:40 -05:00
Alan Modra
160a943ff8 COFF build-id writes uninitialised data to file
1) The first write in write_build_id wrote rubbish past the struct
external_IMAGE_DEBUG_DIRECTORY, which was later overwritten with
correct data.  No user visible problem there, except that tools like
valgrind complain.
2) The size for the pdb name was incorrectly calculated.

	* emultempl/pe.em (write_build_id): Write the debug directory,
	not the entire section contents.
	(setup_build_id): Add size for the base name of pdb_name, not
	the full path.
	* emultempl/pep.em: Likewise.
	* testsuite/ld-pe/pdb2-section-contrib.d: Update.
2022-12-23 10:35:38 +10:30
Mike Frysinger
2ac6aa431e sim: mips: merge mips64vr4300 with existing multi-run build
The existing mips64vr-* multi-run build already handles mips4300
targets, so reuse that for mips64vr43* targets too.  This moves
more logic from build-time to runtime so we can have a single
binary that supports many targets.
2022-12-22 19:04:23 -05:00
GDB Administrator
51b500b5a0 Automatic date update in version.in 2022-12-23 00:01:40 +00:00
Indu Bhagat
2440ed038a sframe: doc: update documentation for pauth key in SFrame FDE
ChangeLog:

	* libsframe/doc/sframe-spec.texi
2022-12-22 09:58:21 -08:00
Indu Bhagat
d429702d9e gas: sframe: testsuite: add testcase for .cfi_b_key_frame
This is actually a composite test that checks SFrame unwind information
generation for both the .cfi_negate_ra_state and .cfi_b_key_frame
directives on aarch64.

ChangeLog:

	* testsuite/gas/cfi-sframe/cfi-sframe-aarch64-pac-ab-key-1.d:
	New test.
	* testsuite/gas/cfi-sframe/cfi-sframe-aarch64-pac-ab-key-1.s:
	Likewise.
	* testsuite/gas/cfi-sframe/cfi-sframe.exp: Run new test.
2022-12-22 09:57:52 -08:00
Indu Bhagat
95e829affb objdump/readelf: sframe: emit marker for SFrame FDE with B key
ChangeLog:

	* libsframe/sframe-dump.c (is_sframe_abi_arch_aarch64): New
	definition.
	(dump_sframe_func_with_fres): Emit a string if B key is used.
2022-12-22 09:57:27 -08:00
Indu Bhagat
3369de90b8 gas: sframe: add support for .cfi_b_key_frame
Gather the information from the DWARF FDE on whether frame's return
addresses are signed using the B key or A key.  Reflect the information in
the SFrame counterpart data structure, the SFrame FDE.

ChangeLog:

	* gas/gen-sframe.c (get_dw_fde_pauth_b_key_p): New definition.
	(sframe_v1_set_func_info): Add new argument for pauth_key.
	(sframe_set_func_info): Likewise.
	(output_sframe_funcdesc): Likewise.
	* gas/gen-sframe.h (struct sframe_version_ops): Add new argument
	to the function pointer declaration.
	* gas/sframe-opt.c (sframe_convert_frag): Handle pauth_key.
2022-12-22 09:57:16 -08:00
Indu Bhagat
41eed6e187 sframe.h: add support for .cfi_b_key_frame
ARM 8.3 provides five separate keys that can be used to authenticate
pointers. There are two key for executable (instruction) pointers. The
enum pointer_auth_key in gas/config/tc-aarch64.h currently holds two keys:
  enum pointer_auth_key {
    AARCH64_PAUTH_KEY_A,
    AARCH64_PAUTH_KEY_B
  };

Analogous to the above, in SFrame format V1, a bit is reserved in the SFrame
FDE to indicate which key is used for signing the frame's return addresses:
  - SFRAME_AARCH64_PAUTH_KEY_A has a value of 0
  - SFRAME_AARCH64_PAUTH_KEY_B has a value of 1

Note that the information in this bit will always be used along with the
mangled_ra_p bit, the latter indicates whether the return addresses are
mangled/contain PAC auth bits.

include/ChangeLog:

	* sframe.h (SFRAME_AARCH64_PAUTH_KEY_A): New definition.
	(SFRAME_AARCH64_PAUTH_KEY_B): Likewise.
	(SFRAME_V1_FUNC_INFO): Adjust to accommodate pauth_key.
	(SFRAME_V1_FUNC_PAUTH_KEY): New macro.
	(SFRAME_V1_FUNC_INFO_UPDATE_PAUTH_KEY): Likewise.
2022-12-22 09:57:02 -08:00
Jan Beulich
a5ce326cfe gas: re-arrange listing output for .irp and alike
It is kind of odd to have the expansions of such constructs ahead of
their definition in listings with macro expansion enabled. Adjust this
by pulling ahead the output of the definition lines, taking care to
avoid producing a listing line for (non-existing) line 0 when the source
is stdin.

Note that with the code movement the conditional operator isn't
necessary anymore - list->line now match up.
2022-12-22 14:31:11 +01:00
Jan Beulich
760ab3d0db x86: correct/improve TSX controls
TSXLDTRK takes RTM as a prereq. Additionally introduce an umbrella "tsx"
extension option covering both RTM and HLE, paralleling the "abm" one we
already have.
2022-12-22 09:36:16 +01:00
Jan Beulich
0919e770af x86: add dependencies on SVME
SEV-ES is an extension to SVME. SNP in turn is an extension to SEV-ES,
and yet in turn RMPQUERY is a SNP extension.

Note that cpu_arch[] has no SNP entry, so CPU_ANY_SNP_FLAGS remains
unused (just like CPU_SNP_FLAGS already is).
2022-12-22 09:35:53 +01:00
Jan Beulich
25626f7939 x86: add dependencies on VMX
Both EPT and VMFUNC are extensions to VMX.
2022-12-22 09:35:32 +01:00
Jan Beulich
af1ad9aac5 x86: correct XSAVE* dependencies
Like various other features AMX-TILE takes XSAVE as a prereq.

XSAVES, unconditionally using compacted format, in turn effectively
takes XSAVEC as a prereq (an SDM clarification to this effect is in the
works).
2022-12-22 09:35:11 +01:00
Jan Beulich
9a019125a6 x86: correct dependencies of a few AVX512 sub-features
Like AVX512-FP16, several other extensions require wider than 16-bit
mask registers. As a result they take AVX512BW as a prereq, not (just)
AVX512F. Which in turn points out wrong expectations in the noavx512-1
testcase.
2022-12-22 09:34:50 +01:00
Jan Beulich
b236b82a1a x86: rework noavx512-1 testcase
So far the set of ".noavx512*" has been accumulating, which isn't ideal.
In particular this hides issues with dependencies between features.
Switch back to the default ISA before disabling a particular subset.
Furthermore limit redundancy by wrapping the repeated block of insns in
an .irp.
2022-12-22 09:34:17 +01:00
Jan Beulich
b20f426174 x86: add dependencies on AVX2
Like AVX-VNNI both VAES and VPCLMUL take AVX2 as a prereq, for operating
on up to 256-bit packed integer vectors.
2022-12-22 09:33:53 +01:00
Jan Beulich
88bd2203ef x86: correct SSE dependencies
SSE itself takes FXSR as a prereq. Like AES, PCLMUL, and SHA both GFNI
and KL take SSE2 as a prereq, for operating on packed integers. And
while correcting KL also record it as a prereq to WIDEKL.
2022-12-22 09:33:26 +01:00
Jan Beulich
5091b9ee34 x86: correct what gets disabled by certain ".arch .no*"
Features with prereqs as well as features with dependents cannot re-use
CPU_*_MASK for the 3rd argument of SUBARCH() - they need to use
CPU_ANY_*_MASK in order to avoid disabling too many (when there are
prereqs) and/or too few (when there are dependents) features.

Generally any CPU_ANY_*_MASK which exist should not remain unused.
Exceptions are
- FISTTP which has no corresponding entry in cpu_arch[],
- IAMCU which is a base architecture and hence uses ARCH(), not
  SUBARCH() (only extensions can be disabled, but unlike for Cpu*86 it
  would be a little more clumsy to suppress generating of the #define).
2022-12-22 09:33:01 +01:00
Jan Beulich
4d97c5c833 x86: re-work ISA extension dependency handling
Getting both forward and reverse ISA dependencies right / consistent has
been a permanent source of mistakes. Reduce what needs specifying
manually to just the direct forward dependencies. Transitive forward
dependencies as well as reverse ones are now derived and hence cannot go
out of sync anymore (at least in the vast majority of cases; there are a
few special cases to still take care of manually). In the course of this
several CPU_ANY_*_FLAGS disappear, requiring adjustment to the
assembler's cpu_arch[].

Note that to retain the correct reverse dependency of AVX512F wrt
AVX512-VP2INTERSECT, the latter has the previously missing AVX512F
prereq added.

Note further that to avoid adding the following undue prereqs:
* ATHLON, K8, and AMDFAM10 gain CMOV and FXSR,
* IAMCU gains 387,
auxiliary table entries (including a colon-separated modifier) are
introduced in addition to the ones representing from converting the old
table.

To maintain forward-only dependencies between AVX (XOP) and SSE* (SSE4a)
(i.e. "nosse" not disabling AVX), reverse dependency tracking is
artifically suppressed.

As a side effect disabling of SSE or SSE2 will now also disable AES,
PCLMUL, and SHA (respective elements were missing from
CPU_ANY_SSE2_FLAGS).
2022-12-22 09:32:29 +01:00
Mike Frysinger
2011a54779 sim: mips: match target on cpu settings
We don't need to enforce larger target settings when the only thing
the sim should care about is the CPU target.  So reduce most of the
target matches to only check the CPU.
2022-12-21 22:27:12 -05:00
Mike Frysinger
d455df988a sim: mips: move fpu bitsize defines to top-level configure
This drops support for the --enable-sim-float configure option,
but it's not clear anyone ever actually used that.  Eventually
we'll want this to be a runtime option anyways.
2022-12-21 22:27:12 -05:00
Mike Frysinger
19b11256a5 sim: mips: move bitsize defines to top-level configure
Since the msb value is always defined as the wordsize-1, stop
hardcoding that value directly, and use a CPP value instead.
2022-12-21 22:27:12 -05:00
Mike Frysinger
2d5700ad4e sim: mips: move subtarget defines to top-level configure
We want to kill off mips/configure entirely.  Move this small part
out now to get started.
2022-12-21 22:27:11 -05:00
Mike Frysinger
0fb6c560ff sim: mips: always resolve active bfd mach dynamically
Don't assume that the default bfd that we configured for is the one
that is always active when running a program.  We already have access
to the real runtime value, so use it directly.  This simplifies the
code quite a bit, and will make it easier to support multiple mach's
in a single binary.
2022-12-21 22:27:11 -05:00
Mike Frysinger
f4ac230605 sim: hw-config.h: move generation to top-level
In order to compile arch objects from the top-level, we need to
generate the hw-config.h header, so move that logic up to the top
level first.
2022-12-21 22:21:25 -05:00
Mike Frysinger
3d04211786 sim: build: hoist lists of hw devices up
We need these in the top-level to generate libsim.a, but also in the
subdirs to generate hw-config.h.  Move it to the local.mk, and pass
it down when running recursive make.  This avoids duplication, and
makes it available to both.  We can simplify this once we move the
various steps up to the top-level too.
2022-12-21 22:21:25 -05:00
Mike Frysinger
d47ea1b9c1 sim: build: hoist lists of common objects up
In order to create libsim.a in the common dir, we need the list of
objects for each target.  To avoid duplicating the list with the
recursive make in each port, pass it down as a variable.  This is
a temporary hack until the top-level creates libsim.a for ports.
2022-12-21 22:21:25 -05:00
GDB Administrator
e9c4e2d24f Automatic date update in version.in 2022-12-22 00:01:01 +00:00
Alan Modra
d28fbc7197 PR29925, Memory leak in find_abstract_instance
The testcase in the PR had a variable with both DW_AT_decl_file and
DW_AT_specification, where the DW_AT_specification also specified
DW_AT_decl_file.  This leads to a memory leak as the file name is
malloced and duplicates are not expected.

I've also changed find_abstract_instance to not use a temp for "name",
because that can result in a change in behaviour from the usual last
of duplicate attributes wins.

	PR 29925
	* dwarf2.c (find_abstract_instance): Delete "name" variable.
	Free *filename_ptr before assigning new file name.
	(scan_unit_for_symbols): Similarly free func->file and
	var->file before assigning.
2022-12-22 07:03:07 +10:30
Andrew Pinski
f7cb9bba3d Fix compiling of top.c
When I moved my last patch forward, somehow I missed removing
the #endif for the HAVE_LIBMPFR case.

Committed as obvious after a quick build.

gdb/ChangeLog:
	* top.c: Remove the extra #endif which was missed.
2022-12-21 17:32:40 +00:00
Andrew Pinski
9911806278 Use toplevel configure for GMP and MPFR for gdb
This patch uses the toplevel configure parts for GMP/MPFR for
gdb. The only thing is that gdb now requires MPFR for building.
Before it was a recommended but not required library.
Also this allows building of GMP and MPFR with the toplevel
directory just like how it is done for GCC.
We now error out in the toplevel configure of the version
of GMP and MPFR that is wrong.

OK after GDB 13 branches? Build gdb 3 ways:
with GMP and MPFR in the toplevel (static library used at that point for both)
With only MPFR in the toplevel (GMP distro library used and MPFR built from source)
With neither GMP and MPFR in the toplevel (distro libraries used)

Changes from v1:
* Updated gdb/README and gdb/doc/gdb.texinfo.
* Regenerated using unmodified autoconf-2.69

Thanks,
Andrew Pinski

ChangeLog:
	* Makefile.def: Add configure-gdb dependencies
	on all-gmp and all-mpfr.
	* configure.ac: Split out MPC checking from MPFR.
	Require GMP and MPFR if the gdb directory exist.
	* Makefile.in: Regenerate.
	* configure: Regenerate.

gdb/ChangeLog:

	PR bug/28500
	* configure.ac: Remove AC_LIB_HAVE_LINKFLAGS
	for gmp and mpfr.
	Use GMPLIBS and GMPINC which is provided by the
	toplevel configure.
	* Makefile.in (LIBGMP, LIBMPFR): Remove.
	(GMPLIBS, GMPINC): Add definition.
	(INTERNAL_CFLAGS_BASE): Add GMPINC.
	(CLIBS): Exchange LIBMPFR and LIBGMP
	for GMPLIBS.
	* target-float.c: Make the code conditional on
	HAVE_LIBMPFR unconditional.
	* top.c: Remove code checking HAVE_LIBMPFR.
	* configure: Regenerate.
	* config.in: Regenerate.
	* README: Update GMP/MPFR section of the config
	options.
	* doc/gdb.texinfo: Likewise.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28500
2022-12-21 16:49:23 +00:00
Bruno Larsen
68ce1575fc gdb/c++: validate 'using' directives based on the current line
When asking GDB to print a variable from an imported namespace, we only
want to see variables imported in lines that the inferior has already
gone through, as is being tested last in gdb.cp/nsusing.exp. However
with the proposed change to gdb.cp/nsusing.exp, we get the following
failures:

(gdb) PASS: gdb.cp/nsusing.exp: continue to breakpoint: marker10 stop
print x
$9 = 911
(gdb) FAIL: gdb.cp/nsusing.exp: print x, before using statement
next
15        y += x;
(gdb) PASS: gdb.cp/nsusing.exp: using namespace M
print x
$10 = 911
(gdb) PASS: gdb.cp/nsusing.exp: print x, only using M

Showing that the feature wasn't functioning properly, it just so
happened that gcc ordered the namespaces in a convenient way.
This happens because GDB doesn't take into account the line where the
"using namespace" directive is written. So long as it shows up in the
current scope, we assume it is valid.

To fix this, add a new member to struct using_direct, that stores the
line where the directive was written, and a new function that informs if
the using directive is valid already.

Unfortunately, due to a GCC bug, the failure still shows up. Compilers
that set the declaration line of the using directive correctly (such as
Clang) do not show such a bug, so the test includes an XFAIL for gcc
code.

Finally, because the final test of gdb.cp/nsusing.exp has turned into
multiple that all would need XFAILs for older GCCs (<= 4.3), and that
GCC is very old, if it is detected, the test just exits early.

Approved-by: Tom Tromey <tom@tromey.com>
2022-12-21 16:26:44 +01:00
Nick Clifton
ea6ed58e63 Updated Romanian translation for the BFD sub-directory. 2022-12-21 12:19:04 +00:00
Nick Clifton
75393a2d54 Fix an attempt to allocate an unreasonably large amount of memory when parsing a corrupt ELF file.
PR  29924
	* objdump.c (load_specific_debug_section): Check for excessively
	large sections.
2022-12-21 11:51:23 +00:00