All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: asm/unified.h: guard the IT macros against redefinition when using LTO
@ 2015-07-24 21:42 Nicolas Pitre
  2015-07-27 11:16 ` Dave Martin
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Pitre @ 2015-07-24 21:42 UTC (permalink / raw)
  To: linux-arm-kernel


With LTO, the intermediate representation for each .c file contains those
global assembly macro definitions. When the lot is merged together during
the final link, we get duplicate definition errors:

[...]
/tmp/cc48fUMp.s:42352: Error: Macro `it' was already defined
/tmp/cc48fUMp.s:42354: Error: Macro `itt' was already defined
/tmp/cc48fUMp.s:42356: Error: Macro `ite' was already defined
[...]

Guard those against redefinitions.

Signed-off-by: Nicolas Pitre <nico@linaro.org>

diff --git a/arch/arm/include/asm/unified.h b/arch/arm/include/asm/unified.h
index a91ae49961..ee257a3de7 100644
--- a/arch/arm/include/asm/unified.h
+++ b/arch/arm/include/asm/unified.h
@@ -103,6 +103,8 @@
 	.endm
 #else	/* !__ASSEMBLY__ */
 __asm__(
+/* the .L_it_macros_defined guards against redefinition in the LTO case */
+"	.ifndef	.L_it_macros_defined\n"
 "	.macro	it, cond\n"
 "	.endm\n"
 "	.macro	itt, cond\n"
@@ -132,7 +134,9 @@ __asm__(
 "	.macro	iteet, cond\n"
 "	.endm\n"
 "	.macro	iteee, cond\n"
-"	.endm\n");
+"	.endm\n"
+"	.set	.L_it_macros_defined,1\n"
+"	.endif");
 #endif	/* __ASSEMBLY__ */
 
 #endif	/* CONFIG_ARM_ASM_UNIFIED */

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

* [PATCH] ARM: asm/unified.h: guard the IT macros against redefinition when using LTO
  2015-07-24 21:42 [PATCH] ARM: asm/unified.h: guard the IT macros against redefinition when using LTO Nicolas Pitre
@ 2015-07-27 11:16 ` Dave Martin
  2015-07-27 11:21   ` Russell King - ARM Linux
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Martin @ 2015-07-27 11:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 24, 2015 at 05:42:15PM -0400, Nicolas Pitre wrote:
> 
> With LTO, the intermediate representation for each .c file contains those
> global assembly macro definitions. When the lot is merged together during
> the final link, we get duplicate definition errors:
> 
> [...]
> /tmp/cc48fUMp.s:42352: Error: Macro `it' was already defined
> /tmp/cc48fUMp.s:42354: Error: Macro `itt' was already defined
> /tmp/cc48fUMp.s:42356: Error: Macro `ite' was already defined
> [...]
> 
> Guard those against redefinitions.
> 
> Signed-off-by: Nicolas Pitre <nico@linaro.org>

Reviewed-by: Dave Martin <Dave.Martin@arm.com>

I have a vague memory of hitting this before, but LTO had other problems
at the time...

Another scary thing with LTO is asms that use directives like
.arch_extension, .fpu etc. that will stay active for the rest of the LTO
unit of nothing is done about it.

I can't remember whether that was resolved somehow.

Cheers
---Dave
 
> diff --git a/arch/arm/include/asm/unified.h b/arch/arm/include/asm/unified.h
> index a91ae49961..ee257a3de7 100644
> --- a/arch/arm/include/asm/unified.h
> +++ b/arch/arm/include/asm/unified.h
> @@ -103,6 +103,8 @@
>  	.endm
>  #else	/* !__ASSEMBLY__ */
>  __asm__(
> +/* the .L_it_macros_defined guards against redefinition in the LTO case */
> +"	.ifndef	.L_it_macros_defined\n"
>  "	.macro	it, cond\n"
>  "	.endm\n"
>  "	.macro	itt, cond\n"
> @@ -132,7 +134,9 @@ __asm__(
>  "	.macro	iteet, cond\n"
>  "	.endm\n"
>  "	.macro	iteee, cond\n"
> -"	.endm\n");
> +"	.endm\n"
> +"	.set	.L_it_macros_defined,1\n"
> +"	.endif");
>  #endif	/* __ASSEMBLY__ */
>  
>  #endif	/* CONFIG_ARM_ASM_UNIFIED */
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH] ARM: asm/unified.h: guard the IT macros against redefinition when using LTO
  2015-07-27 11:16 ` Dave Martin
@ 2015-07-27 11:21   ` Russell King - ARM Linux
  0 siblings, 0 replies; 3+ messages in thread
From: Russell King - ARM Linux @ 2015-07-27 11:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Jul 27, 2015 at 12:16:15PM +0100, Dave Martin wrote:
> Another scary thing with LTO is asms that use directives like
> .arch_extension, .fpu etc. that will stay active for the rest of the LTO
> unit of nothing is done about it.

That would be a problem, especially for things like the neon support,
as we specifically want stuff like that to be built separately.  The
same probably applies where we want to build with different architecture
options.

So, maybe the answer is to build most of the kernel with LTO enabled, but
those bits which require explicit -march= or -mfpu= options need to remain
separate non-LTO-able objects.

-- 
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.

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

end of thread, other threads:[~2015-07-27 11:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-24 21:42 [PATCH] ARM: asm/unified.h: guard the IT macros against redefinition when using LTO Nicolas Pitre
2015-07-27 11:16 ` Dave Martin
2015-07-27 11:21   ` Russell King - ARM Linux

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.