From: Jan Beulich <jbeulich@suse.com>
To: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>,
Markus Metzger <markus.t.metzger@intel.com>
Cc: gdb-patches@sourceware.org, binutils@sourceware.org
Subject: Re: [PATCH v3 02/44] bfd: add intelgt target to BFD
Date: Fri, 1 Aug 2025 14:20:47 +0200 [thread overview]
Message-ID: <c2b0f60d-e3f1-4f35-b94e-04de2b421b52@suse.com> (raw)
In-Reply-To: <20250801-upstream-intelgt-mvp-v3-2-59ce0f87075b@intel.com>
On 01.08.2025 11:37, Tankut Baris Aktemur wrote:
> --- a/bfd/config.bfd
> +++ b/bfd/config.bfd
> @@ -198,6 +198,7 @@ fido*) targ_archs=bfd_m68k_arch ;;
> hppa*) targ_archs=bfd_hppa_arch ;;
> i[3-7]86) targ_archs=bfd_i386_arch ;;
> ia16) targ_archs=bfd_i386_arch ;;
> +intelgt) targ_archs=bfd_intelgt_arch ;;
> kvx) targ_archs=bfd_kvx_arch ;;
> loongarch*) targ_archs=bfd_loongarch_arch ;;
> m6811*|m68hc11*) targ_archs="bfd_m68hc11_arch bfd_m68hc12_arch bfd_m9s12x_arch bfd_m9s12xg_arch" ;;
> @@ -705,12 +706,12 @@ case "${targ}" in
> ;;
> x86_64-*-linux-*)
> targ_defvec=x86_64_elf64_vec
> - targ_selvecs="i386_elf32_vec iamcu_elf32_vec x86_64_elf32_vec i386_pei_vec x86_64_pe_vec x86_64_pei_vec"
> + targ_selvecs="i386_elf32_vec iamcu_elf32_vec x86_64_elf32_vec i386_pei_vec x86_64_pe_vec x86_64_pei_vec intelgt_elf64_vec"
> want64=true
> ;;
> x86_64-*-mingw* | x86_64-*-pe | x86_64-*-pep | x86_64-*-cygwin)
> targ_defvec=x86_64_pe_vec
> - targ_selvecs="x86_64_pe_vec x86_64_pei_vec x86_64_pe_big_vec x86_64_elf64_vec i386_pe_vec i386_pei_vec i386_elf32_vec iamcu_elf32_vec pdb_vec"
> + targ_selvecs="x86_64_pe_vec x86_64_pei_vec x86_64_pe_big_vec x86_64_elf64_vec i386_pe_vec i386_pei_vec i386_elf32_vec iamcu_elf32_vec pdb_vec intelgt_elf64_vec intelgt_legacy_elf64_vec"
> want64=true
> targ_underscore=no
> ;;
I'm not convinced of forcing this as secondary target onto (about) everyone.
> @@ -781,7 +782,13 @@ case "${targ}" in
> targ_defvec=i386_elf32_vec
> targ_selvecs="i386_msdos_vec i386_aout_vec"
> ;;
> -
Please don't remove the (visually) separating blank lines; instead add a new
one yourself.
> +#ifdef BFD64
> + intelgt-*-elf)
> + targ_defvec=intelgt_elf64_vec
> + targ_selvecs="intelgt_elf64_vec"
Why would targ_selvecs need to hold what targ_defvec already has?
> --- /dev/null
> +++ b/bfd/elf64-intelgt.c
> @@ -0,0 +1,195 @@
> +/* Intel(R) Graphics Technology-specific support for ELF
> + Copyright (C) 2022-2025 Free Software Foundation, Inc.
> +
> + This file is part of BFD, the Binary File Descriptor library.
> +
> + This program is free software; you can redistribute it and/or modify
> + it under the terms of the GNU General Public License as published by
> + the Free Software Foundation; either version 3 of the License, or
> + (at your option) any later version.
> +
> + This program is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + GNU General Public License for more details.
> +
> + You should have received a copy of the GNU General Public License
> + along with this program; if not, write to the Free Software
> + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
> + MA 02110-1301, USA. */
> +
> +#include "sysdep.h"
> +#include "bfd.h"
> +#include "libbfd.h"
> +#include "elf-bfd.h"
> +
> +#include "elf/common.h"
> +#include "elf/intelgt.h"
> +
> +#define MINUS_ONE (~ (bfd_vma) 0)
> +
> +#define INTELGT_ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0]))
What's wrong with ARRAY_SIZE()?
> +static bool
> +elf64_intelgt_elf_object_p (bfd *abfd)
> +{
> + return bfd_default_set_arch_mach (abfd, bfd_arch_intelgt, bfd_mach_intelgt);
> +}
> +
> +/* Map BFD relocs to the IntelGT relocs. */
> +struct elf_reloc_map
> +{
> + bfd_reloc_code_real_type bfd_reloc_val;
> + unsigned char elf_reloc_val;
> +};
> +
> +static const struct elf_reloc_map elf64_intelgt_reloc_map[] =
> +{
> + { BFD_RELOC_64, R_ZE_SYM_ADDR },
> + { BFD_RELOC_32, R_ZE_SYM_ADDR_32 },
> + { BFD_RELOC_ZE_SYM_ADDR32_HI, R_ZE_SYM_ADDR32_HI },
> + { BFD_RELOC_ZE_PER_THREAD_PAYLOAD_OFFSET_32,
> + R_PER_THREAD_PAYLOAD_OFFSET_32 },
> +};
> +
> +static reloc_howto_type elf64_intelgt_howto_table[] =
> +{
> + HOWTO (R_ZE_NONE, /* type */
> + 0, /* rightshift */
> + 0, /* size (0 = byte, 1 = short, 2 = long) */
> + 0, /* bitsize */
> + false, /* pc_relative */
> + 0, /* bitpos */
> + complain_overflow_dont,/* complain_on_overflow */
> + NULL, /* special_function */
> + "R_ZE_NONE", /* name */
> + false, /* partial_inplace */
> + 0, /* src_mask */
> + 0, /* dst_mask */
> + false), /* pcrel_offset */
> + HOWTO (R_ZE_SYM_ADDR, /* type */
> + 0, /* rightshift */
> + 2, /* size (0 = byte, 1 = short, 2 = long) */
> + 64, /* bitsize */
> + false, /* pc_relative */
> + 0, /* bitpos */
> + complain_overflow_unsigned, /* complain_on_overflow */
> + bfd_elf_generic_reloc, /* special_function */
> + "R_ZE_SYM_ADDR", /* name */
> + false, /* partial_inplace */
> + MINUS_ONE, /* src_mask */
Based on the arch apparently using RELA relocations, src_mask shouldn't be
non-zero anywhere aiui.
> + MINUS_ONE, /* dst_mask */
While for a 64-bit reloc this looks right, ...
> + false), /* pcrel_offset */
> + HOWTO (R_ZE_SYM_ADDR_32, /* type */
> + 0, /* rightshift */
> + 2, /* size (0 = byte, 1 = short, 2 = long) */
> + 32, /* bitsize */
> + false, /* pc_relative */
> + 0, /* bitpos */
> + complain_overflow_unsigned, /* complain_on_overflow */
> + bfd_elf_generic_reloc, /* special_function */
> + "R_ZE_SYM_ADDR_32", /* name */
> + false, /* partial_inplace */
> + MINUS_ONE, /* src_mask */
> + MINUS_ONE, /* dst_mask */
... I don't think it's right here. I'm also unconvinced of the use of
complain_overflow_unsigned, when ...
> + false), /* pcrel_offset */
> + HOWTO (R_ZE_SYM_ADDR32_HI, /* type */
> + 32, /* rightshift */
> + 2, /* size (0 = byte, 1 = short, 2 = long) */
> + 32, /* bitsize */
> + false, /* pc_relative */
> + 0, /* bitpos */
> + complain_overflow_unsigned, /* complain_on_overflow */
> + bfd_elf_generic_reloc, /* special_function */
> + "R_ZE_SYM_ADDR32_HI", /* name */
> + false, /* partial_inplace */
> + MINUS_ONE, /* src_mask */
> + MINUS_ONE, /* dst_mask */
> + false), /* pcrel_offset */
... the other half of the address can be represented this way.
> --- a/binutils/readelf.c
> +++ b/binutils/readelf.c
> @@ -124,6 +124,7 @@
> #include "elf/kvx.h"
> #include "elf/lm32.h"
> #include "elf/iq2000.h"
> +#include "elf/intelgt.h"
> #include "elf/m32c.h"
> #include "elf/m32r.h"
> #include "elf/m68k.h"
> @@ -2395,6 +2396,10 @@ dump_relocations (Filedata * filedata,
> case EM_AMDGPU:
> rtype = elf_amdgpu_reloc_type (type);
> break;
> +
> + case EM_INTELGT:
> + rtype = elf_intelgt_reloc_type (type);
> + break;
> }
>
> if (rtype == NULL)
> @@ -15589,6 +15594,8 @@ is_32bit_abs_reloc (Filedata * filedata, unsigned int reloc_type)
> return reloc_type == 1; /* R_XTENSA_32. */
> case EM_Z80:
> return reloc_type == 6; /* R_Z80_32. */
> + case EM_INTELGT:
> + return reloc_type == 2; /* R_ZE_SYM_ADDR_32 */
Not sure here as well, when this can be the lower half of a 64-bit address.
> --- /dev/null
> +++ b/include/elf/intelgt.h
> @@ -0,0 +1,39 @@
> +/* Copyright (C) 2022-2025 Free Software Foundation, Inc.
> +
> + This file is part of BFD, the Binary File Descriptor library.
> +
> + This program is free software; you can redistribute it and/or modify
> + it under the terms of the GNU General Public License as published by
> + the Free Software Foundation; either version 3 of the License, or
> + (at your option) any later version.
> +
> + This program is distributed in the hope that it will be useful,
> + but WITHOUT ANY WARRANTY; without even the implied warranty of
> + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + GNU General Public License for more details.
> +
> + You should have received a copy of the GNU General Public License
> + along with this program; if not, write to the Free Software
> + Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
> + MA 02110-1301, USA. */
> +
> +/* This file holds definitions specific to the IntelGT ABI. */
> +
> +#ifndef __INTELGT_H_
> +#define __INTELGT_H_
> +
> +#include "elf/reloc-macros.h"
> +
> +START_RELOC_NUMBERS (elf_intelgt_reloc_type)
> + RELOC_NUMBER (R_ZE_NONE, 0)
> + /* 64-bit address. */
> + RELOC_NUMBER (R_ZE_SYM_ADDR, 1)
> + /* 32-bit address or lower 32-bit of a 64-bit address. */
> + RELOC_NUMBER (R_ZE_SYM_ADDR_32, 2)
> + /* Higher 32bits of a 64-bit address. */
> + RELOC_NUMBER (R_ZE_SYM_ADDR32_HI, 3)
> + /* 32-bit field of payload offset of per-thread data. */
> + RELOC_NUMBER (R_PER_THREAD_PAYLOAD_OFFSET_32, 4)
Why is this not R_ZE_PER_THREAD_PAYLOAD_OFFSET_32?
Jan
next prev parent reply other threads:[~2025-08-01 12:23 UTC|newest]
Thread overview: 92+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-01 9:37 [PATCH v3 00/44] A new target to debug Intel GPUs Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 01/44] gdb, intelgt: add intelgt as a basic machine Tankut Baris Aktemur
2025-12-09 20:44 ` Simon Marchi
2025-12-19 11:13 ` Aktemur, Tankut Baris
2025-08-01 9:37 ` [PATCH v3 02/44] bfd: add intelgt target to BFD Tankut Baris Aktemur
2025-08-01 12:20 ` Jan Beulich [this message]
2025-08-08 5:03 ` Metzger, Markus T
2025-12-09 21:05 ` Simon Marchi
2025-12-19 12:46 ` Aktemur, Tankut Baris
2025-08-01 9:37 ` [PATCH v3 03/44] ld: add intelgt as a target configuration Tankut Baris Aktemur
2025-08-01 12:06 ` Jan Beulich
2025-08-08 5:03 ` Metzger, Markus T
2025-08-01 9:37 ` [PATCH v3 04/44] opcodes: add intelgt as a configuration Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 05/44] gdb, gdbserver, gdbsupport: add 'device' tag to XML target description Tankut Baris Aktemur
2025-12-09 21:27 ` Simon Marchi
2025-12-15 21:03 ` Simon Marchi
2025-12-18 15:04 ` Aktemur, Tankut Baris
2026-01-09 19:12 ` Aktemur, Tankut Baris
2026-01-09 19:34 ` Simon Marchi
2025-08-01 9:37 ` [PATCH v3 06/44] gdb, arch, intelgt: add intelgt arch definitions Tankut Baris Aktemur
2025-12-09 21:48 ` Simon Marchi
2025-12-16 15:47 ` Metzger, Markus T
2025-08-01 9:37 ` [PATCH v3 07/44] gdb, intelgt: add the target-dependent definitions for the Intel GT architecture Tankut Baris Aktemur
2025-12-11 18:53 ` Simon Marchi
2025-12-19 16:01 ` Aktemur, Tankut Baris
2025-08-01 9:37 ` [PATCH v3 08/44] gdb, intelgt: add disassemble feature " Tankut Baris Aktemur
2025-12-11 19:37 ` Simon Marchi
2025-12-23 11:03 ` Aktemur, Tankut Baris
2025-08-01 9:37 ` [PATCH v3 09/44] gdb, gdbserver, ze: in-memory libraries Tankut Baris Aktemur
2025-12-12 4:13 ` Simon Marchi
2025-12-12 11:20 ` Metzger, Markus T
2025-12-12 19:34 ` Simon Marchi
2025-12-15 13:07 ` Metzger, Markus T
2025-12-15 21:25 ` Simon Marchi
2025-08-01 9:37 ` [PATCH v3 10/44] gdb, gdbserver, rsp, ze: acknowledge libraries Tankut Baris Aktemur
2025-12-12 4:41 ` Simon Marchi
2025-12-12 14:28 ` Metzger, Markus T
2025-08-01 9:37 ` [PATCH v3 11/44] gdb, solib, ze: update target_solib_ops::bfd_open_from_target_memory Tankut Baris Aktemur
2025-12-12 4:43 ` Simon Marchi
2025-12-12 14:33 ` Metzger, Markus T
2025-08-01 9:37 ` [PATCH v3 12/44] gdb, infrun, ze: allow saving process events Tankut Baris Aktemur
2025-12-12 4:57 ` Simon Marchi
2025-12-15 13:13 ` Metzger, Markus T
2025-12-16 21:10 ` Simon Marchi
2025-12-17 9:30 ` Metzger, Markus T
2025-12-17 20:44 ` Simon Marchi
2025-12-18 7:20 ` Metzger, Markus T
2025-08-01 9:37 ` [PATCH v3 13/44] gdb, ze: add TARGET_WAITKIND_UNAVAILABLE Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 14/44] gdb, infrun, ze: handle stopping unavailable threads Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 15/44] gdb, infrun, ze: allow resuming " Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 16/44] gdb, gdbserver, ze: add U stop reply Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 17/44] gdb, gdbserver, ze: add library notification to " Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 18/44] gdbserver, ze: report TARGET_WAITKIND_UNAVAILABLE events Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 19/44] gdb, ze: handle TARGET_WAITKIND_UNAVAILABLE in stop_all_threads Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 20/44] gdb, remote: handle thread unavailability in print_one_stopped_thread Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 21/44] gdb, remote: do 'remote_add_inferior' in 'remote_notice_new_inferior' earlier Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 22/44] gdb, remote: handle a generic process PID in remote_notice_new_inferior Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 23/44] gdb, remote: handle a generic process PID in process_stop_reply Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 24/44] gdb: use the pid from inferior in setup_inferior Tankut Baris Aktemur
2025-12-12 19:51 ` Simon Marchi
2025-12-13 12:40 ` Aktemur, Tankut Baris
2025-08-01 9:37 ` [PATCH v3 25/44] gdb: revise the pid_to_exec_file target op Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 26/44] gdb: load solibs if the target does not have the notion of an exec file Tankut Baris Aktemur
2025-12-12 20:30 ` Simon Marchi
2026-01-09 19:10 ` Aktemur, Tankut Baris
2025-08-01 9:37 ` [PATCH v3 27/44] gdbserver: import AC_LIB_HAVE_LINKFLAGS macro into the autoconf script Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 28/44] gdbserver: add a pointer to the owner thread in regcache Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 29/44] gdbserver: wait for stopped threads in queue_stop_reply_callback Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 30/44] gdbserver: adjust pid after the target attaches Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 31/44] gdb: do not create a thread after a process event Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 32/44] gdb, ze: on a whole process stop, mark all threads as not_resumed Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 33/44] gdb, dwarf, ze: add DW_OP_INTEL_regval_bits Tankut Baris Aktemur
2025-08-01 12:02 ` Jan Beulich
2025-08-01 12:31 ` Metzger, Markus T
2025-08-01 12:50 ` Jan Beulich
2025-08-08 5:25 ` Metzger, Markus T
2025-08-01 9:37 ` [PATCH v3 34/44] gdbserver: allow configuring for a heterogeneous target Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 35/44] gdbserver, ze, intelgt: introduce ze-low and intel-ze-low targets Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 36/44] testsuite, sycl: add SYCL support Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 37/44] testsuite, sycl: add test for backtracing inside a kernel Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 38/44] testsuite, sycl: add test for 'info locals' and 'info args' Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 39/44] testsuite, sycl: add tests for stepping and accessing data elements Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 40/44] testsuite, sycl: add test for 1-D and 2-D parallel_for kernels Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 41/44] testsuite, sycl: add test for scheduler-locking Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 42/44] testsuite, arch, intelgt: add a disassembly test Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 43/44] testsuite, arch, intelgt: add intelgt-program-bp.exp Tankut Baris Aktemur
2025-08-01 9:37 ` [PATCH v3 44/44] testsuite, sycl: test canceling a stepping flow Tankut Baris Aktemur
2025-09-17 12:43 ` [PATCH v3 00/44] A new target to debug Intel GPUs Aktemur, Tankut Baris
2025-10-14 6:34 ` Aktemur, Tankut Baris
2025-12-08 11:32 ` Aktemur, Tankut Baris
2025-12-09 21:30 ` Simon Marchi
2025-12-19 12:52 ` Aktemur, Tankut Baris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c2b0f60d-e3f1-4f35-b94e-04de2b421b52@suse.com \
--to=jbeulich@suse.com \
--cc=binutils@sourceware.org \
--cc=gdb-patches@sourceware.org \
--cc=markus.t.metzger@intel.com \
--cc=tankut.baris.aktemur@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox