platform/upstream/binutils.git
6 months agobpf: Added linker support for R_BPF_64_NODYLD32.
Cupertino Miranda [Wed, 20 Dec 2023 12:24:03 +0000 (12:24 +0000)]
bpf: Added linker support for R_BPF_64_NODYLD32.

This patch adds linker support to patch R_BPF_64_NODYLD32 relocations.
The implementation was based on comments and code in LLVM, as the GNU
toolchain does not uses this relocation type.

6 months agoMAINTAINERS: Update my email address
Joseph Myers [Mon, 8 Jan 2024 18:55:03 +0000 (18:55 +0000)]
MAINTAINERS: Update my email address

6 months agoMIPS/GAS: mips.exp, mark all mipsisa32*-linux as addr32
YunQiang Su [Fri, 24 Nov 2023 08:55:12 +0000 (16:55 +0800)]
MIPS/GAS: mips.exp, mark all mipsisa32*-linux as addr32

Currently, only mipsisa32-linux and mipsisa32el-linux is marked
as addr32, which make mipsisa32rN(el) not marked.

This change can fix 2 test failures on mipsisa32rN(el)-linux:
FAIL: MIPS MIPS64 MIPS-3D ASE instructions (-mips3d flag)
FAIL: MIPS MIPS64 MDMX ASE instructions (-mdmx flag)

