All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm: LLVMLinux: Use __builtin_frame_address instead of named registers
@ 2013-09-06 21:42 ` behanw at converseincode.com
  0 siblings, 0 replies; 7+ messages in thread
From: behanw @ 2013-09-06 21:42 UTC (permalink / raw)
  To: linux, linux-arm-kernel, linux-kernel
  Cc: behanw, Paul E. McKenney, David Howells, Catalin Marinas, Dave Jones

From: Behan Webster <behanw@converseincode.com>

The LLVMLinux Project is working to be able to build the Linux kernel with
clang/LLVM. With the release of LLVM 3.3 clang is now able to compile the Linux
kernel with a number of small patches (available from the LLVMLinux git repo).

Use the frame pointer to calculate the end of the stack for current_pt_regs()
The existing code uses the stack pointer to do this calculation.
Using the frame pointer yeilds the same value in a more portable way.
This change supports being able to compile the kernel with gcc and clang.

Behan Webster (1):
  arm: LLVMLinux: Calculate pt_regs address from fp

 arch/arm/include/asm/ptrace.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
1.8.1.2


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

* [PATCH] arm: LLVMLinux: Use __builtin_frame_address instead of named registers
@ 2013-09-06 21:42 ` behanw at converseincode.com
  0 siblings, 0 replies; 7+ messages in thread
From: behanw at converseincode.com @ 2013-09-06 21:42 UTC (permalink / raw)
  To: linux-arm-kernel

From: Behan Webster <behanw@converseincode.com>

The LLVMLinux Project is working to be able to build the Linux kernel with
clang/LLVM. With the release of LLVM 3.3 clang is now able to compile the Linux
kernel with a number of small patches (available from the LLVMLinux git repo).

Use the frame pointer to calculate the end of the stack for current_pt_regs()
The existing code uses the stack pointer to do this calculation.
Using the frame pointer yeilds the same value in a more portable way.
This change supports being able to compile the kernel with gcc and clang.

Behan Webster (1):
  arm: LLVMLinux: Calculate pt_regs address from fp

 arch/arm/include/asm/ptrace.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

-- 
1.8.1.2

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

* [PATCH] arm: LLVMLinux: Calculate pt_regs address from fp
  2013-09-06 21:42 ` behanw at converseincode.com
@ 2013-09-06 21:42   ` behanw at converseincode.com
  -1 siblings, 0 replies; 7+ messages in thread
From: behanw @ 2013-09-06 21:42 UTC (permalink / raw)
  To: linux
  Cc: behanw, Mark Charlebois, Paul E. McKenney, David Howells,
	Catalin Marinas, Dave Jones, moderated list:ARM PORT, open list

From: Behan Webster <behanw@converseincode.com>

Use the frame pointer to calculate the end of the stack for current_pt_regs()
The existing code uses the stack pointer to do this calculation.
Using the frame pointer yeilds the same value in a more portable way.
This change supports being able to compile the kernel with gcc and clang.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Signed-off-by: Behan Webster <behanw@converseincode.com>
Reviewed-by: Jan-Simon Möller <dl9pf@gmx.de>
---
 arch/arm/include/asm/ptrace.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h
index 04c99f3..8aec2db 100644
--- a/arch/arm/include/asm/ptrace.h
+++ b/arch/arm/include/asm/ptrace.h
@@ -138,9 +138,9 @@ static inline unsigned long user_stack_pointer(struct pt_regs *regs)
 	return regs->ARM_sp;
 }
 
-#define current_pt_regs(void) ({				\
-	register unsigned long sp asm ("sp");			\
-	(struct pt_regs *)((sp | (THREAD_SIZE - 1)) - 7) - 1;	\
+#define current_pt_regs(void) ({					\
+	(struct pt_regs *)(((unsigned long)(__builtin_frame_address(0))	\
+		| (THREAD_SIZE - 1)) - 7) - 1;				\
 })
 
 #endif /* __ASSEMBLY__ */
-- 
1.8.1.2


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

