unofficial mirror of libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] ARC: update definitions in elf/elf.h
@ 2022-11-18 13:15 Shahab Vahedi via Libc-alpha
  2022-11-19  0:34 ` Vineet Gupta via Libc-alpha
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Shahab Vahedi via Libc-alpha @ 2022-11-18 13:15 UTC (permalink / raw)
  To: libc-alpha; +Cc: Shahab Vahedi, Vineet Gupta, Claudiu Zissulescu

While porting ARCv2 to elfutils [1], it was brought up that the
necessary changes to the project's libelf/elf.h must come from
glibc, because they sync it from glibc [2].  Therefore, this patch
is to update ARC entries in elf/elf.h.

The majority of the update is about adding new definitions,
specially for the relocations.  However, there is one rename, one
deletion, and one change:

- R_ARC_JUMP_SLOT renamed to R_ARC_JMP_SLOT to match binutils.
- R_ARC_B26 removed because it is unused and deprecated.
- R_ARC_TLS_DTPOFF_S9 changed from 0x4a to the correct value 0x49.

[1]
https://sourceware.org/pipermail/elfutils-devel/2022q4/005530.html

[2]
https://sourceware.org/pipermail/elfutils-devel/2022q4/005548.html

Signed-off-by: Shahab Vahedi <shahab@synopsys.com>
---
 elf/elf.h | 30 +++++++++++++++++++++++++-----
 1 file changed, 25 insertions(+), 5 deletions(-)

diff --git a/elf/elf.h b/elf/elf.h
index 920e6891e6..dfe5f79036 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -4160,13 +4160,23 @@ enum
 #define R_LARCH_GNU_VTENTRY  58
 
 
+/* ARC specific declarations.  */
+
+/* Processor specific flags for the Ehdr e_flags field.  */
+#define EF_ARC_MACH_MSK	    0x000000ff
+#define EF_ARC_OSABI_MSK    0x00000f00
+#define EF_ARC_ALL_MSK	    (EF_ARC_MACH_MSK | EF_ARC_OSABI_MSK)
+
+/* Processor specific values for the Shdr sh_type field.  */
+#define SHT_ARC_ATTRIBUTES	(SHT_LOPROC + 1) /* ARC attributes section.  */
+
 /* ARCompact/ARCv2 specific relocs.  */
 #define R_ARC_NONE		0x0
 #define R_ARC_8			0x1
 #define R_ARC_16		0x2
 #define R_ARC_24		0x3
 #define R_ARC_32		0x4
-#define R_ARC_B26		0x5
+
 #define R_ARC_B22_PCREL		0x6
 #define R_ARC_H30		0x7
 #define R_ARC_N8		0x8
@@ -4206,16 +4216,23 @@ enum
 #define R_ARC_SECTOFF_ME_2	0x2A
 #define R_ARC_SECTOFF_1		0x2B
 #define R_ARC_SECTOFF_2		0x2C
+#define R_ARC_SDA_12		0x2D
+#define R_ARC_SDA16_ST2		0x30
+#define R_ARC_32_PCREL		0x31
 #define R_ARC_PC32		0x32
 #define R_ARC_GOTPC32		0x33
 #define R_ARC_PLT32		0x34
 #define R_ARC_COPY		0x35
 #define R_ARC_GLOB_DAT		0x36
-#define R_ARC_JUMP_SLOT		0x37
+#define R_ARC_JMP_SLOT		0x37
 #define R_ARC_RELATIVE		0x38
 #define R_ARC_GOTOFF		0x39
 #define R_ARC_GOTPC		0x3A
 #define R_ARC_GOT32		0x3B
+#define R_ARC_S21W_PCREL_PLT	0x3C
+#define R_ARC_S25H_PCREL_PLT	0x3D
+
+#define R_ARC_JLI_SECTOFF	0x3F
 
 #define R_ARC_TLS_DTPMOD	0x42
 #define R_ARC_TLS_DTPOFF	0x43
@@ -4224,9 +4241,12 @@ enum
 #define R_ARC_TLS_GD_LD	        0x46
 #define R_ARC_TLS_GD_CALL	0x47
 #define R_ARC_TLS_IE_GOT	0x48
-#define R_ARC_TLS_DTPOFF_S9	0x4a
-#define R_ARC_TLS_LE_S9		0x4a
-#define R_ARC_TLS_LE_32		0x4b
+#define R_ARC_TLS_DTPOFF_S9	0x49
+#define R_ARC_TLS_LE_S9		0x4A
+#define R_ARC_TLS_LE_32		0x4B
+#define R_ARC_S25W_PCREL_PLT	0x4C
+#define R_ARC_S21H_PCREL_PLT	0x4D
+#define R_ARC_NPS_CMEM16	0x4E
 
 /* OpenRISC 1000 specific relocs.  */
 #define R_OR1K_NONE		0
-- 
2.38.1


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

* Re: [PATCH] ARC: update definitions in elf/elf.h
  2022-11-18 13:15 [PATCH] ARC: update definitions in elf/elf.h Shahab Vahedi via Libc-alpha
@ 2022-11-19  0:34 ` Vineet Gupta via Libc-alpha
  2022-11-21 13:07   ` Shahab Vahedi via Libc-alpha
  2022-11-21 13:06 ` [PATCH v2] " Shahab Vahedi via Libc-alpha
  2022-11-27 17:38 ` [PATCH v3 0/2] Update ARC " Shahab Vahedi via Libc-alpha
  2 siblings, 1 reply; 12+ messages in thread
From: Vineet Gupta via Libc-alpha @ 2022-11-19  0:34 UTC (permalink / raw)
  To: Shahab Vahedi, libc-alpha; +Cc: Claudiu Zissulescu, arcml



On 11/18/22 05:15, Shahab Vahedi wrote:
> While porting ARCv2 to elfutils [1], it was brought up that the
> necessary changes to the project's libelf/elf.h must come from
> glibc, because they sync it from glibc [2].  Therefore, this patch
> is to update ARC entries in elf/elf.h.
>
> The majority of the update is about adding new definitions,
> specially for the relocations.  However, there is one rename, one
> deletion, and one change:

For completeness: And some cosmetic changes to uppercase hex digits.

>
> - R_ARC_JUMP_SLOT renamed to R_ARC_JMP_SLOT to match binutils.
> - R_ARC_B26 removed because it is unused and deprecated.
> - R_ARC_TLS_DTPOFF_S9 changed from 0x4a to the correct value 0x49.

Technically this would be an ABI change, but is currently not being used 
in glibc at all (and I doubt anything outside glibc would use it 
anyways) so this should be non-controversial.

> [1]
> https://sourceware.org/pipermail/elfutils-devel/2022q4/005530.html
>
> [2]
> https://sourceware.org/pipermail/elfutils-devel/2022q4/005548.html
>
> Signed-off-by: Shahab Vahedi <shahab@synopsys.com>
> ---
>   elf/elf.h | 30 +++++++++++++++++++++++++-----
>   1 file changed, 25 insertions(+), 5 deletions(-)
>
> diff --git a/elf/elf.h b/elf/elf.h
> index 920e6891e6..dfe5f79036 100644
> --- a/elf/elf.h
> +++ b/elf/elf.h
> @@ -4160,13 +4160,23 @@ enum
>   #define R_LARCH_GNU_VTENTRY  58
>   
>   
> +/* ARC specific declarations.  */
> +
> +/* Processor specific flags for the Ehdr e_flags field.  */
> +#define EF_ARC_MACH_MSK	    0x000000ff
> +#define EF_ARC_OSABI_MSK    0x00000f00
> +#define EF_ARC_ALL_MSK	    (EF_ARC_MACH_MSK | EF_ARC_OSABI_MSK)
> +
> +/* Processor specific values for the Shdr sh_type field.  */
> +#define SHT_ARC_ATTRIBUTES	(SHT_LOPROC + 1) /* ARC attributes section.  */
> +
>   /* ARCompact/ARCv2 specific relocs.  */
>   #define R_ARC_NONE		0x0
>   #define R_ARC_8			0x1
>   #define R_ARC_16		0x2
>   #define R_ARC_24		0x3
>   #define R_ARC_32		0x4
> -#define R_ARC_B26		0x5
> +
>   #define R_ARC_B22_PCREL		0x6
>   #define R_ARC_H30		0x7
>   #define R_ARC_N8		0x8
> @@ -4206,16 +4216,23 @@ enum
>   #define R_ARC_SECTOFF_ME_2	0x2A
>   #define R_ARC_SECTOFF_1		0x2B
>   #define R_ARC_SECTOFF_2		0x2C
> +#define R_ARC_SDA_12		0x2D
> +#define R_ARC_SDA16_ST2		0x30
> +#define R_ARC_32_PCREL		0x31

OK.

>   #define R_ARC_PC32		0x32
>   #define R_ARC_GOTPC32		0x33
>   #define R_ARC_PLT32		0x34
>   #define R_ARC_COPY		0x35
>   #define R_ARC_GLOB_DAT		0x36
> -#define R_ARC_JUMP_SLOT		0x37
> +#define R_ARC_JMP_SLOT		0x37

Did you build glibc with this change ? There are references to old 
definition.

git grep R_ARC_JUMP_SLOT

sysdeps/arc/dl-machine.h:199:  ((((type) == 
R_ARC_JUMP_SLOT                                     \
sysdeps/arc/dl-machine.h:206:#define ELF_MACHINE_JMP_SLOT R_ARC_JUMP_SLOT
sysdeps/arc/dl-machine.h:277:        case R_ARC_JUMP_SLOT:
sysdeps/arc/dl-machine.h:337:  if (r_type == R_ARC_JUMP_SLOT)



>   #define R_ARC_RELATIVE		0x38
>   #define R_ARC_GOTOFF		0x39
>   #define R_ARC_GOTPC		0x3A
>   #define R_ARC_GOT32		0x3B
> +#define R_ARC_S21W_PCREL_PLT	0x3C
> +#define R_ARC_S25H_PCREL_PLT	0x3D
> +
> +#define R_ARC_JLI_SECTOFF	0x3F

OK.

>   #define R_ARC_TLS_DTPMOD	0x42
>   #define R_ARC_TLS_DTPOFF	0x43
> @@ -4224,9 +4241,12 @@ enum
>   #define R_ARC_TLS_GD_LD	        0x46
>   #define R_ARC_TLS_GD_CALL	0x47
>   #define R_ARC_TLS_IE_GOT	0x48
> -#define R_ARC_TLS_DTPOFF_S9	0x4a
> -#define R_ARC_TLS_LE_S9		0x4a
> -#define R_ARC_TLS_LE_32		0x4b
> +#define R_ARC_TLS_DTPOFF_S9	0x49

Value change, but not used currently so no ABI implications.

> +#define R_ARC_TLS_LE_S9		0x4A

cosmetic. OK

> +#define R_ARC_TLS_LE_32		0x4B

Ditto.

> +#define R_ARC_S25W_PCREL_PLT	0x4C
> +#define R_ARC_S21H_PCREL_PLT	0x4D
> +#define R_ARC_NPS_CMEM16	0x4E

OK.


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

* [PATCH v2] ARC: update definitions in elf/elf.h
  2022-11-18 13:15 [PATCH] ARC: update definitions in elf/elf.h Shahab Vahedi via Libc-alpha
  2022-11-19  0:34 ` Vineet Gupta via Libc-alpha