These failures don't happen for mipsisa32rN-mti-elf etc,
due to that, the output is set as NO_ABI instead of O32, then
gas won't warn:
`fp=64' used with a 32-bit ABI
Maybe, we should change this behaivour in future.

6 months agoarm: Add support for Armv8.9-A and Armv9.4-A
srinath [Mon, 8 Jan 2024 14:13:28 +0000 (14:13 +0000)]
arm: Add support for Armv8.9-A and Armv9.4-A

This patch adds AArch32 support for -march=armv8.9-a and
-march=armv9.4-a. The behaviour of the new options can be
expressed using a combination of existing feature flags
and tables.

The cpu_arch_ver entries for ARM_ARCH_V9_4A and ARM_ARCH_V8_9A
are technically redundant but it including them for macro code
consistency across architectures.

6 months agoaarch64: Add ite feature system registers.
srinath [Mon, 8 Jan 2024 14:08:58 +0000 (14:08 +0000)]
aarch64: Add ite feature system registers.

This patch adds ite feature (FEAT_ITE) system registers,
trcitecr_el1, trcitecr_el12, trcitecr_el2 and trciteedcr.

6 months agogas/doc: fix several typos
Samuel Tardieu [Thu, 4 Jan 2024 16:44:16 +0000 (17:44 +0100)]
gas/doc: fix several typos

Signed-off-by: Samuel Tardieu <sam@rfc1149.net>
6 months ago[gdb/testsuite] Add missing -no-prompt-anchor in gdb.base/vfork-follow-parent.exp
Tom de Vries [Mon, 8 Jan 2024 12:01:50 +0000 (13:01 +0100)]
[gdb/testsuite] Add missing -no-prompt-anchor in gdb.base/vfork-follow-parent.exp

When running test-case gdb.base/vfork-follow-parent.exp it passes fine, but
when running it with "taskset -c 0" I run into:
...
(gdb) inferior 1^M
[Switching to inferior 1 [process 26606] (vfork-follow-parent-exit)]^M
[Switching to thread 1.1 (process 26606)]^M
(gdb) Reading symbols from vfork-follow-parent-exit...^M
FAIL: $exp: exec_file=vfork-follow-parent-exit: target-non-stop=on: \
  non-stop=off: resolution_method=schedule-multiple: inferior 1 (timeout)
...

Fix this by using -no-prompt-anchor.

Tested on x86_64-linux.

PR testsuite/31166
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31166

6 months agoAdd support for the aarch64-gnu target (GNU/Hurd on AArch64)
Sergey Bugaev [Mon, 1 Jan 2024 11:53:09 +0000 (14:53 +0300)]
Add support for the aarch64-gnu target (GNU/Hurd on AArch64)

Also recognized are aarch64-*-gnu tagrets, e.g. aarch64-pc-gnu or
aarch64-unknown-gnu.

The ld/emulparams/aarch64gnu.sh file is (for now) identical to aarch64fbsd.sh,
or to aarch64linux.sh with Linux-specific logic removed; and mainly different
from the generic aarch64elf.sh in that it does not set EMBEDDED=yes.

Coupled with a corresponding GCC patch, this produces a toolchain that can
sucessfully build working binaries targeting aarch64-gnu.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
6 months ago[gdb/testsuite] Make gdb.base/solib-search.exp more robust
Tom de Vries [Mon, 8 Jan 2024 09:37:44 +0000 (10:37 +0100)]
[gdb/testsuite] Make gdb.base/solib-search.exp more robust

On aarch64-linux, with gcc 13.2.1, I run into:
...
 (gdb) backtrace^M
 #0  break_here () at solib-search.c:30^M
 #1  0x0000fffff7f20194 in lib2_func4 () at solib-search-lib2.c:50^M
 #2  0x0000fffff7f70194 in lib1_func3 () at solib-search-lib1.c:50^M
 #3  0x0000fffff7f20174 in lib2_func2 () at solib-search-lib2.c:30^M
 #4  0x0000fffff7f70174 in lib1_func1 () at solib-search-lib1.c:30^M
 #5  0x00000000004101b4 in main () at solib-search.c:23^M
 (gdb) PASS: gdb.base/solib-search.exp: \
   backtrace (with wrong libs) (data collection)
 FAIL: gdb.base/solib-search.exp: backtrace (with wrong libs)
...

The FAIL is generated by this code in the test-case:
...
    if { $expect_fail } {
# If the backtrace output is correct the test isn't sufficiently
# testing what it should.
if { $count == $total_expected } {
    set fail 1
}
...

The test-case:
- builds two versions of two shared libs, a "right" and "wrong" version, the
  difference being an additional dummy function (called spacer function),
- uses the "right" version to generate a core file,
- uses the "wrong" version to interpret the core file, and
- generates a backtrace.

The intent is that the backtrace is incorrect due to using the "wrong"
version, but actually it's correct.  This is because the spacer functions
aren't large enough.

Fix this by increasing the size of the spacer functions by adding a dummy
loop, after which we have, as expected, an incorrect backtrace:
...
 (gdb) backtrace^M
 #0  break_here () at solib-search.c:30^M
 #1  0x0000fffff7f201c0 in ?? ()^M
 #2  0x0000fffff7f20174 in lib2_func2 () at solib-search-lib2.c:30^M
 #3  0x0000fffff7f20174 in lib2_func2 () at solib-search-lib2.c:30^M
 #4  0x0000fffff7f70174 in lib1_func1 () at solib-search-lib1.c:30^M
 #5  0x00000000004101b4 in main () at solib-search.c:23^M
 (gdb) PASS: gdb.base/solib-search.exp: \
   backtrace (with wrong libs) (data collection)
 PASS: gdb.base/solib-search.exp: backtrace (with wrong libs)
...

Tested on aarch64-linux.

6 months agoi386: Use .insn describe jmpabs's testcases.
Hu, Lin1 [Mon, 8 Jan 2024 07:47:30 +0000 (15:47 +0800)]
i386: Use .insn describe jmpabs's testcases.

gas/ChangeLog:

* testsuite/gas/i386/x86-64-apx-jmpabs-inval.s: Use .insn instead
of .byte to describe test cases.

6 months agoAutomatic date update in version.in
GDB Administrator [Mon, 8 Jan 2024 00:01:17 +0000 (00:01 +0000)]
Automatic date update in version.in

6 months agoi386: Correct adcx suffix in disassembler
H.J. Lu [Sun, 7 Jan 2024 19:58:53 +0000 (11:58 -0800)]
i386: Correct adcx suffix in disassembler

Since 0x66 is the opcode prefix for adcx, it is wrong to use the 'S'
prefix:

  'S' => print 'w', 'l' or 'q' if suffix_always is true

on adcx.  Add

  'L' => print 'l' or 'q' if suffix_always is true

replace S with L on adcx and adox.

gas/

PR binutils/31219
* testsuite/gas/i386/suffix.d: Updated.
* testsuite/gas/i386/x86-64-suffix.d: Likewise.
* testsuite/gas/i386/suffix.s: Add tests for adcx and adox.
* testsuite/gas/i386/x86-64-suffix.s: Likewise.

opcodes/

PR binutils/31219
* i386-dis.c: Add the 'L' suffix.
(prefix_table): Replace S with L on adcx and adox.
(putop): Handle the 'L' suffix.

6 months agosim: warnings: enable -Wshadow=local
Mike Frysinger [Fri, 22 Dec 2023 01:14:49 +0000 (20:14 -0500)]
sim: warnings: enable -Wshadow=local

This brings us in sync with current set of gdb warnings (for C).

6 months agosim: cris: change temp var name slightly to avoid shadowing
Mike Frysinger [Fri, 22 Dec 2023 00:41:17 +0000 (19:41 -0500)]
sim: cris: change temp var name slightly to avoid shadowing

Rename the temp var to avoid shadowing another one:

.../sim/cris/semcrisv10f-switch.c:11032:22: error: declaration of ‘tmp_tmpb’ shadows a previous local [-Werror=shadow=compatible-local]
11032 |   tmp_tmpb = ({   SI tmp_tmpb;
      |                      ^~~~~~~~
.../sim/cris/semcrisv10f-switch.c:11031:24: note: shadowed declaration is here
11031 |   tmp_tmpres = ({   SI tmp_tmpb;
      |                        ^~~~~~~~

6 months agosim: cris: add error fallbacks when decoding condition & swap codes
Mike Frysinger [Sun, 24 Dec 2023 10:13:42 +0000 (05:13 -0500)]
sim: cris: add error fallbacks when decoding condition & swap codes

The condition & swap code decoder only checks known bits and sets
based on that.  If the variable is out of range, it ends up returning
uninitialized data.  Turn that case into a hard error.

This fixes build warnings like:
sim/cris/semcrisv10f-switch.c:13115:11: error:
variable 'tmp_condres' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]

6 months agoAutomatic date update in version.in
GDB Administrator [Sun, 7 Jan 2024 00:01:58 +0000 (00:01 +0000)]
Automatic date update in version.in

6 months agold: Adjust x86 and x86-64 tests for -z mark-plt
H.J. Lu [Sat, 6 Jan 2024 14:43:04 +0000 (06:43 -0800)]
ld: Adjust x86 and x86-64 tests for -z mark-plt

To support -z mark-plt enabled by default, adjust x86 tests to accept
non-zero r_addend for JUMP_SLOT relocation and pass -z nomark-plt to
x86-64 tests if -z mark-plt changes the expected outputs.

* testsuite/ld-elf/indirect-extern-access-2.rd: Allow non-zero
r_addend for JUMP_SLOT relocation.
* testsuite/ld-elf/pr23161d.rd: Likewise.
* testsuite/ld-ifunc/ifunc-25c-x86.d: Likewise.
* testsuite/ld-ifunc/ifunc-16-x86-64-now.d: Pass -z nomark-plt
to linker.
* testsuite/ld-ifunc/ifunc-16-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-local-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/ifunc-2-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-20-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-5b-x86-64.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64-now.d: Likewise.
* testsuite/ld-ifunc/pr17154-x86-64.d: Likewise.
* testsuite/ld-x86-64/dt-relr-1a-x32.d: Likewise.
* testsuite/ld-x86-64/dt-relr-1a.d: Likewise.
* testsuite/ld-x86-64/dt-relr-1b-x32.d: Likewise.
* testsuite/ld-x86-64/dt-relr-1b.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2a-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-2a.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3a-x32.d: Likewise.
* testsuite/ld-x86-64/ibt-plt-3a.d: Likewise.
* testsuite/ld-x86-64/pr19636-2d.d: Likewise.
* testsuite/ld-x86-64/pr19636-2e.d: Likewise.
* testsuite/ld-x86-64/pr19636-2f.d: Likewise.
* testsuite/ld-x86-64/pr19636-2l.d: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Pass -z nomark-plt to linker
in 6 tests.

6 months agogas: sframe: fix some typos in code comments
Indu Bhagat [Sat, 6 Jan 2024 11:05:44 +0000 (03:05 -0800)]
gas: sframe: fix some typos in code comments

6 months agoAutomatic date update in version.in
GDB Administrator [Sat, 6 Jan 2024 00:01:23 +0000 (00:01 +0000)]
Automatic date update in version.in

6 months agox86: relax AMD Zen5 testcase expectations
Jan Beulich [Fri, 5 Jan 2024 11:08:23 +0000 (12:08 +0100)]
x86: relax AMD Zen5 testcase expectations

One item was too strict for PE/COFF, and there's really no need to check
for specific comment contents here.

6 months agoAdd AMD znver5 processor support
Tejas Joshi [Wed, 20 Dec 2023 05:10:21 +0000 (10:40 +0530)]
Add AMD znver5 processor support

gas/

* config/tc-i386.c (cpu_arch): Add znver5 ARCH.
* doc/c-i386.texi: Add znver5.
* testsuite/gas/i386/arch-15.d: New.
* testsuite/gas/i386/arch-15.s: Likewise.
* testsuite/gas/i386/arch-15-znver5.d: Likewise.
* testsuite/gas/i386/i386.exp: Add new znver5 test cases.
* testsuite/gas/i386/x86-64.exp: Likewise.
* testsuite/gas/i386/x86-64-arch-5.d: Likewise.
* testsuite/gas/i386/x86-64-arch-5.s: Likewise.
* testsuite/gas/i386/x86-64-arch-5-znver5.d: Likewise.

opcodes/

* i386-gen.c (isa_dependencies): Add ZNVER5 dependencies.
* i386-init.h: Re-generated.

6 months agoArm/doc: separate @code from @item for older makeinfo
Jan Beulich [Fri, 5 Jan 2024 08:28:43 +0000 (09:28 +0100)]
Arm/doc: separate @code from @item for older makeinfo

At least 4.12 doesn't like the constructs without a separator.

6 months agox86: corrections to CPU attribute/flags splitting
Jan Beulich [Fri, 5 Jan 2024 07:20:23 +0000 (08:20 +0100)]
x86: corrections to CPU attribute/flags splitting

There are a number of issues with 734dfd1cc966 ("x86: pack CPU flags in
opcode table"):
- the condition when two array slots need writing wasn't correct (with
  enough new Cpu* added an out of bounds array access would validly have
  been complained about by the compiler),
- table generation didn't take into account CpuAttrUnused and CpuUnused
  being independent, and hence there not always (not) being an "unused"
  bitfield member in both structures,
- cpu_flags_from_attr() wasn't ready for use on big-endian hosts,
- there were two style violations.

6 months agoELF: test certain .text/.data usages
Jan Beulich [Fri, 5 Jan 2024 07:17:34 +0000 (08:17 +0100)]
ELF: test certain .text/.data usages

Various targets have / had overrides for .text and/or .data. Make sure
that in such cases sub-section specifiers are accepted, as mandated by
the doc.

6 months agoELF: test certain .bss usages
Jan Beulich [Fri, 5 Jan 2024 07:16:30 +0000 (08:16 +0100)]
ELF: test certain .bss usages

Various targets have / had overrides for .bss. Make sure that in such
cases
- .previous still works correctly (requiring such targets to invoke
  obj_elf_section_change_hook() from their overriding handlers),
- sub-section specifiers are accepted as far as feasible (mandated by
  the doc).

6 months agogas: correct .bss documentation for non-ELF
Jan Beulich [Fri, 5 Jan 2024 07:13:09 +0000 (08:13 +0100)]
gas: correct .bss documentation for non-ELF

Only ELF permits the specification of a subsection, and even there not
consistently: csky, mcore, and spu handle .bss similar to .lcomm.

6 months agoz80: drop .bss override
Jan Beulich [Fri, 5 Jan 2024 07:12:11 +0000 (08:12 +0100)]
z80: drop .bss override

It doesn't look to be a good idea to override the custom handlers that
ELF and COFF have; afaict doing so broke .previous on ELF, and a sub-
section specifier wasn't accepted either.

6 months agovisium: drop .bss and .skip overrides
Jan Beulich [Fri, 5 Jan 2024 07:11:43 +0000 (08:11 +0100)]
visium: drop .bss and .skip overrides

The comment in s_bss() looks bogus (perhaps simply stale, or wrongly
copied from another target). It also doesn't look to be a good idea to
override the custom handler that ELF has (afaict doing so broke
.previous as well as sub-section specification).

The override for .skip is simply pointless, for read.c having exactly
the same.

While there also drop two adjacent redundant (with read.h) declarations
(which would be outright dangerous if read.h wasn't included anyway).

6 months agov850: drop .bss override
Jan Beulich [Fri, 5 Jan 2024 07:11:18 +0000 (08:11 +0100)]
v850: drop .bss override

While there doesn't look to be anything wrong with this override,
there's also no apparent reason why this override would be needed. Drop
it, reducing overall size a tiny bit.

6 months agoscore: drop .bss override
Jan Beulich [Fri, 5 Jan 2024 07:10:21 +0000 (08:10 +0100)]
score: drop .bss override

The comment looks bogus (perhaps simply stale, or wrongly copied from
another target). It also doesn't look to be a good idea to override the
custom handler that ELF has (afaict doing so broke .previous as well as
sub-section specification).

While there also fold the identical handlers for .text (there likely is
more room for such folding).

6 months agos390: drop .bss override
Jan Beulich [Fri, 5 Jan 2024 07:10:01 +0000 (08:10 +0100)]
s390: drop .bss override

The comment looks bogus (perhaps simply stale), and there are also no
other precautions against subsections being used on ELF with .bss. It
also doesn't look to be a good idea to override the custom handler that
ELF has (afaict doing so further broke .previous).

6 months agorx: drop .bss override
Jan Beulich [Fri, 5 Jan 2024 07:09:40 +0000 (08:09 +0100)]
rx: drop .bss override

It doesn't look to be a good idea to override the custom handler that
ELF has; afaict doing so broke .previous.

6 months agorl78: drop .bss override
Jan Beulich [Fri, 5 Jan 2024 07:09:18 +0000 (08:09 +0100)]
rl78: drop .bss override

It doesn't look to be a good idea to override the custom handler that
ELF has; afaict doing so broke .previous.

6 months agopru: fix .text/.data interaction with .previous
Jan Beulich [Fri, 5 Jan 2024 07:08:52 +0000 (08:08 +0100)]
pru: fix .text/.data interaction with .previous

Just like obj_elf_section() is called for .section, obj_elf_{text,data}()
need calling for .text/.data.

6 months agomicroblaze: drop/restrict override of .text, .data, and .bss
Jan Beulich [Fri, 5 Jan 2024 07:07:58 +0000 (08:07 +0100)]
microblaze: drop/restrict override of .text, .data, and .bss

While only ELF is supported right now, (stub) code generally is in place
for the non-ELF case as well. Don't override .bss for ELF - that's
unlikely to be a good idea anyway and prevented the sub-section
specifier from being usable. Don't override .text and .data at all - for
.data and ELF for the same reason, while for .text and ELF obj-elf.c's is
all we need, and for (hypothetical) non-ELF read.c's identical handling
would have been invoked anyway.

6 months agom68k: drop .bss override
Jan Beulich [Fri, 5 Jan 2024 07:06:54 +0000 (08:06 +0100)]
m68k: drop .bss override

The comment looks bogus (perhaps simply stale), and there are also no
other precautions against subsections being used on ELF with .bss. It
also doesn't look to be a good idea to override the custom handler that
ELF has (afaict doing so further broke .previous).

6 months agom32c: drop .bss override
Jan Beulich [Fri, 5 Jan 2024 07:06:35 +0000 (08:06 +0100)]
m32c: drop .bss override

It doesn't look to be a good idea to override the custom handler that
ELF has; afaict doing so broke .previous.

6 months agoIA64: drop .bss override
Jan Beulich [Fri, 5 Jan 2024 07:06:08 +0000 (08:06 +0100)]
IA64: drop .bss override

It doesn't look to be a good idea to override the custom handlers that
ELF and COFF have. While in this case interaction with ELF's .previous
wasn't screwed, the sub-section specifier wasn't permitted.

6 months agod30v: fix .text/.data interaction with .previous
Jan Beulich [Fri, 5 Jan 2024 07:05:33 +0000 (08:05 +0100)]
d30v: fix .text/.data interaction with .previous

Just like obj_elf_section() is called for .section, obj_elf_{text,data}()
need calling for .text/.data.

6 months agobfin: drop .bss override
Jan Beulich [Fri, 5 Jan 2024 07:05:10 +0000 (08:05 +0100)]
bfin: drop .bss override

It doesn't look to be a good idea to override the custom handler that
ELF has; afaict doing so broke .previous.

6 months agoArm64: drop .bss override
Jan Beulich [Fri, 5 Jan 2024 07:04:42 +0000 (08:04 +0100)]
Arm64: drop .bss override

The comment looks bogus (perhaps simply stale, perhaps wrongly copied
from Arm in the first place), and there are also no other precautions
against subsections being used on ELF with .bss. It also doesn't look
to be a good idea to override the custom handlers that ELF and COFF
have (afaict doing so further broke .previous on ELF).

As to the mapping state update - such also doesn't appear to be done
for other section switching, so its original purpose was at best
questionable as well.

6 months agoArm: drop .bss override
Jan Beulich [Fri, 5 Jan 2024 07:04:18 +0000 (08:04 +0100)]
Arm: drop .bss override

The comment looks bogus (perhaps simply stale), and there are also no
other precautions against subsections being used on ELF with .bss. It
also doesn't look to be a good idea to override the custom handlers that
ELF and COFF have (afaict doing so further broke .previous on ELF).

6 months agoEnforce C++11 as a minimum for building gold [PR30867]
Tamar Christina [Thu, 4 Jan 2024 15:20:14 +0000 (15:20 +0000)]
Enforce C++11 as a minimum for building gold [PR30867]

The attempt in 5e9091dab885 to correct gold for modern LLVM has broken
gold for older compilers.  This commit introduced C++11 types without
changing the build system to require a C++ compiler.  More importantly
it depends on the compiler having at least C++11 as the default
language.  Older compilers which support C++11 but not as the default
language needlessly break.  Fix that.

PR gold/30867
* configure.ac (AX_CXX_COMPILE_STDCXX): Require C++11.
* Makefile.in: Regenerate.
* aclocal.m4: Regenerate.
* config.in: Regenerate.
* configure: Regenerate.
* testsuite/Makefile.in: Regenerate.

6 months agoloongarch: 'index' shadows global
Alan Modra [Wed, 3 Jan 2024 05:33:48 +0000 (16:03 +1030)]
loongarch: 'index' shadows global

Avoid an error when compiling with older versions of gcc.

* elfnn-loongarch.c (loongarch_relax_align): Rename "index" to
"sym_index".

6 months agoTidy bfd_scan_vma
Alan Modra [Sun, 31 Dec 2023 09:09:18 +0000 (19:39 +1030)]
Tidy bfd_scan_vma

In commit 83c79df86bf4 I removed configure tests for strtoull among
other library functions part of C99, but didn't remove what is now
dead code.

* bfd.c (bfd_scan_vma): Delete fall-back for strtoull.

6 months agoPR31120, ld-scripts/fill2 fails when bfd_vma is 32 bits
Alan Modra [Sun, 31 Dec 2023 03:39:10 +0000 (14:09 +1030)]
PR31120, ld-scripts/fill2 fails when bfd_vma is 32 bits

The ld lexer converts strings to integers without overflow checking,
so I don't think there is any problem in truncating an integer that
exceeds the size of a bfd_vma rather than using (bfd_vma) -1.

PR 31120
* ldlex.l: Don't use bfd_scan_vma for integer conversion, use
strtoull.

6 months agoRISC-V: T-HEAD: Fix wrong instruction encoding for th.vsetvli
Jin Ma [Thu, 4 Jan 2024 02:17:40 +0000 (10:17 +0800)]
RISC-V: T-HEAD: Fix wrong instruction encoding for th.vsetvli

Since the particularity of "th.vsetvli" was not taken into account in the
initial support patches for XTheadVector, the program operation failed
due to instruction coding errors. According to T-Head SPEC ([1]), the
"vsetvl" in the XTheadVector extension consists of SEW, LMUL and EDIV,
which is quite different from the "V" extension. Therefore, we cannot
simply reuse the processing of vsetvl in V extension.

We have set up tens of thousands of test cases to ensure that no
further encoding issues are there, and and execute all compiled test
files on real HW and make sure they don't trigger SIGILL.

Ref:
[1] https://github.com/T-head-Semi/thead-extension-spec/releases/download/2.3.0/xthead-2023-11-10-2.3.0.pdf

Co-developed-by: Lifang Xia <lifang_xia@linux.alibaba.com>
Co-developed-by: Christoph Müllner <christoph.muellner@vrull.eu>
gas/ChangeLog:

* config/tc-riscv.c (validate_riscv_insn): Add handling for
th.vsetvli.
(my_getThVsetvliExpression): New function.
(riscv_ip): Likewise.
* testsuite/gas/riscv/x-thead-vector.d: Likewise.
* testsuite/gas/riscv/x-thead-vector.s: Likewise.

include/ChangeLog:

* opcode/riscv.h (OP_MASK_XTHEADVLMUL): New macro.
(OP_SH_XTHEADVLMUL): Likewise.
(OP_MASK_XTHEADVSEW): Likewise.
(OP_SH_XTHEADVSEW): Likewise.
(OP_MASK_XTHEADVEDIV): Likewise.
(OP_SH_XTHEADVEDIV): Likewise.
(OP_MASK_XTHEADVTYPE_RES): Likewise.
(OP_SH_XTHEADVTYPE_RES): Likewise.

opcodes/ChangeLog:

* riscv-dis.c (print_insn_args): Likewise.
* riscv-opc.c: Likewise.

6 months agoAutomatic date update in version.in
GDB Administrator [Fri, 5 Jan 2024 00:02:14 +0000 (00:02 +0000)]
Automatic date update in version.in

6 months ago[gdb/testsuite] Handle PAC marker
Tom de Vries [Thu, 4 Jan 2024 12:42:45 +0000 (13:42 +0100)]
[gdb/testsuite] Handle PAC marker

On aarch64-linux, I run into:
...
FAIL: gdb.base/annota1.exp: backtrace from shlibrary (timeout)
...
due to the PAC marker showing up:
...
^Z^Zframe-address^M
0x000000000041025c [PAC]^M
^Z^Zframe-address-end^M
...

In the docs the marker is documented as follows:
...
When GDB is debugging the AArch64 architecture, and the program is using the
v8.3-A feature Pointer Authentication (PAC), then whenever the link register
$lr is pointing to an PAC function its value will be masked.  When GDB prints
a backtrace, any addresses that required unmasking will be postfixed with the
marker [PAC].  When using the MI, this is printed as part of the addr_flags
field.
...

Update the test-case to allow the PAC marker.

Likewise in a few other test-cases.

While we're at it, rewrite the affected pattern pat_begin in annota1.exp into
a more readable form.  Likewise for the corresponding pat_end.

Tested on aarch64-linux.

Approved-By: Luis Machado <luis.machado@arm.com>
PR testsuite/31202
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31202

6 months agoUpdate year range in copyright notice of binutils files
Alan Modra [Thu, 4 Jan 2024 11:52:08 +0000 (22:22 +1030)]
Update year range in copyright notice of binutils files

Adds two new external authors to etc/update-copyright.py to cover
bfd/ax_tls.m4, and adds gprofng to dirs handled automatically, then
updates copyright messages as follows:

1) Update cgen/utils.scm emitted copyrights.
2) Run "etc/update-copyright.py --this-year" with an extra external
   author I haven't committed, 'Kalray SA.', to cover gas testsuite
   files (which should have their copyright message removed).
3) Build with --enable-maintainer-mode --enable-cgen-maint=yes.
4) Check out */po/*.pot which we don't update frequently.

6 months agoSynchronize config.sub and config.guess with their upstream master versions.
Nick Clifton [Thu, 4 Jan 2024 12:00:34 +0000 (12:00 +0000)]
Synchronize config.sub and config.guess with their upstream master versions.

Brings in:
commit 28ea239c53a2d5d8800c472bc2452eaa16e37af2    config.sub: Remove windows-gnu
commit a6976af01b0c6206561782183a0db42124b19f7b    config.sub: recognise ARM64EC machine type
commit 4e60c54be77f743ff8018ab58fb36fd8bc055e2a    config.sub: allow aarch64c-unknown-freebsd
commit e4786449e1c26716e3f9ea182caf472e4dbc96e0    config.guess: invoke "uname -p" from PATH for non-arm FreeBSD
commit 021155df7fad97a5ae1baa354e15a03ea14500b4    config.guess: Detect Android (as opposed to GNU/Linux)
commit 6c78704d542cebfb56d17474fe9f8395e9defb94    config.sub: add javascript-*-ghcjs
commit 2a7c4b64d4aec5c3a8a975625f0f8c369d365667    testsuite: add coverage for vendor-clobbering
commit 39c49ea712cba8ae6613ef85ab22fe7c552b48b0    config.sub: Systematize parsing of machine code formats
commit d4e37b5868ef910e3e52744c34408084bb13051c    config.sub: Handle arbitrary MIPS CPU names
commit af8d803a82436779d35ea389888788c78677804e    config.guess (aarch64:Linux:*:*): Detect 32-bit ABI
commit 602766470c886df7ae07bcfd7dcf532f0783d3e0    Add KVX MPPA detection
commit be68d790b6bc7dd84982fa6760f1448e92849e63    config.sub: Add Apple tvOS and watchOS
commit 998ba1414387b4ce1a519be234e1609bc7912e0c    config.sub: Accept $cpu-$vendor-none-{coff,elf}

6 months agoLoongArch: Fix linker generate PLT entry for data symbol
mengqinggang [Thu, 1 Dec 2022 09:23:14 +0000 (17:23 +0800)]
LoongArch: Fix linker generate PLT entry for data symbol

With old "medium" code model, we call a function with a pair of PCALAU12I
and JIRL instructions. The assembler produces something like:

   8: 1a00000c  pcalau12i    $t0, 0
8: R_LARCH_PCALA_HI20 g
   c: 4c000181  jirl         $ra, $t0, 0
c: R_LARCH_PCALA_LO12 g

The linker generates a "PLT entry" for data without any diagnostic.
If "g" is a data symbol and ld with -shared option, it may load two
instructions in the PLT.

Without -shared option, loongarch_elf_adjust_dynamic_symbol can delete PLT
entry.

For R_LARCH_PCALA_HI20 relocation, linker only generate PLT entry for STT_FUNC
and STT_GNU_IFUNC symbols.

6 months agogdb: improve error reporting from expression parser
Andrew Burgess [Fri, 22 Dec 2023 11:29:13 +0000 (11:29 +0000)]
gdb: improve error reporting from expression parser

This commits changes how errors are reported from the expression
parser.  Previously, parser errors were reported like this:

  (gdb) p a1 +}= 432
  A syntax error in expression, near `}= 432'.
  (gdb) p a1 +
  A syntax error in expression, near `'.

The first case is fine, a user can figure out what's going wrong, but
the second case is a little confusing; as the error occurred at the
end of the expression GDB just reports the empty string to the user.

After this commit the first case is unchanged, but the second case now
reports like this:

  (gdb) p a1 +
  A syntax error in expression, near the end of `a1 +'.

