On Wed, Aug 31, 2016 at 4:05 PM, Benoit Canet <
[email protected]> wrote:

> The c-shared is intented to build C libraries hence it
> does not export main and it's initialization does not
> set the fs register with arch_prctl() leading to a crash.
>
> Use -buildmode=shared -buildmode=pie to produce a library
>

Doesn't the second option override the first one??


> which export main and is position independant while having
> and init calling arch_prctl().
>

I need either you or Pekka (who wrote this patch?) to explain to me how it
makes sense for arch_prctl() to override the fs base, despite the fact that
OSv needs to to be set to something else for OSv's internal TLS mechanisms
to work.

This still doesn't make any sense to me :-(

Can you please try buildmode=shared instead of buildmode=pie? This should
build a shared library which can't just (I would hope) take over the fs
base register on a whim....


>
> With this patch and the arch_prctl() stuff I revived from
> Pekka's previous go work the code now crash after resolving
> __vdso_gettimeofday to null later when the scheduler is initialized.
>
> Signed-off-by: Benoît Canet <[email protected]>
> ---
>  golang-example/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/golang-example/Makefile b/golang-example/Makefile
> index 15cc093..bbfb015 100644
> --- a/golang-example/Makefile
> +++ b/golang-example/Makefile
> @@ -3,7 +3,7 @@ module: hello
>         echo '/hello: $${MODULE_DIR}/hello' > usr.manifest
>
>  hello: hello.go
> -       /usr/lib/golang/bin/go build -buildmode=c-shared hello.go
> +       /usr/lib/golang/bin/go build -buildmode=shared -buildmode=pie
> hello.go
>
>  clean:
>         rm -f hello usr.manifest
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups
> "OSv Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to