@ 2022-11-21 13:06 ` Shahab Vahedi via Libc-alpha
  2022-11-21 14:30   ` Adhemerval Zanella Netto via Libc-alpha
  2022-11-27 17:38 ` [PATCH v3 0/2] Update ARC " Shahab Vahedi via Libc-alpha
  2 siblings, 1 reply; 12+ messages in thread
From: Shahab Vahedi via Libc-alpha @ 2022-11-21 13:06 UTC (permalink / raw)
  To: libc-alpha; +Cc: Shahab Vahedi, Vineet Gupta, Claudiu Zissulescu, arcml

While porting ARCv2 to elfutils [1], it was brought up that the
necessary changes to the project's libelf/elf.h must come from
glibc, because they sync it from glibc [2].  Therefore, this patch
is to update ARC entries in elf/elf.h.

The majority of the update is about adding new definitions,
specially for the relocations.  However, there is one rename, one
deletion, and one change:

- R_ARC_JUMP_SLOT renamed to R_ARC_JMP_SLOT to match binutils.
- R_ARC_B26 removed because it is unused and deprecated.
- R_ARC_TLS_DTPOFF_S9 changed from 0x4a to the correct value 0x49.

[1]
https://sourceware.org/pipermail/elfutils-devel/2022q4/005530.html

[2]
https://sourceware.org/pipermail/elfutils-devel/2022q4/005548.html

Signed-off-by: Shahab Vahedi <shahab@synopsys.com>
---
Chagelog:
v2:
  - Rename instances of R_ARC_JUMP_SLOT to R_ARC_JMP_SLOT.
  - Remove an unnecessary extra empty line introduced in elf/elf.h.

 elf/elf.h                | 29 ++++++++++++++++++++++++-----
 sysdeps/arc/dl-machine.h |  8 ++++----
 2 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/elf/elf.h b/elf/elf.h
index 920e6891e6..da41bad34b 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -4159,6 +4159,15 @@ enum
 #define R_LARCH_GNU_VTINHERIT  57
 #define R_LARCH_GNU_VTENTRY  58
 
+/* ARC specific declarations.  */
+
+/* Processor specific flags for the Ehdr e_flags field.  */
+#define EF_ARC_MACH_MSK	    0x000000ff
+#define EF_ARC_OSABI_MSK    0x00000f00
+#define EF_ARC_ALL_MSK	    (EF_ARC_MACH_MSK | EF_ARC_OSABI_MSK)
+
+/* Processor specific values for the Shdr sh_type field.  */
+#define SHT_ARC_ATTRIBUTES	(SHT_LOPROC + 1) /* ARC attributes section.  */
 
 /* ARCompact/ARCv2 specific relocs.  */
 #define R_ARC_NONE		0x0
@@ -4166,7 +4175,7 @@ enum
 #define R_ARC_16		0x2
 #define R_ARC_24		0x3
 #define R_ARC_32		0x4
-#define R_ARC_B26		0x5
+
 #define R_ARC_B22_PCREL		0x6
 #define R_ARC_H30		0x7
 #define R_ARC_N8		0x8
@@ -4206,16 +4215,23 @@ enum
 #define R_ARC_SECTOFF_ME_2	0x2A
 #define R_ARC_SECTOFF_1		0x2B
 #define R_ARC_SECTOFF_2		0x2C
+#define R_ARC_SDA_12		0x2D
+#define R_ARC_SDA16_ST2		0x30
+#define R_ARC_32_PCREL		0x31
 #define R_ARC_PC32		0x32
 #define R_ARC_GOTPC32		0x33
 #define R_ARC_PLT32		0x34
 #define R_ARC_COPY		0x35
 #define R_ARC_GLOB_DAT		0x36
-#define R_ARC_JUMP_SLOT		0x37
+#define R_ARC_JMP_SLOT		0x37
 #define R_ARC_RELATIVE		0x38
 #define R_ARC_GOTOFF		0x39
 #define R_ARC_GOTPC		0x3A
 #define R_ARC_GOT32		0x3B
+#define R_ARC_S21W_PCREL_PLT	0x3C
+#define R_ARC_S25H_PCREL_PLT	0x3D
+
+#define R_ARC_JLI_SECTOFF	0x3F
 
 #define R_ARC_TLS_DTPMOD	0x42
 #define R_ARC_TLS_DTPOFF	0x43
@@ -4224,9 +4240,12 @@ enum
 #define R_ARC_TLS_GD_LD	        0x46
 #define R_ARC_TLS_GD_CALL	0x47
 #define R_ARC_TLS_IE_GOT	0x48
-#define R_ARC_TLS_DTPOFF_S9	0x4a
-#define R_ARC_TLS_LE_S9		0x4a
-#define R_ARC_TLS_LE_32		0x4b
+#define R_ARC_TLS_DTPOFF_S9	0x49
+#define R_ARC_TLS_LE_S9		0x4A
+#define R_ARC_TLS_LE_32		0x4B
+#define R_ARC_S25W_PCREL_PLT	0x4C
+#define R_ARC_S21H_PCREL_PLT	0x4D
+#define R_ARC_NPS_CMEM16	0x4E
 
 /* OpenRISC 1000 specific relocs.  */
 #define R_OR1K_NONE		0
diff --git a/sysdeps/arc/dl-machine.h b/sysdeps/arc/dl-machine.h
index c6ad232384..8420cd0006 100644
--- a/sysdeps/arc/dl-machine.h
+++ b/sysdeps/arc/dl-machine.h
@@ -183,14 +183,14 @@ __start:								\n\
    ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
    of the main executable's symbols, as for a COPY reloc.  */
 #define elf_machine_type_class(type)				\
-  ((((type) == R_ARC_JUMP_SLOT					\
+  ((((type) == R_ARC_JMP_SLOT					\
      || (type) == R_ARC_TLS_DTPMOD				\
      || (type) == R_ARC_TLS_DTPOFF				\
      || (type) == R_ARC_TLS_TPOFF) * ELF_RTYPE_CLASS_PLT)	\
    | (((type) == R_ARC_COPY) * ELF_RTYPE_CLASS_COPY))
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
-#define ELF_MACHINE_JMP_SLOT  R_ARC_JUMP_SLOT
+#define ELF_MACHINE_JMP_SLOT  R_ARC_JMP_SLOT
 
 /* Fixup a PLT entry to bounce directly to the function at VALUE.  */
 
@@ -261,7 +261,7 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
           break;
 
         case R_ARC_GLOB_DAT:
-        case R_ARC_JUMP_SLOT:
+        case R_ARC_JMP_SLOT:
             *reloc_addr = value;
           break;
 
@@ -321,7 +321,7 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
   ElfW(Addr) *const reloc_addr = (void *) (l_addr + reloc->r_offset);
   const unsigned int r_type = ELFW (R_TYPE) (reloc->r_info);
 
-  if (r_type == R_ARC_JUMP_SLOT)
+  if (r_type == R_ARC_JMP_SLOT)
     *reloc_addr += l_addr;
   else
     _dl_reloc_bad_type (map, r_type, 1);
-- 
2.38.1


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

* Re: [PATCH] ARC: update definitions in elf/elf.h
  2022-11-19  0:34 ` Vineet Gupta via Libc-alpha