Which I think is clearer.  There is a possible issue if the expression
being parsed is very long, GDB will repeat the whole expression.  But
this issue already exists in the standard case; if the error occurs
early in a long expression GDB will repeat everything after the syntax
error.  So I've not worried about this case in my new code either,
which keeps things simpler.

I did consider trying to have multi-line errors here, in the style
that gcc produces, with some kind of '~~~~~^' marker on the second
line to indicate where the error occurred; but I rejected this due to
the places in GDB where we catch an error and repackage the message
within some longer string, I don't think multi-line error messages
would work well in that case.  At a minimum it would require some
significant work in order to make all our error handling multi-line
aware.

I've added a couple of extra tests in gdb.base/exprs.exp.

Approved-By: John Baldwin <jhb@FreeBSD.org>
6 months agogdb: merge error handling from different expression parsers
Andrew Burgess [Tue, 2 Jan 2024 14:02:44 +0000 (14:02 +0000)]
gdb: merge error handling from different expression parsers

Many (all?) of the expression parsers implement yyerror to handle
parser errors, and all of these functions are basically identical.

This commit adds a new parser_state::parse_error() function, which
implements the common error handling code, this function can then be
called from all the different yyerror functions.

The benefit of this is that (in a future commit) I can improve the
error output, and all the expression parsers will benefit.

