public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Update LoongArch relocations for psABI v2.30
@ 2024-02-23  4:47 Xi Ruoyao
  2024-02-23  4:47 ` [PATCH 1/2] libelf: Sync elf.h from glibc Xi Ruoyao
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Xi Ruoyao @ 2024-02-23  4:47 UTC (permalink / raw)
  To: elfutils-devel
  Cc: Mark Wielaard, WANG Xuerui, Jinyang He, Youling Tang, Xi Ruoyao

LoongArch psABI v2.30 has introduced 17 new reloc types for TLS
descriptor, TLS LE relaxation, and medium code model function call.  Add
them to elfutils.

Tested on loongarch64-linux-gnu with Binutils-2.42 and GCC 14 (trunk).

Xi Ruoyao (2):
  libelf: Sync elf.h from glibc
  backends: Update list of LoongArch relocations

 backends/loongarch_reloc.def | 17 +++++++++++++++++
 libelf/elf.h                 | 31 ++++++++++++++++++++++++++++++-
 2 files changed, 47 insertions(+), 1 deletion(-)

-- 
2.43.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] libelf: Sync elf.h from glibc
  2024-02-23  4:47 [PATCH 0/2] Update LoongArch relocations for psABI v2.30 Xi Ruoyao
@ 2024-02-23  4:47 ` Xi Ruoyao
  2024-02-23  4:47 ` [PATCH 2/2] backends: Update list of LoongArch relocations Xi Ruoyao
  2024-02-24 13:04 ` [PATCH 0/2] Update LoongArch relocations for psABI v2.30 Mark Wielaard
  2 siblings, 0 replies; 6+ messages in thread
From: Xi Ruoyao @ 2024-02-23  4:47 UTC (permalink / raw)
  To: elfutils-devel
  Cc: Mark Wielaard, WANG Xuerui, Jinyang He, Youling Tang, Xi Ruoyao

Adds new LoongArch relocations.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
---
 libelf/elf.h | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/libelf/elf.h b/libelf/elf.h
index 7b4a8fe4..f2206e5c 100644
--- a/libelf/elf.h
+++ b/libelf/elf.h
@@ -1,5 +1,5 @@
 /* This file defines standard ELF types, structures, and macros.
-   Copyright (C) 1995-2023 Free Software Foundation, Inc.
+   Copyright (C) 1995-2024 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -791,9 +791,12 @@ typedef struct
 					   Register */
 #define NT_PPC_PKEY	0x110		/* Memory Protection Keys
 					   registers.  */
+#define NT_PPC_DEXCR	0x111		/* PowerPC DEXCR registers.  */
+#define NT_PPC_HASHKEYR	0x112		/* PowerPC HASHKEYR register.  */
 #define NT_386_TLS	0x200		/* i386 TLS slots (struct user_desc) */
 #define NT_386_IOPERM	0x201		/* x86 io permission bitmap (1=deny) */
 #define NT_X86_XSTATE	0x202		/* x86 extended state using xsave */
+#define NT_X86_SHSTK	0x204		/* x86 SHSTK state */
 #define NT_S390_HIGH_GPRS	0x300	/* s390 upper register halves */
 #define NT_S390_TIMER	0x301		/* s390 timer register */
 #define NT_S390_TODCMP	0x302		/* s390 TOD clock comparator register */
@@ -832,6 +835,8 @@ typedef struct
 #define NT_MIPS_DSP	0x800		/* MIPS DSP ASE registers.  */
 #define NT_MIPS_FP_MODE	0x801		/* MIPS floating-point mode.  */
 #define NT_MIPS_MSA	0x802		/* MIPS SIMD registers.  */
+#define NT_RISCV_CSR	0x900		/* RISC-V Control and Status Registers */
+#define NT_RISCV_VECTOR	0x901		/* RISC-V vector registers */
 #define NT_LOONGARCH_CPUCFG	0xa00	/* LoongArch CPU config registers.  */
 #define NT_LOONGARCH_CSR	0xa01	/* LoongArch control and
 					   status registers.  */
@@ -841,6 +846,8 @@ typedef struct
 					   SIMD Extension registers.  */
 #define NT_LOONGARCH_LBT	0xa04	/* LoongArch Loongson Binary
 					   Translation registers.  */
+#define NT_LOONGARCH_HW_BREAK	0xa05   /* LoongArch hardware breakpoint registers */
+#define NT_LOONGARCH_HW_WATCH	0xa06   /* LoongArch hardware watchpoint registers */
 
 /* Legal values for the note segment descriptor types for object files.  */
 
@@ -3632,6 +3639,11 @@ enum
 /* x86-64 sh_type values.  */
 #define SHT_X86_64_UNWIND	0x70000001 /* Unwind information.  */
 
