sparclinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] sparc/module: R_SPARC_UA64 handling to help with LLVM IAS enablement
@ 2025-06-09 13:53 Koakuma via B4 Relay
  2025-06-09 13:53 ` [PATCH 1/2] sparc/module: Add R_SPARC_UA64 relocation handling Koakuma via B4 Relay
  2025-06-09 13:53 ` [PATCH 2/2] sparc/module: Make it clear that relocation numbers are shown in hex Koakuma via B4 Relay
  0 siblings, 2 replies; 7+ messages in thread
From: Koakuma via B4 Relay @ 2025-06-09 13:53 UTC (permalink / raw)
  To: David S. Miller, Andreas Larsson, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt
  Cc: sparclinux, linux-kernel, llvm, Koakuma

Hello~

This series lets the module loader handle R_SPARC_UA64, which is emitted
by LLVM's IAS in certain conditions. Additionally, I put on a small change
to the error log to make it clearer that the printed relocation number
is in hex.

The intention is to get both the kernel and LLVM in a state where
doing a clang+IAS build is possible.

As with before, on the LLVM side the project is tracked here:
https://github.com/llvm/llvm-project/issues/40792

Signed-off-by: Koakuma <koachan@protonmail.com>
---
Koakuma (2):
      sparc/module: Add R_SPARC_UA64 relocation handling
      sparc/module: Make it clear that relocation numbers are shown in hex

 arch/sparc/include/asm/elf_64.h | 1 +
 arch/sparc/kernel/module.c      | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)
---
base-commit: 19272b37aa4f83ca52bdf9c16d5d81bdd1354494
change-id: 20250305-b4-sparc-relocs-65ac77ca8920

Best regards,
-- 
Koakuma <koachan@protonmail.com>



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

* [PATCH 1/2] sparc/module: Add R_SPARC_UA64 relocation handling
  2025-06-09 13:53 [PATCH 0/2] sparc/module: R_SPARC_UA64 handling to help with LLVM IAS enablement Koakuma via B4 Relay
@ 2025-06-09 13:53 ` Koakuma via B4 Relay
  2025-08-03  1:15   ` Koakuma
  2025-06-09 13:53 ` [PATCH 2/2] sparc/module: Make it clear that relocation numbers are shown in hex Koakuma via B4 Relay
  1 sibling, 1 reply; 7+ messages in thread
From: Koakuma via B4 Relay @ 2025-06-09 13:53 UTC (permalink / raw)
  To: David S. Miller, Andreas Larsson, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt
  Cc: sparclinux, linux-kernel, llvm, Koakuma

From: Koakuma <koachan@protonmail.com>

This is needed so that the kernel can handle R_SPARC_UA64 relocations,
which is emitted by LLVM's IAS.

Signed-off-by: Koakuma <koachan@protonmail.com>
---
 arch/sparc/include/asm/elf_64.h | 1 +
 arch/sparc/kernel/module.c      | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/sparc/include/asm/elf_64.h b/arch/sparc/include/asm/elf_64.h
index 8fb09eec8c3e796a9a79aa0a7877842ceb7ea6d3..694ed081cf8d99adf70be25e5dc0e30a45f70398 100644
--- a/arch/sparc/include/asm/elf_64.h
+++ b/arch/sparc/include/asm/elf_64.h
@@ -58,6 +58,7 @@
 #define R_SPARC_7		43
 #define R_SPARC_5		44
 #define R_SPARC_6		45
+#define R_SPARC_UA64		54
 
 /* Bits present in AT_HWCAP, primarily for Sparc32.  */
 #define HWCAP_SPARC_FLUSH       0x00000001
diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c
index b8c51cc23d96944037494f13d2d65a43bb187729..6e3d4dde4f9ab33040b300c40d5fd5d0584e166d 100644
--- a/arch/sparc/kernel/module.c
+++ b/arch/sparc/kernel/module.c
@@ -87,6 +87,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
 			break;
 #ifdef CONFIG_SPARC64
 		case R_SPARC_64:
+		case R_SPARC_UA64:
 			location[0] = v >> 56;
 			location[1] = v >> 48;
 			location[2] = v >> 40;

-- 
2.49.0



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

* [PATCH 2/2] sparc/module: Make it clear that relocation numbers are shown in hex
  2025-06-09 13:53 [PATCH 0/2] sparc/module: R_SPARC_UA64 handling to help with LLVM IAS enablement Koakuma via B4 Relay
  2025-06-09 13:53 ` [PATCH 1/2] sparc/module: Add R_SPARC_UA64 relocation handling Koakuma via B4 Relay
