]> git.ipfire.org Git - thirdparty/binutils-gdb.git/log
thirdparty/binutils-gdb.git
18 months agosim: bfin: initial bf60x support users/vapier/sim/bfin
Mike Frysinger [Wed, 18 May 2011 17:14:24 +0000 (13:14 -0400)] 
sim: bfin: initial bf60x support

18 months agose_all32bitopcodes: mark certain block of insns as invalid under sim
Mike Frysinger [Mon, 24 Jun 2013 00:11:11 +0000 (20:11 -0400)] 
se_all32bitopcodes: mark certain block of insns as invalid under sim

Are these actually invalid?  Or is the sim getting it wrong?

18 months agoignore more stuff
Mike Frysinger [Wed, 5 Jun 2013 14:54:30 +0000 (10:54 -0400)] 
ignore more stuff

18 months agosim: bfin: add new GPIO model (bf60x)
Mike Frysinger [Sun, 25 Mar 2012 15:49:32 +0000 (11:49 -0400)] 
sim: bfin: add new GPIO model (bf60x)

This models the new GPIO controller found on BF60x processors.

18 months agosim: bfin: add new DDE (distributed DMA engine) model (bf60x)
Mike Frysinger [Fri, 3 Jun 2011 05:13:45 +0000 (01:13 -0400)] 
sim: bfin: add new DDE (distributed DMA engine) model (bf60x)

This models the new DMA controller found on BF60x processors.

18 months agosim: bfin: add new SMC (static memory) model (bf60x)
Mike Frysinger [Mon, 30 May 2011 09:02:58 +0000 (05:02 -0400)] 
sim: bfin: add new SMC (static memory) model (bf60x)

This models the new static memory controller found on BF60x processors.

2012-08-28  Mike Frysinger  <vapier@gentoo.org>

* configure.ac (SIM_AC_OPTION_HARDWARE): Add bfin_smc.
* configure: Regenerated.
* dv-bfin_smc.c, dv-bfin_smc.h: New device model.
* machs.h (BFIN_MMR_SMC_SIZE): Define.

18 months agosim: bfin: add new EFS (Electronic Fuse Serial) model (bf60x)
Mike Frysinger [Wed, 18 May 2011 20:25:58 +0000 (16:25 -0400)] 
sim: bfin: add new EFS (Electronic Fuse Serial) model (bf60x)

This models the new fuse controller found on BF60x processors.

18 months agosim: bfin: add new SPU (system protection unit) model (bf60x)
Mike Frysinger [Wed, 18 May 2011 17:53:07 +0000 (13:53 -0400)] 
sim: bfin: add new SPU (system protection unit) model (bf60x)

This models the new system protection unit found on BF60x processors.

This is mostly a stub implementation at the moment -- shims for the
registers.

2012-08-28  Mike Frysinger  <vapier@gentoo.org>

* configure.ac (SIM_AC_OPTION_HARDWARE): Add bfin_spu.
* configure: Regenerated.
* dv-bfin_spu.c, dv-bfin_spu.h: New device model.
* machs.h (BFIN_MMR_SPU_SIZE): Define.

18 months agosim: bfin: add new SEC (system event controller) model (bf60x)
Mike Frysinger [Wed, 18 May 2011 17:14:24 +0000 (13:14 -0400)] 
sim: bfin: add new SEC (system event controller) model (bf60x)

This models the new interrupt controller found on BF60x processors.

This is mostly a stub implementation at the moment -- shims for the
registers.  There is no port routing yet.

2012-08-28  Mike Frysinger  <vapier@gentoo.org>

* configure.ac (SIM_AC_OPTION_HARDWARE): Add bfin_sec.
* configure: Regenerated.
* dv-bfin_sec.c, dv-bfin_sec.h: New device model.
* machs.h (BFIN_MMR_SEC_BASE): Define.
(BFIN_MMR_SEC_SIZE): Likewise.

18 months agosim: bfin: add new CGU (clock generation) model (bf60x)
Mike Frysinger [Wed, 18 May 2011 17:14:24 +0000 (13:14 -0400)] 
sim: bfin: add new CGU (clock generation) model (bf60x)

This models the new clock generation unit found on BF60x processors.

2012-08-28  Mike Frysinger  <vapier@gentoo.org>

* configure.ac (SIM_AC_OPTION_HARDWARE): Add bfin_cgu.
* configure: Regenerated.
* dv-bfin_cgu.c, dv-bfin_cgu.h: New device model.
* machs.h (BFIN_MMR_CGU_SIZE): Define.

18 months agosim: bfin: add new UART model (bf60x)
Mike Frysinger [Wed, 18 May 2011 17:14:24 +0000 (13:14 -0400)] 
sim: bfin: add new UART model (bf60x)

This models the latest UART implementation found on BF60x processors.

2012-08-28  Mike Frysinger  <vapier@gentoo.org>

* configure.ac (SIM_AC_OPTION_HARDWARE): Add bfin_uart4.
* configure: Regenerated.
* dv-bfin_uart.c (bfin_uart_poll): Call bfin_uart_get_status with
new second argument.
(bfin_uart_get_status): Change to take a 2nd argument.  Replace
TEMT | THRE with new txs argument.
* dv-bfin_uart.h: Include new dv-bfin_uart_core.h header.
(struct bfin_uart, bfin_uart_get_next_byte, bfin_uart_write_byte,
bfin_uart_get_status, bfin_uart_write_buffer, bfin_uart_read_buffer,
bfin_uart_reschedule): Delete.
* dv-bfin_uart2.c (bfin_uart_io_read_buffer): Call
bfin_uart_get_status with new second argument.
* dv-bfin_uart4.c, dv-bfin_uart4.h: New UART model.
* dv-bfin_uart_core.h: New file.
* machs.h (BFIN_MMR_UART4_SIZE): Define.

18 months agosim: bfin: handle invalid dsp32 mac/mult insns
Mike Frysinger [Mon, 9 Apr 2012 03:32:36 +0000 (23:32 -0400)] 
sim: bfin: handle invalid dsp32 mac/mult insns

18 months agob/sim/testsuite/sim/bfin/se_undefinedinstruction3.S is broke? need to test on hardware
Mike Frysinger [Sun, 8 Apr 2012 20:50:19 +0000 (16:50 -0400)] 
b/sim/testsuite/sim/bfin/se_undefinedinstruction3.S is broke? need to test on hardware

18 months agosim: skip sysroot for most syscalls
Mike Frysinger [Mon, 19 Mar 2012 05:02:03 +0000 (01:02 -0400)] 
sim: skip sysroot for most syscalls

XXX: Need to qualify this better.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
18 months agoRevert "sim: bfin: add proper regs to dmac"
Mike Frysinger [Mon, 19 Mar 2012 03:53:28 +0000 (23:53 -0400)] 
Revert "sim: bfin: add proper regs to dmac"

This reverts commit 29dd0cd28218880292b6d69322b09c09c04fd59b.

18 months agosim: bfin: add proper regs to dmac
Mike Frysinger [Sat, 4 Jun 2011 17:06:39 +0000 (13:06 -0400)] 
sim: bfin: add proper regs to dmac

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
18 months agosim: bfin: make the core timer output port an edge
Mike Frysinger [Tue, 26 Apr 2011 02:15:32 +0000 (22:15 -0400)] 
sim: bfin: make the core timer output port an edge

The output port of the core timer is currently always high and never goes
low, so make sure we lower the level after sending it out.  This way the
other side (the CEC) knows when to delatch things.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-04-26  Mike Frysinger  <vapier@gentoo.org>

* dv-bfin_ctimer.c (bfin_ctimer_expire): Call hw_port_event a 2nd
time with a level of 0.

18 months agosim: bfin: keep output port levels from SIC level and up-to-date
Mike Frysinger [Tue, 26 Apr 2011 01:42:17 +0000 (21:42 -0400)] 
sim: bfin: keep output port levels from SIC level and up-to-date

When the internal interrupt routes get updated (via the IAR MMRs), we need
to resend all the output levels as they might have changed.  We also need
to do this after the MMR write is committed instead of before so that we
send out the most up-to-date value.

Further, we need to send both high and low levels so that when a line goes
low, the other side is made aware of this.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-04-25  Mike Frysinger  <vapier@gentoo.org>

* dv-bfin_sic.c (bfin_sic_forward_interrupts): Declare new local
"levels" array.  Drop empty ipend if check.  Set levels to 1 instead
of calling hw_port_event directly.  Add a new loop over the levels
array at the end of the func and move the HW_TRACE/hw_port_event
call there.
(bfin_sic_52x_io_write_buffer): Move the forward interrupts call
after the value32p write, and run this code for IAR MMRs too.
(bfin_sic_537_io_write_buffer, bfin_sic_54x_io_write_buffer,
bfin_sic_561_io_write_buffer): Likewise.

18 months agosim: bfin: separate port levels from isa levels in the CEC
Mike Frysinger [Mon, 25 Apr 2011 23:12:51 +0000 (19:12 -0400)] 
sim: bfin: separate port levels from isa levels in the CEC

Since the input ports are level based (coming from the SIC/ctimer), make
sure we keep those values separate from levels manually raised via insns
(like RAISE and EXCPT) or cleared via MMRs (writes to ILAT).  This way
the peripherals can raise/lower their interrupt lines without affecting
manual tweaking, and we get behavior that matches the hardware.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-04-25  Mike Frysinger  <vapier@gentoo.org>

* dv-bfin_cec.c (bfin_cec): Add "plat" member.
(bfin_cec_io_read_buffer): Merge "plat" with "ilat" when reading
the ILAT MMR.
(bfin_cec_port_event): Use the incoming level to set/clear bits
in "plat".  When the bit isn't yet set, also call _cec_raise.
(_cec_raise): Merge "plat" with "ilat" when calling __cec_get_ivg.