This commit is pure refactoring though, and so, there should be no
user visible changes after this commit.

Approved-By: John Baldwin <jhb@FreeBSD.org>
6 months agogdb: don't try to style content in error calls
Andrew Burgess [Fri, 22 Dec 2023 11:48:54 +0000 (11:48 +0000)]
gdb: don't try to style content in error calls

While working on a later commit in this series I realised that the
error() function doesn't support output styling.  Due to the way that
output from error() calls is passed around within the exception
object and often combined with other output, it's not immediately
obvious to me if we should be trying to support styling in this
context or not.

On inspection, I found one place in GDB where we apparently try to
apply styling within the error() output (in procfs.c).  I suspect this
error() call might not be tested.

Rather than try to implement styling in the error() output, right now
I'm proposing to just remove the attempt to style error() output.

This doesn't mean that someone shouldn't add error() styling in the
future, but right now, I'm not planning to do that, I just wanted to
fix this in passing.

Approved-By: John Baldwin <jhb@FreeBSD.org>
6 months agoLoongArch: Fix loongarch*-elf target ld testsuite failure
Lulu Cai [Wed, 27 Dec 2023 09:10:41 +0000 (17:10 +0800)]
LoongArch: Fix loongarch*-elf target ld testsuite failure

The loongarch*-elf target does not support SHARED and PIE, so this
target is skipped for some tests that require these options.

