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
which export main and is position independant while having
and init calling arch_prctl().

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.

Reply via email to