@ 2025-06-09 13:53 ` Koakuma via B4 Relay
  1 sibling, 0 replies; 7+ messages in thread
From: Koakuma via B4 Relay @ 2025-06-09 13:53 UTC (permalink / raw)
  To: David S. Miller, Andreas Larsson, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt
  Cc: sparclinux, linux-kernel, llvm, Koakuma

From: Koakuma <koachan@protonmail.com>

This is to ease debugging by removing the ambiguity of the shown
number base.

Signed-off-by: Koakuma <koachan@protonmail.com>
---
 arch/sparc/kernel/module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c
index 6e3d4dde4f9ab33040b300c40d5fd5d0584e166d..49740450a6859fda566459ee4679869f9854b760 100644
--- a/arch/sparc/kernel/module.c
+++ b/arch/sparc/kernel/module.c
@@ -142,7 +142,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
 			break;
 
 		default:
-			printk(KERN_ERR "module %s: Unknown relocation: %x\n",
+			printk(KERN_ERR "module %s: Unknown relocation: 0x%x\n",
 			       me->name,
 			       (int) (ELF_R_TYPE(rel[i].r_info) & 0xff));
 			return -ENOEXEC;

-- 
2.49.0



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

* Re: [PATCH 1/2] sparc/module: Add R_SPARC_UA64 relocation handling
  2025-06-09 13:53 ` [PATCH 1/2] sparc/module: Add R_SPARC_UA64 relocation handling Koakuma via B4 Relay
@ 2025-08-03  1:15   ` Koakuma
  2025-08-14 22:40     ` Nathan Chancellor
  0 siblings, 1 reply; 7+ messages in thread
From: Koakuma @ 2025-08-03  1:15 UTC (permalink / raw)
  To: koachan
  Cc: David S. Miller, Andreas Larsson, Nathan Chancellor,
	Nick Desaulniers, Bill Wendling, Justin Stitt, sparclinux,
	linux-kernel, llvm

Koakuma via B4 Relay <devnull+koachan.protonmail.com@kernel.org> wrote:

> From: Koakuma koachan@protonmail.com
> 
> 
> This is needed so that the kernel can handle R_SPARC_UA64 relocations,
> which is emitted by LLVM's IAS.
> 
> Signed-off-by: Koakuma koachan@protonmail.com
> 
> ---
> arch/sparc/include/asm/elf_64.h | 1 +
> arch/sparc/kernel/module.c | 1 +
> 2 files changed, 2 insertions(+)
> 
> diff --git a/arch/sparc/include/asm/elf_64.h b/arch/sparc/include/asm/elf_64.h
> index 8fb09eec8c3e796a9a79aa0a7877842ceb7ea6d3..694ed081cf8d99adf70be25e5dc0e30a45f70398 100644
> --- a/arch/sparc/include/asm/elf_64.h
> +++ b/arch/sparc/include/asm/elf_64.h
> @@ -58,6 +58,7 @@
> #define R_SPARC_7 43
> #define R_SPARC_5 44
> #define R_SPARC_6 45
> +#define R_SPARC_UA64 54
> 
> /* Bits present in AT_HWCAP, primarily for Sparc32. */
> #define HWCAP_SPARC_FLUSH 0x00000001
> diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c
> index b8c51cc23d96944037494f13d2d65a43bb187729..6e3d4dde4f9ab33040b300c40d5fd5d0584e166d 100644
> --- a/arch/sparc/kernel/module.c
> +++ b/arch/sparc/kernel/module.c
> @@ -87,6 +87,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
> break;
> #ifdef CONFIG_SPARC64
> case R_SPARC_64:
> + case R_SPARC_UA64:
> location[0] = v >> 56;
> 
> location[1] = v >> 48;
> 
> location[2] = v >> 40;
> 
> 
> --
> 2.49.0

Ping. Is there anything else I should do for this?

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

* Re: [PATCH 1/2] sparc/module: Add R_SPARC_UA64 relocation handling
  2025-08-03  1:15   ` Koakuma
@ 2025-08-14 22:40     ` Nathan Chancellor
  2025-08-15  9:30       ` Andreas Larsson
  2025-08-18 16:17       ` Koakuma
  0 siblings, 2 replies; 7+ messages in thread
From: Nathan Chancellor @ 2025-08-14 22:40 UTC (permalink / raw)
  To: Koakuma
  Cc: David S. Miller, Andreas Larsson, Nick Desaulniers, Bill Wendling,
	Justin Stitt, sparclinux, linux-kernel, llvm