6 months agoLoongArch: Fix some macro that cannot be expanded properly
Lulu Cai [Wed, 27 Dec 2023 11:42:01 +0000 (19:42 +0800)]
LoongArch: Fix some macro that cannot be expanded properly

Suppose we want to use la.got to generate 32 pcrel and
32 abs instruction sequences respectively. According to
the existing conditions, to generate 32 pcrel sequences
use -mabi=ilp32*, and to generate 32 abs use -mabi=ilp32*
and -mla-global-with-abs.

Due to the fact that the conditions for generating 32 abs
also satisfy 32 pcrel, using -mabi=ilp32* and -mla-global-with-abs
will result in only generating instruction sequences of 32 pcrel.

By modifying the conditions for macro expansion and adjusting
the matching order of macro instructions, it is ensured that
the correct sequence of instructions can be generated.

6 months agoAutomatic date update in version.in
GDB Administrator [Thu, 4 Jan 2024 00:01:45 +0000 (00:01 +0000)]
Automatic date update in version.in

7 months agosim: ppc: unify igen filter modules
Mike Frysinger [Wed, 3 Jan 2024 08:12:42 +0000 (03:12 -0500)]
sim: ppc: unify igen filter modules

The common igen code was forked from the ppc long ago.  The filter
module is still pretty similar in API, so we can unfork them with
a little bit of effort.

