Re: [PATCH 2/2] x86/asm: Fix inline asm call constraints for clang

2017-09-21 Thread Josh Poimboeuf
On Thu, Sep 21, 2017 at 05:35:11PM +0200, Ingo Molnar wrote: > > * Josh Poimboeuf wrote: > > > On Wed, Sep 20, 2017 at 10:32:43AM -0700, H. Peter Anvin wrote: > > > On 09/19/17 11:45, Josh Poimboeuf wrote: > > > > For inline asm statements which have a CALL instruction, we list the > > > > stack

Re: [PATCH 2/2] x86/asm: Fix inline asm call constraints for clang

2017-09-21 Thread Ingo Molnar
* Josh Poimboeuf wrote: > On Wed, Sep 20, 2017 at 10:32:43AM -0700, H. Peter Anvin wrote: > > On 09/19/17 11:45, Josh Poimboeuf wrote: > > > For inline asm statements which have a CALL instruction, we list the > > > stack pointer as a constraint to convince GCC to ensure the frame > > > pointer

Re: [PATCH 2/2] x86/asm: Fix inline asm call constraints for clang

2017-09-21 Thread Dmitry Vyukov
On Thu, Sep 21, 2017 at 1:52 PM, Brian Gerst wrote: >>> I think we need just the frame itself and RSP pointing below this >>> frame. If we don't have a frame, CALL instruction will smash whatever >>> RSP happens to point to. Compiler doesn't have to setup RSP to point >>> below use

Re: [PATCH 2/2] x86/asm: Fix inline asm call constraints for clang

2017-09-21 Thread Brian Gerst
On Thu, Sep 21, 2017 at 4:12 AM, Dmitry Vyukov wrote: > On Wed, Sep 20, 2017 at 11:19 PM, Andy Lutomirski wrote: On Wed, Sep 20, 2017 at 08:01:02PM +0200, Dmitry Vyukov wrote: > On Wed, Sep 20, 2017 at 7:46 PM, H. Peter Anvin wrote: >> On 09/20/17 10:38, Dmitry Vyukov wrote: >>

Re: [PATCH 2/2] x86/asm: Fix inline asm call constraints for clang

2017-09-21 Thread Dmitry Vyukov
On Wed, Sep 20, 2017 at 11:19 PM, Andy Lutomirski wrote: >>> On Wed, Sep 20, 2017 at 08:01:02PM +0200, Dmitry Vyukov wrote: On Wed, Sep 20, 2017 at 7:46 PM, H. Peter Anvin wrote: > On 09/20/17 10:38, Dmitry Vyukov wrote: > > I think we need just the frame itself and RSP pointing

Re: [PATCH 2/2] x86/asm: Fix inline asm call constraints for clang

2017-09-20 Thread Andy Lutomirski
> On Sep 20, 2017, at 2:07 PM, Josh Poimboeuf wrote: > >> On Wed, Sep 20, 2017 at 08:01:02PM +0200, Dmitry Vyukov wrote: >>> On Wed, Sep 20, 2017 at 7:46 PM, H. Peter Anvin wrote: On 09/20/17 10:38, Dmitry Vyukov wrote: I think we need just the frame itself and RSP pointing bel

Re: [PATCH 2/2] x86/asm: Fix inline asm call constraints for clang

2017-09-20 Thread Josh Poimboeuf
On Wed, Sep 20, 2017 at 08:01:02PM +0200, Dmitry Vyukov wrote: > On Wed, Sep 20, 2017 at 7:46 PM, H. Peter Anvin wrote: > > On 09/20/17 10:38, Dmitry Vyukov wrote: > >> > >> I think we need just the frame itself and RSP pointing below this > >> frame. If we don't have a frame, CALL instruction wil

Re: [PATCH 2/2] x86/asm: Fix inline asm call constraints for clang

2017-09-20 Thread Dmitry Vyukov
On Wed, Sep 20, 2017 at 7:46 PM, H. Peter Anvin wrote: > On 09/20/17 10:38, Dmitry Vyukov wrote: >> >> I think we need just the frame itself and RSP pointing below this >> frame. If we don't have a frame, CALL instruction will smash whatever >> RSP happens to point to. Compiler doesn't have to set

Re: [PATCH 2/2] x86/asm: Fix inline asm call constraints for clang