@ 2022-11-21 13:07   ` Shahab Vahedi via Libc-alpha
  0 siblings, 0 replies; 12+ messages in thread
From: Shahab Vahedi via Libc-alpha @ 2022-11-21 13:07 UTC (permalink / raw)
  To: Vineet Gupta; +Cc: libc-alpha@sourceware.org, arcml, Claudiu Zissulescu

Hi Vineet,

FYI, a second version of the patch is submitted [1]. Regarding what
has changed, a changelog is put right after the sign-off line.

On 11/19/22 01:34, Vineet Gupta wrote:
> On 11/18/22 05:15, Shahab Vahedi wrote:
>> The majority of the update is about adding new definitions,
>> specially for the relocations.  However, there is one rename, one
>> deletion, and one change:
> 
> For completeness: And some cosmetic changes to uppercase hex digits.

Indeed, there are some cosmetic changes. If you don't mind, I'm going
to leave this part out of the commit message.

>> -#define R_ARC_JUMP_SLOT        0x37
>> +#define R_ARC_JMP_SLOT        0x37
> 
> Did you build glibc with this change ? There are references to old definition.
> 
> git grep R_ARC_JUMP_SLOT
> 
> sysdeps/arc/dl-machine.h:199:  ((((type) == R_ARC_JUMP_SLOT                                     \
> sysdeps/arc/dl-machine.h:206:#define ELF_MACHINE_JMP_SLOT R_ARC_JUMP_SLOT
> sysdeps/arc/dl-machine.h:277:        case R_ARC_JUMP_SLOT:
> sysdeps/arc/dl-machine.h:337:  if (r_type == R_ARC_JUMP_SLOT)

Thank you very much for noticing this. This was a snafu on my part.
I forgot to bring the complete changes from an old downstream branch
I had. This has been fixed in v2 of the patch [1] which is now tested
by building the current master branch:

$ module load <arcv2_toolchain>
$ configure --prefix=/usr                                \
            --with-headers=/path/to/sysroot/usr/include  \
            --build=x86_64-pc-linux-gnu                  \
            --host=arc-snps-linux-gnu                    \
            --target=arc-snps-linux-gnu                  \
            --disable-werror                             \
            CFLAGS="-Og -g3 -fvar-tracking-assignments"  \
            CXXFLAGS="-Og -g3 -fvar-tracking-assignments"
$ make

[1]
https://sourceware.org/pipermail/libc-alpha/2022-November/143536.html

-- 
Shahab

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

* Re: [PATCH v2] ARC: update definitions in elf/elf.h
  2022-11-21 13:06 ` [PATCH v2] " Shahab Vahedi via Libc-alpha
@ 2022-11-21 14:30   ` Adhemerval Zanella Netto via Libc-alpha
  2022-11-23  4:13     ` Vineet Gupta via Libc-alpha
  0 siblings, 1 reply; 12+ messages in thread
From: Adhemerval Zanella Netto via Libc-alpha @ 2022-11-21 14:30 UTC (permalink / raw)
  To: Shahab Vahedi, libc-alpha; +Cc: Vineet Gupta, Claudiu Zissulescu, arcml



On 21/11/22 10:06, Shahab Vahedi via Libc-alpha wrote:
> While porting ARCv2 to elfutils [1], it was brought up that the
> necessary changes to the project's libelf/elf.h must come from
> glibc, because they sync it from glibc [2].  Therefore, this patch
> is to update ARC entries in elf/elf.h.
> 
> The majority of the update is about adding new definitions,
> specially for the relocations.  However, there is one rename, one
> deletion, and one change:
> 
> - R_ARC_JUMP_SLOT renamed to R_ARC_JMP_SLOT to match binutils.
> - R_ARC_B26 removed because it is unused and deprecated.
> - R_ARC_TLS_DTPOFF_S9 changed from 0x4a to the correct value 0x49.
> 
> [1]
> https://sourceware.org/pipermail/elfutils-devel/2022q4/005530.html
> 
> [2]
> https://sourceware.org/pipermail/elfutils-devel/2022q4/005548.html
> 
> Signed-off-by: Shahab Vahedi <shahab@synopsys.com>

We discussed this briefly on glibc patchwork review meeting [1],
and if does not trigger any regression it ok to arch maintainers
to handle such changes.

[1] https://sourceware.org/glibc/wiki/PatchworkReviewMeetings

