Stack smashing when using FunPtr wrappers on ARM

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Stack smashing when using FunPtr wrappers on ARM

Stephen Paul Weber
I just got my unregistered LLVM-based ARM cross-compiler to a working place,
which means I can produce any binaries which do no crash.  Yay!

However, <http://hackage.haskell.org/trac/ghc/ticket/7621> when I try to use
FunPtr wrappers, something smashes the stack.

Would others working on ARM cross-compilers be willing to try this test and
see if it works for you:

{-# LANGUAGE ForeignFunctionInterface #-}
module Main (main) where

import Foreign.Ptr

foreign import ccall "wrapper" wrap_refresh :: ( IO ()) -> IO (FunPtr ( IO ()))

main :: IO ()
main = do
        wrap_refresh (return ())
        return ()

--
Stephen Paul Weber, @singpolyma
See <http://singpolyma.net> for how I prefer to be contacted
edition right joseph


Reply | Threaded
Open this post in threaded view
|

Stack smashing when using FunPtr wrappers on ARM

Nathan Hüsken
I tried it here with android. It works, no segfault.
I have used llvm-3.2, maybe that helps?

On 01/24/2013 03:44 PM, Stephen Paul Weber wrote:

> I just got my unregistered LLVM-based ARM cross-compiler to a working
> place, which means I can produce any binaries which do no crash.  Yay!
>
> However, <http://hackage.haskell.org/trac/ghc/ticket/7621> when I try to
> use FunPtr wrappers, something smashes the stack.
>
> Would others working on ARM cross-compilers be willing to try this test
> and see if it works for you:
>
> {-# LANGUAGE ForeignFunctionInterface #-}
> module Main (main) where
>
> import Foreign.Ptr
>
> foreign import ccall "wrapper" wrap_refresh :: ( IO ()) -> IO (FunPtr (
> IO ()))
>
> main :: IO ()
> main = do
>     wrap_refresh (return ())
>     return ()
>



Reply | Threaded
Open this post in threaded view
|

Stack smashing when using FunPtr wrappers on ARM

Stephen Paul Weber
Somebody claiming to be Nathan H?sken wrote:
>I tried it here with android. It works, no segfault.
>I have used llvm-3.2, maybe that helps?

This is your normal (registered) build with llvm-3.2, yes?

I am building one against llvm-3.0 just now and if it fails will try
llvm-3.2

--
Stephen Paul Weber, @singpolyma
See <http://singpolyma.net> for how I prefer to be contacted
edition right joseph


Reply | Threaded
Open this post in threaded view
|

Stack smashing when using FunPtr wrappers on ARM

Karel Gardas
On 01/24/13 04:51 PM, Stephen Paul Weber wrote:
> Somebody claiming to be Nathan H?sken wrote:
>> I tried it here with android. It works, no segfault.
>> I have used llvm-3.2, maybe that helps?
>
> This is your normal (registered) build with llvm-3.2, yes?
>
> I am building one against llvm-3.0 just now and if it fails will try
> llvm-3.2

Perhaps, the difference is not in llvm, but in registerised versus
unregisterised build?

Stephen, honestly speaking, why are you going unregisterised route?
Isn't it possible for you to use registerised build?

Thanks,
Karel




Reply | Threaded
Open this post in threaded view
|

Stack smashing when using FunPtr wrappers on ARM

Stephen Paul Weber
Somebody claiming to be Karel Gardas wrote:
>On 01/24/13 04:51 PM, Stephen Paul Weber wrote:
>>Somebody claiming to be Nathan H?sken wrote:
>>>I tried it here with android. It works, no segfault.
>>>I have used llvm-3.2, maybe that helps?
>>I am building one against llvm-3.0 just now and if it fails will try
>>llvm-3.2
>
>Stephen, honestly speaking, why are you going unregisterised route?  Isn't
>it possible for you to use registerised build?

I'm trying an unregisterised build because until this morning that was the
only kind anyone had ever made work without producing segfaulting binaries.  
Now that Nathan has additionally had success with a registered build, I am
going to try that some more :)

--
Stephen Paul Weber, @singpolyma
See <http://singpolyma.net> for how I prefer to be contacted
edition right joseph


Reply | Threaded
Open this post in threaded view
|

Stack smashing when using FunPtr wrappers on ARM

Karel Gardas
On 01/24/13 05:04 PM, Stephen Paul Weber wrote:

> Somebody claiming to be Karel Gardas wrote:
>> On 01/24/13 04:51 PM, Stephen Paul Weber wrote:
>>> Somebody claiming to be Nathan H?sken wrote:
>>>> I tried it here with android. It works, no segfault.
>>>> I have used llvm-3.2, maybe that helps?
>>> I am building one against llvm-3.0 just now and if it fails will try
>>> llvm-3.2
>>
>> Stephen, honestly speaking, why are you going unregisterised route?
>> Isn't it possible for you to use registerised build?
>
> I'm trying an unregisterised build because until this morning that was
> the only kind anyone had ever made work without producing segfaulting
> binaries. Now that Nathan has additionally had success with a registered
> build, I am going to try that some more :)

Good! I don't follow cross-compilation to ARM that much, but native
arm-linux compiles also well here...

Karel



Reply | Threaded
Open this post in threaded view
|

Stack smashing when using FunPtr wrappers on ARM

Nathan Hüsken
In reply to this post by Stephen Paul Weber
On 01/24/2013 04:51 PM, Stephen Paul Weber wrote:
> Somebody claiming to be Nathan H?sken wrote:
>> I tried it here with android. It works, no segfault.
>> I have used llvm-3.2, maybe that helps?
>
> This is your normal (registered) build with llvm-3.2, yes?

Yes that is correct. It is a quick-llvm build.

> I am building one against llvm-3.0 just now and if it fails will try
> llvm-3.2
>