2017-09-20 Thread H. Peter Anvin
On 09/20/17 10:38, Dmitry Vyukov wrote: > > I think we need just the frame itself and RSP pointing below this > frame. If we don't have a frame, CALL instruction will smash whatever > RSP happens to point to. Compiler doesn't have to setup RSP to point > below used part of stack in leaf functions.

Re: [PATCH 2/2] x86/asm: Fix inline asm call constraints for clang

2017-09-20 Thread Josh Poimboeuf
On Tue, Sep 19, 2017 at 08:18:23PM -0500, Josh Poimboeuf wrote: > On Tue, Sep 19, 2017 at 01:45:28PM -0500, Josh Poimboeuf wrote: > > For inline asm statements which have a CALL instruction, we list the > > stack pointer as a constraint to convince GCC to ensure the frame > > pointer is set up firs

Re: [PATCH 2/2] x86/asm: Fix inline asm call constraints for clang

2017-09-20 Thread Josh Poimboeuf
On Wed, Sep 20, 2017 at 10:32:43AM -0700, H. Peter Anvin wrote: > On 09/19/17 11:45, Josh Poimboeuf wrote: > > For inline asm statements which have a CALL instruction, we list the > > stack pointer as a constraint to convince GCC to ensure the frame > > pointer is set up first: > > > > static in

Re: [PATCH 2/2] x86/asm: Fix inline asm call constraints for clang

2017-09-20 Thread H. Peter Anvin
On 09/19/17 11:45, Josh Poimboeuf wrote: > For inline asm statements which have a CALL instruction, we list the > stack pointer as a constraint to convince GCC to ensure the frame > pointer is set up first: > > static inline void foo() > { > register void *__sp asm(_ASM_SP); > asm(

Re: [PATCH 2/2] x86/asm: Fix inline asm call constraints for clang

2017-09-20 Thread Dmitry Vyukov
On Wed, Sep 20, 2017 at 7:32 PM, H. Peter Anvin wrote: > On 09/19/17 11:45, Josh Poimboeuf wrote: >> For inline asm statements which have a CALL instruction, we list the >> stack pointer as a constraint to convince GCC to ensure the frame >> pointer is set up first: >> >> static inline void foo(

Re: [PATCH 2/2] x86/asm: Fix inline asm call constraints for clang

2017-09-19 Thread Josh Poimboeuf
On Tue, Sep 19, 2017 at 03:25:59PM -0700, Alexander Potapenko wrote: > On Tue, Sep 19, 2017 at 2:55 PM, Alexander Potapenko > wrote: > > On Tue, Sep 19, 2017 at 11:45 AM, Josh Poimboeuf > > wrote: > >> For inline asm statements which have a CALL instruction, we list the > >> stack pointer as a

Re: [PATCH 2/2] x86/asm: Fix inline asm call constraints for clang

2017-09-19 Thread Josh Poimboeuf
On Tue, Sep 19, 2017 at 01:45:28PM -0500, Josh Poimboeuf wrote: > For inline asm statements which have a CALL instruction, we list the > stack pointer as a constraint to convince GCC to ensure the frame > pointer is set up first: > > static inline void foo() > { > register void *__sp asm

Re: [PATCH 2/2] x86/asm: Fix inline asm call constraints for clang

2017-09-19 Thread Alexander Potapenko
On Tue, Sep 19, 2017 at 2:55 PM, Alexander Potapenko wrote: > On Tue, Sep 19, 2017 at 11:45 AM, Josh Poimboeuf wrote: >> For inline asm statements which have a CALL instruction, we list the >> stack pointer as a constraint to convince GCC to ensure the frame >> pointer is set up first: >> >> st

Re: [PATCH 2/2] x86/asm: Fix inline asm call constraints for clang

2017-09-19 Thread Alexander Potapenko
On Tue, Sep 19, 2017 at 11:45 AM, Josh Poimboeuf wrote: > For inline asm statements which have a CALL instruction, we list the > stack pointer as a constraint to convince GCC to ensure the frame > pointer is set up first: > > static inline void foo() > { > register void *__sp asm(_ASM_

[PATCH 2/2] x86/asm: Fix inline asm call constraints for clang

2017-09-19 Thread Josh Poimboeuf
For inline asm statements which have a CALL instruction, we list the stack pointer as a constraint to convince GCC to ensure the frame pointer is set up first: static inline void foo() { register void *__sp asm(_ASM_SP); asm("call bar" : "+r" (__sp)) } Unfortunately, that pa