Hello,

I am working on server-side webassembly stuff and the fact that I am not a 
javascript interpreter was getting in the way due to nearly all the 
standard library pulling in syscall/js. To obviate this problem, I have 
created a custom GOOS that I will not link any javascript code to. I have 
been having a strange issue when trying to test a "Hello world" program via 
this 
fork: https://github.com/Xe/go/commit/37bc30ec064a32a630cdad325f83020c1f5be976

The program in question:

// main.go
package main

func main() {
  println("hello, world!")
}

Yields this error

~/Code/godagger/bin $ GOOS=dagger GOARCH=wasm ./go build -o main.wasm -v -x 
main.go
WORK=/var/folders/90/m9qxx4xn30j6qb9_kmyz85gc0000gn/T/go-build069828174
mkdir -p $WORK/b001/
cat >$WORK/b001/importcfg.link << 'EOF' # internal
packagefile 
command-line-arguments=/Users/cadey/Library/Caches/go-build/55/55f7fdd8d4421dbcf4f7086d0f8340cf6ecd0eda676e8f50afcd3c96a8bc56ff-d
packagefile 
runtime=/Users/cadey/Library/Caches/go-build/67/6714236b47a70990fb0340fe648fd0e231957e66e66f6d4e0b90bc00bac56821-d
packagefile 
internal/bytealg=/Users/cadey/Library/Caches/go-build/5a/5a1eaeacdfbfd8980aaa38233ba37799dc4586554c2f9644f5cf112ee2de67d2-d
packagefile 
internal/cpu=/Users/cadey/Library/Caches/go-build/86/86d373925de1c5e6175ca992d172e639189a2a4f620eeef7924585ac1a828e0d-d
packagefile 
runtime/internal/atomic=/Users/cadey/Library/Caches/go-build/88/88207d5f364c51cfd7fb7df7be3c10cef8b1ef1dccf48b8c30e98e93f31e520c-d
packagefile 
runtime/internal/sys=/Users/cadey/Library/Caches/go-build/c6/c6325bb1714391e476d316b6c6f8862eef903eae90ec2c950de6c3cb7ca8e2d2-d
EOF
mkdir -p $WORK/b001/exe/
cd .
/Users/cadey/Code/godagger/pkg/tool/darwin_amd64/link -o $WORK/b001/exe/a.out 
-importcfg $WORK/b001/importcfg.link -buildmode=exe 
-buildid=qUazlQjl5WNuE_nxTSUB/wxw_T9z-Fi14c-8QHTjK/qSmPArTKnJaVIYdqMrzQ/qUazlQjl5WNuE_nxTSUB
 -extld=clang 
/Users/cadey/Library/Caches/go-build/55/55f7fdd8d4421dbcf4f7086d0f8340cf6ecd0eda676e8f50afcd3c96a8bc56ff-d
(hash) command-line-arguments
type.*: phase error: addr=0x11e8 but sym=0x10 type=8

In a failed attempt to debug this further, I have added some debugging calls to 
that part of the linker and gotten this information:

/home/xena/code/godagger/pkg/tool/linux_amd64/link -o $WORK/b001/exe/a.out 
-importcfg $WORK/b001/importcfg.link -buildmode=exe 
-buildid=lTuDD7l8NofYrQu5290j/4J8rA7P-Z303raUCyHDx/w2G2ociXd8XhV0dnVhOW/lTuDD7l8NofYrQu5290j
 -w -extld=gcc 
/home/xena/.cache/go-build/a7/a7bb24f76c378aab3f926f3008fe40a7d0d5fa9f3fbe1736242aad551faf1cee-d
# command-line-arguments
2018/09/05 18:56:52 &sym.Symbol{Name:"type.*", Type:0x8, Version:0, Attr:520, 
Dynid:-1, Align:0, Elfsym:0, LocalElfsym:0, Value:16, Size:0, 
Sub:(*sym.Symbol)(nil), Outer:(*sym.Symbol)(nil), Gotype:(*sym.Symbol)(nil), 
File:"", auxinfo:(*sym.AuxSymbol)(nil), Sect:(*sym.Section)(0xc000cd0140), 
FuncInfo:(*sym.FuncInfo)(nil), Lib:(*sym.Library)(nil), P:[]uint8(nil), 
R:[]sym.Reloc(nil)}
2018/09/05 18:56:52 i: 0, s.Value: 10 addr: 11e8, eaddr: 11e8
type.*: phase error: addr=0x11e8 but sym=0x10 type=8

I tried skipping over this block of code in the linker, but that produced an 
obviously wrong binary output (less than 1024 bytes). 

What did I do wrong?

Christine Dodrill

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to