18 months agogdb: bfin: add some Blackfin-specific tests
Jie Zhang [Wed, 10 Mar 2010 15:33:44 +0000 (10:33 -0500)] 
gdb: bfin: add some Blackfin-specific tests

Not sure this is still needed ...

Signed-off-by: Jie Zhang <jie@codesourcery.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
18 months agosim: tweak signed to unsigned local vars
Mike Frysinger [Sat, 10 Apr 2010 20:52:32 +0000 (16:52 -0400)] 
sim: tweak signed to unsigned local vars

This tweaks a lot of hardware code to use "unsigned" instead of "int" to
fix gcc warnings about signed/unsigned comparisons.  In these cases, the
code is already working with unsigned variables, so there shouldn't be a
problem converting the local variables from "int".

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-04-10  Mike Frysinger  <vapier@gentoo.org>

* dv-sockser.c (dv_sockser_init): Change local tmp var to unsigned.
* hw-ports.c, hw-ports.h (hw_port_encode): Change sizeof_buf arg to
unsigned.
* hw-properties.c (hw_add_range_array_property): Change local i var
to unsigned.
(hw_add_reg_array_property): Likewise.
(hw_add_string_array_property): Change local vars sizeof_array and
string_nr to unsigned.
(hw_find_string_array_property): Change local vars nr_entries to
unsigned.
* hw-tree.c (split_device_specifier): Change local len var to
unsigned.
(print_properties): Change local cell_nr var to unsigned.
* sim-core.c (sim_core_read_buffer): Change local nr_bytes var to
unsigned.
(sim_core_write_buffer): Likewise.

18 months agosim: bfin: add bootroms
Mike Frysinger [Sun, 20 Feb 2011 01:38:23 +0000 (20:38 -0500)] 
sim: bfin: add bootroms

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
18 months agogdb: ignore test generated files
Mike Frysinger [Tue, 29 Mar 2011 03:05:48 +0000 (23:05 -0400)] 
gdb: ignore test generated files

18 months agogitignore: ignore site.{bak,exp} treewide
Mike Frysinger [Wed, 10 Mar 2010 19:35:51 +0000 (14:35 -0500)] 
gitignore: ignore site.{bak,exp} treewide

These files are never checked into cvs, and are generated by most
testsuites, so ignore them.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-03-28  Mike Frysinger  <vapier@gentoo.org>

* .gitignore: Ignore site.bak and site.exp.

18 months agosim: ppc: merge misc igen APIs
Mike Frysinger [Mon, 1 Jan 2024 23:14:13 +0000 (18:14 -0500)] 
sim: ppc: merge misc igen APIs

The common igen code provides the same misc APIs as the ppc version,
so delete the ppc code and pull in the common one.  There is one
minor difference: the ppc code has a unique dumpf function.  The
common code switched to lf_printf for the same functionality, but
since that requires changes throughout the igen codebase, delay that
cleanup for now so we can merge the rest.

18 months agosim: ppc: rework igen error to match common
Mike Frysinger [Mon, 1 Jan 2024 22:34:01 +0000 (17:34 -0500)] 
sim: ppc: rework igen error to match common

Switch to an ERROR macro and tweak the error signature to match the
common igen version in preparation for merging the two implementations.

18 months agosim: igen: extend error to take arguments
Mike Frysinger [Mon, 1 Jan 2024 22:28:51 +0000 (17:28 -0500)] 
sim: igen: extend error to take arguments

The ppc igen error helper allows arbitrary printf calls, so extend
the common one to do the same.

18 months agosim: ppc: rename igen max_insn_bit_size
Mike Frysinger [Mon, 1 Jan 2024 22:17:50 +0000 (17:17 -0500)] 
sim: ppc: rename igen max_insn_bit_size

We want to avoid conflicts with the common igen enums.  This should
get migrated over to the common parsing logic, but for now, switch
the name to avoid redefinition.

18 months agosim: igen: minor constify logic
Mike Frysinger [Mon, 1 Jan 2024 22:09:02 +0000 (17:09 -0500)] 
sim: igen: minor constify logic

Copy some improvements from the ppc igen code.

18 months agosim: ppc: unify igen filter_filename implementations
Mike Frysinger [Mon, 1 Jan 2024 21:44:50 +0000 (16:44 -0500)] 
sim: ppc: unify igen filter_filename implementations

Now that both igen implementations are in the top-level, we can unify
the filter_filename implementation between them since they're the same
(literally the same code).

18 months agosim: ppc: replace filter_filename with lbasename
Mike Frysinger [Mon, 1 Jan 2024 21:32:48 +0000 (16:32 -0500)] 
sim: ppc: replace filter_filename with lbasename

The lbasename function from libiberty provides the same API as this
custom function.  The common/ code already made the switch, so make
the same change to the ppc code to avoid target duplication.

18 months agosim: ppc: hoist igen compilation into top-level
Mike Frysinger [Mon, 1 Jan 2024 20:48:15 +0000 (15:48 -0500)] 
sim: ppc: hoist igen compilation into top-level

This simplifies the build a bit (especially for deps in port subdirs),
and avoids recursive make.  This in turn speeds up the build, and lets
us reuse existing build-time vs host-time logic from Makefile.am.

18 months agosim: ppc: drop build-config.h usage
Mike Frysinger [Mon, 1 Jan 2024 20:26:21 +0000 (15:26 -0500)] 
sim: ppc: drop build-config.h usage

This header is only used by the igen tool, and none of the igen code
depends on the configure-time checks.  Delete the logic to simplify
to prepare for moving it to the local.mk code.

18 months agosim: ppc: simplify filter_host.c logic
Mike Frysinger [Mon, 1 Jan 2024 20:24:12 +0000 (15:24 -0500)] 
sim: ppc: simplify filter_host.c logic

Switch this from a build-time generation to a static include.  This
makes the build rules a bit simpler, especially as we move them to
Automake from hand-written makefiles.

18 months agosim: igen: remove libigen.a when cleaning
Mike Frysinger [Mon, 1 Jan 2024 20:38:10 +0000 (15:38 -0500)] 
sim: igen: remove libigen.a when cleaning

18 months agosim: ppc: drop unused host bitsize settings
Mike Frysinger [Mon, 1 Jan 2024 16:04:08 +0000 (11:04 -0500)] 
sim: ppc: drop unused host bitsize settings

This is never set anywhere, so it's always empty.  Scrub it.

18 months agosim: frv: fix cmpb uninitialized variable usage
Mike Frysinger [Sun, 24 Dec 2023 10:21:30 +0000 (05:21 -0500)] 
sim: frv: fix cmpb uninitialized variable usage

This code sets up the cc variable based on the comparison of other
registers, but it does so incrementally with bit operations, and it
never initializes the cc variable.  Initialize it to 0 which the
cmpba insn is already doing.

18 months agosim: arm: mark local read-only arrays as static const
Mike Frysinger [Fri, 22 Dec 2023 01:06:10 +0000 (20:06 -0500)] 
sim: arm: mark local read-only arrays as static const

Move it into read-only data sections to avoid constructing them on the
stack at runtime.

18 months agosim: warnings: enable -Wunused-variable
Mike Frysinger [Wed, 6 Dec 2023 13:39:25 +0000 (06:39 -0700)] 
sim: warnings: enable -Wunused-variable

18 months agocpu: or1k: drop unused l.swa flag
Mike Frysinger [Tue, 19 Dec 2023 01:55:58 +0000 (20:55 -0500)] 
cpu: or1k: drop unused l.swa flag

The "flag" argument isn't set/used in this insn, so drop it.
This fixes an unused variable warning in the generated sim.

18 months agosim: fix pervasive typo
Tom Tromey [Sun, 31 Dec 2023 21:55:58 +0000 (14:55 -0700)] 
sim: fix pervasive typo

I noticed a typo in a sim constant.  This patch fixes it.
permenant -> permanent

18 months agoAutomatic date update in version.in
GDB Administrator [Mon, 1 Jan 2024 00:00:49 +0000 (00:00 +0000)] 
Automatic date update in version.in

18 months agoRun 'black' on tui-window.py
Tom Tromey [Sun, 31 Dec 2023 23:36:44 +0000 (16:36 -0700)] 
Run 'black' on tui-window.py

Mark pointed out that a recent patch of mine caused the buildbot to
complain about the formatting of some Python test code.  This patch
re-runs 'black' to fix the problem.

19 months ago[gdb/testsuite] Fix typo in gdb.base/catch-syscall.exp
Tom de Vries [Sun, 31 Dec 2023 08:39:45 +0000 (09:39 +0100)] 
[gdb/testsuite] Fix typo in gdb.base/catch-syscall.exp

On aarch64-linux with a gdb build without libexpat, I run into:
...
(gdb) PASS: gdb.base/catch-syscall.exp: determine pipe syscall: \
  catch syscall 59
continue
Continuing.

Catchpoint 5 (call to syscall 59), 0x0000fffff7e04578 in pipe () from \
  /lib64/libc.so.6
(gdb) FAIL: gdb.base/catch-syscall.exp: determine pipe syscall: continue
...

