linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] powerpc/vdso: Fix build of VDSO32 with pcrel
@ 2025-05-12 18:14 Christophe Leroy
  2025-06-10  6:03 ` Christophe Leroy
  2025-06-15  2:38 ` Madhavan Srinivasan
  0 siblings, 2 replies; 4+ messages in thread
From: Christophe Leroy @ 2025-05-12 18:14 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin, Naveen N Rao,
	Madhavan Srinivasan
  Cc: Christophe Leroy, linux-kernel, linuxppc-dev

Building vdso32 on power10 with pcrel leads to following errors:

	  VDSO32A arch/powerpc/kernel/vdso/gettimeofday-32.o
	arch/powerpc/kernel/vdso/gettimeofday.S: Assembler messages:
	arch/powerpc/kernel/vdso/gettimeofday.S:40: Error: syntax error; found `@', expected `,'
	arch/powerpc/kernel/vdso/gettimeofday.S:71:  Info: macro invoked from here
	arch/powerpc/kernel/vdso/gettimeofday.S:40: Error: junk at end of line: `@notoc'
	arch/powerpc/kernel/vdso/gettimeofday.S:71:  Info: macro invoked from here
	 ...
	make[2]: *** [arch/powerpc/kernel/vdso/Makefile:85: arch/powerpc/kernel/vdso/gettimeofday-32.o] Error 1
	make[1]: *** [arch/powerpc/Makefile:388: vdso_prepare] Error 2

Once the above is fixed, the following happens:

	  VDSO32C arch/powerpc/kernel/vdso/vgettimeofday-32.o
	cc1: error: '-mpcrel' requires '-mcmodel=medium'
	make[2]: *** [arch/powerpc/kernel/vdso/Makefile:89: arch/powerpc/kernel/vdso/vgettimeofday-32.o] Error 1
	make[1]: *** [arch/powerpc/Makefile:388: vdso_prepare] Error 2
	make: *** [Makefile:251: __sub-make] Error 2

Make sure pcrel version of CFUNC() macro is used only for powerpc64
builds and remove -mpcrel for powerpc32 builds.

Fixes: 7e3a68be42e1 ("powerpc/64: vmlinux support building with PCREL addresing")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/include/asm/ppc_asm.h | 2 +-
 arch/powerpc/kernel/vdso/Makefile  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
index 02897f4b0dbf..b891910fce8a 100644
--- a/arch/powerpc/include/asm/ppc_asm.h
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -183,7 +183,7 @@
 /*
  * Used to name C functions called from asm
  */
-#ifdef CONFIG_PPC_KERNEL_PCREL
+#if defined(__powerpc64__) && defined(CONFIG_PPC_KERNEL_PCREL)
 #define CFUNC(name) name@notoc
 #else
 #define CFUNC(name) name
diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
index e8824f933326..8834dfe9d727 100644
--- a/arch/powerpc/kernel/vdso/Makefile
+++ b/arch/powerpc/kernel/vdso/Makefile
@@ -53,7 +53,7 @@ ldflags-$(CONFIG_LD_ORPHAN_WARN) += -Wl,--orphan-handling=$(CONFIG_LD_ORPHAN_WAR
 ldflags-y += $(filter-out $(CC_AUTO_VAR_INIT_ZERO_ENABLER) $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
 
 CC32FLAGS := -m32
-CC32FLAGSREMOVE := -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc
+CC32FLAGSREMOVE := -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc -mpcrel
 ifdef CONFIG_CC_IS_CLANG
 # This flag is supported by clang for 64-bit but not 32-bit so it will cause
 # an unused command line flag warning for this file.
-- 
2.47.0


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

* Re: [PATCH] powerpc/vdso: Fix build of VDSO32 with pcrel
  2025-05-12 18:14 [PATCH] powerpc/vdso: Fix build of VDSO32 with pcrel Christophe Leroy
@ 2025-06-10  6:03 ` Christophe Leroy
  2025-06-10  6:22   ` Madhavan Srinivasan
  2025-06-15  2:38 ` Madhavan Srinivasan
  1 sibling, 1 reply; 4+ messages in thread
From: Christophe Leroy @ 2025-06-10  6:03 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin, Naveen N Rao,
	Madhavan Srinivasan
  Cc: linux-kernel, linuxppc-dev

Hi Maddy,

ping ?

Christophe