> ---
> Chagelog:
> v2:
>   - Rename instances of R_ARC_JUMP_SLOT to R_ARC_JMP_SLOT.
>   - Remove an unnecessary extra empty line introduced in elf/elf.h.
> 
>  elf/elf.h                | 29 ++++++++++++++++++++++++-----
>  sysdeps/arc/dl-machine.h |  8 ++++----
>  2 files changed, 28 insertions(+), 9 deletions(-)
> 
> diff --git a/elf/elf.h b/elf/elf.h
> index 920e6891e6..da41bad34b 100644
> --- a/elf/elf.h
> +++ b/elf/elf.h
> @@ -4159,6 +4159,15 @@ enum
>  #define R_LARCH_GNU_VTINHERIT  57
>  #define R_LARCH_GNU_VTENTRY  58
>  
> +/* ARC specific declarations.  */
> +
> +/* Processor specific flags for the Ehdr e_flags field.  */
> +#define EF_ARC_MACH_MSK	    0x000000ff
> +#define EF_ARC_OSABI_MSK    0x00000f00
> +#define EF_ARC_ALL_MSK	    (EF_ARC_MACH_MSK | EF_ARC_OSABI_MSK)
> +
> +/* Processor specific values for the Shdr sh_type field.  */
> +#define SHT_ARC_ATTRIBUTES	(SHT_LOPROC + 1) /* ARC attributes section.  */
>  
>  /* ARCompact/ARCv2 specific relocs.  */
>  #define R_ARC_NONE		0x0
> @@ -4166,7 +4175,7 @@ enum
>  #define R_ARC_16		0x2
>  #define R_ARC_24		0x3
>  #define R_ARC_32		0x4
> -#define R_ARC_B26		0x5
> +
>  #define R_ARC_B22_PCREL		0x6
>  #define R_ARC_H30		0x7
>  #define R_ARC_N8		0x8
> @@ -4206,16 +4215,23 @@ enum
>  #define R_ARC_SECTOFF_ME_2	0x2A
>  #define R_ARC_SECTOFF_1		0x2B
>  #define R_ARC_SECTOFF_2		0x2C
> +#define R_ARC_SDA_12		0x2D
> +#define R_ARC_SDA16_ST2		0x30
> +#define R_ARC_32_PCREL		0x31
>  #define R_ARC_PC32		0x32
>  #define R_ARC_GOTPC32		0x33
>  #define R_ARC_PLT32		0x34
>  #define R_ARC_COPY		0x35
>  #define R_ARC_GLOB_DAT		0x36
> -#define R_ARC_JUMP_SLOT		0x37
> +#define R_ARC_JMP_SLOT		0x37
>  #define R_ARC_RELATIVE		0x38
>  #define R_ARC_GOTOFF		0x39
>  #define R_ARC_GOTPC		0x3A
>  #define R_ARC_GOT32		0x3B
> +#define R_ARC_S21W_PCREL_PLT	0x3C
> +#define R_ARC_S25H_PCREL_PLT	0x3D
> +
> +#define R_ARC_JLI_SECTOFF	0x3F
>  
>  #define R_ARC_TLS_DTPMOD	0x42
>  #define R_ARC_TLS_DTPOFF	0x43
> @@ -4224,9 +4240,12 @@ enum
>  #define R_ARC_TLS_GD_LD	        0x46
>  #define R_ARC_TLS_GD_CALL	0x47
>  #define R_ARC_TLS_IE_GOT	0x48
> -#define R_ARC_TLS_DTPOFF_S9	0x4a
> -#define R_ARC_TLS_LE_S9		0x4a
> -#define R_ARC_TLS_LE_32		0x4b
> +#define R_ARC_TLS_DTPOFF_S9	0x49
> +#define R_ARC_TLS_LE_S9		0x4A
> +#define R_ARC_TLS_LE_32		0x4B
> +#define R_ARC_S25W_PCREL_PLT	0x4C
> +#define R_ARC_S21H_PCREL_PLT	0x4D
> +#define R_ARC_NPS_CMEM16	0x4E
>  
>  /* OpenRISC 1000 specific relocs.  */
>  #define R_OR1K_NONE		0
> diff --git a/sysdeps/arc/dl-machine.h b/sysdeps/arc/dl-machine.h
> index c6ad232384..8420cd0006 100644
> --- a/sysdeps/arc/dl-machine.h
> +++ b/sysdeps/arc/dl-machine.h
> @@ -183,14 +183,14 @@ __start:								\n\
>     ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
>     of the main executable's symbols, as for a COPY reloc.  */
>  #define elf_machine_type_class(type)				\
> -  ((((type) == R_ARC_JUMP_SLOT					\
> +  ((((type) == R_ARC_JMP_SLOT					\
>       || (type) == R_ARC_TLS_DTPMOD				\
>       || (type) == R_ARC_TLS_DTPOFF				\
>       || (type) == R_ARC_TLS_TPOFF) * ELF_RTYPE_CLASS_PLT)	\
>     | (((type) == R_ARC_COPY) * ELF_RTYPE_CLASS_COPY))
>  
>  /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
> -#define ELF_MACHINE_JMP_SLOT  R_ARC_JUMP_SLOT
> +#define ELF_MACHINE_JMP_SLOT  R_ARC_JMP_SLOT
>  
>  /* Fixup a PLT entry to bounce directly to the function at VALUE.  */
>  
> @@ -261,7 +261,7 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
>            break;
>  
>          case R_ARC_GLOB_DAT:
> -        case R_ARC_JUMP_SLOT:
> +        case R_ARC_JMP_SLOT:
>              *reloc_addr = value;
>            break;
>  
> @@ -321,7 +321,7 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
>    ElfW(Addr) *const reloc_addr = (void *) (l_addr + reloc->r_offset);
>    const unsigned int r_type = ELFW (R_TYPE) (reloc->r_info);
>  
> -  if (r_type == R_ARC_JUMP_SLOT)
> +  if (r_type == R_ARC_JMP_SLOT)
>      *reloc_addr += l_addr;
>    else
>      _dl_reloc_bad_type (map, r_type, 1);

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

* Re: [PATCH v2] ARC: update definitions in elf/elf.h
  2022-11-21 14:30   ` Adhemerval Zanella Netto via Libc-alpha
@ 2022-11-23  4:13     ` Vineet Gupta via Libc-alpha
  0 siblings, 0 replies; 12+ messages in thread
From: Vineet Gupta via Libc-alpha @ 2022-11-23  4:13 UTC (permalink / raw)
  To: Adhemerval Zanella Netto, Shahab Vahedi, libc-alpha
  Cc: Claudiu Zissulescu, arcml


On 11/21/22 06:30, Adhemerval Zanella Netto wrote:
> On 21/11/22 10:06, Shahab Vahedi via Libc-alpha wrote:
>> While porting ARCv2 to elfutils [1], it was brought up that the
>> necessary changes to the project's libelf/elf.h must come from
>> glibc, because they sync it from glibc [2].  Therefore, this patch
>> is to update ARC entries in elf/elf.h.
>>
>> The majority of the update is about adding new definitions,
>> specially for the relocations.  However, there is one rename, one
>> deletion, and one change:
>>
>> - R_ARC_JUMP_SLOT renamed to R_ARC_JMP_SLOT to match binutils.
>> - R_ARC_B26 removed because it is unused and deprecated.
>> - R_ARC_TLS_DTPOFF_S9 changed from 0x4a to the correct value 0x49.
>>
>> [1]
>> https://sourceware.org/pipermail/elfutils-devel/2022q4/005530.html
>>
>> [2]
>> https://sourceware.org/pipermail/elfutils-devel/2022q4/005548.html
>>
>> Signed-off-by: Shahab Vahedi<shahab@synopsys.com>
> We discussed this briefly on glibc patchwork review meeting [1],
> and if does not trigger any regression it ok to arch maintainers
> to handle such changes.

Shahab as a process followup, can you run the full glibc testsuite w/ 
and w/o this change and post the results summary here. It should be easy 
to do this with hsdk dev board. It can also help find fill the the glibc 
testing log for arc for the upcoming release ;-) as 2.36 [1] seems untested.

-Vineet

[1] https://sourceware.org/glibc/wiki/Release/2.36

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

* [PATCH v3 0/2] Update ARC definitions in elf/elf.h
  2022-11-18 13:15 [PATCH] ARC: update definitions in elf/elf.h Shahab Vahedi via Libc-alpha
  2022-11-19  0:34 ` Vineet Gupta via Libc-alpha
  2022-11-21 13:06 ` [PATCH v2] " Shahab Vahedi via Libc-alpha
@ 2022-11-27 17:38 ` Shahab Vahedi via Libc-alpha
  2022-11-27 17:38   ` [PATCH v3 1/2] scripts: Add "|" operator support to glibcpp's parsing Shahab Vahedi via Libc-alpha
  2022-11-27 17:38   ` [PATCH v3 2/2] ARC: update definitions in elf/elf.h Shahab Vahedi via Libc-alpha
  2 siblings, 2 replies; 12+ messages in thread
From: Shahab Vahedi via Libc-alpha @ 2022-11-27 17:38 UTC (permalink / raw)
  To: libc-alpha
  Cc: Shahab Vahedi, Vineet Gupta, Florian Weimer, Claudiu Zissulescu,
	arcml

After updating the ARC definitions in elf/elf.h (the second patch of
this series), I noticed a lack of parsing support for it in glibcpp.py.
Please read the description of the first patch for more details.  To
have the tests pass all the time, the first patch fixes the potential
issue and the second one is related to the actual update of definitions
in elf.h header.

Rationale for the CCs:

Florian Weimer -- Changes related to glibcpp and glibcelf
Vineet  Gupta  -- Changes related to elf.h (ARC section)

Shahab Vahedi (2):
  scripts: Add "|" operator support to glibcpp's parsing
  ARC: update definitions in elf/elf.h

 elf/elf.h                | 29 ++++++++++++++++++++++++-----
 scripts/glibcelf.py      |  3 +++
 scripts/glibcpp.py       |  1 +
 support/tst-glibcpp.py   |  1 +
 sysdeps/arc/dl-machine.h |  8 ++++----
 5 files changed, 33 insertions(+), 9 deletions(-)

-- 
2.38.1


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

* [PATCH v3 1/2] scripts: Add "|" operator support to glibcpp's parsing
  2022-11-27 17:38 ` [PATCH v3 0/2] Update ARC " Shahab Vahedi via Libc-alpha
@ 2022-11-27 17:38   ` Shahab Vahedi via Libc-alpha
  2022-11-27 18:21     ` Florian Weimer via Libc-alpha
  2022-11-27 17:38   ` [PATCH v3 2/2] ARC: update definitions in elf/elf.h Shahab Vahedi via Libc-alpha
  1 sibling, 1 reply; 12+ messages in thread
From: Shahab Vahedi via Libc-alpha @ 2022-11-27 17:38 UTC (permalink / raw)
  To: libc-alpha; +Cc: Shahab Vahedi, Florian Weimer, Claudiu Zissulescu, arcml

From the tests point of view, this is a necessary step for another
patch [1] and allows parsing macros such as "#define A | B".  Without
it, a few tests [2] choke when the other patch [1] is applied:

/src/glibc/scripts/../elf/elf.h:4167: error: uninterpretable macro
token sequence: ( EF_ARC_MACH_MSK | EF_ARC_OSABI_MSK )
Traceback (most recent call last):
    File "/src/glibc/elf/tst-glibcelf.py", line 23, in <module>
      import glibcelf
    File "/src/glibc/scripts/glibcelf.py", line 226, in <module>
      _elf_h = _parse_elf_h()
               ^^^^^^^^^^^^^^
    File "/src/glibc/scripts/glibcelf.py", line 223, in _parse_elf_h
      raise IOError('parse error in elf.h')
  OSError: parse error in elf.h

[1] ARC: update definitions in elf/elf.h
https://sourceware.org/pipermail/libc-alpha/2022-November/143503.html

[2]
tst-glibcelf, tst-relro-ldso, and tst-relro-libc

Signed-off-by: Shahab Vahedi <shahab@synopsys.com>
---
 scripts/glibcpp.py     | 1 +
 support/tst-glibcpp.py | 1 +
 2 files changed, 2 insertions(+)

diff --git a/scripts/glibcpp.py b/scripts/glibcpp.py
index 455459a609..2f39979894 100644
--- a/scripts/glibcpp.py
+++ b/scripts/glibcpp.py
@@ -346,6 +346,7 @@ RE_SPLIT_INTEGER_SUFFIX = re.compile(r'([^ullULL]+)([ullULL]*)')
 BINARY_OPERATORS = {
     '+': operator.add,
     '<<': operator.lshift,
+    '|': operator.or_,
 }
 
 # Use the general-purpose dict type if it is order-preserving.
diff --git a/support/tst-glibcpp.py b/support/tst-glibcpp.py
index a2db1916cc..cca8bd6c44 100644
--- a/support/tst-glibcpp.py
+++ b/support/tst-glibcpp.py
@@ -131,6 +131,7 @@ check_macro_eval('#define A 1', {'A': 1})
 check_macro_eval('#define A (1)', {'A': 1})
 check_macro_eval('#define A (1 + 1)', {'A': 2})
 check_macro_eval('#define A (1U << 31)', {'A': 1 << 31})
+check_macro_eval('#define A (1 | 2)', {'A': 1 | 2})
 check_macro_eval('''\
 #define A (B + 1)
 #define B 10
-- 
2.38.1


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

* [PATCH v3 2/2] ARC: update definitions in elf/elf.h
  2022-11-27 17:38 ` [PATCH v3 0/2] Update ARC " Shahab Vahedi via Libc-alpha
  2022-11-27 17:38   ` [PATCH v3 1/2] scripts: Add "|" operator support to glibcpp's parsing Shahab Vahedi via Libc-alpha
@ 2022-11-27 17:38   ` Shahab Vahedi via Libc-alpha
  2022-11-30  2:11     ` Vineet Gupta via Libc-alpha
  1 sibling, 1 reply; 12+ messages in thread
From: Shahab Vahedi via Libc-alpha @ 2022-11-27 17:38 UTC (permalink / raw)
  To: libc-alpha
  Cc: Shahab Vahedi, Vineet Gupta, Florian Weimer, Claudiu Zissulescu,
	arcml

While porting ARCv2 to elfutils [1], it was brought up that the
necessary changes to the project's libelf/elf.h must come from
glibc, because they sync it from glibc [2].  Therefore, this patch
is to update ARC entries in elf/elf.h.

The majority of the update is about adding new definitions,
specially for the relocations.  However, there is one rename, one
deletion, and one change:

- R_ARC_JUMP_SLOT renamed to R_ARC_JMP_SLOT to match binutils.
- R_ARC_B26 removed because it is unused and deprecated.
- R_ARC_TLS_DTPOFF_S9 changed from 0x4a to the correct value 0x49.

Finally, a specific SHT class for ARC has been added to glibcelf.py.
Else, it would result in a collision:

  _register_elf_h(Sht, ranges=True,
 File "/src/glibc/scripts/glibcelf.py", line x, in _register_elf_h
   raise ValueError('duplicate value {}: {}, {}'.format(
                    ValueError: duplicate value 1879048193:
                    SHT_ARC_ATTRIBUTES, SHT_X86_64_UNWIND

[1]
https://sourceware.org/pipermail/elfutils-devel/2022q4/005530.html

[2]
https://sourceware.org/pipermail/elfutils-devel/2022q4/005548.html

No regression has been observed after applying this patch.  Below
follows the result:

UNSUPPORTED: crypt/cert
UNSUPPORTED: elf/tst-audit22
FAIL: elf/tst-audit25a
FAIL: elf/tst-audit25b
FAIL: elf/tst-bz15311
FAIL: elf/tst-bz28937
FAIL: elf/tst-dlmopen4
UNSUPPORTED: elf/tst-dlopen-self-container
UNSUPPORTED: elf/tst-dlopen-tlsmodid-container
UNSUPPORTED: elf/tst-glibc-hwcaps-prepend-cache
UNSUPPORTED: elf/tst-ldconfig-bad-aux-cache
UNSUPPORTED: elf/tst-ldconfig-ld_so_conf-update
UNSUPPORTED: elf/tst-pldd
UNSUPPORTED: elf/tst-preload-pthread-libc
XPASS: elf/tst-protected1a
XPASS: elf/tst-protected1b
FAIL: elf/tst-tls-allocation-failure-static-patched
FAIL: elf/tst-tls1
FAIL: elf/tst-tls3
FAIL: elf/tst-tlsalign-extern
UNSUPPORTED: elf/tst-valgrind-smoke
UNSUPPORTED: grp/tst-initgroups1
UNSUPPORTED: grp/tst-initgroups2
UNSUPPORTED: io/tst-getcwd-smallbuff
UNSUPPORTED: locale/tst-localedef-path-norm
FAIL: localedata/sort-test
UNSUPPORTED: localedata/tst-localedef-hardlinks
FAIL: malloc/tst-malloc-thread-fail-malloc-check
FAIL: malloc/tst-malloc_info-malloc-check
UNSUPPORTED: math/test-fesetexcept-traps
UNSUPPORTED: math/test-fexcept-traps
UNSUPPORTED: math/test-nearbyint-except
UNSUPPORTED: math/test-nearbyint-except-2
UNSUPPORTED: misc/tst-adjtimex
UNSUPPORTED: misc/tst-clock_adjtime
FAIL: misc/tst-misalign-clone
FAIL: misc/tst-misalign-clone-internal
UNSUPPORTED: misc/tst-ntp_adjtime
UNSUPPORTED: misc/tst-pkey
UNSUPPORTED: misc/tst-rseq
UNSUPPORTED: misc/tst-rseq-disable
UNSUPPORTED: misc/tst-syslog
UNSUPPORTED: misc/tst-ttyname
FAIL: nptl/test-cond-printers
FAIL: nptl/test-condattr-printers
FAIL: nptl/test-mutex-printers
FAIL: nptl/test-mutexattr-printers
FAIL: nptl/test-rwlock-printers
FAIL: nptl/test-rwlockattr-printers
UNSUPPORTED: nptl/tst-pthread-gdb-attach
UNSUPPORTED: nptl/tst-pthread-gdb-attach-static
UNSUPPORTED: nptl/tst-pthread-getattr
UNSUPPORTED: nptl/tst-rseq-nptl
UNSUPPORTED: nss/tst-nss-compat1
UNSUPPORTED: nss/tst-nss-db-endgrent
UNSUPPORTED: nss/tst-nss-db-endpwent
UNSUPPORTED: nss/tst-nss-files-hosts-long
UNSUPPORTED: nss/tst-nss-gai-actions
UNSUPPORTED: nss/tst-nss-test3
UNSUPPORTED: nss/tst-reload1
UNSUPPORTED: nss/tst-reload2
UNSUPPORTED: posix/bug-ga2
UNSUPPORTED: posix/bug-ga2-mem
FAIL: posix/globtest
UNSUPPORTED: posix/tst-vfork3
UNSUPPORTED: posix/tst-vfork3-mem
UNSUPPORTED: resolv/mtrace-tst-leaks2
UNSUPPORTED: resolv/tst-leaks2
UNSUPPORTED: resolv/tst-resolv-ai_idn
UNSUPPORTED: resolv/tst-resolv-ai_idn-latin1
UNSUPPORTED: resolv/tst-resolv-res_init
UNSUPPORTED: resolv/tst-resolv-res_init-thread
UNSUPPORTED: rt/tst-bz28213
UNSUPPORTED: rt/tst-mqueue1
UNSUPPORTED: rt/tst-mqueue10
UNSUPPORTED: rt/tst-mqueue2
UNSUPPORTED: rt/tst-mqueue3
UNSUPPORTED: rt/tst-mqueue4
UNSUPPORTED: rt/tst-mqueue5
UNSUPPORTED: rt/tst-mqueue6
UNSUPPORTED: rt/tst-mqueue8
UNSUPPORTED: rt/tst-mqueue8x
UNSUPPORTED: rt/tst-mqueue9
UNSUPPORTED: stdlib/test-bz22786
UNSUPPORTED: stdlib/tst-system
UNSUPPORTED: string/test-bcopy
UNSUPPORTED: string/test-memmove
UNSUPPORTED: string/tst-memmove-overflow
UNSUPPORTED: string/tst-strerror
UNSUPPORTED: string/tst-strsignal
UNSUPPORTED: time/tst-clock_settime
UNSUPPORTED: time/tst-settimeofday
Summary of test results:
     21 FAIL
   4184 PASS
     69 UNSUPPORTED
     16 XFAIL
      2 XPASS

Signed-off-by: Shahab Vahedi <shahab@synopsys.com>
---
ChangeLog:
v3:
  - Fix a collision in glibcelf.py.
  - Add test results to the commit message.
v2:
  - Rename instances of R_ARC_JUMP_SLOT to R_ARC_JMP_SLOT.
  - Remove an unnecessary extra empty line introduced in elf/elf.h.

 elf/elf.h                | 29 ++++++++++++++++++++++++-----
 scripts/glibcelf.py      |  3 +++
 sysdeps/arc/dl-machine.h |  8 ++++----
 3 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/elf/elf.h b/elf/elf.h
index 920e6891e6..da41bad34b 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -4159,6 +4159,15 @@ enum
 #define R_LARCH_GNU_VTINHERIT  57
 #define R_LARCH_GNU_VTENTRY  58
 
+/* ARC specific declarations.  */
+
+/* Processor specific flags for the Ehdr e_flags field.  */
+#define EF_ARC_MACH_MSK	    0x000000ff
+#define EF_ARC_OSABI_MSK    0x00000f00
+#define EF_ARC_ALL_MSK	    (EF_ARC_MACH_MSK | EF_ARC_OSABI_MSK)
+
+/* Processor specific values for the Shdr sh_type field.  */
+#define SHT_ARC_ATTRIBUTES	(SHT_LOPROC + 1) /* ARC attributes section.  */
 
 /* ARCompact/ARCv2 specific relocs.  */
 #define R_ARC_NONE		0x0
@@ -4166,7 +4175,7 @@ enum
 #define R_ARC_16		0x2
 #define R_ARC_24		0x3
 #define R_ARC_32		0x4
-#define R_ARC_B26		0x5
+
 #define R_ARC_B22_PCREL		0x6
 #define R_ARC_H30		0x7
 #define R_ARC_N8		0x8
@@ -4206,16 +4215,23 @@ enum
 #define R_ARC_SECTOFF_ME_2	0x2A
 #define R_ARC_SECTOFF_1		0x2B
 #define R_ARC_SECTOFF_2		0x2C
+#define R_ARC_SDA_12		0x2D
+#define R_ARC_SDA16_ST2		0x30
+#define R_ARC_32_PCREL		0x31
 #define R_ARC_PC32		0x32
 #define R_ARC_GOTPC32		0x33
 #define R_ARC_PLT32		0x34
 #define R_ARC_COPY		0x35
 #define R_ARC_GLOB_DAT		0x36
-#define R_ARC_JUMP_SLOT		0x37
+#define R_ARC_JMP_SLOT		0x37
 #define R_ARC_RELATIVE		0x38
 #define R_ARC_GOTOFF		0x39
 #define R_ARC_GOTPC		0x3A
 #define R_ARC_GOT32		0x3B
+#define R_ARC_S21W_PCREL_PLT	0x3C
+#define R_ARC_S25H_PCREL_PLT	0x3D
+
+#define R_ARC_JLI_SECTOFF	0x3F
 
 #define R_ARC_TLS_DTPMOD	0x42
 #define R_ARC_TLS_DTPOFF	0x43
@@ -4224,9 +4240,12 @@ enum
 #define R_ARC_TLS_GD_LD	        0x46
 #define R_ARC_TLS_GD_CALL	0x47
 #define R_ARC_TLS_IE_GOT	0x48
-#define R_ARC_TLS_DTPOFF_S9	0x4a
-#define R_ARC_TLS_LE_S9		0x4a
-#define R_ARC_TLS_LE_32		0x4b
+#define R_ARC_TLS_DTPOFF_S9	0x49
+#define R_ARC_TLS_LE_S9		0x4A
+#define R_ARC_TLS_LE_32		0x4B
+#define R_ARC_S25W_PCREL_PLT	0x4C
+#define R_ARC_S21H_PCREL_PLT	0x4D
+#define R_ARC_NPS_CMEM16	0x4E
 
 /* OpenRISC 1000 specific relocs.  */
 #define R_OR1K_NONE		0
diff --git a/scripts/glibcelf.py b/scripts/glibcelf.py
index 59aab56ecf..a85594c3d9 100644
--- a/scripts/glibcelf.py
+++ b/scripts/glibcelf.py
@@ -304,6 +304,8 @@ class Sht(_TypedConstant):
     prefix = 'SHT_'
 class ShtALPHA(Sht):
     """Supplemental SHT_* constants for EM_ALPHA."""
+class ShtARC(Sht):
+    """Supplemental SHT_* constants for EM_ARC."""
 class ShtARM(Sht):
     """Supplemental SHT_* constants for EM_ARM."""
 class ShtCSKY(Sht):
@@ -317,6 +319,7 @@ class ShtPARISC(Sht):
 class ShtRISCV(Sht):
     """Supplemental SHT_* constants for EM_RISCV."""
 _register_elf_h(ShtALPHA, prefix='SHT_ALPHA_', parent=Sht)
+_register_elf_h(ShtARC, prefix='SHT_ARC_', parent=Sht)
 _register_elf_h(ShtARM, prefix='SHT_ARM_', parent=Sht)
 _register_elf_h(ShtCSKY, prefix='SHT_CSKY_', parent=Sht)
 _register_elf_h(ShtIA_64, prefix='SHT_IA_64_', parent=Sht)
diff --git a/sysdeps/arc/dl-machine.h b/sysdeps/arc/dl-machine.h
index c6ad232384..8420cd0006 100644
--- a/sysdeps/arc/dl-machine.h
+++ b/sysdeps/arc/dl-machine.h
@@ -183,14 +183,14 @@ __start:								\n\
    ELF_RTYPE_CLASS_NOCOPY iff TYPE should not be allowed to resolve to one
    of the main executable's symbols, as for a COPY reloc.  */
 #define elf_machine_type_class(type)				\
-  ((((type) == R_ARC_JUMP_SLOT					\
+  ((((type) == R_ARC_JMP_SLOT					\
      || (type) == R_ARC_TLS_DTPMOD				\
      || (type) == R_ARC_TLS_DTPOFF				\
      || (type) == R_ARC_TLS_TPOFF) * ELF_RTYPE_CLASS_PLT)	\
    | (((type) == R_ARC_COPY) * ELF_RTYPE_CLASS_COPY))
 
 /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries.  */
-#define ELF_MACHINE_JMP_SLOT  R_ARC_JUMP_SLOT
+#define ELF_MACHINE_JMP_SLOT  R_ARC_JMP_SLOT
 
 /* Fixup a PLT entry to bounce directly to the function at VALUE.  */
 
@@ -261,7 +261,7 @@ elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
           break;
 
         case R_ARC_GLOB_DAT:
-        case R_ARC_JUMP_SLOT:
+        case R_ARC_JMP_SLOT:
             *reloc_addr = value;
           break;
 
@@ -321,7 +321,7 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
   ElfW(Addr) *const reloc_addr = (void *) (l_addr + reloc->r_offset);
   const unsigned int r_type = ELFW (R_TYPE) (reloc->r_info);
 
-  if (r_type == R_ARC_JUMP_SLOT)
+  if (r_type == R_ARC_JMP_SLOT)
     *reloc_addr += l_addr;
   else
     _dl_reloc_bad_type (map, r_type, 1);
-- 
2.38.1


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

* Re: [PATCH v3 1/2] scripts: Add "|" operator support to glibcpp's parsing
  2022-11-27 17:38   ` [PATCH v3 1/2] scripts: Add "|" operator support to glibcpp's parsing Shahab Vahedi via Libc-alpha
@ 2022-11-27 18:21     ` Florian Weimer via Libc-alpha
  2022-11-30  2:11       ` Vineet Gupta via Libc-alpha
  0 siblings, 1 reply; 12+ messages in thread
From: Florian Weimer via Libc-alpha @ 2022-11-27 18:21 UTC (permalink / raw)
  To: Shahab Vahedi; +Cc: libc-alpha, Claudiu Zissulescu, arcml

* Shahab Vahedi:

> From the tests point of view, this is a necessary step for another
> patch [1] and allows parsing macros such as "#define A | B".  Without
> it, a few tests [2] choke when the other patch [1] is applied:
>
> /src/glibc/scripts/../elf/elf.h:4167: error: uninterpretable macro
> token sequence: ( EF_ARC_MACH_MSK | EF_ARC_OSABI_MSK )
> Traceback (most recent call last):
>     File "/src/glibc/elf/tst-glibcelf.py", line 23, in <module>
>       import glibcelf
>     File "/src/glibc/scripts/glibcelf.py", line 226, in <module>
>       _elf_h = _parse_elf_h()
>                ^^^^^^^^^^^^^^
>     File "/src/glibc/scripts/glibcelf.py", line 223, in _parse_elf_h
>       raise IOError('parse error in elf.h')
>   OSError: parse error in elf.h
>
> [1] ARC: update definitions in elf/elf.h
> https://sourceware.org/pipermail/libc-alpha/2022-November/143503.html
>
> [2]
> tst-glibcelf, tst-relro-ldso, and tst-relro-libc
>
> Signed-off-by: Shahab Vahedi <shahab@synopsys.com>

This okay and can go in separately, thanks.

Reviewed-by: Florian Weimer <fweimer@redhat.com>

Florian


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

* Re: [PATCH v3 1/2] scripts: Add "|" operator support to glibcpp's parsing
  2022-11-27 18:21     ` Florian Weimer via Libc-alpha
@ 2022-11-30  2:11       ` Vineet Gupta via Libc-alpha
  0 siblings, 0 replies; 12+ messages in thread
From: Vineet Gupta via Libc-alpha @ 2022-11-30  2:11 UTC (permalink / raw)
  To: Florian Weimer, Shahab Vahedi; +Cc: libc-alpha, Claudiu Zissulescu, arcml

On 11/27/22 10:21, Florian Weimer via Libc-alpha wrote:
> * Shahab Vahedi:
> 
>>  From the tests point of view, this is a necessary step for another
>> patch [1] and allows parsing macros such as "#define A | B".  Without
>> it, a few tests [2] choke when the other patch [1] is applied:
>>
>> /src/glibc/scripts/../elf/elf.h:4167: error: uninterpretable macro
>> token sequence: ( EF_ARC_MACH_MSK | EF_ARC_OSABI_MSK )
>> Traceback (most recent call last):
>>      File "/src/glibc/elf/tst-glibcelf.py", line 23, in <module>
>>        import glibcelf
>>      File "/src/glibc/scripts/glibcelf.py", line 226, in <module>
>>        _elf_h = _parse_elf_h()
>>                 ^^^^^^^^^^^^^^
>>      File "/src/glibc/scripts/glibcelf.py", line 223, in _parse_elf_h
>>        raise IOError('parse error in elf.h')
>>    OSError: parse error in elf.h
>>
>> [1] ARC: update definitions in elf/elf.h
>> https://sourceware.org/pipermail/libc-alpha/2022-November/143503.html
>>
>> [2]
>> tst-glibcelf, tst-relro-ldso, and tst-relro-libc
>>
>> Signed-off-by: Shahab Vahedi <shahab@synopsys.com>
> 
> This okay and can go in separately, thanks.
> 
> Reviewed-by: Florian Weimer <fweimer@redhat.com>

Committed !

Thx,
-Vineet

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

* Re: [PATCH v3 2/2] ARC: update definitions in elf/elf.h
  2022-11-27 17:38   ` [PATCH v3 2/2] ARC: update definitions in elf/elf.h Shahab Vahedi via Libc-alpha
@ 2022-11-30  2:11     ` Vineet Gupta via Libc-alpha
  0 siblings, 0 replies; 12+ messages in thread
From: Vineet Gupta via Libc-alpha @ 2022-11-30  2:11 UTC (permalink / raw)
  To: Shahab Vahedi, libc-alpha; +Cc: Florian Weimer, Claudiu Zissulescu, arcml

On 11/27/22 09:38, Shahab Vahedi via Libc-alpha wrote:
> While porting ARCv2 to elfutils [1], it was brought up that the
> necessary changes to the project's libelf/elf.h must come from
> glibc, because they sync it from glibc [2].  Therefore, this patch
> is to update ARC entries in elf/elf.h.
> 
> The majority of the update is about adding new definitions,
> specially for the relocations.  However, there is one rename, one
> deletion, and one change:
> 
> - R_ARC_JUMP_SLOT renamed to R_ARC_JMP_SLOT to match binutils.
> - R_ARC_B26 removed because it is unused and deprecated.
> - R_ARC_TLS_DTPOFF_S9 changed from 0x4a to the correct value 0x49.
> 
> Finally, a specific SHT class for ARC has been added to glibcelf.py.
> Else, it would result in a collision:
> 
>    _register_elf_h(Sht, ranges=True,
>   File "/src/glibc/scripts/glibcelf.py", line x, in _register_elf_h
>     raise ValueError('duplicate value {}: {}, {}'.format(
>                      ValueError: duplicate value 1879048193:
>                      SHT_ARC_ATTRIBUTES, SHT_X86_64_UNWIND
> 
> [1]
> https://sourceware.org/pipermail/elfutils-devel/2022q4/005530.html
> 
> [2]
> https://sourceware.org/pipermail/elfutils-devel/2022q4/005548.html
> 
> No regression has been observed after applying this patch.  Below
> follows the result:
> 
> UNSUPPORTED: crypt/cert
> UNSUPPORTED: elf/tst-audit22
> FAIL: elf/tst-audit25a
> FAIL: elf/tst-audit25b
> FAIL: elf/tst-bz15311
> FAIL: elf/tst-bz28937
> FAIL: elf/tst-dlmopen4
> UNSUPPORTED: elf/tst-dlopen-self-container
> UNSUPPORTED: elf/tst-dlopen-tlsmodid-container
> UNSUPPORTED: elf/tst-glibc-hwcaps-prepend-cache
> UNSUPPORTED: elf/tst-ldconfig-bad-aux-cache
> UNSUPPORTED: elf/tst-ldconfig-ld_so_conf-update
> UNSUPPORTED: elf/tst-pldd
> UNSUPPORTED: elf/tst-preload-pthread-libc
> XPASS: elf/tst-protected1a
> XPASS: elf/tst-protected1b
> FAIL: elf/tst-tls-allocation-failure-static-patched
> FAIL: elf/tst-tls1
> FAIL: elf/tst-tls3
> FAIL: elf/tst-tlsalign-extern
> UNSUPPORTED: elf/tst-valgrind-smoke
> UNSUPPORTED: grp/tst-initgroups1
> UNSUPPORTED: grp/tst-initgroups2
> UNSUPPORTED: io/tst-getcwd-smallbuff
> UNSUPPORTED: locale/tst-localedef-path-norm
> FAIL: localedata/sort-test
> UNSUPPORTED: localedata/tst-localedef-hardlinks
> FAIL: malloc/tst-malloc-thread-fail-malloc-check
> FAIL: malloc/tst-malloc_info-malloc-check
> UNSUPPORTED: math/test-fesetexcept-traps
> UNSUPPORTED: math/test-fexcept-traps
> UNSUPPORTED: math/test-nearbyint-except
> UNSUPPORTED: math/test-nearbyint-except-2
> UNSUPPORTED: misc/tst-adjtimex
> UNSUPPORTED: misc/tst-clock_adjtime
> FAIL: misc/tst-misalign-clone
> FAIL: misc/tst-misalign-clone-internal
> UNSUPPORTED: misc/tst-ntp_adjtime
> UNSUPPORTED: misc/tst-pkey
> UNSUPPORTED: misc/tst-rseq
> UNSUPPORTED: misc/tst-rseq-disable
> UNSUPPORTED: misc/tst-syslog
> UNSUPPORTED: misc/tst-ttyname
> FAIL: nptl/test-cond-printers
> FAIL: nptl/test-condattr-printers
> FAIL: nptl/test-mutex-printers
> FAIL: nptl/test-mutexattr-printers
> FAIL: nptl/test-rwlock-printers
> FAIL: nptl/test-rwlockattr-printers
> UNSUPPORTED: nptl/tst-pthread-gdb-attach
> UNSUPPORTED: nptl/tst-pthread-gdb-attach-static
> UNSUPPORTED: nptl/tst-pthread-getattr
> UNSUPPORTED: nptl/tst-rseq-nptl
> UNSUPPORTED: nss/tst-nss-compat1
> UNSUPPORTED: nss/tst-nss-db-endgrent
> UNSUPPORTED: nss/tst-nss-db-endpwent
> UNSUPPORTED: nss/tst-nss-files-hosts-long
> UNSUPPORTED: nss/tst-nss-gai-actions
> UNSUPPORTED: nss/tst-nss-test3
> UNSUPPORTED: nss/tst-reload1
> UNSUPPORTED: nss/tst-reload2
> UNSUPPORTED: posix/bug-ga2
> UNSUPPORTED: posix/bug-ga2-mem
> FAIL: posix/globtest
> UNSUPPORTED: posix/tst-vfork3
> UNSUPPORTED: posix/tst-vfork3-mem
> UNSUPPORTED: resolv/mtrace-tst-leaks2
> UNSUPPORTED: resolv/tst-leaks2
> UNSUPPORTED: resolv/tst-resolv-ai_idn
> UNSUPPORTED: resolv/tst-resolv-ai_idn-latin1
> UNSUPPORTED: resolv/tst-resolv-res_init
> UNSUPPORTED: resolv/tst-resolv-res_init-thread
> UNSUPPORTED: rt/tst-bz28213
> UNSUPPORTED: rt/tst-mqueue1
> UNSUPPORTED: rt/tst-mqueue10
> UNSUPPORTED: rt/tst-mqueue2
> UNSUPPORTED: rt/tst-mqueue3
> UNSUPPORTED: rt/tst-mqueue4
> UNSUPPORTED: rt/tst-mqueue5
> UNSUPPORTED: rt/tst-mqueue6
> UNSUPPORTED: rt/tst-mqueue8
> UNSUPPORTED: rt/tst-mqueue8x
> UNSUPPORTED: rt/tst-mqueue9
> UNSUPPORTED: stdlib/test-bz22786
> UNSUPPORTED: stdlib/tst-system
> UNSUPPORTED: string/test-bcopy
> UNSUPPORTED: string/test-memmove
> UNSUPPORTED: string/tst-memmove-overflow
> UNSUPPORTED: string/tst-strerror
> UNSUPPORTED: string/tst-strsignal
> UNSUPPORTED: time/tst-clock_settime
> UNSUPPORTED: time/tst-settimeofday
> Summary of test results:
>       21 FAIL
>     4184 PASS
>       69 UNSUPPORTED
>       16 XFAIL
>        2 XPASS
> 
> Signed-off-by: Shahab Vahedi<shahab@synopsys.com>
> ---

Committed !

Thx,
-Vineet

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

end of thread, other threads:[~2022-11-30  2:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-18 13:15 [PATCH] ARC: update definitions in elf/elf.h Shahab Vahedi via Libc-alpha
2022-11-19  0:34 ` Vineet Gupta via Libc-alpha
2022-11-21 13:07   ` Shahab Vahedi via Libc-alpha
2022-11-21 13:06 ` [PATCH v2] " Shahab Vahedi via Libc-alpha
2022-11-21 14:30   ` Adhemerval Zanella Netto via Libc-alpha
2022-11-23  4:13     ` Vineet Gupta via Libc-alpha
2022-11-27 17:38 ` [PATCH v3 0/2] Update ARC " Shahab Vahedi via Libc-alpha
2022-11-27 17:38   ` [PATCH v3 1/2] scripts: Add "|" operator support to glibcpp's parsing Shahab Vahedi via Libc-alpha
2022-11-27 18:21     ` Florian Weimer via Libc-alpha
2022-11-30  2:11       ` Vineet Gupta via Libc-alpha
2022-11-27 17:38   ` [PATCH v3 2/2] ARC: update definitions in elf/elf.h Shahab Vahedi via Libc-alpha
2022-11-30  2:11     ` Vineet Gupta via Libc-alpha

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).