+/* x86-64 d_tag values.  */
+#define DT_X86_64_PLT		(DT_LOPROC + 0)
+#define DT_X86_64_PLTSZ		(DT_LOPROC + 1)
+#define DT_X86_64_PLTENT	(DT_LOPROC + 3)
+#define DT_X86_64_NUM		4
 
 /* AM33 relocations.  */
 #define R_MN10300_NONE		0	/* No reloc.  */
@@ -4319,6 +4331,23 @@ enum
 #define R_LARCH_ADD_ULEB128 107
 #define R_LARCH_SUB_ULEB128 108
 #define R_LARCH_64_PCREL 109
+#define R_LARCH_CALL36 110
+#define R_LARCH_TLS_DESC_PC_HI20 111
+#define R_LARCH_TLS_DESC_PC_LO12 112
+#define R_LARCH_TLS_DESC64_PC_LO20 113
+#define R_LARCH_TLS_DESC64_PC_HI12 114
+#define R_LARCH_TLS_DESC_HI20 115
+#define R_LARCH_TLS_DESC_LO12 116
+#define R_LARCH_TLS_DESC64_LO20 117
+#define R_LARCH_TLS_DESC64_HI12 118
+#define R_LARCH_TLS_DESC_LD 119
+#define R_LARCH_TLS_DESC_CALL 120
+#define R_LARCH_TLS_LE_HI20_R 121
+#define R_LARCH_TLS_LE_ADD_R 122
+#define R_LARCH_TLS_LE_LO12_R 123
+#define R_LARCH_TLS_LD_PCREL20_S2 124
+#define R_LARCH_TLS_GD_PCREL20_S2 125
+#define R_LARCH_TLS_DESC_PCREL20_S2 126
 
 /* ARC specific declarations.  */
 
-- 
2.43.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] backends: Update list of LoongArch relocations
  2024-02-23  4:47 [PATCH 0/2] Update LoongArch relocations for psABI v2.30 Xi Ruoyao
  2024-02-23  4:47 ` [PATCH 1/2] libelf: Sync elf.h from glibc Xi Ruoyao
@ 2024-02-23  4:47 ` Xi Ruoyao
  2024-02-24 13:04 ` [PATCH 0/2] Update LoongArch relocations for psABI v2.30 Mark Wielaard
  2 siblings, 0 replies; 6+ messages in thread
From: Xi Ruoyao @ 2024-02-23  4:47 UTC (permalink / raw)
  To: elfutils-devel
  Cc: Mark Wielaard, WANG Xuerui, Jinyang He, Youling Tang, Xi Ruoyao

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
---
 backends/loongarch_reloc.def | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/backends/loongarch_reloc.def b/backends/loongarch_reloc.def
index a39eefd9..cdc83211 100644
--- a/backends/loongarch_reloc.def
+++ b/backends/loongarch_reloc.def
@@ -128,3 +128,20 @@ RELOC_TYPE (SUB6,			REL)
 RELOC_TYPE (ADD_ULEB128,		REL)
 RELOC_TYPE (SUB_ULEB128,		REL)
 RELOC_TYPE (64_PCREL,			REL)
+RELOC_TYPE (CALL36,			REL)
+RELOC_TYPE (TLS_DESC_PC_HI20,		REL)
+RELOC_TYPE (TLS_DESC_PC_LO12,		REL)
+RELOC_TYPE (TLS_DESC64_PC_LO20,		REL)
+RELOC_TYPE (TLS_DESC64_PC_HI12,		REL)
+RELOC_TYPE (TLS_DESC_HI20,		REL)
+RELOC_TYPE (TLS_DESC_LO12,		REL)
+RELOC_TYPE (TLS_DESC64_LO20,		REL)
+RELOC_TYPE (TLS_DESC64_HI12,		REL)
+RELOC_TYPE (TLS_DESC_LD,		REL)
+RELOC_TYPE (TLS_DESC_CALL,		REL)
+RELOC_TYPE (TLS_LE_HI20_R,		REL)
+RELOC_TYPE (TLS_LE_ADD_R,		REL)
+RELOC_TYPE (TLS_LE_LO12_R,		REL)
+RELOC_TYPE (TLS_LD_PCREL20_S2,		REL)
+RELOC_TYPE (TLS_GD_PCREL20_S2,		REL)
+RELOC_TYPE (TLS_DESC_PCREL20_S2,	REL)
-- 
2.43.2


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] Update LoongArch relocations for psABI v2.30
  2024-02-23  4:47 [PATCH 0/2] Update LoongArch relocations for psABI v2.30 Xi Ruoyao
  2024-02-23  4:47 ` [PATCH 1/2] libelf: Sync elf.h from glibc Xi Ruoyao
  2024-02-23  4:47 ` [PATCH 2/2] backends: Update list of LoongArch relocations Xi Ruoyao
@ 2024-02-24 13:04 ` Mark Wielaard
  2 siblings, 0 replies; 6+ messages in thread