The filter.c module is still here because of the unique it_is API.
The common igen code doesn't seem to have an equiv API as this only
operates on two strings and not an actual filter object, and it's
easy enough to leave behind to unfork the rest.

7 months agosim: ppc: unify igen line number output modules
Mike Frysinger [Wed, 3 Jan 2024 07:54:37 +0000 (02:54 -0500)]
sim: ppc: unify igen line number output modules

The common igen code was forked from the ppc long ago.  The lf module
is still pretty similar in API, so we can unfork them with a little
bit of effort.

Some of the generated ppc code is now slightly different, but that's
because of fixes the common igen code has gained, but not the ppc igen
code (e.g. fixing of #line numbers).

The ppc code retains lf_print__c_code because the common igen code
rewrote the logic to a new table.c API.  Let's delay that in the ppc
code to at least unfork all this code.

7 months agosim: igen: clean up headers a bit
Mike Frysinger [Wed, 3 Jan 2024 08:07:25 +0000 (03:07 -0500)]
sim: igen: clean up headers a bit

Add standard multiple inclusion protection, and add a few missing
local includes when one header uses another.  This isn't complete,
but fixes some short comings seen when merging the ppc igen.

7 months agosim: ppc: switch to common endian code
Mike Frysinger [Wed, 3 Jan 2024 07:17:16 +0000 (02:17 -0500)]
sim: ppc: switch to common endian code

The common sim-endian is a forked & updated version of the ppc code.
Fortunately, they didn't diverge from the basic APIs, so they are
still compatible, which means we can just delete the ppc version now
that the build env is merged at the top-level.

7 months agosim: common: include sim-types.h in the endian header directly
Mike Frysinger [Wed, 3 Jan 2024 07:15:54 +0000 (02:15 -0500)]
sim: common: include sim-types.h in the endian header directly

This is a bit redundant for most ports as they go through sim-basics.h
which always includes sim-types.h before including sim-endian.h, but in
order to unify ppc's sim-endian code, we need this include here.  Plus,
it's the directly we generally want to go to get away from one header
that defines all APIs and causes hard to untangle dependencies.

7 months agosim: ppc: rename local ALU SIGNED64 macros
Mike Frysinger [Wed, 3 Jan 2024 07:13:55 +0000 (02:13 -0500)]
sim: ppc: rename local ALU SIGNED64 macros

The common/ code has macros with the same name but different behavior:
it's for declaring integer constants as 64-bit, not for casting them.
Rename ppc's local variant since it's only used in this file in order
to avoid conflicts.

7 months agosim: ppc: sync WITH_TARGET_{ADDRESS,CELL}_BITSIZE with common/
Mike Frysinger [Wed, 3 Jan 2024 07:10:52 +0000 (02:10 -0500)]
sim: ppc: sync WITH_TARGET_{ADDRESS,CELL}_BITSIZE with common/

This will make it easier to share common/ code that rely on these
additional defines.

7 months agosim: cr16: cleanup unused variable compiler warnings
Mike Frysinger [Wed, 3 Jan 2024 06:54:57 +0000 (01:54 -0500)]
sim: cr16: cleanup unused variable compiler warnings

7 months agosim: configure: switch to m4_map
Mike Frysinger [Wed, 3 Jan 2024 01:26:53 +0000 (20:26 -0500)]
sim: configure: switch to m4_map

Minor reduction in boilerplate here.  No real functional changes.

7 months agosim: drop support for recursive makes entirely
Mike Frysinger [Tue, 2 Jan 2024 15:23:09 +0000 (10:23 -0500)]
sim: drop support for recursive makes entirely

Now that all ports have been merged to the top-level, we no longer need
this framework to pass settings down to sub-makefiles.  Delete it all.

7 months agosim: ppc: hoist compilation up to top-level
Mike Frysinger [Tue, 2 Jan 2024 14:58:07 +0000 (09:58 -0500)]
sim: ppc: hoist compilation up to top-level

This removes all recursive makes from the ppc port.

7 months agosim: drop support for automatic subdir recursion
Mike Frysinger [Tue, 2 Jan 2024 15:02:39 +0000 (10:02 -0500)]
sim: drop support for automatic subdir recursion

No port relies on this anymore, so we can scrub it all.

7 months agosim: ppc: move libsim.a creation to top-level
Mike Frysinger [Tue, 2 Jan 2024 14:50:43 +0000 (09:50 -0500)]
sim: ppc: move libsim.a creation to top-level

The objects are still compiled in the subdir, but the creation of the
archive itself is in the top-level.  This is a required step before we
can move compilation itself up, and makes it easier to review.

The downside is that each object compile is a recursive make instead of
a single one.  It adds some overhead, so it's not great, but it shouldn't
be a big deal.  This will go away once compilation is hoisted up.

7 months agosim: ppc: move main.o compilation to top-level
Mike Frysinger [Tue, 2 Jan 2024 13:28:34 +0000 (08:28 -0500)]
sim: ppc: move main.o compilation to top-level

7 months agoLoongArch: delete bfd/.elfnn-loongarch.c.swp
mengqinggang [Wed, 3 Jan 2024 03:27:35 +0000 (11:27 +0800)]
LoongArch: delete bfd/.elfnn-loongarch.c.swp

7 months agoAutomatic date update in version.in
GDB Administrator [Wed, 3 Jan 2024 00:02:14 +0000 (00:02 +0000)]
Automatic date update in version.in

7 months agoFix GDB reverse-step and reverse-next command behavior
Carl Love [Tue, 2 Jan 2024 22:46:12 +0000 (17:46 -0500)]
Fix GDB reverse-step and reverse-next command behavior

Currently GDB when executing in reverse over multiple statements in a single
line of source code, GDB stops in the middle of the line.  Thus requiring
multiple commands to reach the previous line.  GDB should stop at the first
instruction of the line, not in the middle of the line.

The following description of the incorrect behavior was taken from an
earlier message by Pedro Alves <pedro@palves.net>:

https://sourceware.org/pipermail/gdb-patches/2023-January/196110.html

---------------------------------

The source line looks like:

   func1 ();  func2 ();

in the test case:

(gdb) list 1
1       void func1 ()
2       {
3       }
4
5       void func2 ()
6       {
7       }
8
9       int main ()
10      {
11        func1 (); func2 ();
12      }

compiled with:

 $ gcc reverse.c -o reverse -g3 -O0
 $ gcc -v
 ...
 gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04)

