All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mach-bcm SMC: address clang inline asm incompatibility
@ 2014-07-01 12:05 ` Alex Elder
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Elder @ 2014-07-01 12:05 UTC (permalink / raw)
  To: bcm, mporter
  Cc: behanw, bcm-kernel-feedback-list, linux-arm-kernel, linux-kernel

My GCC-based build environment likes to call register r12 by the
name "ip" in inline asm.  Behan Webster informed me that his Clang-
based build environment likes "r12" instead.

Try to make them both happy.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Behan Webster <behanw@converseincode.com>
---
 arch/arm/mach-bcm/bcm_kona_smc.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c
index a55a7ec..3937bd5 100644
--- a/arch/arm/mach-bcm/bcm_kona_smc.c
+++ b/arch/arm/mach-bcm/bcm_kona_smc.c
@@ -106,9 +106,14 @@ int __init bcm_kona_smc_init(void)
  * request result appropriately.  This result value is found in r0
  * when the "smc" request completes.
  */
+#ifdef __clang__
+#define R12	"r12"
+#else  /* !__clang__ */
+#define R12	"ip"	/* gcc calls r12 "ip" */
+#endif /* !__clang__ */
 static int bcm_kona_do_smc(u32 service_id, u32 buffer_phys)
 {
-	register u32 ip asm("ip");	/* Also called r12 */
+	register u32 ip asm(R12);	/* Also called r12 */
 	register u32 r0 asm("r0");
 	register u32 r4 asm("r4");
 	register u32 r5 asm("r5");
@@ -120,7 +125,7 @@ static int bcm_kona_do_smc(u32 service_id, u32 buffer_phys)
 
 	asm volatile (
 		/* Make sure we got the registers we want */
-		__asmeq("%0", "ip")
+		__asmeq("%0", R12)
 		__asmeq("%1", "r0")
 		__asmeq("%2", "r4")
 		__asmeq("%3", "r5")
-- 
1.9.1


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

* [PATCH] mach-bcm SMC: address clang inline asm incompatibility
@ 2014-07-01 12:05 ` Alex Elder
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Elder @ 2014-07-01 12:05 UTC (permalink / raw)
  To: linux-arm-kernel

My GCC-based build environment likes to call register r12 by the
name "ip" in inline asm.  Behan Webster informed me that his Clang-
based build environment likes "r12" instead.

Try to make them both happy.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Behan Webster <behanw@converseincode.com>
---
 arch/arm/mach-bcm/bcm_kona_smc.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c
index a55a7ec..3937bd5 100644
--- a/arch/arm/mach-bcm/bcm_kona_smc.c
+++ b/arch/arm/mach-bcm/bcm_kona_smc.c
@@ -106,9 +106,14 @@ int __init bcm_kona_smc_init(void)
  * request result appropriately.  This result value is found in r0
  * when the "smc" request completes.
  */
