Tom de Vries [Sat, 24 Feb 2024 10:00:20 +0000 (11:00 +0100)]
[gdb/build] Fix static cast of virtual base
With this change in bfd/development.sh:
...
-development=true
+development=false
...
we run into:
...
In file included from tui-data.h:28:0,
from tui-command.c:24:
gdb-checked-static-cast.h: In instantiation of \
‘T gdb::checked_static_cast(V*) [with T = tui_cmd_window*; V = tui_win_info]’:
tui-command.c:65:15: required from here
gdb-checked-static-cast.h:63:14: error: cannot convert from pointer to base \
class ‘tui_win_info’ to pointer to derived class ‘tui_cmd_window’ because \
the base is virtual
T result = static_cast<T> (v);
^~~~~~~~~~~~~~~~~~
...
Fix this by using dynamic_cast instead of gdb::checked_static_cast in
TUI_CMD_WIN and TUI_STATUS_WIN.
Tested on x86_64-linux, with development set to false.
Reported-By: Robert Xiao <spam_hole@shaw.ca>
Reported-By: Simon Marchi <simark@simark.ca>
Approved-By: Tom Tromey <tom@tromey.com>
PR build/31399
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31399
Change-Id: I555bdebf617b8d5c4688fc0a1a9fe878dbde0af8
Andrew Burgess [Wed, 6 Mar 2024 17:28:48 +0000 (17:28 +0000)]
gdb: use static_cast in gdb::checked_static_cast
This commit:
commit
6fe4779ac4b1874c995345e3eabd89cb1a05fbdf
Date: Sat Feb 24 11:00:20 2024 +0100
[gdb/build] Fix static cast of virtual base
addressed an issue where GDB would not compile in production mode due
to a use of gdb::checked_static_cast. The problem was that we were
asking GDB to cast from a virtual base class to a sub-class, this
works fine when using dynamic_cast, but does not work with
static_cast.
The gdb::checked_static_cast actually uses dynamic_cast under the hood
in development mode in order to ensure that the cast is valid, while
in a production build we use static_cast as this is more efficient.
What this meant however, was that when gdb::checked_static_cast was
used to cast from a virtual base class, the dynamic_cast of a
non-production build worked fine, while the production build's
static_cast caused a build failure.
However, the gdb::checked_static_cast function already contains some
static_assert calls that are intended to catch any issues with invalid
type casting, the goal of these asserts was to prevent issues like
this: the build only failing in production mode. Clearly the current
asserts are not enough.
I don't think there is a std::is_virtual_base type trait check, so
what I propose instead is that in non-production mode we also make use
of static_cast. This will ensure that any errors that crop up in
production mode should also be revealed in non-production mode, and
should catch issues like this in the future.
There should be no user visible changes after this commit.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31399
Change-Id: I829f335d8b326cb8e4298cc9640e0eb93e7a1b63
Co-Authored-By: Simon Marchi <simon.marchi@polymtl.ca>
Sung-hun Kim [Tue, 26 Mar 2024 07:09:06 +0000 (16:09 +0900)]
RISCV: gas: Change initial CFI operation from DW_CFA_def_cfa_register to DW_CFA_def_cfa
The DWARF specification (especially, DWARF4 and 5 [1,2]) states that
DW_CFA_def_cfa_register cannot be used as the first CFI operation.
It said DW_CFA_def_cfa_register as follows:
... This operation is valid only if the current CFA rule is defined
to use a register and offset.
So, DW_CFA_def_cfa_register can be used after that other definition
operation such as DW_CFA_def_cfa is called. However, the current gas
code emits DW_CFA_def_cfa_register as an initial CFI operation for RISCV.
In the libgcc, the unwinding function does not care about it, so it can
unwind the call stack. However, on the third party library such as
libunwindstack in Android, it causes a fatal error.
This patch changes the initial CFI operation to DW_CFA_def_cfa with
offset 0. It works as same as the previous one, but it does not have
any limitation so it satisfies the DWARF spec. This change resolves
the compatibility issue while preserving the original behaviour.
[1] DWARF4 specification, https://dwarfstd.org/doc/DWARF4.pdf
[2] DWARF5 specification, https://dwarfstd.org/doc/DWARF5.pdf
Change-Id: Ic83af38002d3790de4041c07f2e5d317c4358a1c
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
Dongkyun Son [Mon, 11 Mar 2024 08:21:53 +0000 (17:21 +0900)]
packaging: bump version to 2.42
Change-Id: Ieaff3685537c4a1b3823f8547ddc7adc624d5e16
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
Slava Barinov [Thu, 8 Jun 2023 09:03:46 +0000 (12:03 +0300)]
Workaround for riscv64 gold
This change is required to build a cross-binutils and enable acceleration
Change-Id: Ifb3547e6889b6844d0e726bac8175faf1a9ac7b8
Slava Barinov [Thu, 1 Jun 2023 09:21:49 +0000 (12:21 +0300)]
packaging: Add riscv64 platform
Change-Id: I127a29c6910e8863bb2e3e0b1ec8c4b7f82c22f8
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
Dongkyun Son [Fri, 9 Jun 2023 07:59:00 +0000 (16:59 +0900)]
packaging: add binutils-libs dependency in build
Fix configure error
/usr/lib64/gcc/x86_64-tizen-linux-gnu/13.1.0/../../../../x86_64-tizen-linux-gnu/bin/as:
error while loading shared libraries: libbfd-2.40.so: cannot open shared
object file: No such file or directory
Change-Id: I85267dabad3b190333dba377671f17f8137837d1
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
Dongkyun Son [Thu, 11 May 2023 00:42:23 +0000 (09:42 +0900)]
packaging: add libs package with GPL-2.0+ licensed
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
Slava Barinov [Thu, 4 May 2023 14:08:21 +0000 (17:08 +0300)]
packaging: Remove libsframe.la with docs
Change-Id: I97cc889e768f8755627075117a23884f4e0313e6
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
Dongkyun Son [Thu, 26 Jan 2023 08:57:09 +0000 (17:57 +0900)]
packaging: Bump version to 2.40
Change-Id: I0ed6c5efe6da862c633c55197f5b49994b36f648
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
Slava Barinov [Tue, 4 Apr 2023 12:13:32 +0000 (15:13 +0300)]
readline: fix path in configure.in
The path fix allows configure dumper to collect the information.
Change-Id: I347977a90df5fcaed59e37f1701ef32ae96d85ee
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
Dongkyun Son [Thu, 26 Jan 2023 23:23:12 +0000 (08:23 +0900)]
packaging: fix build error
error: Installed (but unpackaged) file(s) found:
/usr/lib64/libctf-nobfd.la
/usr/lib64/libctf.la
Change-Id: I78ab9706a099a4fccb2d66508a4d529c7882d74e
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
Łukasz Stelmach [Mon, 23 Jan 2023 19:27:53 +0000 (20:27 +0100)]
packaging: Fix build breaks and packaging after upgrade to 2.39
Remove two additional directories related to gdb.
Package new shared libraries and remove libtool files.
Change-Id: I8deeb28b0a7a0ed9a51dea7d17ba4541d6415586
Signed-off-by: Łukasz Stelmach <l.stelmach@samsung.com>
Dongkyun Son [Tue, 10 May 2022 03:13:13 +0000 (12:13 +0900)]
packaging: fix error
[ 211s] Installed (but unpackaged) file(s) found:
[ 211s] /usr/lib64/libbfd.la
[ 211s] /usr/lib64/libopcodes.la
Change-Id: I1beca706e75ae1afd869d3aac04537b02c6f5123
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
Dongkyun Son [Mon, 9 May 2022 08:46:27 +0000 (17:46 +0900)]
packaging: keep shared libraries for libbfd & libopcodes
Change-Id: I48e2d9bea9fb68fd7ab2c5d766f906ce385f645b
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
Dongkyun Son [Wed, 17 Mar 2021 11:06:40 +0000 (20:06 +0900)]
packaging: disable binutils_run_tests of cross binutils
Cross-toolchain testing is not straightforward.
Change-Id: I4670e694b4e26cf4d94786cb6c3824b9cb42cacd
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
Slava Barinov [Fri, 25 Sep 2020 09:08:27 +0000 (12:08 +0300)]
packaging: Turn off separate-code for i586
Change-Id: Id1126e73b8bbe641f3c80fc84b016bfa5df10571
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
Dongkyun Son [Thu, 24 Sep 2020 06:13:49 +0000 (15:13 +0900)]
Fix error while linking Tizen Apps
cherry-picked from RS-TizenStudio/gcc-9.2/pull/10
Change-Id: I30e8222f838680785c22527ab9295bb9c2f9e902
Signed-off-by: Karthik Bhat <kv.bhat@samsung.com>
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
Slava Barinov [Thu, 4 Jun 2020 12:08:07 +0000 (15:08 +0300)]
packaging: Add support for configure-dumper
Change-Id: Icb766cf48e675d30a5843355679be786b6e531b7
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
Slava Barinov [Mon, 3 Feb 2020 15:24:21 +0000 (18:24 +0300)]
packaging: Enable testing infrastructrure
Now Binutils can be tested just like GCC package, by defining run_tests to 1
Change-Id: I10a8667985ee3cd430ea8fbdbbd06653a4d72df8
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
Dongkyun Son [Wed, 12 Feb 2020 02:54:00 +0000 (11:54 +0900)]
configure: diabled relro by default
Change-Id: I74fa9ab77b0bb1a4a9a9a461235d929d985bd4e7
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
Slava Barinov [Tue, 19 Nov 2019 10:59:16 +0000 (13:59 +0300)]
packaging: version bump
Change-Id: Id27d126ac3d940e72645de8f3e6b0f81c10c04c5
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
Andrey Drobyshev [Mon, 8 Oct 2018 12:41:37 +0000 (15:41 +0300)]
ld/testing: clear compiler & linker flags when running testsuite.
Passing CLFAGS, CXXFLAGS, LDFLAGS used previously on build stage cause failures
when running "make check". It's safer to clear them.
Change-Id: If2bba2baca0f99c3931af2a55739ff6a087f2b0f
Signed-off-by: Andrey Drobyshev <a.drobyshev@partner.samsung.com>
Andrey Drobyshev [Mon, 1 Oct 2018 13:35:47 +0000 (16:35 +0300)]
packaging: fix testsuite build.
* Add list of dependent packages needed to build & run tests along with
corresponding macro run_tests;
* Add %check section.
Signed-off-by: Andrey Drobyshev <a.drobyshev@partner.samsung.com>
Change-Id: I2cc277d6855247747025a4d3b744a5c7804f4fca
Mikhail Kashkarov [Thu, 11 May 2017 09:14:51 +0000 (12:14 +0300)]
Add armv7hl support.
Change-Id: I1abc28bf90731946353b86579e85bd391c1745d3
Slava Barinov [Thu, 25 May 2017 08:10:06 +0000 (11:10 +0300)]
Introduce --enable-new-dtags configure option.
ld/configure --enable-new-dtags sets ld.bfd --enable-new-dtags option by
default.
The ld option switches on generation of DT_RUNPATH tag instead of DT_RPATH tag
which is deprecated and breaks LD_LIBRARY_PATH usage.
Debian binutils bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=835859
* ld/configure.ac: Add --enable-new-dtags option.
* ld/ldmain.c: Set link_info.new_dtags to 1 if when --enable-new-dtags is
switched on.
* ld/configure: Regenerate.
* ld/config.in: Regenerate.
* packaging/binutils.spec: Switch on --enable-new-dtags.
* packaging/binutils-armv7l.spec: Regenerate.
* packaging/binutils-aarch64.spec: Regenerate.
Change-Id: I0ec86f61a8b97d55c29bb441a9ae4db94060ea22
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
Slava Barinov [Mon, 27 Feb 2017 11:29:01 +0000 (14:29 +0300)]
2.27 version
Slava Barinov [Mon, 27 Feb 2017 09:57:34 +0000 (12:57 +0300)]
Packaging added.
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
Nick Clifton [Mon, 29 Jan 2024 14:51:43 +0000 (14:51 +0000)]
Update version number to 2.42
Indu Bhagat [Mon, 29 Jan 2024 14:22:06 +0000 (14:22 +0000)]
x86: testsuite: scfi: adjust COFI testcase and gas: scfi: untraceable control flow should be a hard error
Nick Clifton [Mon, 29 Jan 2024 11:31:52 +0000 (11:31 +0000)]
Updated French translations for GOLD and LD
Nick Clifton [Mon, 29 Jan 2024 11:22:39 +0000 (11:22 +0000)]
LoongArch: update test cases about TLS
GDB Administrator [Mon, 29 Jan 2024 00:01:47 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 28 Jan 2024 00:01:20 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 27 Jan 2024 00:01:30 +0000 (00:01 +0000)]
Automatic date update in version.in
mengqinggang [Fri, 26 Jan 2024 10:50:57 +0000 (10:50 +0000)]
Backport commits
969f5c0e1 (LoongArch: gas: Add support for s9 register) and
a0aa6f4ab (LoongArch: ld: Add support for TLS LE symbol with addend) to 2.42 branch.
GDB Administrator [Fri, 26 Jan 2024 00:01:13 +0000 (00:01 +0000)]
Automatic date update in version.in
Andrew Carlotti [Fri, 19 Jan 2024 17:15:04 +0000 (17:15 +0000)]
gas: Update NEWS
Groups entries by architecture, and update AArch64 content.
Andrew Carlotti [Mon, 15 Jan 2024 07:26:53 +0000 (07:26 +0000)]
aarch64: Update Architecture Extensions documentation
Restructure the architecture extensions table, add a new table for architecture
version dependencies, add missing architecture extensions, and improve some
extension descriptions.
mengqinggang [Thu, 18 Jan 2024 11:03:11 +0000 (19:03 +0800)]
LoongArch: gas: Start a new frag after instructions that can be relaxed
For R_LARCH_TLS_{LE_HI20_R,LE_ADD_R,LD_PC_HI20,GD_PC_HI20, DESC_PC_HI20}
relocations, start a new frag to get correct eh_frame Call Frame Information
FDE DW_CFA_advance_loc info.
mengqinggang [Sun, 1 Oct 2023 07:29:44 +0000 (15:29 +0800)]
LoongArch: gas: Don't define LoongArch .align
Gcc may generate "\t.align\t%d,
54525952,4\n" before commit
b20c7ee066cb7d952fa193972e8bc6362c6e4063. To write
54525952 (NOP) to object
file, we call s_align_ptwo (-4). It result in alignment padding must be a
multiple of 4 if .align has second parameter.
Use default s_align_ptwo for .align.
Xi Ruoyao [Fri, 19 Jan 2024 16:38:24 +0000 (00:38 +0800)]
LoongArch: Fix some test failures about TLS desc and TLS relaxation
There are two issues causing 11 test failures:
1. The TLS desc tests are matching the entire disassemble of a linked
executable. But if ld is configured --enable-default-hash-style=gnu
(note that most modern distros use this option), the layout of the
linked executables will be different and the immediate operands in
the linked executables will also be different. So we add
"--hash-style=both" for these tests to cancel the effect of
--enable-default-hash-style=gnu, like [x86_64 mark-plt tests].
2. By default objdump disassemble uses [pseudo-instructions] so "addi.w"
is outputed as "li.w", causing mismatches in TLS relaxation tests.
We can turn off the pseudo-instruction usage in objdump using "-M
no-aliases" to fix them.
[x86_64 mark-plt tests]:
16666ccc91295d1568c5c2cb0e7600694840dfd9
[pseudo-instructions]:
17f9439038257b1de0c130a416a9a7645c653cb0
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
mengqinggang [Wed, 10 Jan 2024 01:55:13 +0000 (09:55 +0800)]
LoongArch: Do not emit R_LARCH_RELAX for two register macros
For two register macros (e.g. la.local $t0, $t1, symbol) used in extreme code
model, do not emit R_LARCH_RELAX relocations.
GDB Administrator [Thu, 25 Jan 2024 00:03:06 +0000 (00:03 +0000)]
Automatic date update in version.in
Andrew Carlotti [Tue, 23 Jan 2024 18:22:12 +0000 (18:22 +0000)]
aarch64: Eliminate unused variable warnings with -DNDEBUG
GDB Administrator [Wed, 24 Jan 2024 00:02:16 +0000 (00:02 +0000)]
Automatic date update in version.in
Andrew Carlotti [Wed, 17 Jan 2024 12:37:15 +0000 (12:37 +0000)]
aarch64: Include +predres2 in -march=armv8.9-a
This matches the dependencies in the architecture, in LLVM, and even in the
original Binutils commit message that mistakenly included it only in armv9.4-a.
Xi Ruoyao [Tue, 23 Jan 2024 15:59:12 +0000 (15:59 +0000)]
[PATCH v2] gas/NEWS, ld/NEWS: Announce LoongArch changes in 2.42
Jan Beulich [Mon, 22 Jan 2024 07:52:30 +0000 (08:52 +0100)]
x86/APX: also amend the PUSH2/POP2 testcase
Commit
f530d5f1bab6 ("Update x86/APX: VROUND{P,S}{S,D} can generally be
encoded") took care of only half of the remaining issue. Add #pass here
as well.
GDB Administrator [Tue, 23 Jan 2024 00:02:50 +0000 (00:02 +0000)]
Automatic date update in version.in
Vladimir Mezentsev [Sat, 20 Jan 2024 02:40:21 +0000 (18:40 -0800)]
Fix 31252 gprofng causes testsuite parallel jobs fail
Before running our tests, we made a fake installation into ./tmpdir.
This installation changes libopcodes.la in the build area.
Gas testing may fail if gas and gprofng tests are run in parallel.
I create a script to run gprofng. Inside this script, LD_LIBRARY_PATH,
GPROFNG_SYSCONFDIR are set.
putenv_libcollector_ld_misc() first uses $GPROFNG_PRELOAD_LIBDIRS to create
directories for SP_COLLECTOR_LIBRARY_PATH ($SP_COLLECTOR_LIBRARY_PATH is used
to set up LD_PRELOAD).
gprofng/ChangeLog
2024-01-19 Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
PR gprofng/31252
PR gprofng/30808
* src/envsets.cc (putenv_libcollector_ld_misc): Use
$GPROFNG_PRELOAD_LIBDIRS first to build SP_COLLECTOR_LIBRARY_PATH.
* testsuite/config/default.exp: Create a script to run gprofng.
* testsuite/lib/display-lib.exp: Fix typo.
Nick Clifton [Mon, 22 Jan 2024 17:26:00 +0000 (17:26 +0000)]
Updated Serbian translations for th bfd, gold and opcodes directories
GDB Administrator [Mon, 22 Jan 2024 00:01:20 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Sun, 21 Jan 2024 00:01:19 +0000 (00:01 +0000)]
Automatic date update in version.in
GDB Administrator [Sat, 20 Jan 2024 00:00:41 +0000 (00:00 +0000)]
Automatic date update in version.in
H.J. Lu [Fri, 19 Jan 2024 14:42:20 +0000 (06:42 -0800)]
Update x86/APX: VROUND{P,S}{S,D} can generally be encoded
Append "#pass" to APX tests for targets which pad text sections with NOPs.
* testsuite/gas/i386/x86-64-apx-evex-promoted-intel.d: Append
"#pass".
* testsuite/gas/i386/x86-64-apx-evex-promoted.d: Likewise.
(cherry picked from commit
f530d5f1bab6eb5adc65f422ef811fb278a21a4b)
Jan Beulich [Fri, 19 Jan 2024 09:18:32 +0000 (10:18 +0100)]
x86/APX: VROUND{P,S}{S,D} can generally be encoded
VRNDSCALE{P,S}{S,D} is the AVX512 generalization of these AVX insns. As
long as the immediate has the top 4 bits clear, they are equivalent to
the earlier VEX-encoded insns, and hence can be used to permit use of
eGPR-s in the memory operand. Since this is the normal way of using
these insns, also alter the resulting diagnostic to complain about the
immediate, not the eGPR use.
Jan Beulich [Fri, 19 Jan 2024 09:17:44 +0000 (10:17 +0100)]
x86/APX: be consistent with insn suffixes
When there's a suitably disambiguating register operand, suffixes are
generally omitted (unless in suffix-always mode). All NDD insns have a
suitable register operand, so they shouldn't have suffixes by default.
Jan Beulich [Fri, 19 Jan 2024 09:16:00 +0000 (10:16 +0100)]
x86: support APX forms of U{RD,WR}MSR
This was missed in
6177c84d5edc ("Support APX GPR32 with extend evex
prefix").
Nick Clifton [Fri, 19 Jan 2024 11:45:44 +0000 (11:45 +0000)]
Add multilib.am to the list of top level files included in any release created by the src-release.sh script
GDB Administrator [Fri, 19 Jan 2024 00:02:36 +0000 (00:02 +0000)]
Automatic date update in version.in
Xi Ruoyao [Tue, 16 Jan 2024 07:00:16 +0000 (15:00 +0800)]
LoongArch: Adapt R_LARCH_{PCALA,GOT,TLS_IE,TLS_DESC}64_* handling per psABI v2.30
In LoongArch psABI v2.30, an offset (-8 for LO20 and -12 for HI12)
should be applied on PC for these reloc types to avoid wrong relocation
when the instruction sequence crosses a page boundary.
The lld linker has already adapted the change. Make it for the bfd
linker too.
Link: https://github.com/loongson/la-abi-specs/releases/v2.30
Link: https://github.com/loongson-community/discussions/issues/17
Link: https://github.com/llvm/llvm-project/pull/73387
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Nick Clifton [Thu, 18 Jan 2024 11:22:36 +0000 (11:22 +0000)]
Updated translations for various sub-directories
Alan Modra [Tue, 16 Jan 2024 00:36:23 +0000 (11:06 +1030)]
PR30824 internal error with -z pack-relative-relocs
This corrects a counting problem, where prior to relocate_section relr
encoded relative relocs were allowed when it was known they were on
even boundaries, but relocate_section can only put relative relocs
(non-relr) on eight byte boundaries.
PR 30824
* elf64-ppc.c (RELR_ALIGN): Define, use throughout.
(maybe_relr): New function, use throughout.
(cherry picked from commit
f91074ebd8dc8077c9c778a42360e77a636dce5e)
H.J. Lu [Wed, 17 Jan 2024 16:03:29 +0000 (08:03 -0800)]
Update x86-64: Add -z mark-plt and -z nomark-plt
Pass --hash-style=both to ld for -z mark-plt tests to support linker
configured with --enable-default-hash-style=gnu.
* testsuite/ld-x86-64/mark-plt-1b-x32.d: Pass --hash-style=both
to ld.
* testsuite/ld-x86-64/mark-plt-1b.d: Likewise.
* testsuite/ld-x86-64/mark-plt-1d-x32.d: Likewise.
* testsuite/ld-x86-64/mark-plt-1d.d: Likewise.
(cherry picked from commit
16666ccc91295d1568c5c2cb0e7600694840dfd9)
Nick Clifton [Wed, 17 Jan 2024 12:08:31 +0000 (12:08 +0000)]
Import gcc commit
65388b28656d65595bdaf191df85af81c35ca63 which adds support for explicit object member function mangling.
H.J. Lu [Mon, 15 Jan 2024 15:31:29 +0000 (07:31 -0800)]
x86-64: Skip SCFI tests for x32 targets
Since SCFI isn't supported on x32:
Fatal error: SCFI is not supported for this ABI
skip SCFI tests for x32 targets.
PR gas/31245
* testsuite/gas/scfi/x86_64/scfi-x86-64.exp: Skip for x32
targets.
(cherry picked from commit
7bd344dd0e0469a93cbbf50f797155278cb76a0b)
Nick Clifton [Mon, 15 Jan 2024 15:14:03 +0000 (15:14 +0000)]
fix typo
Nick Clifton [Mon, 15 Jan 2024 15:10:12 +0000 (15:10 +0000)]
Update version number and regenerate configure files
Nick Clifton [Mon, 15 Jan 2024 14:42:15 +0000 (14:42 +0000)]
Add markers for 2.42 branch
Nick Clifton [Mon, 15 Jan 2024 14:21:37 +0000 (14:21 +0000)]
Update branch/release creation documentation
Victor Do Nascimento [Mon, 15 Jan 2024 13:02:36 +0000 (13:02 +0000)]
aarch64: rcpc3: Regenerate aarch64-*-2.c files
Victor Do Nascimento [Wed, 10 Jan 2024 19:20:05 +0000 (19:20 +0000)]
aarch64: rcpc3: Add FP load/store insns
Along with the relevant unit-tests, this adds the following rcpc3
instructions:
STL1 { <Vt>.D }[<index>], [<Xn|SP>]
LDAP1 { <Vt>.D }[<index>], [<Xn|SP>]
LDAPUR <Bt>, [<Xn|SP>{, #<simm>}]
LDAPUR <Ht>, [<Xn|SP>{, #<simm>}]
LDAPUR <St>, [<Xn|SP>{, #<simm>}]
LDAPUR <Dt>, [<Xn|SP>{, #<simm>}]
LDAPUR <Qt>, [<Xn|SP>{, #<simm>}]
STLUR <Bt>, [<Xn|SP>{, #<simm>}]
STLUR <Ht>, [<Xn|SP>{, #<simm>}]
STLUR <St>, [<Xn|SP>{, #<simm>}]
STLUR <Dt>, [<Xn|SP>{, #<simm>}]
STLUR <Qt>, [<Xn|SP>{, #<simm>}]
with `#<simm>' taking on a signed 8-bit integer value in the range
[-256,255] and `index' the values 0 or 1.
Co-authored-by: Srinath Parvathaneni <srinath.parvathaneni@arm.com>
Victor Do Nascimento [Thu, 4 Jan 2024 14:06:38 +0000 (14:06 +0000)]
aarch64: rcpc3: Add integer load/store insns
Along with the relevant unit tests and updates to the existing
regression tests, this adds support for the following novel rcpc3
insns:
LDIAPP <Wt1>, <Wt2>, [<Xn|SP>]
LDIAPP <Wt1>, <Wt2>, [<Xn|SP>], #8
LDIAPP <Xt1>, <Xt2>, [<Xn|SP>]
LDIAPP <Xt1>, <Xt2>, [<Xn|SP>], #16
STILP <Wt1>, <Wt2>, [<Xn|SP>]
STILP <Wt1>, <Wt2>, [<Xn|SP>, #-8]!
STILP <Xt1>, <Xt2>, [<Xn|SP>]
STILP <Xt1>, <Xt2>, [<Xn|SP>, #-16]!
LDAPR <Wt>, [<Xn|SP>], #4
LDAPR <Xt>, [<Xn|SP>], #8
STLR <Wt>, [<Xn|SP>, #-4]!
STLR <Xt>, [<Xn|SP>, #-8]!
Victor Do Nascimento [Thu, 4 Jan 2024 14:04:40 +0000 (14:04 +0000)]
aarch64: rcpc3: Define RCPC3_INSN macro
This patch adds the necessary macro for encoding FEAT_RCPC3-dependent
instructions in Binutils.
Victor Do Nascimento [Tue, 9 Jan 2024 10:04:11 +0000 (10:04 +0000)]
aarch64: rcpc3: add support in general_constraint_met_p
Given the introduction of the new address operand types for rcpc3
instructions, this patch adds the necessary logic to teach
`general_constraint_met_p` how to proper handle these.
Victor Do Nascimento [Fri, 5 Jan 2024 17:26:09 +0000 (17:26 +0000)]
aarch64: rcpc3: New RCPC3_ADDR operand types
The particular choices of address indexing, along with their encoding
for RCPC3 instructions lead to the requirement of a new set of operand
descriptions, along with the relevant inserter/extractor set.
That is, for the integer load/stores, there is only a single valid
indexing offset quantity and offset mode is allowed - The value is
always equivalent to the amount of data read/stored by the
operation and the offset is post-indexed for Load-Acquire RCpc, and
pre-indexed with writeback for Store-Release insns.
This indexing quantity/mode pair is selected by the setting of a
single bit in the instruction. To represent these insns, we add the
following operand types:
- AARCH64_OPND_RCPC3_ADDR_OPT_POSTIND
- AARCH64_OPND_RCPC3_ADDR_OPT_PREIND_WB
In the case of loads and stores involving SIMD/FP registers, the
optional offset is encoded as an 8-bit signed immediate, but neither
post-indexing or pre-indexing with writeback is available. This
created the need for an operand type similar to
AARCH64_OPND_ADDR_OFFSET, with the difference that FLD_index should
not be checked.
We thus introduce the AARCH64_OPND_RCPC3_ADDR_OFFSET operand, a
variant of AARCH64_OPND_ADDR_OFFSET, w/o the FLD_index bitfield.
Victor Do Nascimento [Fri, 5 Jan 2024 17:27:04 +0000 (17:27 +0000)]
aarch64: rcpc3: Define address operand fields and inserter/extractors
Beyond the need to encode any registers involved in data transfer and
the address base register for load/stores, it is necessary to specify
the data register addressing mode and whether the address register is
to be pre/post-indexed, whereby loads may be post-indexed and stores
pre-indexed with write-back.
The use of a single bit to specify both the indexing mode and indexing
value requires a novel function be written to accommodate this for
address operand insertion in assembly and another for extraction in
disassembly, along with the definition of two insn fields for use with
these instructions.
This therefore defines the following functions:
- aarch64_ins_rcpc3_addr_opt_offset
- aarch64_ins_rcpc3_addr_offset
- aarch64_ext_rcpc3_addr_opt_offset
- aarch64_ext_rcpc3_addr_offset
It extends the `do_special_{encoding|decoding}' functions and defines
two rcpc3 instruction fields:
- FLD_opc2
- FLD_rcpc3_size
Victor Do Nascimento [Tue, 9 Jan 2024 16:22:07 +0000 (16:22 +0000)]
aarch64: rcpc3: Create implicit load/store size calc function
The allowed immediate offsets in integer rcpc3 load store instructions
are not encoded explicitly in the instruction itself, being rather
implicitly equivalent to the amount of data loaded/stored by the
instruction.
This leads to the requirement that this quantity be calculated based on
the number of registers involved in the transfer, either as data
source or destination registers and their respective qualifiers.
This is done via `calc_ldst_datasize (const aarch64_opnd_info *opnds)'
implemented here, using a cumulative sum of qualifier sizes preceding
the address operand in the OPNDS operand list argument.
Victor Do Nascimento [Thu, 4 Jan 2024 13:34:52 +0000 (13:34 +0000)]
aarch64: rcpc3: Add +rcpc3 architectural feature support flag
Indicating the presence of the Armv8.2-a feature adding further
support for the Release Consistency Model, the `+rcpc3' architectural
extension flag is added to the list of possible `-march' options in
Binutils, together with the necessary macro for encoding rcpc3
instructions.
Mark Wielaard [Thu, 4 Jan 2024 00:31:31 +0000 (01:31 +0100)]
bfd: riscv_maybe_function_sym check _bfd_elf_is_local_label_name
This fixes the ld "Handle no DWARF information" testcase. Which
currently fails on riscv because a local label name is assumed
to be the current function name.
bfd/ChangeLog:
* elfnn-riscv.c (riscv_maybe_function_sym): Also check
_bfd_elf_is_local_label_name.
Andrew Carlotti [Mon, 15 Jan 2024 11:20:20 +0000 (11:20 +0000)]
aarch64: Fix tlbi and tlbip instructions
There are some tlbi operations that don't have a corresponding tlbip operation,
but we were incorrectly using the same list for both. Add the missing tlbi
*nxs operations, and use the F_REG_128 flag to filter tlbi operations that
don't have a tlbip analogue. For increased clarity, I have also used a macro
to reduce duplication between the 'nxs' and non-'nxs' variants, and added a
test to verify that no invalid combinations are accepted.
Additionally, fix two missing checks for AARCH64_OPND_SYSREG_TLBIP that were
preventing disassembly of tlbip instructions.
Andrew Carlotti [Mon, 15 Jan 2024 11:19:48 +0000 (11:19 +0000)]
aarch64: Refactor aarch64_sys_ins_reg_supported_p
Add an aarch64_feature_set field to aarch64_sys_ins_reg, and use this for
feature checks instead of testing against a list of operand codes.
Nick Clifton [Mon, 15 Jan 2024 12:25:00 +0000 (12:25 +0000)]
nm: Replace --with-symbol-versions with --without-symbol-versions in --help output
PR 31243
nm: Fix --help output
Andrew Carlotti [Mon, 15 Jan 2024 11:16:05 +0000 (11:16 +0000)]
aarch64: Remove unused BTI feature bit
OK for master?
Nick Clifton [Mon, 15 Jan 2024 11:45:28 +0000 (11:45 +0000)]
Add generated source files and fix thinko in aarch64-asm.c
Srinath Parvathaneni [Mon, 15 Jan 2024 09:40:11 +0000 (09:40 +0000)]
aarch64: Add SVE2.1 Contiguous load/store instructions.
Hi,
This patch add support for SVE2.1 instructions ld1q,
ld2q, ld3q and ld4q, st1q, st2q, st3q and st4q.
Regression testing for aarch64-none-elf target and found no regressions.
Ok for binutils-master?
Regards,
Srinath.
Srinath Parvathaneni [Mon, 15 Jan 2024 09:38:39 +0000 (09:38 +0000)]
PATCH 5/6][Binutils] aarch64: Add SVE2.1 fmin and fmax instructions.
Hi,
This patch add support for SVE2.1 instruction faddqv,
fmaxnmqv, fmaxqv, fminnmqv and fminqv.
Regression testing for aarch64-none-elf target and found no regressions.
Ok for binutils-master?
Regards,
Srinath.
Srinath Parvathaneni [Mon, 15 Jan 2024 09:37:32 +0000 (09:37 +0000)]
aarch64: Add SVE2.1 dupq, eorqv and extq instructions.
Hi,
This patch add support for SVE2.1 instruction dupq, eorqv and extq.
Regression testing for aarch64-none-elf target and found no regressions.
Ok for binutils-master?
Regards,
Srinath.
Srinath Parvathaneni [Mon, 15 Jan 2024 09:35:55 +0000 (09:35 +0000)]
aarch64: Add support for FEAT_SVE2p1.
Hi,
This patch add support for FEAT_SVE2p1 (SVE2.1 Extension) feature
along with +sve2p1 optional flag to enabe this feature.
Also support for following SVE2p1 instructions is added
addqv, andqv, smaxqv, sminqv, umaxqv, uminqv and uminqv.
Regression testing for aarch64-none-elf target and found no regressions.
Ok for binutils-master?
Regards,
Srinath.
Srinath Parvathaneni [Mon, 15 Jan 2024 09:34:41 +0000 (09:34 +0000)]
aarch64: Add support for FEAT_SME2p1 instructions.
Hi,
This patch add support for FEAT_SME2p1 and "movaz" instructions
along with the optional flag +sme2p1.
Following "movaz" instructions are add:
Move and zero two ZA tile slices to vector registers.
Move and zero four ZA tile slices to vector registers.
Regression testing for aarch64-none-elf target and found no regressions.
Ok for binutils-master?
Regards,
Srinath.
Srinath Parvathaneni [Mon, 15 Jan 2024 09:28:28 +0000 (09:28 +0000)]
aarch64: Add support for FEAT_B16B16 instructions.
Hi,
This patch add support for SVE2.1 and SME2.1 non-widening BFloat16
(FEAT_B16B16) instructions.
Following instructions predicated, unpredicated and indexed
variants are added in this patch.
bfadd, bfclamp, bfmax bfmaxnm, bfmin,bfminnm,
bfmla,bfmls,bfmul and bfsub.
Regression testing for aarch64-none-elf target and found no regressions.
Ok for binutils-master?
Regards,
Srinath.
Indu Bhagat [Mon, 15 Jan 2024 09:00:51 +0000 (01:00 -0800)]
gas/NEWS: announce the new SCFI command line option
Indu Bhagat [Mon, 15 Jan 2024 09:00:47 +0000 (01:00 -0800)]
gas: testsuite: add an x86 testsuite for SCFI
The testsuite for SCFI contains target-specific tests.
When a test is executed with --scfi=experimental command line option,
the CFI annotations in the test .s files are skipped altogether by the
GAS for processing. The CFI directives in the input assembly files are,
however, validated by running the assembler one more time without
--scfi=experimental.
Some testcases are used to highlight those asm constructs that the SCFI
machinery in GAS currently does not support:
- Only System V AMD64 ABI is supported for now. Using either --32 or
--x32 with SCFI results in hard error.
See scfi-unsupported-1.s.
- Untraceable stack-pointer manipulation in function epilougue and prologue.
See scfi-unsupported-2.s.
- Using Dynamically Realigned Arguement Pointer (DRAP) register to
realign the stack. For SCFI, the CFA must be only REG_SP or REG_FP
based. See scfi-unsupported-drap-1.s
Some testcases are used to highlight some diagnostics that the SCFI
machinery in GAS currently issues, with an intent to help user correct
inadvertent errors in their hand-written asm. An error is issued when
GAS finds that input asm is not amenable to correct CFI synthesis.
- (#1) "Warning: SCFI: Asymetrical register restore"
- (#2) "Error: SCFI: usage of REG_FP as scratch not supported"
- (#3) "Error: SCFI: unsupported stack manipulation pattern"
In case of (#2) and (#3), SCFI generation is skipped for the respective
function. Above is a subset of the warnings/errors implemented in the
code.
gas/testsuite/:
* gas/scfi/README: New test.
* gas/scfi/x86_64/ginsn-add-1.l: New test.
* gas/scfi/x86_64/ginsn-add-1.s: New test.
* gas/scfi/x86_64/ginsn-dw2-regnum-1.l: New test.
* gas/scfi/x86_64/ginsn-dw2-regnum-1.s: New test.
* gas/scfi/x86_64/ginsn-pop-1.l: New test.
* gas/scfi/x86_64/ginsn-pop-1.s: New test.
* gas/scfi/x86_64/ginsn-push-1.l: New test.
* gas/scfi/x86_64/ginsn-push-1.s: New test.
* gas/scfi/x86_64/scfi-add-1.d: New test.
* gas/scfi/x86_64/scfi-add-1.l: New test.
* gas/scfi/x86_64/scfi-add-1.s: New test.
* gas/scfi/x86_64/scfi-add-2.d: New test.
* gas/scfi/x86_64/scfi-add-2.l: New test.
* gas/scfi/x86_64/scfi-add-2.s: New test.
* gas/scfi/x86_64/scfi-asm-marker-1.d: New test.
* gas/scfi/x86_64/scfi-asm-marker-1.l: New test.
* gas/scfi/x86_64/scfi-asm-marker-1.s: New test.
* gas/scfi/x86_64/scfi-asm-marker-2.d: New test.
* gas/scfi/x86_64/scfi-asm-marker-2.l: New test.
* gas/scfi/x86_64/scfi-asm-marker-2.s: New test.
* gas/scfi/x86_64/scfi-asm-marker-3.d: New test.
* gas/scfi/x86_64/scfi-asm-marker-3.l: New test.
* gas/scfi/x86_64/scfi-asm-marker-3.s: New test.
* gas/scfi/x86_64/scfi-bp-sp-1.d: New test.
* gas/scfi/x86_64/scfi-bp-sp-1.l: New test.
* gas/scfi/x86_64/scfi-bp-sp-1.s: New test.
* gas/scfi/x86_64/scfi-bp-sp-2.d: New test.
* gas/scfi/x86_64/scfi-bp-sp-2.l: New test.
* gas/scfi/x86_64/scfi-bp-sp-2.s: New test.
* gas/scfi/x86_64/scfi-callee-saved-1.d: New test.
* gas/scfi/x86_64/scfi-callee-saved-1.l: New test.
* gas/scfi/x86_64/scfi-callee-saved-1.s: New test.
* gas/scfi/x86_64/scfi-callee-saved-2.d: New test.
* gas/scfi/x86_64/scfi-callee-saved-2.l: New test.
* gas/scfi/x86_64/scfi-callee-saved-2.s: New test.
* gas/scfi/x86_64/scfi-callee-saved-3.d: New test.
* gas/scfi/x86_64/scfi-callee-saved-3.l: New test.
* gas/scfi/x86_64/scfi-callee-saved-3.s: New test.
* gas/scfi/x86_64/scfi-callee-saved-4.d: New test.
* gas/scfi/x86_64/scfi-callee-saved-4.l: New test.
* gas/scfi/x86_64/scfi-callee-saved-4.s: New test.
* gas/scfi/x86_64/scfi-cfg-1.d: New test.
* gas/scfi/x86_64/scfi-cfg-1.l: New test.
* gas/scfi/x86_64/scfi-cfg-1.s: New test.
* gas/scfi/x86_64/scfi-cfg-2.d: New test.
* gas/scfi/x86_64/scfi-cfg-2.l: New test.
* gas/scfi/x86_64/scfi-cfg-2.s: New test.
* gas/scfi/x86_64/scfi-cfi-label-1.d: New test.
* gas/scfi/x86_64/scfi-cfi-label-1.l: New test.
* gas/scfi/x86_64/scfi-cfi-label-1.s: New test.
* gas/scfi/x86_64/scfi-cfi-sections-1.d: New test.
* gas/scfi/x86_64/scfi-cfi-sections-1.l: New test.
* gas/scfi/x86_64/scfi-cfi-sections-1.s: New test.
* gas/scfi/x86_64/scfi-cofi-1.d: New test.
* gas/scfi/x86_64/scfi-cofi-1.l: New test.
* gas/scfi/x86_64/scfi-cofi-1.s: New test.
* gas/scfi/x86_64/scfi-diag-1.l: New test.
* gas/scfi/x86_64/scfi-diag-1.s: New test.
* gas/scfi/x86_64/scfi-diag-2.l: New test.
* gas/scfi/x86_64/scfi-diag-2.s: New test.
* gas/scfi/x86_64/scfi-dyn-stack-1.d: New test.
* gas/scfi/x86_64/scfi-dyn-stack-1.l: New test.
* gas/scfi/x86_64/scfi-dyn-stack-1.s: New test.
* gas/scfi/x86_64/scfi-enter-1.d: New test.
* gas/scfi/x86_64/scfi-enter-1.l: New test.
* gas/scfi/x86_64/scfi-enter-1.s: New test.
* gas/scfi/x86_64/scfi-fp-diag-2.l: New test.
* gas/scfi/x86_64/scfi-fp-diag-2.s: New test.
* gas/scfi/x86_64/scfi-indirect-mov-1.d: New test.
* gas/scfi/x86_64/scfi-indirect-mov-1.l: New test.
* gas/scfi/x86_64/scfi-indirect-mov-1.s: New test.
* gas/scfi/x86_64/scfi-indirect-mov-2.d: New test.
* gas/scfi/x86_64/scfi-indirect-mov-2.l: New test.
* gas/scfi/x86_64/scfi-indirect-mov-2.s: New test.
* gas/scfi/x86_64/scfi-indirect-mov-3.d: New test.
* gas/scfi/x86_64/scfi-indirect-mov-3.l: New test.
* gas/scfi/x86_64/scfi-indirect-mov-3.s: New test.
* gas/scfi/x86_64/scfi-indirect-mov-4.d: New test.
* gas/scfi/x86_64/scfi-indirect-mov-4.l: New test.
* gas/scfi/x86_64/scfi-indirect-mov-4.s: New test.
* gas/scfi/x86_64/scfi-indirect-mov-5.s: New test.
* gas/scfi/x86_64/scfi-lea-1.d: New test.
* gas/scfi/x86_64/scfi-lea-1.l: New test.
* gas/scfi/x86_64/scfi-lea-1.s: New test.
* gas/scfi/x86_64/scfi-leave-1.d: New test.
* gas/scfi/x86_64/scfi-leave-1.l: New test.
* gas/scfi/x86_64/scfi-leave-1.s: New test.
* gas/scfi/x86_64/scfi-pushq-1.d: New test.
* gas/scfi/x86_64/scfi-pushq-1.l: New test.
* gas/scfi/x86_64/scfi-pushq-1.s: New test.
* gas/scfi/x86_64/scfi-pushsection-1.d: New test.
* gas/scfi/x86_64/scfi-pushsection-1.l: New test.
* gas/scfi/x86_64/scfi-pushsection-1.s: New test.
* gas/scfi/x86_64/scfi-pushsection-2.d: New test.
* gas/scfi/x86_64/scfi-pushsection-2.l: New test.
* gas/scfi/x86_64/scfi-pushsection-2.s: New test.
* gas/scfi/x86_64/scfi-selfalign-func-1.d: New test.
* gas/scfi/x86_64/scfi-selfalign-func-1.l: New test.
* gas/scfi/x86_64/scfi-selfalign-func-1.s: New test.
* gas/scfi/x86_64/scfi-simple-1.d: New test.
* gas/scfi/x86_64/scfi-simple-1.l: New test.
* gas/scfi/x86_64/scfi-simple-1.s: New test.
* gas/scfi/x86_64/scfi-simple-2.d: New test.
* gas/scfi/x86_64/scfi-simple-2.l: New test.
* gas/scfi/x86_64/scfi-simple-2.s: New test.
* gas/scfi/x86_64/scfi-sub-1.d: New test.
* gas/scfi/x86_64/scfi-sub-1.l: New test.
* gas/scfi/x86_64/scfi-sub-1.s: New test.
* gas/scfi/x86_64/scfi-sub-2.d: New test.
* gas/scfi/x86_64/scfi-sub-2.l: New test.
* gas/scfi/x86_64/scfi-sub-2.s: New test.
* gas/scfi/x86_64/scfi-unsupported-1.l: New test.
* gas/scfi/x86_64/scfi-unsupported-1.s: New test.
* gas/scfi/x86_64/scfi-unsupported-2.l: New test.
* gas/scfi/x86_64/scfi-unsupported-2.s: New test.
* gas/scfi/x86_64/scfi-unsupported-3.l: New test.
* gas/scfi/x86_64/scfi-unsupported-3.s: New test.
* gas/scfi/x86_64/scfi-unsupported-4.l: New test.
* gas/scfi/x86_64/scfi-unsupported-4.s: New test.
* gas/scfi/x86_64/scfi-unsupported-cfg-1.l: New test.
* gas/scfi/x86_64/scfi-unsupported-cfg-1.s: New test.
* gas/scfi/x86_64/scfi-unsupported-cfg-2.l: New test.
* gas/scfi/x86_64/scfi-unsupported-cfg-2.s: New test.
* gas/scfi/x86_64/scfi-unsupported-drap-1.l: New test.
* gas/scfi/x86_64/scfi-unsupported-drap-1.s: New test.
* gas/scfi/x86_64/scfi-unsupported-insn-1.l: New test.
* gas/scfi/x86_64/scfi-unsupported-insn-1.s: New test.
* gas/scfi/x86_64/scfi-x86-64.exp: New file.
Indu Bhagat [Mon, 15 Jan 2024 09:00:42 +0000 (01:00 -0800)]
opcodes: i386-reg.tbl: Add a comment to reflect dependency on ordering
The ginsn representation keeps the DWARF register number of the
operands. The API ginsn_dw2_regnum relies on the the relative ordering
of these register entries in the table. Add a comment to make it clear.
opcodes/
* i386-reg.tbl: Add a comment.
Indu Bhagat [Mon, 15 Jan 2024 09:00:36 +0000 (01:00 -0800)]
gas: doc: update documentation for the new listing option
Add a new listing option, -i, to emit ginsn in the listing output. We
may also emit other SCFI information if necessary in the future.
ginsn are most useful when seen alongside the assembly instructions.
Hence, they are emitted when the user includes the assembly instructions
in the listing output, i.e., "-ali=FILE".
gas/doc/:
* as.texi: Add documentation for the new listing option, -i.
Indu Bhagat [Mon, 15 Jan 2024 09:00:31 +0000 (01:00 -0800)]
gas: x86: synthesize CFI for hand-written asm
This patch adds support in GAS to create generic GAS instructions
(a.k.a., the ginsn) for the x86 backend (AMD64 ABI only at this time).
Using this ginsn infrastructure, GAS can then synthesize CFI for
hand-written asm for x86_64.
A ginsn is a target-independent representation of the machine
instructions. One machine instruction may need one or more ginsn.
This patch also adds skeleton support for printing ginsn in the listing
output for debugging purposes.
Since the current use-case of ginsn is to synthesize CFI, the x86 target
needs to generate ginsns necessary for the following machine
instructions only:
- All change of flow instructions, including all conditional and
unconditional branches, call and return from functions.
- All register saves and unsaves to the stack.
- All instructions affecting the two registers that could potentially
be used as the base register for CFA tracking. For SCFI, the base
register for CFA tracking is limited to REG_SP and REG_FP only for
now.
The representation of ginsn is kept simple:
- GAS instruction has GINSN_NUM_SRC_OPNDS (defined to be 2 at this time)
number of source operands and one destination operand at this time.
- GAS instruction uses DWARF register numbers in its representation and
does not track register size.
- GAS instructions carry location information (file name and line
number).
- GAS instructions are ID's with a natural number in order of their
addtion to the list. This can be used as a proxy for the static
program order of the corresponding machine instructions.
Note that, GAS instruction (ginsn) format does not support
GINSN_TYPE_PUSH and GINSN_TYPE_POP. Some architectures, like aarch64,
do not have push and pop instructions, but rather STP/LDP/STR/LDR etc.
instructions. Further these instructions have a variety of addressing
modes, like offset, pre-indexing and post-indexing etc. Among other
things, one of differences in these addressing modes is _when_ the addr
register is updated with the result of the address calculation: before
or after the memory operation. To best support such needs, the generic
instructions like GINSN_TYPE_LOAD, GINSN_TYPE_STORE together with
GINSN_TYPE_ADD, and GINSN_TYPE_SUB may be used.
The functionality provided in ginsn.c and scfi.c is compiled in when a
target defines TARGET_USE_SCFI and TARGET_USE_GINSN. This can be
revisited later when there are other use-cases of creating ginsn's in
GAS, apart from the current use-case of synthesizing CFI for
hand-written asm.
Support is added only for System V AMD64 ABI for ELF at this time. If
the user enables SCFI with --32, GAS issues an error:
"Fatal error: SCFI is not supported for this ABI"
For synthesizing (DWARF) CFI, the SCFI machinery requires the programmer
to adhere to some pre-requisites for their asm:
- Hand-written asm block must begin with a .type foo, @function
It is highly recommended to, additionally, also ensure that:
- Hand-written asm block ends with a .size foo, .-foo
The SCFI machinery encodes some rules which align with the standard
calling convention specified by the ABI. Apart from the rules, the SCFI
machinery employs some heuristics. For example:
- The base register for CFA tracking may be either REG_SP or REG_FP.
- If the base register for CFA tracking is REG_SP, the precise amount of
stack usage (and hence, the value of REG_SP) must be known at all times.
- If using dynamic stack allocation, the function must switch to
FP-based CFA. This means using instructions like the following (in
AMD64) in prologue:
pushq %rbp
movq %rsp, %rbp
and analogous instructions in epilogue.
- Save and Restore of callee-saved registers must be symmetrical.
However, the SCFI machinery at this time only warns if any such
asymmetry is seen.
These heuristics/rules are architecture-independent and are meant to
employed for all architectures/ABIs using SCFI in the future.
gas/
* Makefile.am: Add new files.
* Makefile.in: Regenerated.
* as.c (defined): Handle documentation and listing option for
ginsns and SCFI.
* config/obj-elf.c (obj_elf_size): Invoke ginsn_data_end.
(obj_elf_type): Invoke ginsn_data_begin.
* config/tc-i386.c (x86_scfi_callee_saved_p): New function.
(ginsn_prefix_66H_p): Likewise.
(ginsn_dw2_regnum): Likewise.
(x86_ginsn_addsub_reg_mem): Likewise.
(x86_ginsn_addsub_mem_reg): Likewise.
(x86_ginsn_alu_imm): Likewise.
(x86_ginsn_move): Likewise.
(x86_ginsn_lea): Likewise.
(x86_ginsn_jump): Likewise.
(x86_ginsn_jump_cond): Likewise.
(x86_ginsn_enter): Likewise.
(x86_ginsn_safe_to_skip): Likewise.
(x86_ginsn_unhandled): Likewise.
(x86_ginsn_new): New functionality to generate ginsns.
(md_assemble): Invoke x86_ginsn_new.
(s_insn): Likewise.
(i386_target_format): Add hard error for usage of SCFI with non AMD64 ABIs.
* config/tc-i386.h (TARGET_USE_GINSN): New definition.
(TARGET_USE_SCFI): Likewise.
(SCFI_MAX_REG_ID): Likewise.
(REG_FP): Likewise.
(REG_SP): Likewise.
(SCFI_INIT_CFA_OFFSET): Likewise.
(SCFI_CALLEE_SAVED_REG_P): Likewise.
(x86_scfi_callee_saved_p): Likewise.
* gas/listing.h (LISTING_GINSN_SCFI): New define for ginsn and
SCFI.
* gas/read.c (read_a_source_file): Close SCFI processing at end
of file read.
* gas/scfidw2gen.c (scfi_process_cfi_label): Add implementation.
(scfi_process_cfi_signal_frame): Likewise.
* subsegs.h (struct frch_ginsn_data): New forward declaration.
(struct frchain): New member for ginsn data.
* gas/subsegs.c (subseg_set_rest): Initialize the new member.
* symbols.c (colon): Invoke ginsn_frob_label to convey
user-defined labels to ginsn infrastructure.
* ginsn.c: New file.
* ginsn.h: New file.
* scfi.c: New file.
* scfi.h: New file.
Indu Bhagat [Mon, 15 Jan 2024 09:00:27 +0000 (01:00 -0800)]
opcodes: x86: new marker for insns that implicitly update stack pointer
Some x86 instructions affect the stack pointer implicitly. Add a new
operand constraint to reflect this. This will be useful for SCFI
implmentation to ensure its correctness.
Mark all push, pop, call, ret, enter, leave, INT, iret instructions.
opcodes/
* i386-gen.c: Update opcode_modifiers.
* i386-opc.h: Add a new constraint.
* i386-opc.tbl: Update the affected instructions.
* i386-tbl.h: Regenerated.
Indu Bhagat [Mon, 15 Jan 2024 09:00:23 +0000 (01:00 -0800)]
opcodes: gas: x86: define and use Rex2 as attribute not constraint
Rex2 is currently an operand constraint. For the upcoming SCFI
implementation in GAS, we need to identify operations which implicitly
update the stack pointer. An operand constraint enumerator for implicit
stack op seems more appropriate than an attribute. However, two opcodes
currently necessitate both Rex2 and an implicit stack op marker; this
prompts revisiting the current representations a bit.
Make Rex2 a standalone attribute, so that later a new operand constraint
may be added for IMPLICIT_STACK_OP.
ChangeLog:
* gas/config/tc-i386.c (is_apx_rex2_encoding): Update the check.
* opcodes/i386-gen.c: Add a new BITFIELD for Rex2.
* opcodes/i386-opc.h (REX2_REQUIRED): Remove.
* opcodes/i386-opc.tbl: Remove Rex2 operand constraint.
* opcodes/i386-tbl.h: Regenerated.
Indu Bhagat [Mon, 15 Jan 2024 09:00:19 +0000 (01:00 -0800)]
gas: scfidw2gen: new functionality to prepare for SCFI
Define a new set of handlers for CFI directives for the purpose of SCFI.
The SCFI machinery ignores many of the user-specified CFI direcives when
SCFI is in effect. A warning ("Warning: SCFI ignores most
user-specified CFI directives") is issued once per file. The following
CFI directives, however, are not ignored:
- .cfi_sections
- .cfi_label
- .cfi_signal_frame
gas/
* Makefile.am: Add new files to GAS_CFILES and HFILES.
* Makefile.in: Likewise.
* gas/read.c (scfi_pop_insert): New define.
(pobegin): Use the SCFI handlers.
* scfidw2gen.c: New file.
* scfidw2gen.h: New file.