Now let's debug it with target record, using current gdb git master
(f3d8ae90b236),

 $ gdb ~/reverse
 GNU gdb (GDB) 14.0.50.20230124-git
 ...
 Reading symbols from /home/pedro/reverse...
 (gdb) start
 Temporary breakpoint 1 at 0x1147: file reverse.c, line 11.
 Starting program: /home/pedro/reverse
 [Thread debugging using libthread_db enabled]
 Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

 Temporary breakpoint 1, main () at reverse.c:11
 11        func1 (); func2 ();
 (gdb) record

 (gdb) disassemble /s
 Dump of assembler code for function main:
 reverse.c:
 10      {
    0x000055555555513f <+0>:     endbr64
    0x0000555555555143 <+4>:     push   %rbp
    0x0000555555555144 <+5>:     mov    %rsp,%rbp

 11        func1 (); func2 ();
 => 0x0000555555555147 <+8>:     mov    $0x0,%eax
    0x000055555555514c <+13>:    call   0x555555555129 <func1>
    0x0000555555555151 <+18>:    mov    $0x0,%eax
    0x0000555555555156 <+23>:    call   0x555555555134 <func2>
    0x000055555555515b <+28>:    mov    $0x0,%eax

 12      }
    0x0000555555555160 <+33>:    pop    %rbp
    0x0000555555555161 <+34>:    ret
 End of assembler dump.

 (gdb) n
 12      }

So far so good, a "next" stepped over the whole of line 11 and stopped at
line 12.

Let's confirm where we are now:

 (gdb) disassemble /s
 Dump of assembler code for function main:
 reverse.c:
 10      {
    0x000055555555513f <+0>:     endbr64
    0x0000555555555143 <+4>:     push   %rbp
    0x0000555555555144 <+5>:     mov    %rsp,%rbp

 11        func1 (); func2 ();
    0x0000555555555147 <+8>:     mov    $0x0,%eax
    0x000055555555514c <+13>:    call   0x555555555129 <func1>
    0x0000555555555151 <+18>:    mov    $0x0,%eax
    0x0000555555555156 <+23>:    call   0x555555555134 <func2>
    0x000055555555515b <+28>:    mov    $0x0,%eax

 12      }
 => 0x0000555555555160 <+33>:    pop    %rbp
    0x0000555555555161 <+34>:    ret
 End of assembler dump.

Good, we're at the first instruction of line 12.

Now let's undo the "next", with "reverse-next":

 (gdb) reverse-next
 11        func1 (); func2 ();

Seemingly stopped at line 11.  Let's see exactly where:

 (gdb) disassemble /s
 Dump of assembler code for function main:
 reverse.c:
 10      {
    0x000055555555513f <+0>:     endbr64
    0x0000555555555143 <+4>:     push   %rbp
    0x0000555555555144 <+5>:     mov    %rsp,%rbp

 11        func1 (); func2 ();
    0x0000555555555147 <+8>:     mov    $0x0,%eax
    0x000055555555514c <+13>:    call   0x555555555129 <func1>
 => 0x0000555555555151 <+18>:    mov    $0x0,%eax
    0x0000555555555156 <+23>:    call   0x555555555134 <func2>
    0x000055555555515b <+28>:    mov    $0x0,%eax

 12      }
    0x0000555555555160 <+33>:    pop    %rbp
    0x0000555555555161 <+34>:    ret
 End of assembler dump.
 (gdb)

And lo, we stopped in the middle of line 11!  That is a bug, we should have
stepped back all the way to the beginning of the line.  The "reverse-next"
should have fully undone the prior "next" command.

--------------------

This patch fixes the incorrect GDB behavior by ensuring that GDB  stops at
the first instruction in the line.

The test case gdb.reverse/func-map-to-same-line.exp is added to testsuite
to verify this fix when the line table information is and is not available.

7 months agoPowerPC and aarch64: Fix reverse stepping failure
Carl Love [Tue, 2 Jan 2024 22:46:02 +0000 (17:46 -0500)]
PowerPC and aarch64: Fix reverse stepping failure

When running GDB's testsuite on aarch64-linux/Ubuntu 20.04 (also spotted on
the ppc backend), there are failures in gdb.reverse/solib-precsave.exp and
gdb.reverse/solib-reverse.exp.

The failure happens around the following code:

38  b[1] = shr2(17);          /* middle part two */
40  b[0] = 6;   b[1] = 9;     /* generic statement, end part two */
42  shr1 ("message 1\n");     /* shr1 one */

Normal execution:

- step from line 38 will land on line 40.
- step from line 40 will land on line 42.

Reverse execution:
- step from line 42 will land on line 40.
- step from line 40 will land on line 40.
- step from line 40 will land on line 38.

The problem here is that line 40 contains two contiguous but distinct
PC ranges in the line table, like so:

Line 40 - [0x7ec ~ 0x7f4]
Line 40 - [0x7f4 ~ 0x7fc]

The two distinct ranges are generated because GCC started outputting source
column information, which GDB doesn't take into account at the moment.

When stepping forward from line 40, we skip both of these ranges and land on
line 42. When stepping backward from line 42, we stop at the start PC of the
second (or first, going backwards) range of line 40.

Since we've reached ecs->event_thread->control.step_range_start, we stop
stepping backwards.

The above issues were fixed by introducing a new function that looks for
adjacent PC ranges for the same line, until we notice a line change. Then
we take that as the start PC of the range.  The new start PC for the range
is used for the control.step_range_start when setting up a step range.

The test case gdb.reverse/map-to-same-line.exp is added to test the fix
for the above reverse step issues.

Patch has been tested on PowerPC, X86 and AArch64 with no regressions.

7 months agoAdd gdb_compile options column-info and no-column-info
Carl Love [Tue, 2 Jan 2024 22:45:55 +0000 (17:45 -0500)]
Add gdb_compile options column-info and no-column-info

This patch adds two new options to gdb_compile to specify if the compile
should or should not generate the line table information.  The
options are supported on clang and gcc version 7 and newer.

Patch has been tested on PowerPC with both gcc and clang.

7 months agogdb/dwarf2: Add support for DW_LNS_set_epilogue_begin in line-table
Guinevere Larsen [Wed, 1 Nov 2023 16:25:32 +0000 (17:25 +0100)]
gdb/dwarf2: Add support for DW_LNS_set_epilogue_begin in line-table

This commit adds a mechanism for GDB to detect the linetable opcode
DW_LNS_set_epilogue_begin. This opcode is set by compilers to indicate
that a certain instruction marks the point where the frame is destroyed.

While the standard allows for multiple points marked with epilogue_begin
in the same function, for performance reasons, the function that
searches for the epilogue address will only find the last address that
sets this flag for a given block.

This commit also changes amd64_stack_frame_destroyed_p_1 to attempt to
use the epilogue begin directly, and only if an epilogue can't be found
will it attempt heuristics based on the current instruction.

Finally, this commit also changes the dwarf assembler to be able to emit
epilogue-begin instructions, to make it easier to test this patch

Approved-By: Tom Tromey <tom@tromey.com>
7 months agosim: ppc: hoist pk.h creation to top-level
Mike Frysinger [Tue, 2 Jan 2024 07:18:53 +0000 (02:18 -0500)]
sim: ppc: hoist pk.h creation to top-level

7 months agosim: ppc: hoist hw.[ch] creation to top-level
Mike Frysinger [Tue, 2 Jan 2024 07:11:11 +0000 (02:11 -0500)]
sim: ppc: hoist hw.[ch] creation to top-level