* [PATCH] arm: LLVMLinux: Calculate pt_regs address from fp
@ 2013-09-06 21:42   ` behanw at converseincode.com
  0 siblings, 0 replies; 7+ messages in thread
From: behanw at converseincode.com @ 2013-09-06 21:42 UTC (permalink / raw)
  To: linux-arm-kernel

From: Behan Webster <behanw@converseincode.com>

Use the frame pointer to calculate the end of the stack for current_pt_regs()
The existing code uses the stack pointer to do this calculation.
Using the frame pointer yeilds the same value in a more portable way.
This change supports being able to compile the kernel with gcc and clang.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Signed-off-by: Behan Webster <behanw@converseincode.com>
Reviewed-by: Jan-Simon M?ller <dl9pf@gmx.de>
---
 arch/arm/include/asm/ptrace.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h
index 04c99f3..8aec2db 100644
--- a/arch/arm/include/asm/ptrace.h
+++ b/arch/arm/include/asm/ptrace.h
@@ -138,9 +138,9 @@ static inline unsigned long user_stack_pointer(struct pt_regs *regs)
 	return regs->ARM_sp;
 }
 
-#define current_pt_regs(void) ({				\
-	register unsigned long sp asm ("sp");			\
-	(struct pt_regs *)((sp | (THREAD_SIZE - 1)) - 7) - 1;	\
+#define current_pt_regs(void) ({					\
+	(struct pt_regs *)(((unsigned long)(__builtin_frame_address(0))	\
+		| (THREAD_SIZE - 1)) - 7) - 1;				\
 })
 
 #endif /* __ASSEMBLY__ */
-- 
1.8.1.2

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

* Re: [PATCH] arm: LLVMLinux: Calculate pt_regs address from fp
  2013-09-06 21:42   ` behanw at converseincode.com
@ 2013-09-06 22:18     ` Russell King - ARM Linux
  -1 siblings, 0 replies; 7+ messages in thread
From: Russell King - ARM Linux @ 2013-09-06 22:18 UTC (permalink / raw)
  To: behanw
  Cc: Mark Charlebois, Paul E. McKenney, David Howells,
	Catalin Marinas, Dave Jones, moderated list:ARM PORT, open list

On Fri, Sep 06, 2013 at 05:42:41PM -0400, behanw@converseincode.com wrote:
> From: Behan Webster <behanw@converseincode.com>
> 
> Use the frame pointer to calculate the end of the stack for current_pt_regs()
> The existing code uses the stack pointer to do this calculation.
> Using the frame pointer yeilds the same value in a more portable way.
> This change supports being able to compile the kernel with gcc and clang.

What happens when frame pointers are disabled on gcc?

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

* [PATCH] arm: LLVMLinux: Calculate pt_regs address from fp
@ 2013-09-06 22:18     ` Russell King - ARM Linux
  0 siblings, 0 replies; 7+ messages in thread
From: Russell King - ARM Linux @ 2013-09-06 22:18 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Sep 06, 2013 at 05:42:41PM -0400, behanw at converseincode.com wrote:
> From: Behan Webster <behanw@converseincode.com>
> 
> Use the frame pointer to calculate the end of the stack for current_pt_regs()
> The existing code uses the stack pointer to do this calculation.
> Using the frame pointer yeilds the same value in a more portable way.
> This change supports being able to compile the kernel with gcc and clang.

What happens when frame pointers are disabled on gcc?

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

* [PATCH] arm: LLVMLinux: Calculate pt_regs address from fp
  2013-09-06 22:18     ` Russell King - ARM Linux
  (?)
@ 2013-09-06 23:02     ` Behan Webster
  -1 siblings, 0 replies; 7+ messages in thread
From: Behan Webster @ 2013-09-06 23:02 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/06/13 18:18, Russell King - ARM Linux wrote:
> On Fri, Sep 06, 2013 at 05:42:41PM -0400, behanw at converseincode.com wrote:
>> From: Behan Webster <behanw@converseincode.com>
>>
>> Use the frame pointer to calculate the end of the stack for current_pt_regs()
>> The existing code uses the stack pointer to do this calculation.
>> Using the frame pointer yeilds the same value in a more portable way.
>> This change supports being able to compile the kernel with gcc and clang.
> What happens when frame pointers are disabled on gcc?
Drat. Good point. Didn't think of that.

Could be rewritten to use current_stack_pointer (assuming the patch 
series that implements that would be amenable).

Thanks,

Behan

-- 
Behan Webster
behanw at converseincode.com

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

end of thread, other threads:[~2013-09-06 23:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-06 21:42 [PATCH] arm: LLVMLinux: Use __builtin_frame_address instead of named registers behanw
2013-09-06 21:42 ` behanw at converseincode.com
2013-09-06 21:42 ` [PATCH] arm: LLVMLinux: Calculate pt_regs address from fp behanw
2013-09-06 21:42   ` behanw at converseincode.com
2013-09-06 22:18   ` Russell King - ARM Linux
2013-09-06 22:18     ` Russell King - ARM Linux
2013-09-06 23:02     ` Behan Webster

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.