Le 12/05/2025 à 20:14, Christophe Leroy a écrit :
> Building vdso32 on power10 with pcrel leads to following errors:
> 
> 	  VDSO32A arch/powerpc/kernel/vdso/gettimeofday-32.o
> 	arch/powerpc/kernel/vdso/gettimeofday.S: Assembler messages:
> 	arch/powerpc/kernel/vdso/gettimeofday.S:40: Error: syntax error; found `@', expected `,'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:71:  Info: macro invoked from here
> 	arch/powerpc/kernel/vdso/gettimeofday.S:40: Error: junk at end of line: `@notoc'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:71:  Info: macro invoked from here
> 	 ...
> 	make[2]: *** [arch/powerpc/kernel/vdso/Makefile:85: arch/powerpc/kernel/vdso/gettimeofday-32.o] Error 1
> 	make[1]: *** [arch/powerpc/Makefile:388: vdso_prepare] Error 2
> 
> Once the above is fixed, the following happens:
> 
> 	  VDSO32C arch/powerpc/kernel/vdso/vgettimeofday-32.o
> 	cc1: error: '-mpcrel' requires '-mcmodel=medium'
> 	make[2]: *** [arch/powerpc/kernel/vdso/Makefile:89: arch/powerpc/kernel/vdso/vgettimeofday-32.o] Error 1
> 	make[1]: *** [arch/powerpc/Makefile:388: vdso_prepare] Error 2
> 	make: *** [Makefile:251: __sub-make] Error 2
> 
> Make sure pcrel version of CFUNC() macro is used only for powerpc64
> builds and remove -mpcrel for powerpc32 builds.
> 
> Fixes: 7e3a68be42e1 ("powerpc/64: vmlinux support building with PCREL addresing")
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
>   arch/powerpc/include/asm/ppc_asm.h | 2 +-
>   arch/powerpc/kernel/vdso/Makefile  | 2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
> index 02897f4b0dbf..b891910fce8a 100644
> --- a/arch/powerpc/include/asm/ppc_asm.h
> +++ b/arch/powerpc/include/asm/ppc_asm.h
> @@ -183,7 +183,7 @@
>   /*
>    * Used to name C functions called from asm
>    */
> -#ifdef CONFIG_PPC_KERNEL_PCREL
> +#if defined(__powerpc64__) && defined(CONFIG_PPC_KERNEL_PCREL)
>   #define CFUNC(name) name@notoc
>   #else
>   #define CFUNC(name) name
> diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
> index e8824f933326..8834dfe9d727 100644
> --- a/arch/powerpc/kernel/vdso/Makefile
> +++ b/arch/powerpc/kernel/vdso/Makefile
> @@ -53,7 +53,7 @@ ldflags-$(CONFIG_LD_ORPHAN_WARN) += -Wl,--orphan-handling=$(CONFIG_LD_ORPHAN_WAR
>   ldflags-y += $(filter-out $(CC_AUTO_VAR_INIT_ZERO_ENABLER) $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
>   
>   CC32FLAGS := -m32
> -CC32FLAGSREMOVE := -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc
> +CC32FLAGSREMOVE := -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc -mpcrel
>   ifdef CONFIG_CC_IS_CLANG
>   # This flag is supported by clang for 64-bit but not 32-bit so it will cause
>   # an unused command line flag warning for this file.


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

* Re: [PATCH] powerpc/vdso: Fix build of VDSO32 with pcrel
  2025-06-10  6:03 ` Christophe Leroy