7 months agosim: ppc: hoist igen execution to top-level
Mike Frysinger [Tue, 2 Jan 2024 07:00:09 +0000 (02:00 -0500)]
sim: ppc: hoist igen execution to top-level

Invoke ppc's igen from the top-level like we do for all other ports.

7 months agosim: ppc: merge configure logic into top-level
Mike Frysinger [Tue, 2 Jan 2024 06:40:06 +0000 (01:40 -0500)]
sim: ppc: merge configure logic into top-level

Now that the ppc configure script is just namespaced options, we can
move it to ppc/acinclude.m4 and include it directly in the top-level
configure script and kill off the last subdir configure script.

7 months agosim: ppc: scope configure options to --enable-sim-ppc-xxx
Mike Frysinger [Tue, 2 Jan 2024 06:30:53 +0000 (01:30 -0500)]
sim: ppc: scope configure options to --enable-sim-ppc-xxx

To prepare for moving these into the top-level configure, namespace
then with the port name like we do with all other ports.

7 months agosim: ppc: standardize configure option processing
Mike Frysinger [Tue, 2 Jan 2024 06:13:44 +0000 (01:13 -0500)]
sim: ppc: standardize configure option processing

Switch from ad-hoc $silent checks & echo calls to standard
AC_MSG_CHECKING & AC_MSG_RESULT calls.  Also delete pointless
variable setting after calling AC_MSG_ERROR.

7 months agosim: ppc: switch to AS_HELP_STRING for automatic formatting
Mike Frysinger [Tue, 2 Jan 2024 05:55:33 +0000 (00:55 -0500)]
sim: ppc: switch to AS_HELP_STRING for automatic formatting

7 months agosim: ppc: drop now unused config.in
Mike Frysinger [Tue, 2 Jan 2024 05:39:08 +0000 (00:39 -0500)]
sim: ppc: drop now unused config.in

7 months agosim: ppc: move defines.h generation to the top-level
Mike Frysinger [Tue, 2 Jan 2024 05:24:22 +0000 (00:24 -0500)]
sim: ppc: move defines.h generation to the top-level

Since we rely on the top-level config.h now, the defines.h generation
step should live here too.

7 months agosim: ppc: drop configure compiler checks
Mike Frysinger [Tue, 2 Jan 2024 05:12:51 +0000 (00:12 -0500)]
sim: ppc: drop configure compiler checks

Now that the ppc script only checks configure options and sets up
variables in the Makefile from those, delete all the compile related
logic to greatly simplify the configure script.

7 months agosim: ppc: drop custom config.h header
Mike Frysinger [Tue, 2 Jan 2024 05:11:38 +0000 (00:11 -0500)]
sim: ppc: drop custom config.h header

Now that everything has moved to the top-level, we can drop the
custom ppc config.h and reuse the common one.

7 months agosim: ppc: stop including headers from gdb/
Mike Frysinger [Tue, 2 Jan 2024 05:10:33 +0000 (00:10 -0500)]
sim: ppc: stop including headers from gdb/

The common sim code doesn't snoop in gdb/, and the ppc code doesn't
need to either.  Any common code we pull from gnulib/ now only.

7 months agosim: ppc: move termios probes to top-level
Mike Frysinger [Tue, 2 Jan 2024 04:57:12 +0000 (23:57 -0500)]
sim: ppc: move termios probes to top-level

This is the last compile-time logic in the ppc subdir.

7 months agosim: ppc: switch to AC_CACHE_CHECK
Mike Frysinger [Tue, 2 Jan 2024 04:42:45 +0000 (23:42 -0500)]
sim: ppc: switch to AC_CACHE_CHECK

This macro replaces the AC_MSG_CHECKING+AC_CACHE_VAL+AC_MSG_RESULT
which reduces the boilerplate in here a little bit.

7 months agosim: ppc: switch struct member checks to AC_CHECK_MEMBER
Mike Frysinger [Tue, 2 Jan 2024 04:53:53 +0000 (23:53 -0500)]
sim: ppc: switch struct member checks to AC_CHECK_MEMBER

This covers a lot of the AC_MSG_CHECKING+AC_TRY_COMPILE+AC_MSG_RESULT
boilerplate and matches what we do in the top-level platform checks.

7 months agosim: ppc: move termio defines to config.h
Mike Frysinger [Tue, 2 Jan 2024 04:37:11 +0000 (23:37 -0500)]
sim: ppc: move termio defines to config.h

Move the defines from explicit -D options to config.h defines to simplify
the build and make it easier to move to the top-level configure.

7 months agosim: ppc: move struct statfs to top-level
Mike Frysinger [Tue, 2 Jan 2024 04:32:29 +0000 (23:32 -0500)]
sim: ppc: move struct statfs to top-level

7 months agosim: ppc: move long long test to top-level
Mike Frysinger [Tue, 2 Jan 2024 04:22:17 +0000 (23:22 -0500)]
sim: ppc: move long long test to top-level

While the sim code doesn't utilize HAVE_LONG_LONG itself, other code
(like libiberty) seem to, so check for it in the top-level for all
ports to leverage.

7 months agosim: ppc: hoist sysv tests to top-level
Mike Frysinger [Tue, 2 Jan 2024 04:15:46 +0000 (23:15 -0500)]
sim: ppc: hoist sysv tests to top-level

Now that the sysv tests turn into config.h defines and everything
checks that, we can move the tests to the top-level and out of the
ppc subdir.

7 months agosim: ppc: always compile in the sysv sem & shm device files
Mike Frysinger [Tue, 2 Jan 2024 01:22:45 +0000 (20:22 -0500)]
sim: ppc: always compile in the sysv sem & shm device files

Move the stub logic to the device files themselves.  This makes the
configure & build logic more static which will make it easier to move
to the top-level build, and matches what we did with the common/ hw
tree already.

This also decouples the logic from the two -- in the past, you needed
both sem & shm in order to enable the device models, but now each one
is tied to its own independent knob.  Practically speaking, this will
probably not make a difference, but it simplifies the build a bit.

7 months agosim: ppc: change SysV sem & shm tests to compile-time
Mike Frysinger [Tue, 2 Jan 2024 01:11:52 +0000 (20:11 -0500)]
sim: ppc: change SysV sem & shm tests to compile-time

Instead of executing code to see if SysV semaphores & shared memory
are available, switch to just a compile-time test.  The system used
to compile might not match the system used to run the code wrt the
current kernel & OS settings, but the library APIs should.  So move
the failures from compile-time to runtime so the program is more
portable, and works correctly even when cross-compiling.

7 months agosim: ppc: merge System V semaphores checks
Mike Frysinger [Tue, 2 Jan 2024 01:03:26 +0000 (20:03 -0500)]
sim: ppc: merge System V semaphores checks

Compile tests can use earlier defines, so hoist the HAVE_UNION_SEMUN
define to before the semaphore check, and use it in the test so that
we can merge the 2 versions into one.

This also defines HAVE_UNION_SEMUN even when ac_cv_sysv_sem is not
set, but that's OK as this define is only about a type existing, not
about whether the overall code is usable.