In the test-case, this pattern handles either the syscall name or number for
the pipe syscall:
...
  -re -wrap "Catchpoint $decimal \\(call to syscall (pipe|$SYS_pipe)\\).*" {
...
but the pattern for the pipe2 syscall mistakenly uses SYS_pipe instead of
SYS_pipe2:
...
  -re -wrap "Catchpoint $decimal \\(call to syscall (pipe2|$SYS_pipe)\\).*" {
...
and consequently doesn't handle the pipe2 syscall number.

Fix the typo by using SYS_pipe2 instead.

Tested on aarch64-linux.

19 months agoAutomatic date update in version.in
GDB Administrator [Sun, 31 Dec 2023 00:00:10 +0000 (00:00 +0000)] 
Automatic date update in version.in

19 months agoAdd keywords to TuiWindow.write
Tom Tromey [Wed, 13 Dec 2023 05:49:52 +0000 (22:49 -0700)] 
Add keywords to TuiWindow.write

The gdb docs promise that methods with more than two or more arguments
will accept keywords.  However, I found that TuiWindow.write didn't
allow them.  This patch adds the missing support.

19 months ago[gdb/testsuite] Fix gdb.base/gdb-index-err.exp for root user
Tom de Vries [Sat, 30 Dec 2023 19:04:10 +0000 (20:04 +0100)] 
[gdb/testsuite] Fix gdb.base/gdb-index-err.exp for root user

When running test-case gdb.base/gdb-index-err.exp in a container as root user,
I run into:
...
FAIL: gdb.base/gdb-index-err.exp: flag=: \
  try to write index to a non-writable directory
FAIL: gdb.base/gdb-index-err.exp: flag=-dwarf-5: \
  try to write index to a non-writable directory
...

The test-case creates a directory without write permissions:
...
$ ls -ald private
dr-xr-xr-x 2 root root 4096 Dec 29 06:26 private/
...
but apparently the root user is still able to write in it.

Fix this by making the test unsupported for the root user.

Tested on x86_64-linux.

Reviewed-By: Lancelot SIX <lancelot.six@amd.com>
PR testsuite/31197
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31197

19 months agoLoongArch: Commas inside double quotes
Alan Modra [Thu, 28 Dec 2023 11:42:17 +0000 (22:12 +1030)] 
LoongArch: Commas inside double quotes

This adds an extra feature: Commas inside double quotes are not an
arg delimiter, and thus can be part of the arg.

* loongarch-coder.c (loongarch_split_args_by_comma): Commas
inside quotes are not arg delimiters.

19 months agoRegen bfd-in2.h
Alan Modra [Sat, 30 Dec 2023 02:27:42 +0000 (12:57 +1030)] 
Regen bfd-in2.h

Please DON'T edit this file.  READ THE COMMENT!

19 months agoMAINTAINERS: Update my email address
Joseph Myers [Sat, 30 Dec 2023 00:32:00 +0000 (00:32 +0000)] 
MAINTAINERS: Update my email address

There will be another update in January.

19 months agoAutomatic date update in version.in
GDB Administrator [Sat, 30 Dec 2023 00:00:23 +0000 (00:00 +0000)] 
Automatic date update in version.in

19 months agox86: Append "#pass" to APX tests
H.J. Lu [Fri, 29 Dec 2023 23:46:59 +0000 (15:46 -0800)] 
x86: Append "#pass" to APX tests

Append "#pass" to APX tests for targets which pad text sections with NOPs.

* testsuite/gas/i386/x86-64-apx-evex-promoted-bad.d: Append
"#pass".
* testsuite/gas/i386/x86-64-apx-ndd-optimize.d: Likewise.
* testsuite/gas/i386/x86-64-apx-ndd.d: Likewise.
* testsuite/gas/i386/x86-64-apx-pushp-popp-intel.d: Likewise.
* testsuite/gas/i386/x86-64-apx-pushp-popp.d: Likewise.

19 months agox86: Don't use .insn with '/'
H.J. Lu [Fri, 29 Dec 2023 23:43:07 +0000 (15:43 -0800)] 
x86: Don't use .insn with '/'

'/' starts a comment for some targets.  Use .byte instead of .insn with
'/'.

* testsuite/gas/i386/x86-64-apx-evex-promoted-bad.s: Use .byte
instead of .insn with '/'.

19 months agoFix x86-64: Add R_X86_64_CODE_4_GOTPCRELX
H.J. Lu [Fri, 29 Dec 2023 20:43:11 +0000 (12:43 -0800)] 
Fix x86-64: Add R_X86_64_CODE_4_GOTPCRELX

commit 3d5a60de52556f6a53d71d7e607c6696450ae3e4
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Thu Jun 8 10:01:03 2023 -0700

    x86-64: Add R_X86_64_CODE_4_GOTPCRELX

added a new field, fx_tcbit3, to fix.  But it didn't initialize it.
Fix it by clearing it in fix_new_internal.

* wrtite.c (fix_new_internal): Clear fx_tcbit3.

19 months agodwarf, fortran: add support for DW_TAG_entry_point
Nils-Christian Kempke [Mon, 21 Mar 2022 14:43:38 +0000 (15:43 +0100)] 
dwarf, fortran: add support for DW_TAG_entry_point

Fortran provides additional entry points for subroutines and functions.
These entry points may use only a subset (or a different set) of the
parameters of the original subroutine.  The entry points may be described
via the DWARF tag DW_TAG_entry_point.

This commit adds support for parsing the DW_TAG_entry_point DWARF tag.
Currently, between ifx/ifort/gfortran, only ifort is actually emitting
this tag.  Both, ifx and gfortran use the DW_TAG_subprogram tag as
workaround/alternative.  Thus, this patch really only adds more ifort
support.  Even so, some of the attached tests still fail for ifort, due
to some wrong line info generated for the entry points in ifort.

After this patch it is possible to set a breakpoint in gdb with the
ifort compiled example at the entry points 'foo' and 'foobar', which was not
possible before.

As gcc and ifx do not emit the tag I also added a test to gdb.dwarf2
which uses some underlying c compiled code and adds some Fortran style DWARF
to it emitting the DW_TAG_entry_point.  Before this patch it was not
possible to actually define breakpoint at the entry point tags.

For gfortran there actually exists a bug on bugzilla, asking for the use
of DW_TAG_entry_point over DW_TAG_subprogram:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37134

This patch was originally posted here

https://sourceware.org/legacy-ml/gdb-patches/2017-07/msg00317.html

but its review/pinging got lost after a while.  I reworked it to fit the
current GDB.

Co-authored-by: Bernhard Heckel <bernhard.heckel@intel.com>
Co-authored-by: Tim Wiederhake <tim.wiederhake@intel.com>
Approved-by: Tom Tromey <tom@tromey.com>
19 months agogdb, dwarf: add assert to dwarf2_get_pc_bounds
Nils-Christian Kempke [Wed, 13 Jul 2022 09:23:36 +0000 (11:23 +0200)] 
gdb, dwarf: add assert to dwarf2_get_pc_bounds

In dwarf2_get_pc_bounds we were writing unchecked to *lowpc.  This
commit adds a gdb_assert to first check that lowpc != nullptr.

Approved-by: Tom Tromey <tom@tromey.com>
19 months agogdb, dwarf: move part of dwarf2_get_pc_bounds into separate function
Nils-Christian Kempke [Wed, 13 Jul 2022 08:57:27 +0000 (10:57 +0200)] 
gdb, dwarf: move part of dwarf2_get_pc_bounds into separate function

This commit is in preparation of the next commit.  There, we will add
a second variation to retrieve the pc bounds for DIEs tagged with
DW_TAG_entry_point.  Instead of dwarf_get_pc_bounds_ranges_or_highlow_pc
we will call a separate method for entry points.  As the validity checks
at the endo f dwarf2_get_pc_bounds are the same for both variants,
we introduced the new dwarf_get_pc_bounds_ranges_or_highlow_pc method,
outsourcing part of dwarf2_get_pc_bounds.

This commit should have no functional impact on GDB.

Approved-by: Tom Tromey <tom@tromey.com>
19 months agoLoongArch: ld: Add support for tls le relax.
changjiachen [Thu, 28 Dec 2023 12:01:15 +0000 (20:01 +0800)] 
LoongArch: ld: Add support for tls le relax.

Add tls le relax related testsuites in ld.

The new test cases are mainly tested in three aspects:

1. tls le relax function correctness test.
2. tls le relax boundary check test.
3. tls le relax function compatibility test.

ld/testsuite/ChangeLog:

* ld/testsuite/ld-loongarch-elf/relax.exp: Modify test.
* ld/testsuite/ld-loongarch-elf/old-tls-le.s: New test.
* ld/testsuite/ld-loongarch-elf/relax-bound-check-tls-le.s: Likewise.
* ld/testsuite/ld-loongarch-elf/tls-relax-compatible-check-new.s: Likewise.
* ld/testsuite/ld-loongarch-elf/relax-tls-le.s: Likewise.
* ld/testsuite/ld-loongarch-elf/tls-relax-compatible-check-old.s: Likewise.

19 months agoLoongArch: gas: Add support for tls le relax.
changjiachen [Thu, 28 Dec 2023 11:59:39 +0000 (19:59 +0800)] 
LoongArch: gas: Add support for tls le relax.

Add tls le relax related relocs support and testsuites in gas.

The main test is three new relocation items,
R_LARCH_TLS_LE_ADD_R, R_LARCH_TLS_LE_HI20_R,
R_LARCH_TLS_LE_LO12_R can be generated properly
and tls le insn format check.

gas/ChangeLog:

* config/tc-loongarch.c:
(loongarch_args_parser_can_match_arg_helper): Add support for relax.
* gas/testsuite/gas/loongarch/reloc.d: Likewise.
* gas/testsuite/gas/loongarch/reloc.s: Likewise.
* gas/testsuite/gas/loongarch/loongarch.exp: Likewise.
* gas/testsuite/gas/loongarch/tls_le_insn_format_check.s: New test.

19 months agoLoongArch: opcodes: Add support for tls le relax.
changjiachen [Thu, 28 Dec 2023 11:58:28 +0000 (19:58 +0800)] 
LoongArch: opcodes: Add support for tls le relax.

Add new opcode for tls le relax.

opcode/ChangeLog:

* loongarch-opc.c: Add new loongarch opcode.

19 months agoLoongArch: include: Add support for tls le relax.
changjiachen [Thu, 28 Dec 2023 11:57:30 +0000 (19:57 +0800)] 
LoongArch: include: Add support for tls le relax.

Add new relocs number for tls le relax.

include/ChangeLog:

* elf/loongarch.h:
(RELOC_NUMBER (R_LARCH_TLS_LE_HI20_R, 121)): New relocs number.
(RELOC_NUMBER (R_LARCH_TLS_LE_ADD_R, 122)): Likewise.
(RELOC_NUMBER (R_LARCH_TLS_LE_LO12_R, 123)): Likewise.

19 months agoLoongArch: bfd: Add support for tls le relax.
changjiachen [Thu, 28 Dec 2023 12:07:54 +0000 (20:07 +0800)] 
LoongArch: bfd: Add support for tls le relax.

Add tls le relax support and related relocs in bfd.

New relocation related explanation can refer to the following url:
https://github.com/loongson/la-abi-specs/blob/release/laelf.adoc

This support does two main things:

1. Implement support for three new relocation items in bfd.

The three new relocation items are shown below:

R_LARCH_TLS_LE_ADD_R
R_LARCH_TLS_LE_HI20_R
R_LARCH_TLS_LE_LO12_R

2. ADD a new macro RELOCATE_TLS_TP32_HI20

Handle problems caused by symbol extensions in TLS LE, The processing
is similar to the macro RELOCATE_CALC_PC32_HI20 method.

3. Implement the tls le relax function.

bfd/ChangeLog:

* bfd-in2.h: Add relocs related to tls le relax.
* elfnn-loongarch.c:
(loongarch_relax_tls_le): New function.
(RELOCATE_TLS_TP32_HI20): New macro.
(loongarch_elf_check_relocs): Add new reloc support.
(perform_relocation): Likewise.
(loongarch_elf_relocate_section): Handle new relocs related to relax.
(loongarch_elf_relax_section): Likewise.
* elfxx-loongarch.c:
(LOONGARCH_HOWTO (R_LARCH_TLS_LE_ADD_R)): New reloc how to type.
(LOONGARCH_HOWTO (R_LARCH_TLS_LE_HI20_R)): Likewise.
(LOONGARCH_HOWTO (R_LARCH_TLS_LE_LO12_R)): Likewise.
* libbfd.h: Add relocs related to tls le relax.
* reloc.c: Likewise.

19 months agoRISC-V: THEAD: Add 5 assembly pseudoinstructions for XTheadVector extension
Jin Ma [Mon, 25 Dec 2023 08:49:21 +0000 (16:49 +0800)] 
RISC-V: THEAD: Add 5 assembly pseudoinstructions for XTheadVector extension

In order to make it easier to complete the compiler's support for
the XTheadVector extension and to be as compatible as possible
with the programming model of the 'V' extension ([1]), we consider
adding a few pseudo instructions ([2]).

th.vmmv.m vd,vs => th.vmand.mm vd,vs,vs
th.vneg.v vd,vs => th.vrsub.vx vd,vs,x0
th.vncvt.x.x.v vd,vs,vm => th.vnsrl.vx vd,vs,x0,vm
th.vfneg.v vd,vs => th.vfsgnjn.vv vd,vs,vs
th.vfabs.v vd,vs => th.vfsgnjx.vv vd,vs,vs

Ref:
[1] https://gcc.gnu.org/pipermail/gcc-patches/2023-December/641302.html
[2] https://github.com/T-head-Semi/thead-extension-spec/pull/40

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

* testsuite/gas/riscv/x-thead-vector.d: Add tests for new
pseudoinstructions.
* testsuite/gas/riscv/x-thead-vector.s: Likewise.

opcodes/ChangeLog:

* riscv-opc.c: Add new pseudoinstructions.

19 months agoAutomatic date update in version.in
GDB Administrator [Fri, 29 Dec 2023 00:00:37 +0000 (00:00 +0000)] 
Automatic date update in version.in

19 months agold: Mention support for Intel APX relocations in NEWS
H.J. Lu [Thu, 28 Dec 2023 16:46:31 +0000 (08:46 -0800)] 
ld: Mention support for Intel APX relocations in NEWS

19 months agoGold: Handle R_X86_64_CODE_4_GOTPC32_TLSDESC/R_X86_64_CODE_4_GOTTPOFF
H.J. Lu [Sun, 2 Jul 2023 14:46:21 +0000 (07:46 -0700)] 
Gold: Handle R_X86_64_CODE_4_GOTPC32_TLSDESC/R_X86_64_CODE_4_GOTTPOFF

Handle R_X86_64_CODE_4_GOTTPOFF and R_X86_64_CODE_4_GOTPC32_TLSDESC.
Convert

add name@gottpoff(%rip), %reg
mov name@gottpoff(%rip), %reg

to

add $name@tpoff, %reg
mov $name@tpoff, %reg

and

lea name@tlsdesc(%rip), %reg

to

mov     $name@tpoff, %reg
mov name@gottpoff(%rip), %reg

if the instruction is encoded with the REX2 prefix when possible.

elfcpp/

* x86_64.h (R_X86_64_CODE_4_GOTTPOFF): New.
(R_X86_64_CODE_4_GOTPC32_TLSDESC): Likewise.

gold/

* x86_64.cc (Target_x86_64::optimize_tls_reloc): Handle
R_X86_64_CODE_4_GOTPC32_TLSDESC and R_X86_64_CODE_4_GOTTPOFF.
(Target_x86_64::Scan::get_reference_flags): Likewise.
(Target_x86_64::Scan::local): Likewise.
(Target_x86_64::Scan::global): Likewise.
(Target_x86_64::Relocate::relocate): Likewise.
(Target_x86_64::Relocate::relocate_tls): Likewise.
(Target_x86_64::Relocate::tls_desc_gd_to_ie): Handle
R_X86_64_CODE_4_GOTPC32_TLSDESC.
(Target_x86_64::Relocate::tls_desc_gd_to_le): Likewise.
(Target_x86_64::Relocate::tls_ie_to_le): Handle.
R_X86_64_CODE_4_GOTTPOFF.
* testsuite/Makefile.am: Add x86_64_ie_to_le test.
* testsuite/Makefile.in: Regenerated.
* testsuite/x86_64_gd_to_le.s: Add R_X86_64_CODE_4_GOTPC32_TLSDESC
test.
* testsuite/x86_64_gd_to_le.sh: Check GDesc to LE conversion.
* testsuite/x86_64_ie_to_le.s: New file.
* testsuite/x86_64_ie_to_le.sh: Likewise.

19 months agox86-64: Add R_X86_64_CODE_4_GOTTPOFF/R_X86_64_CODE_4_GOTPC32_TLSDESC
H.J. Lu [Fri, 9 Jun 2023 20:50:22 +0000 (13:50 -0700)] 
x86-64: Add R_X86_64_CODE_4_GOTTPOFF/R_X86_64_CODE_4_GOTPC32_TLSDESC

For

add name@gottpoff(%rip), %reg
mov name@gottpoff(%rip), %reg

add

 # define R_X86_64_CODE_4_GOTTPOFF 44

and for

lea name@tlsdesc(%rip), %reg

add

 # define R_X86_64_CODE_4_GOTPC32_TLSDESC 45

if the instruction starts at 4 bytes before the relocation offset.
They are similar to R_X86_64_GOTTPOFF and R_X86_64_GOTPC32_TLSDESC,
respectively.  Linker can covert GOTTPOFF to

add $name@tpoff, %reg
mov $name@tpoff, %reg

and GOTPC32_TLSDESC to

mov $name@tpoff, %reg
mov name@gottpoff(%rip), %reg

if the instruction is encoded with the REX2 prefix when possible.

bfd/

* elf64-x86-64.c (x86_64_elf_howto_table): Add
R_X86_64_CODE_4_GOTTPOFF and R_X86_64_CODE_4_GOTPC32_TLSDESC.
(R_X86_64_standard): Updated.
(x86_64_reloc_map): Add BFD_RELOC_X86_64_CODE_4_GOTTPOFF
and BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC.
(elf_x86_64_check_tls_transition): Handle R_X86_64_CODE_4_GOTTPOFF
and R_X86_64_CODE_4_GOTPC32_TLSDESC.
(elf_x86_64_tls_transition): Likewise.
(elf_x86_64_scan_relocs): Likewise.
(elf_x86_64_relocate_section): Likewise.
* reloc.c (bfd_reloc_code_real): Add
BFD_RELOC_X86_64_CODE_4_GOTTPOFF and
BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC.
* bfd-in2.h: Regenerated.
* libbfd.h: Likewise.

gas/

* config/tc-i386.c (tc_i386_fix_adjustable): Handle
BFD_RELOC_X86_64_CODE_4_GOTTPOFF and
BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC.
(md_assemble): Handle BFD_RELOC_X86_64_CODE_4_GOTTPOFF.
(output_insn): Don't add empty REX prefix with REX2 prefix.
(output_disp): Handle BFD_RELOC_X86_64_CODE_4_GOTTPOFF and
BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC.
(md_apply_fix): Likewise.
(i386_validate_fix): Generate BFD_RELOC_X86_64_CODE_4_GOTTPOFF or
BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC if ixp->fx_tcbit3 is set.
(tc_gen_reloc): Handle BFD_RELOC_X86_64_CODE_4_GOTTPOFF and
BFD_RELOC_X86_64_CODE_4_GOTPC32_TLSDESC.
* testsuite/gas/i386/x86-64-gottpoff.d: New file.
* testsuite/gas/i386/x86-64-gottpoff.s: Likewise.
* testsuite/gas/i386/x86-64-tlsdesc.d: Likewise.
* testsuite/gas/i386/x86-64-tlsdesc.s: Likewise.

include/

* elf/x86-64.h (elf_x86_64_reloc_type): Add
R_X86_64_CODE_4_GOTTPOFF and R_X86_64_CODE_4_GOTPC32_TLSDESC

ld/

* testsuite/ld-x86-64/tlsbindesc.d: Updated.
* testsuite/ld-x86-64/tlsbindesc.rd: Likewise.
* testsuite/ld-x86-64/tlsbindesc.s: Add R_X86_64_CODE_4_GOTTPOFF
and R_X86_64_CODE_4_GOTPC32_TLSDESC tests.

19 months agogold: Handle R_X86_64_CODE_4_GOTPCRELX
H.J. Lu [Thu, 8 Jun 2023 19:12:48 +0000 (12:12 -0700)] 
gold: Handle R_X86_64_CODE_4_GOTPCRELX

Handle R_X86_64_CODE_4_GOTPCRELX and convert

mov name@GOTPCREL(%rip), %r31

to

lea name@GOTPCREL(%rip), %r31

if the instruction is encoded with the REX2 prefix when possible.

elfcpp/

* x86_64.h (R_X86_64_CODE_4_GOTPCRELX): New.

gold/

* x86_64.cc (Target_x86_64::can_convert_mov_to_lea): Handle
R_X86_64_CODE_4_GOTPCRELX.
(Target_x86_64::Scan::get_reference_flags): Likewise.
(Target_x86_64::Scan::local): Likewise.
(Target_x86_64::Scan::possible_function_pointer_reloc): Likewise.
(Target_x86_64::Scan::global): Likewise.
(Target_x86_64::Relocate::relocate): Likewise.
* testsuite/x86_64_mov_to_lea1.s: Add a test for
R_X86_64_CODE_4_GOTPCRELX.
* testsuite/x86_64_mov_to_lea2.s: Likewise.
* testsuite/x86_64_mov_to_lea3.s: Likewise.
* testsuite/x86_64_mov_to_lea4.s: Likewise.
* testsuite/x86_64_mov_to_lea5.s: Likewise.
* testsuite/x86_64_mov_to_lea.sh: Updated.

19 months agox86-64: Add R_X86_64_CODE_4_GOTPCRELX
H.J. Lu [Thu, 8 Jun 2023 17:01:03 +0000 (10:01 -0700)] 
x86-64: Add R_X86_64_CODE_4_GOTPCRELX

For

mov        name@GOTPCREL(%rip), %reg
test       %reg, name@GOTPCREL(%rip)
binop      name@GOTPCREL(%rip), %reg

where binop is one of adc, add, add, cmp, or, sbb, sub, xor instructions,
add

 # define R_X86_64_CODE_4_GOTPCRELX  43

if the instruction starts at 4 bytes before the relocation offset.  It
similar to R_X86_64_GOTPCRELX.  Linker can treat R_X86_64_CODE_4_GOTPCRELX
as R_X86_64_GOTPCREL or convert the above instructions to

lea name(%rip), %reg
mov $name, %reg
test $name, %reg
binop $name, %reg

if the instruction is encoded with the REX2 prefix when possible.

bfd/

* elf64-x86-64.c (x86_64_elf_howto_table): Add
R_X86_64_CODE_4_GOTPCRELX.
(R_X86_64_standard): Updated.
(x86_64_reloc_map): Add BFD_RELOC_X86_64_CODE_4_GOTPCRELX.
(elf_x86_64_convert_load_reloc): Handle R_X86_64_CODE_4_GOTPCRELX.
(elf_x86_64_scan_relocs): Likewise.
(elf_x86_64_relocate_section): Likewise.
* reloc.c (bfd_reloc_code_real): Add
BFD_RELOC_X86_64_CODE_4_GOTPCRELX.
* bfd-in2.h: Regenerated.
* libbfd.h: Likewise.

gas/

* write.h (fix): Add fx_tcbit3.  Change fx_unused to 1 bit.
* config/tc-i386.c (tc_i386_fix_adjustable): Handle
BFD_RELOC_X86_64_CODE_4_GOTPCRELX.
(tc_gen_reloc): Likewise.
(output_disp): Set fixP->fx_tcbit3 for REX2 prefix.
(i386_validate_fix): Generate BFD_RELOC_X86_64_CODE_4_GOTPCRELX
if fixp->fx_tcbit3 is set.
* config/tc-i386.h (TC_FORCE_RELOCATION_LOCAL): Add
BFD_RELOC_X86_64_CODE_4_GOTPCRELX.
(TC_FORCE_RELOCATION_ABS): Likewise.
* testsuite/gas/i386/x86-64-gotpcrel.s: Add tests for
R_X86_64_CODE_4_GOTPCRELX.
* testsuite/gas/i386/x86-64-localpic.s: Likewise.
* testsuite/gas/i386/x86-64-gotpcrel.d: Updated.
* testsuite/gas/i386/x86-64-localpic.d: Likewise.
* testsuite/gas/i386/ilp32/x86-64-localpic.d: Likewise.

include/

* elf/x86-64.h (elf_x86_64_reloc_type): Add
R_X86_64_CODE_4_GOTPCRELX.

ld/

* testsuite/ld-x86-64/apx-load1.s: New file.
* testsuite/ld-x86-64/apx-load1a.d: Likewise.
* testsuite/ld-x86-64/apx-load1b.d: Likewise.
* testsuite/ld-x86-64/apx-load1c.d: Likewise.
* testsuite/ld-x86-64/apx-load1d.d: Likewise.
* testsuite/ld-x86-64/x86-64.exp: Run apx-load1a, apx-load1b,
apx-load1c and apx-load1d.

19 months agogas: Mention initial support for Intel APX in NEWS
H.J. Lu [Thu, 28 Dec 2023 16:19:39 +0000 (08:19 -0800)] 
gas: Mention initial support for Intel APX in NEWS

19 months agox86: Add NT_X86_SHSTK note
Schimpe, Christina [Wed, 27 Dec 2023 14:19:21 +0000 (14:19 +0000)] 
x86: Add NT_X86_SHSTK note

Define NT_X86_SHSTK which is the note for x86 Shadow Stack (SHSTK) to
support Intel SHSTK in Linux kernel.
For now only userspace shadow stack and kernel IBT are supported by the
linux kernel.  This note should be used instead of NT_X86_CET introduced
in the commit "x86: Add NT_X86_CET note", as it is outdated and only
used by old binutils versions.

19 months agoSupport APX JMPABS for disassembler
Hu, Lin1 [Thu, 28 Dec 2023 01:06:41 +0000 (01:06 +0000)] 
Support APX JMPABS for disassembler

gas/ChangeLog:

* testsuite/gas/i386/x86-64.exp: Ditto.
* testsuite/gas/i386/x86-64-apx-jmpabs-intel.d: Ditto.
* testsuite/gas/i386/x86-64-apx-jmpabs-inval.d: Ditto.
* testsuite/gas/i386/x86-64-apx-jmpabs-inval.s: Ditto.
* testsuite/gas/i386/x86-64-apx-jmpabs.d: Ditto.
* testsuite/gas/i386/x86-64-apx-jmpabs.s: Ditto.

opcodes/ChangeLog:

* i386-dis.c (JMPABS_Fixup): New Fixup function to disassemble jmpabs.
(print_insn): Add #UD exception for jmpabs.
(dis386): Modify a1 unit for support jmpabs.
* i386-mnem.h: Regenerated.
* i386-opc.tbl: New insns.
* i386-tbl.h: Regenerated.

19 months agoSupport APX NDD optimized encoding.
Hu, Lin1 [Thu, 28 Dec 2023 01:06:41 +0000 (01:06 +0000)] 
Support APX NDD optimized encoding.

This patch aims to optimize:

add %r16, %r15, %r15 -> add %r16, %r15

gas/ChangeLog:

* config/tc-i386.c (check_Rex_required): New function.
(can_convert_NDD_to_legacy): Ditto.
(match_template): If we can optimzie APX NDD insns, so rematch
template.
* testsuite/gas/i386/x86-64.exp: Add test.
* testsuite/gas/i386/x86-64-apx-ndd-optimize.d: New test.
* testsuite/gas/i386/x86-64-apx-ndd-optimize.s: Ditto.

19 months agoSupport APX pushp/popp
Cui, Lili [Thu, 28 Dec 2023 01:06:41 +0000 (01:06 +0000)] 
Support APX pushp/popp

gas/ChangeLog:

* config/tc-i386.c (process_operands): Handle "PUSHP/POPP requires
rex2.w == 1."
* testsuite/gas/i386/x86-64.exp: Add new test for PUSHP/POPP.
* testsuite/gas/i386/x86-64-apx-pushp-popp-intel.d: New test.
* testsuite/gas/i386/x86-64-apx-pushp-popp-inval.l: Ditto.
* testsuite/gas/i386/x86-64-apx-pushp-popp-inval.s: Ditto.
* testsuite/gas/i386/x86-64-apx-pushp-popp.d: Ditto.
* testsuite/gas/i386/x86-64-apx-pushp-popp.s: Ditto.

opcodes/ChangeLog:

* i386-dis.c (putop): print pushp and popp.
* i386-opc.tbl: Added new insns.
* i386-init.h : Regenerated.
* i386-mnem.h : Regenerated.
* i386-tbl.h: Regenerated.

19 months agoSupport APX Push2/Pop2
Mo, Zewei [Thu, 28 Dec 2023 01:06:40 +0000 (01:06 +0000)] 
Support APX Push2/Pop2

PPX functionality for PUSH/POP is not implemented in this patch
and will be implemented separately.

gas/ChangeLog:

2023-12-28  Zewei Mo <zewei.mo@intel.com>
            H.J. Lu  <hongjiu.lu@intel.com>
            Lili Cui <lili.cui@intel.com>

* config/tc-i386.c: (enum i386_error):
New unsupported_rsp_register and invalid_src_register_set.
(md_assemble): Add handler for unsupported_rsp_register and
invalid_src_register_set.
(check_APX_operands): Add invalid check for push2/pop2.
(match_template): Handle check_APX_operands.
* testsuite/gas/i386/i386.exp: Add apx-push2pop2 tests.
* testsuite/gas/i386/x86-64.exp: Ditto.
* testsuite/gas/i386/x86-64-apx-push2pop2.d: New test.
* testsuite/gas/i386/x86-64-apx-push2pop2.s: Ditto.
* testsuite/gas/i386/x86-64-apx-push2pop2-intel.d: Ditto.
* testsuite/gas/i386/x86-64-apx-push2pop2-inval.l: Ditto.
* testsuite/gas/i386/x86-64-apx-push2pop2-inval.s: Ditto.
* testsuite/gas/i386/apx-push2pop2-inval.s: Ditto.
* testsuite/gas/i386/apx-push2pop2-inval.d: Ditto.
* testsuite/gas/i386/x86-64-apx-evex-promoted-bad.d: Added bad
testcases for POP2.
* testsuite/gas/i386/x86-64-apx-evex-promoted-bad.s: Ditto.

opcodes/ChangeLog:

* i386-dis-evex-reg.h: Add REG_EVEX_MAP4_8F.
* i386-dis-evex-w.h: Add EVEX_W_MAP4_8F_R_0 and EVEX_W_MAP4_FF_R_6
* i386-dis-evex.h: Add REG_EVEX_MAP4_8F.
* i386-dis.c (PUSH2_POP2_Fixup): Add special handling for PUSH2/POP2.
(get_valid_dis386): Add handler for vector length and address_mode for
APX-Push2/Pop2 insn.
(nd): define nd as b for EVEX-promoted instrutions.
(OP_VEX): Add handler of 64-bit vvvv register for APX-Push2/Pop2 insn.
* i386-gen.c: Add Push2Pop2 bitfield.
* i386-opc.h: Regenerated.
* i386-opc.tbl: Regenerated.

19 months agoSupport APX NDD
konglin1 [Thu, 28 Dec 2023 01:06:40 +0000 (01:06 +0000)] 
Support APX NDD

opcodes/ChangeLog:

* opcodes/i386-dis-evex-reg.h: Handle for REG_EVEX_MAP4_80,
REG_EVEX_MAP4_81, REG_EVEX_MAP4_83,  REG_EVEX_MAP4_F6,
REG_EVEX_MAP4_F7, REG_EVEX_MAP4_FE, REG_EVEX_MAP4_FF.
* opcodes/i386-dis-evex.h: Add NDD insn.
* opcodes/i386-dis.c (nd): New define.
(VexGb): Ditto.
(VexGv): Ditto.
(get_valid_dis386): Change for NDD decode.
(print_insn): Ditto.
(putop): Ditto.
(intel_operand_size): Ditto.
(OP_E_memory): Ditto.
(OP_VEX): Ditto.
* opcodes/i386-opc.h (VexVVVV_DST): New.
* opcodes/i386-opc.tbl: Add APX NDD instructions and adjust VexVVVV.
* opcodes/i386-tbl.h: Regenerated.

gas/ChangeLog:

* gas/config/tc-i386.c (operand_size_match):
Support APX NDD that the number of operands is 3.
(build_apx_evex_prefix): Change for ndd encode.
(process_operands): Ditto.
(build_modrm_byte): Ditto.
(match_template): Support swap the first two operands for
APX NDD.
* testsuite/gas/i386/x86-64.exp: Add x86-64-apx-ndd.
* testsuite/gas/i386/x86-64-apx-ndd.d: New test.
* testsuite/gas/i386/x86-64-apx-ndd.s: Ditto.
* testsuite/gas/i386/x86-64-pseudos.d: Add test.
* testsuite/gas/i386/x86-64-pseudos.s: Ditto.
* testsuite/gas/i386/x86-64-apx-evex-promoted-bad.d : Ditto.
* testsuite/gas/i386/x86-64-apx-evex-promoted-bad.s : Ditto.

19 months agoAdd tests for APX GPR32 with extend evex prefix
Cui, Lili [Thu, 28 Dec 2023 01:06:40 +0000 (01:06 +0000)] 
Add tests for APX GPR32 with extend evex prefix

gas/ChangeLog:

2023-12-28 Lingling Kong <lingling.kong@intel.com>
    H.J. Lu  <hongjiu.lu@intel.com>
    Lili Cui <lili.cui@intel.com>
    Lin Hu   <lin1.hu@intel.com>

* testsuite/gas/i386/x86-64-apx-egpr-inval.l: Add some insn don't
support gpr32.
* testsuite/gas/i386/x86-64-apx-egpr-inval.s: Ditto.
* testsuite/gas/i386/x86-64.exp: Add new test.
* testsuite/gas/i386/x86-64-apx-egpr-promote-inval.l: New test.
* testsuite/gas/i386/x86-64-apx-egpr-promote-inval.s: New test.
* testsuite/gas/i386/x86-64-apx-evex-egpr.d: New test.
* testsuite/gas/i386/x86-64-apx-evex-egpr.s: New test.
* testsuite/gas/i386/x86-64-apx-evex-promoted-bad.d: New test.
* testsuite/gas/i386/x86-64-apx-evex-promoted-bad.s: New test.
* testsuite/gas/i386/x86-64-apx-evex-promoted-intel.d: New test.
* testsuite/gas/i386/x86-64-apx-evex-promoted.d: New test.
* testsuite/gas/i386/x86-64-apx-evex-promoted.s: New test.

19 months agoSupport APX GPR32 with extend evex prefix
Cui, Lili [Thu, 28 Dec 2023 01:06:40 +0000 (01:06 +0000)] 
Support APX GPR32 with extend evex prefix

This patch adds non-ND, non-NF forms of EVEX promotion insn.

EVEX extension of legacy instructions:
  All promoted legacy instructions are placed in EVEX map 4, which is
  currently reserved.
EVEX extension of EVEX instructions:
  All existing EVEX instructions are extended by APX using the extended
  EVEX prefix, so that they can access all 32 GPRs.
EVEX extension of VEX instructions:
  Promoting a VEX instruction into the EVEX space does not change the map
  id, the opcode, or the operand encoding of the VEX instruction.

Note: The promoted versions of MOVBE will be extended to include the “MOVBE
  reg1, reg2”.

  gas/ChangeLog:

  2023-12-28  Lingling Kong <lingling.kong@intel.com>
      H.J. Lu  <hongjiu.lu@intel.com>
      Lili Cui <lili.cui@intel.com>
      Lin Hu   <lin1.hu@intel.com>

* config/tc-i386.c (struct _i386_insn): Add has_egpr.
(need_evex_encoding): Adjusted for apx.
(cpu_flags_match): Ditto.
(install_template): Handled APX combines.
(is_apx_evex_encoding): Test apx evex encoding.
(build_apx_evex_prefix): Enabe APX evex prefix.
(md_assemble): Handle apx with evex encoding.
(process_suffix): Handle apx map4 prefix.
(check_register): Assign i.vec_encoding for APX evex instructions.
* testsuite/gas/i386/x86-64-evex.d: Adjust test cases.
* testsuite/gas/i386/x86-64.exp: Adjust x86-64-inval-movbe.

opcodes/ChangeLog:

* i386-dis-evex-len.h: Handle EVEX_LEN_0F38F2, EVEX_LEN_0F38F3.
* i386-dis-evex-prefix.h: Handle PREFIX_EVEX_0F38F2_L_0,
PREFIX_EVEX_0F38F3_L_0, PREFIX_EVEX_MAP4_D8,
PREFIX_EVEX_MAP4_DA, PREFIX_EVEX_MAP4_DB,
PREFIX_EVEX_MAP4_DC, PREFIX_EVEX_MAP4_DD,
PREFIX_EVEX_MAP4_DE, PREFIX_EVEX_MAP4_DF,
PREFIX_EVEX_MAP4_F0, PREFIX_EVEX_MAP4_F1,
PREFIX_EVEX_MAP4_F2, PREFIX_EVEX_MAP4_F8.
* i386-dis-evex-reg.h: Handle REG_EVEX_0F38F3_L_0_P_0.
* i386-dis-evex.h: Add EVEX_MAP4_ for legacy insn
promote to apx to use gpr32
* opcodes/i386-dis-evex-x86-64.h: Handle Add X86_64_EVEX_0F90,
X86_64_EVEX_0F92, X86_64_EVEX_0F93, X86_64_EVEX_0F38F2,
X86_64_EVEX_0F38F3, X86_64_EVEX_0F38F5, X86_64_EVEX_0F38F6,
X86_64_EVEX_0F38F7, X86_64_EVEX_0F3AF0, X86_64_EVEX_0F91.
* i386-dis.c
(struct instr_info): Deleted bool r.
(PREFIX_NP_OR_DATA): New.
(NO_PREFIX): New.
(putop): Ditto.
(X86_64_EVEX_FROM_VEX_TABLE): Diito.
(get_valid_dis386): Decode insn erex in extend evex prefix.
Handle EVEX_MAP4
(print_insn): Handle PREFIX_DATA_AND_NP_ONLY.
(print_register): Handle apx instructions decode.
(OP_E_memory): Diito.
(OP_G): Diito.
(OP_XMM): Diito.
(DistinctDest_Fixup): Diito.
* i386-gen.c (process_i386_opcode_modifier): Add EVEXMAP4.
* i386-opc.h (SPACE_EVEXMAP4): Add legacy insn
promote to evex.
* i386-opc.tbl: Handle some legacy and vex insns don't
support gpr32. And add some legacy insn (map2 / 3) promote
to evex.

19 months agoCreated an empty EVEX_MAP4_ sub-table for EVEX instructions.
Cui, Lili [Thu, 28 Dec 2023 01:06:40 +0000 (01:06 +0000)] 
Created an empty EVEX_MAP4_ sub-table for EVEX instructions.

opcode/ChangeLog:

* i386-dis-evex.hi: Added an empty EVEX_MAP4_ sub-table for
legacy insn promote to EVEX insn.
* opcodes/i386-dis-evex.h: Add EVEX_MAP4.

19 months agoSupport APX GPR32 with rex2 prefix
Cui, Lili [Thu, 28 Dec 2023 01:06:39 +0000 (01:06 +0000)] 
Support APX GPR32 with rex2 prefix

APX uses the REX2 prefix to support EGPR for map0 and map1 of legacy
instructions. We added the NoEgpr flag in i386-gen.c for instructions
that do not support EGPR.

gas/ChangeLog:

2023-12-28  Lingling Kong <lingling.kong@intel.com>
    H.J. Lu  <hongjiu.lu@intel.com>
    Lili Cui <lili.cui@intel.com>
    Lin Hu   <lin1.hu@intel.com>

* config/tc-i386.c
(enum i386_error): Add unsupported_EGPR_for_addressing
and invalid_pseudo_prefix.
(struct _i386_insn): Add rex2 and rex2_encoding for
gpr32.
(cpu_arch): Add apx_f.
(is_cpu): Ditto.
(register_number): Handle RegRex2 for gpr32.
(is_apx_rex2_encoding): New func. Test rex2 prefix encoding.
(build_rex2_prefix): New func. Build legacy insn in
opcode 0/1 use gpr32 with rex2 prefix.
(establish_rex): Handle rex2 and rex2_encoding.
(optimize_encoding): Handel add r16-r31 for registers.
(md_assemble): Handle apx encoding.
(parse_insn): Handle Prefix_REX2.
(check_EgprOperands): New func. Check if Egprs operands
are valid for the instruction
(match_template):  Handle Egpr operands check.
(set_rex_rex2):  New func. set i.rex and i.rex2.
(build_modrm_byte): Ditto.
(output_insn): Handle rex2 2-byte prefix output.
(check_register): Handle check egpr illegal without
target apx, 64-bit mode and with rex_prefix.
* doc/c-i386.texi: Document .apx.
* testsuite/gas/i386/ilp32/x86-64-opcode-inval-intel.d: D5 valid
in 64-bit mode.
* testsuite/gas/i386/ilp32/x86-64-opcode-inval.d: Ditto.
* testsuite/gas/i386/rex-bad: Adjust rex testcase.
* testsuite/gas/i386/x86-64-opcode-inval-intel.d: Ditto.
* testsuite/gas/i386/x86-64-opcode-inval.d: Ditto.
* testsuite/gas/i386/x86-64-opcode-inval.s: Ditto.
* testsuite/gas/i386/x86-64-pseudos-bad.l: Add illegal rex2 test.
* testsuite/gas/i386/x86-64-pseudos-bad.s: Ditto.
* testsuite/gas/i386/x86-64-pseudos.d: Add rex2 test.
* testsuite/gas/i386/x86-64-pseudos.s: Ditto.
* testsuite/gas/i386/x86-64.exp: Run APX tests.
* testsuite/gas/i386/x86-64-apx-egpr-inval.l: New test.
* testsuite/gas/i386/x86-64-apx-egpr-inval.s: New test.
* testsuite/gas/i386/x86-64-apx-rex2.d: New test.
* testsuite/gas/i386/x86-64-apx-rex2.s: New test.

include/ChangeLog:

* opcode/i386.h (REX2_OPCODE): New.
(REX2_M): Ditto.

opcodes/ChangeLog:

* i386-dis.c (struct instr_info): Add erex for gpr32.
Add last_erex_prefix for rex2 prefix.
(REX2_M): Extend for gpr32.
(PREFIX_REX2): Ditto.
(PREFIX_REX2_ILLEGAL): Ditto.
(ckprefix): Ditto.
(prefix_name): Ditto.
(print_insn): Ditto.
(print_register): Ditto.
(OP_E_memory): Ditto.
(OP_REG): Ditto.
(OP_EX): Ditto.
* i386-gen.c (rex2_disallowed): Some instructions are not allowed rex2 prefix.
(process_i386_opcode_modifier): Set NoEgpr for VEX and some special instructions.
(output_i386_opcode): Handle if_entry_needs_special_handle.
* i386-init.h : Regenerated.
* i386-mnem.h : Regenerated.
* i386-opc.h (enum i386_cpu): Add CpuAPX_F.
(NoEgpr): New.
(Prefix_NoOptimize): Ditto.
(Prefix_REX2): Ditto.
(RegRex2): Ditto.
* i386-opc.tbl: Add rex2 prefix.
* i386-reg.tbl: Add egprs (r16-r31).
* i386-tbl.h: Regenerated.

19 months agosim: pru: Fix emulation of carry bit
Dimitar Dimitrov [Fri, 8 Dec 2023 18:39:10 +0000 (20:39 +0200)] 
sim: pru: Fix emulation of carry bit

The PRU architecture documentation [1] was used for the initial GNU
simulator implementation.  But recently [2] TI confirmed the carry
behaviour was wrongly documented.  In reality, the PRU carry behaves
like the carry in ARM processors.

This patch fixes simulator to align with latest recommendations from TI.

The new carry.s test was also validated to pass on real hardware -
a BeaglePlay board [3].  That test is a bit long because TI still
has not released official updates for the PRU documents.  And I wanted
to ensure simulator handles all edge cases exactly as the real hardware
does.

[1] https://www.ti.com/lit/pdf/spruij2
[2] https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1244359/sk-am64b-am64x-pru-assembler-how-works-this-bloody-carry
[3] https://www.beagleboard.org/boards/beagleplay

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
19 months agoRISC-V: PR31179, The SET/ADD/SUB fix breaks ABI compatibility with 2.41 objects
Nelson Chu [Wed, 20 Dec 2023 02:37:41 +0000 (10:37 +0800)] 
RISC-V: PR31179, The SET/ADD/SUB fix breaks ABI compatibility with 2.41 objects

* Problematic fix commit,
2029e13917d53d2289d3ebb390c4f40bd2112d21
RISC-V: Clarify the behaviors of SET/ADD/SUB relocations

* Bugzilla,
https://sourceware.org/bugzilla/show_bug.cgi?id=31179#c5

The addend of SUB_ULEB128 should be zero if using .uleb128, but we make it
non-zero by accident in assembler before.  This causes troubles by applying
the above commit, since the calculation is changed to support .reloc *SUB*
relocations with non-zero addend.

We encourage people to rebuild their stuff to get the non-zero addend of
SUB_ULEB128, but that might need some times, so report warnings to inform
people need to rebuild their stuff if --check-uleb128 is enabled.

Since the failed .reloc cases for ADD/SET/SUB/ULEB128 are rarely to use,
it may acceptable that stop supproting them until people rebuld their stuff,
maybe half-year or a year later.  Or maybe we should teach people that don't
write the .reloc R_RISCV_SUB* with non-zero constant, and then report
warnings/errors in assembler.

bfd/
* elfnn-riscv.c (perform_relocation): Ignore the non-zero addend of
R_RISCV_SUB_ULEB128.
(riscv_elf_relocate_section): Report warnings to inform people need
to rebuild their stuff if --check-uleb128 is enabled.  So that can
get the right non-zero addend of R_RISCV_SUB_ULEB128.
* elfxx-riscv.h (struct riscv_elf_params): Added bool check_uleb128.
ld/
* NEWS: Updated.
* emultempl/riscvelf.em: Added linker risc-v target options,
--[no-]check-uleb128, to enable/disable checking if the addend of
uleb128 is non-zero or not.  So that people will know they need to
rebuild the objects with binutils 2.42 and up, to get the right zero
addend of SUB_ULEB128 relocation, or they may get troubles if using
.reloc.
* ld/testsuite/ld-riscv-elf/ld-riscv-elf.exp: Updated.
* ld/testsuite/ld-riscv-elf/pr31179*: New test cases.

19 months agoAutomatic date update in version.in
GDB Administrator [Thu, 28 Dec 2023 00:01:13 +0000 (00:01 +0000)] 
Automatic date update in version.in

19 months agoasan: buffer overflow in loongarch_elf_rtype_to_howto
Alan Modra [Tue, 26 Dec 2023 12:16:56 +0000 (22:46 +1030)] 
asan: buffer overflow in loongarch_elf_rtype_to_howto

Seen when running ld-loongarch-elf/tlsdesc-dso test.
elfxx-loongarch.c:1844:32: runtime error: index 125 out of bounds for
type 'loongarch_reloc_howto_type [124]'

So either the loongarch_howto_table needs three more
LOONGARCH_EMPTY_HOWTO entries, or loongarch_elf_rtype_to_howto should
be testing for r_type < ARRAY_SIZE (loongarch_howto_table).  I figure
it's worth wasting a little more space to get faster lookup.

* elfxx-loongarch.c (loongarch_howto_table): Add
LOONGARCH_EMPTY_HOWTO entries for 121..123.
(loongarch_elf_rtype_to_howto): Don't support slow lookup.
Assert exact table size and r_type indexing.  Omit return cast.
(loongarch_reloc_name_lookup): Omit assertion and return cast.
(loongarch_reloc_type_lookup): Likewise.

19 months agoPR31191, objcopy leaves temporary files
Alan Modra [Tue, 26 Dec 2023 05:50:34 +0000 (16:20 +1030)] 
PR31191, objcopy leaves temporary files

Fix the ENOTDIR rmdir too.

PR 31191
* objcopy.c (copy_archive): Localise uses of "l".  Remove
const from name_list.name.  Unlink output element on bfd_close
error, and NULL list->name to indicate file is removed.  Adjust
cleanup to prevent rmdir on non-existent file.

19 months agosim: common: pull in newlib extensions for Linux compatibility
Mike Frysinger [Wed, 27 Dec 2023 03:53:31 +0000 (22:53 -0500)] 
sim: common: pull in newlib extensions for Linux compatibility

Since newlib allows people to opt-in to extra errno names, pull them
into our table too.  The values don't conflict with each other -- the
newlib names & values are distinct from newlib's Linux compatibility.

19 months agoAutomatic date update in version.in
GDB Administrator [Wed, 27 Dec 2023 00:00:29 +0000 (00:00 +0000)] 
Automatic date update in version.in

19 months agoAutomatic date update in version.in
GDB Administrator [Tue, 26 Dec 2023 00:01:08 +0000 (00:01 +0000)] 
Automatic date update in version.in

19 months agobinutils: SECURITY: use https URI
Mike Frysinger [Mon, 25 Dec 2023 05:11:19 +0000 (00:11 -0500)] 
binutils: SECURITY: use https URI

19 months agoLoongArch: Add testsuit for DESC and tls transition and tls relaxation.
Lulu Cai [Wed, 13 Dec 2023 03:34:56 +0000 (11:34 +0800)] 
LoongArch: Add testsuit for DESC and tls transition and tls relaxation.

19 months agoLoongArch: Add support for TLS LD/GD/DESC relaxation
mengqinggang [Mon, 11 Dec 2023 08:08:20 +0000 (16:08 +0800)] 
LoongArch: Add support for TLS LD/GD/DESC relaxation

The pcalau12i + addi.d of TLS LD/GD/DESC relax to pcaddi.
Relaxation is only performed when the TLS model transition is not possible.

19 months agoLoongArch: Add tls transition support.
Lulu Cai [Sun, 26 Nov 2023 06:25:26 +0000 (14:25 +0800)] 
LoongArch: Add tls transition support.

Transitions between DESC->IE/LE and IE->LE are supported now.
1. For DESC -> LE:
   pcalau12i  $a0,%desc_pc_hi20(var)     =>  lu12i.w $a0,%le_hi20(var)
   addi.d     $a0,$a0,%desc_pc_lo12(var) =>  ori $a0,$a0,%le_lo12(var)
   ld.d       $a1,$a0,%desc_ld(var)      =>  NOP
   jirl       $ra,$a1,%desc_call(var)  =>  NOP
   add.d      $a0,$a0,$tp
2. For DESC -> IE:
   pcalau12i  $a0,%desc_pc_hi20(var)     =>  pcalau12i $a0,%ie_pc_hi20(var)
   addi.d     $a0,$a0,%desc_pc_lo12(var) =>  ld.d $a0,$a0,%ie_pc_lo12(var)
   ld.d       $a1,$a0,%desc_ld(var)      =>  NOP
   jirl       $ra,$a1,%desc_call(var)  =>  NOP
   add.d      $a0,$a0,$tp
3. For IE -> LE:
   pcalau12i  $a0,%ie_pc_hi20(var)       =>  lu12i.w $a0,%le_hi20(var)
   ld.d       $a0,$a0,%ie_pc_lo12(var)   =>  ori $a0,$a0,%le_lo12(var)
   add.d      $a0,$a0,$tp
4. When a tls variable is accessed using both DESC and IE, DESC transitions
   to IE and uses the same GOT entry as IE.

19 months agoLoongArch: Add support for TLSDESC in ld.
Lulu Cai [Tue, 31 Oct 2023 08:11:56 +0000 (16:11 +0800)] 
LoongArch: Add support for TLSDESC in ld.

1.The linker for each DESC generates a R_LARCH_TLS_DESC64 dynamic
  relocation, which relocation is placed at .rela.dyn.
  TLSDESC always allocates two GOT slots and one dynamic relocation
  space to TLSDESC.
2. When using multiple ways to access the same TLS variable, a
   maximum of 5 GOT slots are used. For example, using GD, TLSDESC,
   and IE to access the same TLS variable, GD always uses the first
   two of the five GOT, TLSDESC uses the third and fourth, and IE
   uses the last.

19 months agoLoongArch: Add new relocs and macro for TLSDESC.
Lulu Cai [Tue, 31 Oct 2023 08:11:29 +0000 (16:11 +0800)] 
LoongArch: Add new relocs and macro for TLSDESC.

The normal DESC instruction sequence is:
  pcalau12i  $a0,%desc_pc_hi20(var)     #R_LARCH_TLS_DESC_PC_HI20
  addi.d     $a0,$a0,%desc_pc_lo12(var) #R_LARCH_TLS_DESC_PC_LO12
  ld.d       $ra,$a0,%desc_ld(var) #R_LARCH_TLS_DESC_LD
  jirl       $ra,$ra,%desc_call(var) #R_LARCH_TLS_DESC_CALL
  add.d      $a0,$a0,$tp

19 months agoAutomatic date update in version.in
GDB Administrator [Mon, 25 Dec 2023 00:00:25 +0000 (00:00 +0000)] 
Automatic date update in version.in

19 months agoRe: LoongArch: Add support for <b ".L1"> and <beq, $t0, $t1, ".L1">
Alan Modra [Sun, 24 Dec 2023 04:11:06 +0000 (14:41 +1030)] 
Re: LoongArch: Add support for <b ".L1"> and <beq, $t0, $t1, ".L1">

This fixes the buffer overflow added in commit 22b78fad28, and a few
other problems.

* loongarch-coder.c (loongarch_split_args_by_comma): Don't
overflow buffer when args == "".  Don't remove unbalanced
quotes.  Don't trim last arg if max number of args exceeded.

19 months agogdb: make value::allocate_register_lazy store id of next non-inline frame
Simon Marchi [Thu, 21 Dec 2023 16:51:38 +0000 (16:51 +0000)] 
gdb: make value::allocate_register_lazy store id of next non-inline frame

Some spots loop on the frame chain to find the first next non-inline
frame, and pass that as the "next frame" to
value::allocate_register_lazy / value::allocate_register.  This is
necessary if the value is used in the process of computing the id of
"this frame".  If the frame next to "this frame" is inlined into "this
frame", then you that next frame won't have a computed id yet.  You have
to go past that to find the next non-inline frame, which will have a
computed id.

In other cases, it's fine to store the id of an inline frame as the
"next frame id" in a register struct value.  When trying to unwind a
register from it, it will just call inline_frame_prev_register, which
will forward the request to the next next frame, until we hit the next
physical frame.

I think it would make things simpler to just never store the id of an
inline frame as the next frame id of register struct values, and go with
the first next non-inline frame directly.  This way, we don't have to
wonder which code paths have to skip inline frames when creating
register values and which don't.

So, change value::allocate_register_lazy to do that work, and remove the
loops for the callers that did it.

Change-Id: Ic88115dac49dc14e3053c95f92050062b24b7310

19 months agogdb: remove VALUE_REGNUM, add value::regnum
Simon Marchi [Sun, 24 Dec 2023 15:38:35 +0000 (10:38 -0500)] 
gdb: remove VALUE_REGNUM, add value::regnum

Remove VALUE_REGNUM, replace it with a method on struct value.  Set
`m_location.reg.regnum` directly from value::allocate_register_lazy,
which is fine because allocate_register_lazy is a static creation
function for struct value.

Change-Id: Id632502357da971617d9dce1e2eab9b56dbcf52d

19 months agogdb: remove VALUE_NEXT_FRAME_ID, add value::next_frame_id
Simon Marchi [Wed, 20 Dec 2023 21:40:46 +0000 (21:40 +0000)] 
gdb: remove VALUE_NEXT_FRAME_ID, add value::next_frame_id

Remove VALUE_NEXT_FRAME_ID, replace it with a method on struct value.  Set
`m_location.reg.next_frame_id` directly from value::allocate_register_lazy,
which is fine because allocate_register_lazy is a static creation
function for struct value.

Change-Id: Ic9f0f239c166a88dccfee836f9f51871e67548e6

19 months agogdb: implement address_from_register using value_from_register
Simon Marchi [Thu, 21 Dec 2023 16:32:55 +0000 (16:32 +0000)] 
gdb: implement address_from_register using value_from_register

As explained in the comment removed by the previous commit "gdb: pass
non-nullptr frame to gdbarch_value_from_register in
address_from_register", address_from_register copies some implementation
bits from value_from_register:

   /* This routine may be called during early unwinding, at a time
      where the ID of FRAME is not yet known.  Calling value_from_register
      would therefore abort in get_frame_id.  However, since we only need
      a temporary value that is never used as lvalue, we actually do not
      really need to set its VALUE_NEXT_FRAME_ID.  Therefore, we re-implement
      the core of value_from_register, but use the null_frame_id.  */

This is no longer relevant, since we now create a value with a valid next
frame id, so change address_from_register to use value_from_register.

Change-Id: I189bd96f28735ed9f47750ffd73764c459ec6f43