@ 2025-06-10  6:22   ` Madhavan Srinivasan
  0 siblings, 0 replies; 4+ messages in thread
From: Madhavan Srinivasan @ 2025-06-10  6:22 UTC (permalink / raw)
  To: Christophe Leroy, Michael Ellerman, Nicholas Piggin, Naveen N Rao
  Cc: linux-kernel, linuxppc-dev



On 6/10/25 11:33 AM, Christophe Leroy wrote:
> Hi Maddy,
> 
> ping ?

Yes, its not lost :) . Will add it for the next fixes PR.

Maddy

> 
> Christophe
> 
> Le 12/05/2025 à 20:14, Christophe Leroy a écrit :
>> Building vdso32 on power10 with pcrel leads to following errors:
>>
>>       VDSO32A arch/powerpc/kernel/vdso/gettimeofday-32.o
>>     arch/powerpc/kernel/vdso/gettimeofday.S: Assembler messages:
>>     arch/powerpc/kernel/vdso/gettimeofday.S:40: Error: syntax error; found `@', expected `,'
>>     arch/powerpc/kernel/vdso/gettimeofday.S:71:  Info: macro invoked from here
>>     arch/powerpc/kernel/vdso/gettimeofday.S:40: Error: junk at end of line: `@notoc'
>>     arch/powerpc/kernel/vdso/gettimeofday.S:71:  Info: macro invoked from here
>>      ...
>>     make[2]: *** [arch/powerpc/kernel/vdso/Makefile:85: arch/powerpc/kernel/vdso/gettimeofday-32.o] Error 1
>>     make[1]: *** [arch/powerpc/Makefile:388: vdso_prepare] Error 2
>>
>> Once the above is fixed, the following happens:
>>
>>       VDSO32C arch/powerpc/kernel/vdso/vgettimeofday-32.o
>>     cc1: error: '-mpcrel' requires '-mcmodel=medium'
>>     make[2]: *** [arch/powerpc/kernel/vdso/Makefile:89: arch/powerpc/kernel/vdso/vgettimeofday-32.o] Error 1
>>     make[1]: *** [arch/powerpc/Makefile:388: vdso_prepare] Error 2
>>     make: *** [Makefile:251: __sub-make] Error 2
>>
>> Make sure pcrel version of CFUNC() macro is used only for powerpc64
>> builds and remove -mpcrel for powerpc32 builds.
>>
>> Fixes: 7e3a68be42e1 ("powerpc/64: vmlinux support building with PCREL addresing")
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>> ---
>>   arch/powerpc/include/asm/ppc_asm.h | 2 +-
>>   arch/powerpc/kernel/vdso/Makefile  | 2 +-
>>   2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
>> index 02897f4b0dbf..b891910fce8a 100644
>> --- a/arch/powerpc/include/asm/ppc_asm.h
>> +++ b/arch/powerpc/include/asm/ppc_asm.h
>> @@ -183,7 +183,7 @@
>>   /*
>>    * Used to name C functions called from asm
>>    */
>> -#ifdef CONFIG_PPC_KERNEL_PCREL
>> +#if defined(__powerpc64__) && defined(CONFIG_PPC_KERNEL_PCREL)
>>   #define CFUNC(name) name@notoc
>>   #else
>>   #define CFUNC(name) name
>> diff --git a/arch/powerpc/kernel/vdso/Makefile b/arch/powerpc/kernel/vdso/Makefile
>> index e8824f933326..8834dfe9d727 100644
>> --- a/arch/powerpc/kernel/vdso/Makefile
>> +++ b/arch/powerpc/kernel/vdso/Makefile
>> @@ -53,7 +53,7 @@ ldflags-$(CONFIG_LD_ORPHAN_WARN) += -Wl,--orphan-handling=$(CONFIG_LD_ORPHAN_WAR
>>   ldflags-y += $(filter-out $(CC_AUTO_VAR_INIT_ZERO_ENABLER) $(CC_FLAGS_FTRACE) -Wa$(comma)%, $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS))
>>     CC32FLAGS := -m32
>> -CC32FLAGSREMOVE := -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc
>> +CC32FLAGSREMOVE := -mcmodel=medium -mabi=elfv1 -mabi=elfv2 -mcall-aixdesc -mpcrel
>>   ifdef CONFIG_CC_IS_CLANG
>>   # This flag is supported by clang for 64-bit but not 32-bit so it will cause
>>   # an unused command line flag warning for this file.
> 


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

* Re: [PATCH] powerpc/vdso: Fix build of VDSO32 with pcrel
  2025-05-12 18:14 [PATCH] powerpc/vdso: Fix build of VDSO32 with pcrel Christophe Leroy
  2025-06-10  6:03 ` Christophe Leroy
@ 2025-06-15  2:38 ` Madhavan Srinivasan
  1 sibling, 0 replies; 4+ messages in thread
From: Madhavan Srinivasan @ 2025-06-15  2:38 UTC (permalink / raw)
  To: Michael Ellerman, Nicholas Piggin, Naveen N Rao, Christophe Leroy
  Cc: linux-kernel, linuxppc-dev

On Mon, 12 May 2025 20:14:55 +0200, Christophe Leroy wrote:
> Building vdso32 on power10 with pcrel leads to following errors:
> 
> 	  VDSO32A arch/powerpc/kernel/vdso/gettimeofday-32.o
> 	arch/powerpc/kernel/vdso/gettimeofday.S: Assembler messages:
> 	arch/powerpc/kernel/vdso/gettimeofday.S:40: Error: syntax error; found `@', expected `,'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:71:  Info: macro invoked from here
> 	arch/powerpc/kernel/vdso/gettimeofday.S:40: Error: junk at end of line: `@notoc'
> 	arch/powerpc/kernel/vdso/gettimeofday.S:71:  Info: macro invoked from here
> 	 ...
> 	make[2]: *** [arch/powerpc/kernel/vdso/Makefile:85: arch/powerpc/kernel/vdso/gettimeofday-32.o] Error 1
> 	make[1]: *** [arch/powerpc/Makefile:388: vdso_prepare] Error 2
> 
> [...]

Applied to powerpc/fixes.

[1/1] powerpc/vdso: Fix build of VDSO32 with pcrel
      https://git.kernel.org/powerpc/c/b93755f408325170edb2156c6a894ed1cae5f4f6

Thanks

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

end of thread, other threads:[~2025-06-15  2:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-12 18:14 [PATCH] powerpc/vdso: Fix build of VDSO32 with pcrel Christophe Leroy
2025-06-10  6:03 ` Christophe Leroy
2025-06-10  6:22   ` Madhavan Srinivasan
2025-06-15  2:38 ` Madhavan Srinivasan

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