From: Mark Wielaard @ 2024-02-24 13:04 UTC (permalink / raw)
  To: Xi Ruoyao; +Cc: elfutils-devel, WANG Xuerui, Jinyang He, Youling Tang

Hi,

On Fri, Feb 23, 2024 at 12:47:26PM +0800, Xi Ruoyao wrote:
> LoongArch psABI v2.30 has introduced 17 new reloc types for TLS
> descriptor, TLS LE relaxation, and medium code model function call.  Add
> them to elfutils.
> 
> Tested on loongarch64-linux-gnu with Binutils-2.42 and GCC 14 (trunk).
> 
> Xi Ruoyao (2):
>   libelf: Sync elf.h from glibc
>   backends: Update list of LoongArch relocations

Thanks, looks good.
Both patches pushed.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/2] backends: Update list of LoongArch relocations
  2023-08-29 13:14 ` [PATCH 2/2] backends: Update list of LoongArch relocations Xi Ruoyao
@ 2023-08-29 13:23   ` Mark Wielaard
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Wielaard @ 2023-08-29 13:23 UTC (permalink / raw)
  To: Xi Ruoyao, elfutils-devel; +Cc: Youling Tang

On Tue, 2023-08-29 at 21:14 +0800, Xi Ruoyao via Elfutils-devel wrote:
> 	* backends/loongarch_reloc.def: Add DELETE, ALIGN, PCREL20_S2,
> 	CFA, ADD6, SUB6, ADD_ULEB128, SUB_ULEB128, 64_PCREL.

Thanks, looks correct.

Pushed,

Mark

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/2] backends: Update list of LoongArch relocations
  2023-08-29 13:14 [PATCH 1/2] libelf: Sync elf.h from Glibc Xi Ruoyao
@ 2023-08-29 13:14 ` Xi Ruoyao
  2023-08-29 13:23   ` Mark Wielaard
  0 siblings, 1 reply; 6+ messages in thread
From: Xi Ruoyao @ 2023-08-29 13:14 UTC (permalink / raw)
  To: elfutils-devel; +Cc: Youling Tang, Mark Wielaard, Xi Ruoyao

	* backends/loongarch_reloc.def: Add DELETE, ALIGN, PCREL20_S2,
	CFA, ADD6, SUB6, ADD_ULEB128, SUB_ULEB128, 64_PCREL.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
---
 backends/loongarch_reloc.def | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/backends/loongarch_reloc.def b/backends/loongarch_reloc.def
index fd204924..a39eefd9 100644
--- a/backends/loongarch_reloc.def
+++ b/backends/loongarch_reloc.def
@@ -119,3 +119,12 @@ RELOC_TYPE (TLS_GD_PC_HI20,		REL)
 RELOC_TYPE (TLS_GD_HI20,		REL)
 RELOC_TYPE (32_PCREL,			REL)
 RELOC_TYPE (RELAX,			REL)
+RELOC_TYPE (DELETE,			REL)
+RELOC_TYPE (ALIGN,			REL)
+RELOC_TYPE (PCREL20_S2,			REL)
+RELOC_TYPE (CFA,			REL)
+RELOC_TYPE (ADD6,			REL)
+RELOC_TYPE (SUB6,			REL)
+RELOC_TYPE (ADD_ULEB128,		REL)
+RELOC_TYPE (SUB_ULEB128,		REL)
+RELOC_TYPE (64_PCREL,			REL)
-- 
2.42.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-02-24 13:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-23  4:47 [PATCH 0/2] Update LoongArch relocations for psABI v2.30 Xi Ruoyao
2024-02-23  4:47 ` [PATCH 1/2] libelf: Sync elf.h from glibc Xi Ruoyao
2024-02-23  4:47 ` [PATCH 2/2] backends: Update list of LoongArch relocations Xi Ruoyao
2024-02-24 13:04 ` [PATCH 0/2] Update LoongArch relocations for psABI v2.30 Mark Wielaard
  -- strict thread matches above, loose matches on Subject: below --
2023-08-29 13:14 [PATCH 1/2] libelf: Sync elf.h from Glibc Xi Ruoyao
2023-08-29 13:14 ` [PATCH 2/2] backends: Update list of LoongArch relocations Xi Ruoyao
2023-08-29 13:23   ` Mark Wielaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).