+#ifdef __clang__
+#define R12	"r12"
+#else  /* !__clang__ */
+#define R12	"ip"	/* gcc calls r12 "ip" */
+#endif /* !__clang__ */
 static int bcm_kona_do_smc(u32 service_id, u32 buffer_phys)
 {
-	register u32 ip asm("ip");	/* Also called r12 */
+	register u32 ip asm(R12);	/* Also called r12 */
 	register u32 r0 asm("r0");
 	register u32 r4 asm("r4");
 	register u32 r5 asm("r5");
@@ -120,7 +125,7 @@ static int bcm_kona_do_smc(u32 service_id, u32 buffer_phys)
 
 	asm volatile (
 		/* Make sure we got the registers we want */
-		__asmeq("%0", "ip")
+		__asmeq("%0", R12)
 		__asmeq("%1", "r0")
 		__asmeq("%2", "r4")
 		__asmeq("%3", "r5")
-- 
1.9.1

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

* Re: [PATCH] mach-bcm SMC: address clang inline asm incompatibility
  2014-07-01 12:05 ` Alex Elder
@ 2014-07-01 12:15   ` Russell King - ARM Linux
  -1 siblings, 0 replies; 6+ messages in thread
From: Russell King - ARM Linux @ 2014-07-01 12:15 UTC (permalink / raw)
  To: Alex Elder
  Cc: bcm, mporter, bcm-kernel-feedback-list, linux-kernel, linux-arm-kernel

On Tue, Jul 01, 2014 at 07:05:39AM -0500, Alex Elder wrote:
> My GCC-based build environment likes to call register r12 by the
> name "ip" in inline asm.  Behan Webster informed me that his Clang-
> based build environment likes "r12" instead.

Two objections, one of which is an acceptable outcome:
1. Why can't clang just learn these alternative names?
2. Why can't we just use "r12" here?

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.

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

* [PATCH] mach-bcm SMC: address clang inline asm incompatibility
@ 2014-07-01 12:15   ` Russell King - ARM Linux
  0 siblings, 0 replies; 6+ messages in thread
From: Russell King - ARM Linux @ 2014-07-01 12:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Jul 01, 2014 at 07:05:39AM -0500, Alex Elder wrote:
> My GCC-based build environment likes to call register r12 by the
> name "ip" in inline asm.  Behan Webster informed me that his Clang-
> based build environment likes "r12" instead.

Two objections, one of which is an acceptable outcome:
1. Why can't clang just learn these alternative names?
2. Why can't we just use "r12" here?

-- 
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly
improving, and getting towards what was expected from it.

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

* Re: [PATCH] mach-bcm SMC: address clang inline asm incompatibility
  2014-07-01 12:15   ` Russell King - ARM Linux
@ 2014-07-01 12:21     ` Alex Elder
  -1 siblings, 0 replies; 6+ messages in thread
From: Alex Elder @ 2014-07-01 12:21 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: bcm, mporter, bcm-kernel-feedback-list, linux-kernel, linux-arm-kernel

On 07/01/2014 07:15 AM, Russell King - ARM Linux wrote:
> On Tue, Jul 01, 2014 at 07:05:39AM -0500, Alex Elder wrote:
>> My GCC-based build environment likes to call register r12 by the
>> name "ip" in inline asm.  Behan Webster informed me that his Clang-
>> based build environment likes "r12" instead.
> 
> Two objections, one of which is an acceptable outcome:
> 1. Why can't clang just learn these alternative names?

I suggested that.  I don't know where to send that suggestion
though.

> 2. Why can't we just use "r12" here?

I don't recall the details, but when I wrote the code originally
that way it gave me errors.  It's why I had the "Also called r12"
comment next to the symbol declaration.

I agree, I'd rather have either one of those than this #ifdef
workaround.  I was supplying this as a potentially quicker fix
for the problem Behan was hitting.

					-Alex

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

* [PATCH] mach-bcm SMC: address clang inline asm incompatibility
@ 2014-07-01 12:21     ` Alex Elder
  0 siblings, 0 replies; 6+ messages in thread
From: Alex Elder @ 2014-07-01 12:21 UTC (permalink / raw)
  To: linux-arm-kernel

On 07/01/2014 07:15 AM, Russell King - ARM Linux wrote:
> On Tue, Jul 01, 2014 at 07:05:39AM -0500, Alex Elder wrote:
>> My GCC-based build environment likes to call register r12 by the
>> name "ip" in inline asm.  Behan Webster informed me that his Clang-
>> based build environment likes "r12" instead.
> 
> Two objections, one of which is an acceptable outcome:
> 1. Why can't clang just learn these alternative names?

I suggested that.  I don't know where to send that suggestion
though.

> 2. Why can't we just use "r12" here?

I don't recall the details, but when I wrote the code originally
that way it gave me errors.  It's why I had the "Also called r12"
comment next to the symbol declaration.

I agree, I'd rather have either one of those than this #ifdef
workaround.  I was supplying this as a potentially quicker fix
for the problem Behan was hitting.

					-Alex

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

end of thread, other threads:[~2014-07-01 12:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-01 12:05 [PATCH] mach-bcm SMC: address clang inline asm incompatibility Alex Elder
2014-07-01 12:05 ` Alex Elder
2014-07-01 12:15 ` Russell King - ARM Linux
2014-07-01 12:15   ` Russell King - ARM Linux
2014-07-01 12:21   ` Alex Elder
2014-07-01 12:21     ` Alex Elder

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.