On Sun, Aug 03, 2025 at 01:15:02AM +0000, Koakuma wrote:
> Koakuma via B4 Relay <devnull+koachan.protonmail.com@kernel.org> wrote:
> 
> > From: Koakuma koachan@protonmail.com
> > 
> > 
> > This is needed so that the kernel can handle R_SPARC_UA64 relocations,
> > which is emitted by LLVM's IAS.
> > 
> > Signed-off-by: Koakuma koachan@protonmail.com
> > 
> > ---
> > arch/sparc/include/asm/elf_64.h | 1 +
> > arch/sparc/kernel/module.c | 1 +
> > 2 files changed, 2 insertions(+)
> > 
> > diff --git a/arch/sparc/include/asm/elf_64.h b/arch/sparc/include/asm/elf_64.h
> > index 8fb09eec8c3e796a9a79aa0a7877842ceb7ea6d3..694ed081cf8d99adf70be25e5dc0e30a45f70398 100644
> > --- a/arch/sparc/include/asm/elf_64.h
> > +++ b/arch/sparc/include/asm/elf_64.h
> > @@ -58,6 +58,7 @@
> > #define R_SPARC_7 43
> > #define R_SPARC_5 44
> > #define R_SPARC_6 45
> > +#define R_SPARC_UA64 54
> > 
> > /* Bits present in AT_HWCAP, primarily for Sparc32. */
> > #define HWCAP_SPARC_FLUSH 0x00000001
> > diff --git a/arch/sparc/kernel/module.c b/arch/sparc/kernel/module.c
> > index b8c51cc23d96944037494f13d2d65a43bb187729..6e3d4dde4f9ab33040b300c40d5fd5d0584e166d 100644
> > --- a/arch/sparc/kernel/module.c
> > +++ b/arch/sparc/kernel/module.c
> > @@ -87,6 +87,7 @@ int apply_relocate_add(Elf_Shdr *sechdrs,
> > break;
> > #ifdef CONFIG_SPARC64
> > case R_SPARC_64:
> > + case R_SPARC_UA64:
> > location[0] = v >> 56;
> > 
> > location[1] = v >> 48;
> > 
> > location[2] = v >> 40;
> > 
> > 
> > --
> > 2.49.0
> 
> Ping. Is there anything else I should do for this?
> 

This seems reasonable to me, sorry for the delay in commenting. I would
expect this to go via the SPARC tree but if they are too busy or
unavailable to pick this up, we would try to route it via Andrew Morton.
Is there more work needed for the integrated assembler other than this
series?

Cheers,
Nathan

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

* Re: [PATCH 1/2] sparc/module: Add R_SPARC_UA64 relocation handling
  2025-08-14 22:40     ` Nathan Chancellor
@ 2025-08-15  9:30       ` Andreas Larsson
  2025-08-18 16:17       ` Koakuma
  1 sibling, 0 replies; 7+ messages in thread
From: Andreas Larsson @ 2025-08-15  9:30 UTC (permalink / raw)
  To: Nathan Chancellor, Koakuma
  Cc: David S. Miller, Nick Desaulniers, Bill Wendling, Justin Stitt,
	sparclinux, linux-kernel, llvm

On 2025-08-15 00:40, Nathan Chancellor wrote:
>> Ping. Is there anything else I should do for this?
>>
> 
> This seems reasonable to me, sorry for the delay in commenting. I would
> expect this to go via the SPARC tree but if they are too busy or
> unavailable to pick this up, we would try to route it via Andrew Morton.
> Is there more work needed for the integrated assembler other than this
> series?
I'll take it through the SPARC tree.

Cheers,
Andreas

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

* Re: [PATCH 1/2] sparc/module: Add R_SPARC_UA64 relocation handling
  2025-08-14 22:40     ` Nathan Chancellor
  2025-08-15  9:30       ` Andreas Larsson
@ 2025-08-18 16:17       ` Koakuma
  1 sibling, 0 replies; 7+ messages in thread
From: Koakuma @ 2025-08-18 16:17 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: David S. Miller, Andreas Larsson, Nick Desaulniers, Bill Wendling,
	Justin Stitt, sparclinux, linux-kernel, llvm

Nathan Chancellor <nathan@kernel.org> wrote:

> Is there more work needed for the integrated assembler other than this
> series?

Yep~ it should be enough. The rest of the work will have to be done in
the LLVM side.

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

end of thread, other threads:[~2025-08-18 16:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-09 13:53 [PATCH 0/2] sparc/module: R_SPARC_UA64 handling to help with LLVM IAS enablement Koakuma via B4 Relay
2025-06-09 13:53 ` [PATCH 1/2] sparc/module: Add R_SPARC_UA64 relocation handling Koakuma via B4 Relay
2025-08-03  1:15   ` Koakuma
2025-08-14 22:40     ` Nathan Chancellor
2025-08-15  9:30       ` Andreas Larsson
2025-08-18 16:17       ` Koakuma
2025-06-09 13:53 ` [PATCH 2/2] sparc/module: Make it clear that relocation numbers are shown in hex Koakuma via B4 Relay

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 NNTP newsgroup(s).