* [PATCH v3 0/6] elf.h: Fix and cleanup the RISC-V defines
@ 2023-05-01 23:47 Palmer Dabbelt
2023-05-01 23:47 ` [PATCH v3 1/6] elf.h, scripts: Don't error on duplicate DT_RISCV_NUM Palmer Dabbelt
` (5 more replies)
0 siblings, 6 replies; 9+ messages in thread
From: Palmer Dabbelt @ 2023-05-01 23:47 UTC (permalink / raw)
To: maskray, joseph; +Cc: libc-alpha
Sorry for all the churn over the weekend, this one actually does fix the
issues (at least on my machine). I also went ahead and reordered the
RISC-V defines that were different that MIPS.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 1/6] elf.h, scripts: Don't error on duplicate DT_RISCV_NUM
2023-05-01 23:47 [PATCH v3 0/6] elf.h: Fix and cleanup the RISC-V defines Palmer Dabbelt
@ 2023-05-01 23:47 ` Palmer Dabbelt
2023-05-03 12:54 ` Andreas Schwab
2023-05-01 23:47 ` [PATCH v3 2/6] elf.h: Remove duplicate STO_RISCV_VARIANT_CC Palmer Dabbelt
` (4 subsequent siblings)
5 siblings, 1 reply; 9+ messages in thread
From: Palmer Dabbelt @ 2023-05-01 23:47 UTC (permalink / raw)
To: maskray, joseph; +Cc: libc-alpha, Palmer Dabbelt
DT_RISCV_NUM is just the count of d_tag entries, so it's OK if it has
the same value as some other entry. Other architectures allow this
duplication, do so for RISC-V as well.
Reported-by: Joseph S. Myers <joseph@codesourcery.com>
Fixes: 117e8b341c ("riscv: Resolve symbols directly for symbols with STO_RISCV_VARIANT_CC.")
Link: https://inbox.sourceware.org/libc-alpha/mhng-0d9fb5a0-63fa-4b02-8029-7c20232f39ee@palmer-ri-x1c9/T/#t
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
---
elf/tst-glibcelf.py | 1 +
scripts/glibcelf.py | 1 +
2 files changed, 2 insertions(+)
diff --git a/elf/tst-glibcelf.py b/elf/tst-glibcelf.py
index 6142ca28ae..41d1b18022 100644
--- a/elf/tst-glibcelf.py
+++ b/elf/tst-glibcelf.py
@@ -182,6 +182,7 @@ DT_NUM
DT_PPC64_NUM
DT_PPC_NUM
DT_PROCNUM
+DT_RISCV_NUM
DT_SPARC_NUM
DT_VALNUM
DT_VALRNGHI
diff --git a/scripts/glibcelf.py b/scripts/glibcelf.py
index 6f48eee129..9d36ea60cd 100644
--- a/scripts/glibcelf.py
+++ b/scripts/glibcelf.py
@@ -450,6 +450,7 @@ DT_IA_64_NUM
DT_MIPS_NUM
DT_PPC_NUM
DT_PPC64_NUM
+DT_RISCV_NUM
DT_SPARC_NUM
'''.strip().split()
_register_elf_h(DtAARCH64, prefix='DT_AARCH64_', skip=_dt_skip, parent=Dt)
--
2.40.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 2/6] elf.h: Remove duplicate STO_RISCV_VARIANT_CC
2023-05-01 23:47 [PATCH v3 0/6] elf.h: Fix and cleanup the RISC-V defines Palmer Dabbelt
2023-05-01 23:47 ` [PATCH v3 1/6] elf.h, scripts: Don't error on duplicate DT_RISCV_NUM Palmer Dabbelt
@ 2023-05-01 23:47 ` Palmer Dabbelt
2023-05-01 23:47 ` [PATCH v3 3/6] elf.h: Remove duplicate DT_RISCV_VARIANT_CC Palmer Dabbelt
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Palmer Dabbelt @ 2023-05-01 23:47 UTC (permalink / raw)
To: maskray, joseph; +Cc: libc-alpha, Palmer Dabbelt
I missed the update from last year that included these already, having
duplicates breaks the build due to redefinition errors like
elf/elf.h:4013: error: macro STO_RISCV_VARIANT_CC redefined
elf.h:3941: note: location of previous definition
Reported-by: Joseph S. Myers <joseph@codesourcery.com>
Fixes: 117e8b341c ("riscv: Resolve symbols directly for symbols with STO_RISCV_VARIANT_CC.")
Link: https://inbox.sourceware.org/libc-alpha/mhng-0d9fb5a0-63fa-4b02-8029-7c20232f39ee@palmer-ri-x1c9/T/#t
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
---
elf/elf.h | 3 ---
1 file changed, 3 deletions(-)
diff --git a/elf/elf.h b/elf/elf.h
index 4f65b5a32d..0cbd4510c6 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -3937,9 +3937,6 @@ enum
#define DT_RISCV_VARIANT_CC (DT_LOPROC + 1)
#define DT_RISCV_NUM 2
-/* RISC-V specific values for the st_other field. */
-#define STO_RISCV_VARIANT_CC 0x80
-
/* RISC-V ELF Flags */
#define EF_RISCV_RVC 0x0001
#define EF_RISCV_FLOAT_ABI 0x0006
--
2.40.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 3/6] elf.h: Remove duplicate DT_RISCV_VARIANT_CC
2023-05-01 23:47 [PATCH v3 0/6] elf.h: Fix and cleanup the RISC-V defines Palmer Dabbelt
2023-05-01 23:47 ` [PATCH v3 1/6] elf.h, scripts: Don't error on duplicate DT_RISCV_NUM Palmer Dabbelt
2023-05-01 23:47 ` [PATCH v3 2/6] elf.h: Remove duplicate STO_RISCV_VARIANT_CC Palmer Dabbelt
@ 2023-05-01 23:47 ` Palmer Dabbelt
2023-05-01 23:47 ` [PATCH v3 4/6] elf.h: Reorder DT_RISCV_* Palmer Dabbelt
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Palmer Dabbelt @ 2023-05-01 23:47 UTC (permalink / raw)
To: maskray, joseph; +Cc: libc-alpha, Palmer Dabbelt
I missed the update from last year that included these already, having
duplicates breaks the build due to redefinition errors like
elf/elf.h:4023: error: macro DT_RISCV_VARIANT_CC redefined
elf/elf.h:3937: note: location of previous definition
Reported-by: Joseph S. Myers <joseph@codesourcery.com>
Fixes: 117e8b341c ("riscv: Resolve symbols directly for symbols with STO_RISCV_VARIANT_CC.")
Link: https://inbox.sourceware.org/libc-alpha/mhng-0d9fb5a0-63fa-4b02-8029-7c20232f39ee@palmer-ri-x1c9/T/#t
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
---
elf/elf.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/elf/elf.h b/elf/elf.h
index 0cbd4510c6..4c61d3a5ee 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -3934,7 +3934,6 @@ enum
#define R_TILEGX_NUM 130
/* RISC-V specific values for the Dyn d_tag field. */
-#define DT_RISCV_VARIANT_CC (DT_LOPROC + 1)
#define DT_RISCV_NUM 2
/* RISC-V ELF Flags */
--
2.40.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 4/6] elf.h: Reorder DT_RISCV_*
2023-05-01 23:47 [PATCH v3 0/6] elf.h: Fix and cleanup the RISC-V defines Palmer Dabbelt
` (2 preceding siblings ...)
2023-05-01 23:47 ` [PATCH v3 3/6] elf.h: Remove duplicate DT_RISCV_VARIANT_CC Palmer Dabbelt
@ 2023-05-01 23:47 ` Palmer Dabbelt
2023-05-02 3:51 ` Fangrui Song
2023-05-01 23:47 ` [PATCH v3 5/6] elf.h: Reorder SHT_RISCV_* Palmer Dabbelt
2023-05-01 23:47 ` [PATCH v3 6/6] elf.h: Reorder PT_RISCV_* Palmer Dabbelt
5 siblings, 1 reply; 9+ messages in thread
From: Palmer Dabbelt @ 2023-05-01 23:47 UTC (permalink / raw)
To: maskray, joseph; +Cc: libc-alpha, Palmer Dabbelt
These match the MIPS ordering.
Reported-by: Fangrui Song <maskray@google.com>
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
---
elf/elf.h | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/elf/elf.h b/elf/elf.h
index 4c61d3a5ee..f9d169e4e2 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -3933,9 +3933,6 @@ enum
#define R_TILEGX_NUM 130
-/* RISC-V specific values for the Dyn d_tag field. */
-#define DT_RISCV_NUM 2
-
/* RISC-V ELF Flags */
#define EF_RISCV_RVC 0x0001
#define EF_RISCV_FLOAT_ABI 0x0006
@@ -4017,6 +4014,7 @@ enum
/* RISC-V specific values for the d_tag field. */
#define DT_RISCV_VARIANT_CC (DT_LOPROC + 1)
+#define DT_RISCV_NUM 2
/* BPF specific declarations. */
--
2.40.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 5/6] elf.h: Reorder SHT_RISCV_*
2023-05-01 23:47 [PATCH v3 0/6] elf.h: Fix and cleanup the RISC-V defines Palmer Dabbelt
` (3 preceding siblings ...)
2023-05-01 23:47 ` [PATCH v3 4/6] elf.h: Reorder DT_RISCV_* Palmer Dabbelt
@ 2023-05-01 23:47 ` Palmer Dabbelt
2023-05-01 23:47 ` [PATCH v3 6/6] elf.h: Reorder PT_RISCV_* Palmer Dabbelt
5 siblings, 0 replies; 9+ messages in thread
From: Palmer Dabbelt @ 2023-05-01 23:47 UTC (permalink / raw)
To: maskray, joseph; +Cc: libc-alpha, Palmer Dabbelt
These match the MIPS ordering.
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
---
elf/elf.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/elf/elf.h b/elf/elf.h
index f9d169e4e2..f4627a3b4f 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -4002,13 +4002,13 @@ enum
#define R_RISCV_NUM 59
+/* RISC-V specific values for the sh_type field. */
+#define SHT_RISCV_ATTRIBUTES (SHT_LOPROC + 3)
+
/* RISC-V specific values for the st_other field. */
#define STO_RISCV_VARIANT_CC 0x80 /* Function uses variant calling
convention */
-/* RISC-V specific values for the sh_type field. */
-#define SHT_RISCV_ATTRIBUTES (SHT_LOPROC + 3)
-
/* RISC-V specific values for the p_type field. */
#define PT_RISCV_ATTRIBUTES (PT_LOPROC + 3)
--
2.40.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 6/6] elf.h: Reorder PT_RISCV_*
2023-05-01 23:47 [PATCH v3 0/6] elf.h: Fix and cleanup the RISC-V defines Palmer Dabbelt
` (4 preceding siblings ...)
2023-05-01 23:47 ` [PATCH v3 5/6] elf.h: Reorder SHT_RISCV_* Palmer Dabbelt
@ 2023-05-01 23:47 ` Palmer Dabbelt
5 siblings, 0 replies; 9+ messages in thread
From: Palmer Dabbelt @ 2023-05-01 23:47 UTC (permalink / raw)
To: maskray, joseph; +Cc: libc-alpha, Palmer Dabbelt
These match the MIPS ordering.
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
---
elf/elf.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/elf/elf.h b/elf/elf.h
index f4627a3b4f..0b35354dbe 100644
--- a/elf/elf.h
+++ b/elf/elf.h
@@ -4002,6 +4002,9 @@ enum
#define R_RISCV_NUM 59
+/* RISC-V specific values for the p_type field. */
+#define PT_RISCV_ATTRIBUTES (PT_LOPROC + 3)
+
/* RISC-V specific values for the sh_type field. */
#define SHT_RISCV_ATTRIBUTES (SHT_LOPROC + 3)
@@ -4009,9 +4012,6 @@ enum
#define STO_RISCV_VARIANT_CC 0x80 /* Function uses variant calling
convention */
-/* RISC-V specific values for the p_type field. */
-#define PT_RISCV_ATTRIBUTES (PT_LOPROC + 3)
-
/* RISC-V specific values for the d_tag field. */
#define DT_RISCV_VARIANT_CC (DT_LOPROC + 1)
#define DT_RISCV_NUM 2
--
2.40.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 4/6] elf.h: Reorder DT_RISCV_*
2023-05-01 23:47 ` [PATCH v3 4/6] elf.h: Reorder DT_RISCV_* Palmer Dabbelt
@ 2023-05-02 3:51 ` Fangrui Song
0 siblings, 0 replies; 9+ messages in thread
From: Fangrui Song @ 2023-05-02 3:51 UTC (permalink / raw)
To: Palmer Dabbelt; +Cc: joseph, libc-alpha
On Mon, May 1, 2023 at 4:48 PM Palmer Dabbelt <palmer@rivosinc.com> wrote:
>
> These match the MIPS ordering.
>
> Reported-by: Fangrui Song <maskray@google.com>
> Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
If you push a revert for 117e8b341c5c0ace8d65feeef136fececb3fdc9c
instead, the "Remove duplicate" patches in this series can be avoided.
You may combine the "Reorder .." patches as well.
(Feel free to remove "Reported-by: Fangrui Song", the information may
not be useful in a commit message...)
Reviewed-by: Fangrui Song <maskray@google.com>
> ---
> elf/elf.h | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/elf/elf.h b/elf/elf.h
> index 4c61d3a5ee..f9d169e4e2 100644
> --- a/elf/elf.h
> +++ b/elf/elf.h
> @@ -3933,9 +3933,6 @@ enum
>
> #define R_TILEGX_NUM 130
>
> -/* RISC-V specific values for the Dyn d_tag field. */
> -#define DT_RISCV_NUM 2
> -
> /* RISC-V ELF Flags */
> #define EF_RISCV_RVC 0x0001
> #define EF_RISCV_FLOAT_ABI 0x0006
> @@ -4017,6 +4014,7 @@ enum
>
> /* RISC-V specific values for the d_tag field. */
> #define DT_RISCV_VARIANT_CC (DT_LOPROC + 1)
> +#define DT_RISCV_NUM 2
>
> /* BPF specific declarations. */
>
> --
> 2.40.0
>
--
宋方睿
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 1/6] elf.h, scripts: Don't error on duplicate DT_RISCV_NUM
2023-05-01 23:47 ` [PATCH v3 1/6] elf.h, scripts: Don't error on duplicate DT_RISCV_NUM Palmer Dabbelt
@ 2023-05-03 12:54 ` Andreas Schwab
0 siblings, 0 replies; 9+ messages in thread
From: Andreas Schwab @ 2023-05-03 12:54 UTC (permalink / raw)
To: Palmer Dabbelt; +Cc: maskray, joseph, libc-alpha
Ok.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-05-03 12:54 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-01 23:47 [PATCH v3 0/6] elf.h: Fix and cleanup the RISC-V defines Palmer Dabbelt
2023-05-01 23:47 ` [PATCH v3 1/6] elf.h, scripts: Don't error on duplicate DT_RISCV_NUM Palmer Dabbelt
2023-05-03 12:54 ` Andreas Schwab
2023-05-01 23:47 ` [PATCH v3 2/6] elf.h: Remove duplicate STO_RISCV_VARIANT_CC Palmer Dabbelt
2023-05-01 23:47 ` [PATCH v3 3/6] elf.h: Remove duplicate DT_RISCV_VARIANT_CC Palmer Dabbelt
2023-05-01 23:47 ` [PATCH v3 4/6] elf.h: Reorder DT_RISCV_* Palmer Dabbelt
2023-05-02 3:51 ` Fangrui Song
2023-05-01 23:47 ` [PATCH v3 5/6] elf.h: Reorder SHT_RISCV_* Palmer Dabbelt
2023-05-01 23:47 ` [PATCH v3 6/6] elf.h: Reorder PT_RISCV_* Palmer Dabbelt
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).