Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/link: internal linker fails to build openshift/installer with "program too large, call relocation distance" and segfaults on linux/arm64 #40492

Open
jcajka opened this issue Jul 30, 2020 · 21 comments
Labels
Milestone

Comments

@jcajka
Copy link
Contributor

@jcajka jcajka commented Jul 30, 2020

What version of Go are you using (go version)?

go version devel +85afa2eb19 Tue Jul 28 16:59:04 2020 +0000 linux/arm64
Also seen with go1.15rc1/1.14.6/1.13.14

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

linux/arm64

What did you do?

git clone https://github.com/openshift/installer
pushd installer
go build -mod=vendor -o bin/openshift-install ./cmd/openshift-install

What did you expect to see?

Build succeed.

What did you see instead?

For the record following is with the master branch go and gcc-10.1.1, gibc-2.31 and binutils-2.34 on (Fedora 32) host.

# go build -mod=vendor -o bin/openshift-install ./cmd/openshift-install                                                                                                                            
# github.com/openshift/installer/cmd/openshift-install                                                                                                                                                                                        
net(.text): program too large, call relocation distance = 146365316                                                                                                                                                                           
net(.text): program too large, call relocation distance = 146365296                                                                                                                                                                           
net(.text): program too large, call relocation distance = 146365196                                                                                                                                                                           
net(.text): program too large, call relocation distance = 146365108                                                                                                                                                                           
net(.text): program too large, call relocation distance = 146365120                                                                                                                                                                           
net(.text): program too large, call relocation distance = 146365084                                                                                                                                                                           
net(.text): program too large, call relocation distance = 146365056                                                                                                                                                                           
net(.text): program too large, call relocation distance = 146364940                                                                                                                                                                           
runtime/cgo(.text): program too large, call relocation distance = 146364852                                                                                                                                                                   
runtime/cgo(.text): program too large, call relocation distance = 146364808                                                                                                                                                                   
runtime/cgo(.text): program too large, call relocation distance = 146364812                                                                                                                                                                   
runtime/cgo(.text): program too large, call relocation distance = 146364824                                                                                                                                                                   
runtime/cgo(.text): program too large, call relocation distance = 146364804                                                                                                                                                                   
runtime/cgo(.text): program too large, call relocation distance = 146364792                                                                                                                                                                   
runtime/cgo(.text): program too large, call relocation distance = 146364788                                                                                                                                                                   
runtime/cgo(.text): program too large, call relocation distance = 146364680                                                                                                                                                                   
runtime/cgo(.text): program too large, call relocation distance = 146364712                                                                                                                                                                   
runtime/cgo(.text): program too large, call relocation distance = 146364680                                                                                                                                                                   
runtime/cgo(.text): program too large, call relocation distance = 146364612                                                                                                                                                                   
runtime/cgo(.text): program too large, call relocation distance = 146364624                                                                                                                                                                   
runtime/cgo(.text): program too large, call relocation distance = 146364564                                                                                                                                                                   
/root/upstream/go/pkg/tool/linux_arm64/link: too many errors                                                                                                                                                                                  
unexpected fault address 0xffff03aca4ca                                                                                                                                                                                                       
fatal error: fault                                                                                                                                                                                                                            
[signal SIGSEGV: segmentation violation code=0x1 addr=0xffff03aca4ca pc=0xe10b0]                                                                                                                                                              
                                                                                                                                                                                                                                              
goroutine 305 [running]:                                                                                                                                                                                                                      
runtime.throw(0x29ff4c, 0x5)                                                                                                                                                                                                                  
        /root/upstream/go/src/runtime/panic.go:1116 +0x54 fp=0x4000037540 sp=0x4000037510 pc=0x41594                                                                                                                                          
runtime.sigpanic()                                                                                                                                                                                                                            
        /root/upstream/go/src/runtime/signal_unix.go:727 +0x3b8 fp=0x4000037570 sp=0x4000037540 pc=0x577d8                                                                                                                                    
encoding/binary.littleEndian.PutUint32(...)                                                                                                                                                                                                   
        /root/upstream/go/src/encoding/binary/binary.go:73                                                                                                                                                                                    
encoding/binary.(*littleEndian).PutUint32(0x489780, 0xffff03aca4ca, 0x4, 0xe6a7302, 0x126c)                                                                                                                                                   
        :1 +0x40 fp=0x40000375a0 sp=0x4000037580 pc=0xe10b0                                                                                                                                                                    
cmd/link/internal/ld.relocsym2(0x4000071880, 0x40007c2000, 0x4000071890, 0x40000718d8, 0x401fcbc480) 
        /root/upstream/go/src/cmd/link/internal/ld/data2.go:481 +0x620 fp=0x4000037750 sp=0x40000375a0 pc=0x171db0
cmd/link/internal/ld.(*Link).reloc2.func2(0x4000071880, 0x4000071880, 0x40007c2000, 0x4000071890, 0x40000718d8, 0x403bcb66f0)
        /root/upstream/go/src/cmd/link/internal/ld/data2.go:505 +0x68 fp=0x40000377a0 sp=0x4000037750 pc=0x1cd128
runtime.goexit()
        /root/upstream/go/src/runtime/asm_arm64.s:1136 +0x4 fp=0x40000377a0 sp=0x40000377a0 pc=0x726b4
created by cmd/link/internal/ld.(*Link).reloc2
        /root/upstream/go/src/cmd/link/internal/ld/data2.go:503 +0xe0

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0x403bcb66f8)
        /root/upstream/go/src/runtime/sema.go:56 +0x38
sync.(*WaitGroup).Wait(0x403bcb66f0)
        /root/upstream/go/src/sync/waitgroup.go:130 +0x6c
cmd/link/internal/ld.(*Link).reloc2(0x4000071880)
        /root/upstream/go/src/cmd/link/internal/ld/data2.go:517 +0x12c
cmd/link/internal/ld.Main(0x448740, 0x10, 0x20, 0x1, 0x1f, 0x1e, 0x2a77c4, 0x14, 0x2aaf46, 0x1a, ...)
        /root/upstream/go/src/cmd/link/internal/ld/main.go:346 +0x1228
main.main()
        /root/upstream/go/src/cmd/link/main.go:68 +0x188

goroutine 80 [syscall]:
syscall.Syscall(0xd7, 0xfffefaed8000, 0x172997cc, 0x0, 0x40006dca28, 0x56c8d05f, 0xec02fd3640213e57)
        /root/upstream/go/src/syscall/asm_linux_arm64.s:9 +0x10
syscall.munmap(0xfffefaed8000, 0x172997cc, 0xffff121717cb, 0x4004e85ce8)
        /root/upstream/go/src/syscall/zsyscall_linux_arm64.go:957 +0x3c
syscall.(*mmapper).Munmap(0x4447a0, 0xfffefaed8000, 0x172997cc, 0x172997cc, 0x0, 0x0)
        /root/upstream/go/src/syscall/syscall_unix.go:94 +0x148
syscall.Munmap(...)
        /root/upstream/go/src/syscall/syscall_linux.go:1003 
cmd/link/internal/ld.(*OutBuf).munmap(0x4000136070)
        /root/upstream/go/src/cmd/link/internal/ld/outbuf_mmap.go:39 +0x54
cmd/link/internal/ld.(*OutBuf).copyHeap(0x4000136070, 0x403941a000)
        /root/upstream/go/src/cmd/link/internal/ld/outbuf.go:152 +0x54
cmd/link/internal/ld.(*OutBuf).Close(0x4000136070, 0x1c3ea8, 0x40317b4270)
        /root/upstream/go/src/cmd/link/internal/ld/outbuf.go:116 +0x124
cmd/link/internal/ld.linknew.func1()
        /root/upstream/go/src/cmd/link/internal/ld/sym.go:61 +0x4c
cmd/link/internal/ld.runAtExitFuncs()
        /root/upstream/go/src/cmd/link/internal/ld/util.go:24 +0x40
cmd/link/internal/ld.Exit(0x2)
        /root/upstream/go/src/cmd/link/internal/ld/util.go:31 +0x20
cmd/link/internal/ld.Exitf(0x2a4c73, 0xf, 0x0, 0x0, 0x0)
        /root/upstream/go/src/cmd/link/internal/ld/util.go:39 +0x100
cmd/link/internal/ld.afterErrorAction(...)
        /root/upstream/go/src/cmd/link/internal/ld/util.go:50
cmd/link/internal/ld.Errorf(0x403f1b4280, 0x2b350e, 0x30, 0x40006dcd88, 0x1, 0x1)
        /root/upstream/go/src/cmd/link/internal/ld/util.go:66 +0x100
cmd/link/internal/arm64.archreloc(0x4000071880, 0x40000718d8, 0x4077122560, 0x403f1b4280, 0x94000000, 0x910da273, 0x1)
        /root/upstream/go/src/cmd/link/internal/arm64/asm.go:634 +0x4dc
cmd/link/internal/ld.relocsym2(0x4000071880, 0x40007c2000, 0x4000071890, 0x40000718d8, 0x403f1b4280)
        /root/upstream/go/src/cmd/link/internal/ld/data2.go:147 +0xe38
cmd/link/internal/ld.(*Link).reloc2.func1(0x4000071880, 0x4000071880, 0x40007c2000, 0x4000071890, 0x40000718d8, 0x403bcb66f0)
        /root/upstream/go/src/cmd/link/internal/ld/data2.go:498 +0x78
created by cmd/link/internal/ld.(*Link).reloc2
        /root/upstream/go/src/cmd/link/internal/ld/data2.go:495 +0x9c

Using linkmode=external seems to work around the issue.
This reminds me of the similar issues with the external linker(on non-amd64 architectures) in the past #17028 . I'm bit surprised that this didn't got hit by any other "big binary" projects as kube, openshift,....

@davecheney
Copy link
Contributor

@davecheney davecheney commented Jul 30, 2020

How big are we talking? If you compile it for amd64 how larger is the image?

@jcajka
Copy link
Contributor Author

@jcajka jcajka commented Jul 30, 2020

@davecheney ~436MB executable on arm64 with external linker, with defaults 468MB on amd64

@davecheney
Copy link
Contributor

@davecheney davecheney commented Jul 30, 2020

That’s staggering. I thought hyperkube was large.

@jcajka
Copy link
Contributor Author

@jcajka jcajka commented Jul 30, 2020

TBH same here, assumed it will be in the "normal" ~100MB range, not 3-4 times larger.

@jcajka
Copy link
Contributor Author

@jcajka jcajka commented Jul 30, 2020

To note it is not stripped with DWARF. And disabling the DWARF have no effect on the build success.

@networkimprov
Copy link

@networkimprov networkimprov commented Jul 30, 2020

@gopherbot remove WaitingForInfo

cc @thanm @aclements @cherrymui

@aclements
Copy link
Member

@aclements aclements commented Jul 30, 2020

Also cc @jeremyfaller .

Looks like we may have a trampoline insertion issue?

@aclements aclements added this to the Go1.15 milestone Jul 30, 2020
@aclements
Copy link
Member

@aclements aclements commented Jul 30, 2020

Note that this was also present in 1.14 and 1.13, so this isn't a regression. I've tentatively put this in the 1.15 milestone, but we probably won't fix this for the initial release (it may make a point release).

@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented Jul 30, 2020

We don't have trampoline support on ARM64. We could implement it (which shouldn't be too hard). But probably too late for 1.15.

@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented Jul 30, 2020

DWARF does not matter. It is solely about program text.

@jcajka
Copy link
Contributor Author

@jcajka jcajka commented Aug 3, 2020

@cherrymui yeah, it would have been really weird if that had any impact

@aclements it would be cool to have it fixed in the go1.15, but it seems that the GC with external linker is ok atm(in all upstream supported versions of GC). So this doesn't seem to me as really critical issue atm.

@aclements
Copy link
Member

@aclements aclements commented Aug 3, 2020

Thanks for the follow-up. Since 1.15 is just about out the door at this point, I'll move this to 1.16.

@aclements aclements modified the milestones: Go1.15, Go1.16 Aug 3, 2020
yselkowitz added a commit to multi-arch/openshift-installer that referenced this issue Oct 5, 2020
There is a bug with the golang internal linker for the linux/arm64 target
that has yet to be fixed:

golang/go#40492
yselkowitz added a commit to multi-arch/openshift-installer that referenced this issue Oct 5, 2020
There is a bug with the golang internal linker for the linux/arm64 target
that has yet to be fixed:

golang/go#40492
@aclements
Copy link
Member

@aclements aclements commented Dec 7, 2020

And bumping to 1.17. We should add trampolines, since this is likely to become a problem for more users in the future.

@aclements aclements modified the milestones: Go1.16, Go1.17 Dec 7, 2020
@jcajka
Copy link
Contributor Author

@jcajka jcajka commented Feb 4, 2021

For the record this is still issue. There are no changes with go1.16. External linker workaround still holds.

@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented Feb 4, 2021

Yes, no work is done for this in Go 1.16. My plan is to do this in 1.17.

vrutkovs added a commit to vrutkovs/installer that referenced this issue Mar 10, 2021
There is a bug with the golang internal linker for the linux/arm64 target
that has yet to be fixed:

golang/go#40492
@zhangfannie
Copy link
Contributor

@zhangfannie zhangfannie commented Mar 17, 2021

If no one plans to do this next quarter, I am happy to take it. Thank you.

@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented Mar 17, 2021

I plan to do this in 1.17. But if you get ahead of me, feel free to send a CL. Thanks.

@yselkowitz
Copy link

@yselkowitz yselkowitz commented Mar 21, 2021

Not sure if this is related, but trying to cross-compile to darwin/arm64 with go1.16.2 produces a similar error (but darwin/amd64 works):

$ GOARCH=arm64 GOOS=darwin ~/go1.16/bin/go build -mod=vendor -ldflags ' -X github.com/openshift/installer/pkg/version.Raw=unreleased-master-4388-g5068bd4ce98d6256af6cc8568bad419beecb40a8-dirty -X github.com/openshift/installer/pkg/version.Commit=5068bd4ce98d6256af6cc8568bad419beecb40a8 -s -w' -tags ' release' -o _output/bin/darwin_arm64/openshift-install ./cmd/openshift-install
# github.com/openshift/installer/cmd/openshift-install
golang.org/x/sys/unix.libc_ioctl_trampoline: program too large, call relocation distance = 145601484
golang.org/x/sys/unix.libc_flock_trampoline: program too large, call relocation distance = 145601744
golang.org/x/sys/unix.libc_read_trampoline: program too large, call relocation distance = 145600432
golang.org/x/sys/unix.libc_mmap_trampoline: program too large, call relocation distance = 145600476
golang.org/x/sys/unix.libc_munmap_trampoline: program too large, call relocation distance = 145600472
runtime.open_trampoline: program too large, call relocation distance = 147504464
runtime.close_trampoline: program too large, call relocation distance = 147504428
runtime.write_trampoline: program too large, call relocation distance = 147504400
runtime.write_trampoline: program too large, call relocation distance = 147504396
runtime.read_trampoline: program too large, call relocation distance = 147504360
runtime.read_trampoline: program too large, call relocation distance = 147504332
runtime.pipe_trampoline: program too large, call relocation distance = 147504320
runtime.pipe_trampoline: program too large, call relocation distance = 147504284
runtime.exit_trampoline: program too large, call relocation distance = 147504292
runtime.raiseproc_trampoline: program too large, call relocation distance = 147504260
runtime.raiseproc_trampoline: program too large, call relocation distance = 147504264
runtime.mmap_trampoline: program too large, call relocation distance = 147504212
runtime.mmap_trampoline: program too large, call relocation distance = 147504120
runtime.munmap_trampoline: program too large, call relocation distance = 147504148
runtime.madvise_trampoline: program too large, call relocation distance = 147504108
runtime.mlock_trampoline: program too large, call relocation distance = 147504076
/home/yselkowi/go1.16/pkg/tool/linux_amd64/link: too many errors
unexpected fault address 0x7fbdd4987000
fatal error: fault
unexpected fault address 0x7fbdd46b7000
fatal error: fault
unexpected fault address 0x7fbdd488c000
unexpected fault address 0x7fbdd4c55000
fatal error: fault
fatal error: fault
unexpected fault address 0x7fbdd4b543c0
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x1 addr=0x7fbdd4987000 pc=0x46dbee]

goroutine 29 [running]:
runtime.throw(0x6dcc2d, 0x5)
	/usr/local/go/src/runtime/panic.go:1117 +0x72 fp=0xc02a788d18 sp=0xc02a788ce8 pc=0x436e52
runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:741 +0x268 fp=0xc02a788d50 sp=0xc02a788d18 pc=0x44e548
runtime.memmove(0x7fbdd49862d0, 0x7fbe5ac5c740, 0xfa0)
	/usr/local/go/src/runtime/memmove_amd64.s:366 +0x42e fp=0xc02a788d58 sp=0xc02a788d50 pc=0x46dbee
cmd/link/internal/ld.(*OutBuf).WriteSym(0xc00015b6c0, 0xc00070a000, 0xdfd61, 0x8bfda0, 0x134e6500, 0x134e6540)
	/usr/local/go/src/cmd/link/internal/ld/outbuf.go:300 +0x2bc fp=0xc02a788de8 sp=0xc02a788d58 pc=0x5ebf1c
cmd/link/internal/ld.writeBlock(0xc00015c000, 0xc00015b6c0, 0xc00070a000, 0xc018d8d518, 0x7479c, 0x8b55d, 0x1004342d0, 0x100080, 0x8bf2e0, 0x200, ...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:952 +0x1a9 fp=0xc02a788f10 sp=0xc02a788de8 pc=0x58a269
cmd/link/internal/ld.writeBlocks.func1(0xc00015c000, 0xc0028fc0e0, 0xc00014c120, 0xc00015b6c0, 0xc00070a000, 0xc018d8d518, 0x7479c, 0x8b55d, 0x100401b00, 0x100080, ...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:909 +0xb1 fp=0xc02a788f78 sp=0xc02a788f10 pc=0x609b51
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1371 +0x1 fp=0xc02a788f80 sp=0xc02a788f78 pc=0x46c9e1
created by cmd/link/internal/ld.writeBlocks
	/usr/local/go/src/cmd/link/internal/ld/data.go:908 +0x565

goroutine 1 [semacquire]:
sync.runtime_Semacquire(0xc0028fc0c8)
	/usr/local/go/src/runtime/sema.go:56 +0x45
sync.(*WaitGroup).Wait(0xc0028fc0c0)
	/usr/local/go/src/sync/waitgroup.go:130 +0x65
cmd/link/internal/ld.asmb(0xc00015c000)
	/usr/local/go/src/cmd/link/internal/ld/asmb.go:73 +0x235
cmd/link/internal/ld.Main(0x87f480, 0x10, 0x20, 0x1, 0x1f, 0x1e, 0x6e4648, 0x14, 0x6e7d51, 0x1a, ...)
	/usr/local/go/src/cmd/link/internal/ld/main.go:339 +0x1465
main.main()
	/usr/local/go/src/cmd/link/main.go:68 +0x258

goroutine 23 [runnable]:
cmd/link/internal/loader.(*Loader).SymValue(...)
	/usr/local/go/src/cmd/link/internal/loader/loader.go:1217
cmd/link/internal/ld.writeBlocks(0xc00015c000, 0xc00015b420, 0xc00014c120, 0xc00070a000, 0xc01c870000, 0xf16e4, 0xf16e4, 0x113754000, 0x1c3ce0, 0x8bf2e0, ...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:846 +0x7e
cmd/link/internal/ld.writeDatblkToOutBuf(...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:1006
cmd/link/internal/ld.datblk(0xc00015c000, 0xc00015b420, 0x113754000, 0x1c3ce0)
	/usr/local/go/src/cmd/link/internal/ld/data.go:994 +0xad
cmd/link/internal/ld.writeParallel.func1(0xc0028fc0c0, 0x6f43e0, 0xc00015c000, 0xc00015b420, 0x113754000, 0x1c3ce0)
	/usr/local/go/src/cmd/link/internal/ld/data.go:988 +0x7a
created by cmd/link/internal/ld.writeParallel
	/usr/local/go/src/cmd/link/internal/ld/data.go:986 +0x152

goroutine 22 [runnable]:
cmd/link/internal/loader.(*Loader).SubSym(...)
	/usr/local/go/src/cmd/link/internal/loader/loader.go:1740
cmd/link/internal/loader.(*Loader).AttrSubSymbol(...)
	/usr/local/go/src/cmd/link/internal/loader/loader.go:1161
cmd/link/internal/ld.writeBlocks(0xc00015c000, 0xc00015b3b0, 0xc00014c120, 0xc00070a000, 0xc01cadd988, 0xa3bb3, 0xa3bb3, 0x109d48000, 0x9a090b0, 0x8bf2e0, ...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:858 +0x785
cmd/link/internal/ld.writeDatblkToOutBuf(...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:1006
cmd/link/internal/ld.datblk(0xc00015c000, 0xc00015b3b0, 0x109d48000, 0x9a090b0)
	/usr/local/go/src/cmd/link/internal/ld/data.go:994 +0xad
cmd/link/internal/ld.writeParallel.func1(0xc0028fc0c0, 0x6f43e0, 0xc00015c000, 0xc00015b3b0, 0x109d48000, 0x9a090b0)
	/usr/local/go/src/cmd/link/internal/ld/data.go:988 +0x7a
created by cmd/link/internal/ld.writeParallel
	/usr/local/go/src/cmd/link/internal/ld/data.go:986 +0x152

goroutine 21 [runnable]:
cmd/link/internal/loader.(*Loader).OuterSym(...)
	/usr/local/go/src/cmd/link/internal/loader/loader.go:1733
cmd/link/internal/loader.(*Loader).AttrSubSymbol(...)
	/usr/local/go/src/cmd/link/internal/loader/loader.go:1157
cmd/link/internal/ld.writeBlocks(0xc00015c000, 0xc00015b340, 0xc00014c120, 0xc00070a000, 0xc01c870008, 0xf16e3, 0xf16e3, 0x108d14160, 0x10309d8, 0x8bf2e0, ...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:858 +0x1c7
cmd/link/internal/ld.writeDatblkToOutBuf(...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:1006
cmd/link/internal/ld.datblk(0xc00015c000, 0xc00015b340, 0x108d14160, 0x10309d8)
	/usr/local/go/src/cmd/link/internal/ld/data.go:994 +0xad
cmd/link/internal/ld.writeParallel.func1(0xc0028fc0c0, 0x6f43e0, 0xc00015c000, 0xc00015b340, 0x108d14160, 0x10309d8)
	/usr/local/go/src/cmd/link/internal/ld/data.go:988 +0x7a
created by cmd/link/internal/ld.writeParallel
	/usr/local/go/src/cmd/link/internal/ld/data.go:986 +0x152

goroutine 19 [runnable]:
cmd/link/internal/loader.(*Loader).SymSize(0xc00070a000, 0x2a564, 0x2a564)
	/usr/local/go/src/cmd/link/internal/loader/loader.go:816 +0xdb
cmd/link/internal/ld.writeBlocks(0xc00015c000, 0xc00015b260, 0xc00014c120, 0xc00070a000, 0xc018da0e38, 0x72078, 0x88e39, 0x1008034b0, 0x8d12c00, 0x8bf2e0, ...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:864 +0x22c
cmd/link/internal/ld.CodeblkPad(...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:834
cmd/link/internal/ld.asmb.func1(0xc00015c000, 0xc00015b260, 0x100001000, 0x8d12c00)
	/usr/local/go/src/cmd/link/internal/ld/asmb.go:39 +0xd3
cmd/link/internal/ld.writeParallel.func1(0xc0028fc0c0, 0x6f43d8, 0xc00015c000, 0xc00015b260, 0x100001000, 0x8d12c00)
	/usr/local/go/src/cmd/link/internal/ld/data.go:988 +0x7a
created by cmd/link/internal/ld.writeParallel
	/usr/local/go/src/cmd/link/internal/ld/data.go:986 +0x152

goroutine 25 [runnable]:
syscall.Syscall(0x3, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/syscall/asm_linux_amd64.s:20 +0x5
syscall.Close(0x3, 0x300000002, 0xc000782c00)
	/usr/local/go/src/syscall/zsyscall_linux_amd64.go:285 +0x45
internal/poll.(*FD).destroy(0xc000028300, 0x18, 0x0)
	/usr/local/go/src/internal/poll/fd_unix.go:83 +0x43
internal/poll.(*FD).decref(0xc000028300, 0x1, 0xcb7b02bb3a378ad1)
	/usr/local/go/src/internal/poll/fd_mutex.go:213 +0x5d
internal/poll.(*FD).Close(0xc000028300, 0x4a8992, 0x87b3a0)
	/usr/local/go/src/internal/poll/fd_unix.go:106 +0x4f
os.(*file).close(0xc000028300, 0x7fbdd4552000, 0x13918000)
	/usr/local/go/src/os/file_unix.go:251 +0x38
os.(*File).Close(...)
	/usr/local/go/src/os/file_posix.go:25
cmd/link/internal/ld.(*OutBuf).Close(0xc00015a070, 0x41, 0x0)
	/usr/local/go/src/cmd/link/internal/ld/outbuf.go:127 +0xca
cmd/link/internal/ld.linknew.func1()
	/usr/local/go/src/cmd/link/internal/ld/sym.go:62 +0x45
cmd/link/internal/ld.runAtExitFuncs(...)
	/usr/local/go/src/cmd/link/internal/ld/util.go:23
cmd/link/internal/ld.Exit(0x2)
	/usr/local/go/src/cmd/link/internal/ld/util.go:30 +0x3b
cmd/link/internal/ld.Exitf(0x6e1a45, 0xf, 0x0, 0x0, 0x0)
	/usr/local/go/src/cmd/link/internal/ld/util.go:38 +0x106
cmd/link/internal/ld.afterErrorAction()
	/usr/local/go/src/cmd/link/internal/ld/util.go:49 +0x7a
cmd/link/internal/loader.(*ErrorReporter).Errorf(0xc00015c010, 0x346b40, 0x6f0446, 0x30, 0xc0014e2ac0, 0x1, 0x1)
	/usr/local/go/src/cmd/link/internal/loader/loader.go:2619 +0x143
cmd/link/internal/loader.(*Loader).Errorf(...)
	/usr/local/go/src/cmd/link/internal/loader/loader.go:2629
cmd/link/internal/arm64.archreloc(0xc00015c000, 0xc00070a000, 0xc00015c048, 0xc014862618, 0xc00017e000, 0xc00070a000, 0xc00017000a, 0x346b40, 0x94000000, 0x9632aefb, ...)
	/usr/local/go/src/cmd/link/internal/arm64/asm.go:730 +0x79c
cmd/link/internal/ld.(*relocSymState).relocsym(0xc0014e2ea0, 0x346b40, 0x7fbdd45ba0b0, 0x30, 0x138aff50)
	/usr/local/go/src/cmd/link/internal/ld/data.go:250 +0x1524
cmd/link/internal/ld.writeBlock(0xc00015c000, 0xc00015b500, 0xc00070a000, 0xc018d78000, 0x7723f, 0x8e000, 0x1000680b0, 0x100020, 0x8bf2e0, 0x200, ...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:953 +0x1e7
cmd/link/internal/ld.writeBlocks.func1(0xc00015c000, 0xc0028fc0e0, 0xc00014c120, 0xc00015b500, 0xc00070a000, 0xc018d78000, 0x7723f, 0x8e000, 0x100001000, 0x100020, ...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:909 +0xb1
created by cmd/link/internal/ld.writeBlocks
	/usr/local/go/src/cmd/link/internal/ld/data.go:908 +0x565

goroutine 26 [running]:
	goroutine running on other thread; stack unavailable
created by cmd/link/internal/ld.writeBlocks
	/usr/local/go/src/cmd/link/internal/ld/data.go:908 +0x565

goroutine 27 [runnable]:
cmd/link/internal/ld.(*OutBuf).WriteSym(0xc00015b5e0, 0xc00070a000, 0x1aa22, 0x8bfda0, 0x136c6600, 0x136c6630)
	/usr/local/go/src/cmd/link/internal/ld/outbuf.go:300 +0x2bc
cmd/link/internal/ld.writeBlock(0xc00015c000, 0xc00015b5e0, 0xc00070a000, 0xc018d82ae8, 0x75ce2, 0x8caa3, 0x100251d40, 0x1008a0, 0x8bf2e0, 0x200, ...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:952 +0x1a9
cmd/link/internal/ld.writeBlocks.func1(0xc00015c000, 0xc0028fc0e0, 0xc00014c120, 0xc00015b5e0, 0xc00070a000, 0xc018d82ae8, 0x75ce2, 0x8caa3, 0x1002011e0, 0x1008a0, ...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:909 +0xb1
created by cmd/link/internal/ld.writeBlocks
	/usr/local/go/src/cmd/link/internal/ld/data.go:908 +0x565

goroutine 28 [running]:
	goroutine running on other thread; stack unavailable
created by cmd/link/internal/ld.writeBlocks
	/usr/local/go/src/cmd/link/internal/ld/data.go:908 +0x565

goroutine 30 [runnable]:
cmd/link/internal/ld.(*OutBuf).WriteSym(0xc00015b730, 0xc00070a000, 0x272d, 0x8bfda0, 0x133ffb00, 0x133ffbb0)
	/usr/local/go/src/cmd/link/internal/ld/outbuf.go:300 +0x2bc
cmd/link/internal/ld.writeBlock(0xc00015c000, 0xc00015b730, 0xc00070a000, 0xc018d938d8, 0x73b24, 0x8a8e5, 0x1005184d0, 0x100830, 0x8bf2e0, 0x200, ...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:952 +0x1a9
cmd/link/internal/ld.writeBlocks.func1(0xc00015c000, 0xc0028fc0e0, 0xc00014c120, 0xc00015b730, 0xc00070a000, 0xc018d938d8, 0x73b24, 0x8a8e5, 0x100501b80, 0x100830, ...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:909 +0xb1
created by cmd/link/internal/ld.writeBlocks
	/usr/local/go/src/cmd/link/internal/ld/data.go:908 +0x565

goroutine 31 [running]:
	goroutine running on other thread; stack unavailable
created by cmd/link/internal/ld.writeBlocks
	/usr/local/go/src/cmd/link/internal/ld/data.go:908 +0x565

goroutine 32 [running]:
	goroutine running on other thread; stack unavailable
created by cmd/link/internal/ld.writeBlocks
	/usr/local/go/src/cmd/link/internal/ld/data.go:908 +0x565
[signal SIGSEGV: segmentation violation code=0x1 addr=0x7fbdd46b7000 pc=0x46dbee]

goroutine 26 [running]:
runtime.throw(0x6dcc2d, 0x5)
	/usr/local/go/src/runtime/panic.go:1117 +0x72 fp=0xc003924d18 sp=0xc003924ce8 pc=0x436e52
runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:741 +0x268 fp=0xc003924d50 sp=0xc003924d18 pc=0x44e548
runtime.memmove(0x7fbdd46b6f50, 0x7fbe64050354, 0x310)
	/usr/local/go/src/runtime/memmove_amd64.s:366 +0x42e fp=0xc003924d58 sp=0xc003924d50 pc=0x46dbee
cmd/link/internal/ld.(*OutBuf).WriteSym(0xc00015b570, 0xc00070a000, 0xb24de, 0x8bfda0, 0x137b3400, 0x137b3440)
	/usr/local/go/src/cmd/link/internal/ld/outbuf.go:300 +0x2bc fp=0xc003924de8 sp=0xc003924d58 pc=0x5ebf1c
cmd/link/internal/ld.writeBlock(0xc00015c000, 0xc00015b570, 0xc00070a000, 0xc018d7dad8, 0x766e4, 0x8d4a5, 0x100164f50, 0x1001c0, 0x8bf2e0, 0x200, ...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:952 +0x1a9 fp=0xc003924f10 sp=0xc003924de8 pc=0x58a269
cmd/link/internal/ld.writeBlocks.func1(0xc00015c000, 0xc0028fc0e0, 0xc00014c120, 0xc00015b570, 0xc00070a000, 0xc018d7dad8, 0x766e4, 0x8d4a5, 0x100101020, 0x1001c0, ...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:909 +0xb1 fp=0xc003924f78 sp=0xc003924f10 pc=0x609b51
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1371 +0x1 fp=0xc003924f80 sp=0xc003924f78 pc=0x46c9e1
created by cmd/link/internal/ld.writeBlocks
	/usr/local/go/src/cmd/link/internal/ld/data.go:908 +0x565
[signal SIGSEGV: segmentation violation code=0x1 addr=0x7fbdd4b543c0 pc=0x46dbea]

goroutine 31 [running]:
runtime.throw(0x6dcc2d, 0x5)
	/usr/local/go/src/runtime/panic.go:1117 +0x72 fp=0xc005e58d18 sp=0xc005e58ce8 pc=0x436e52
runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:741 +0x268 fp=0xc005e58d50 sp=0xc005e58d18 pc=0x44e548
runtime.memmove(0x7fbdd4b543b0, 0x7fbe87b1503d, 0xa70)
	/usr/local/go/src/runtime/memmove_amd64.s:365 +0x42a fp=0xc005e58d58 sp=0xc005e58d50 pc=0x46dbea
cmd/link/internal/ld.(*OutBuf).WriteSym(0xc00015b7a0, 0xc00070a000, 0x2c08, 0x8bfda0, 0x0, 0x32fc81)
	/usr/local/go/src/cmd/link/internal/ld/outbuf.go:300 +0x2bc fp=0xc005e58de8 sp=0xc005e58d58 pc=0x5ebf1c
cmd/link/internal/ld.writeBlock(0xc00015c000, 0xc00015b7a0, 0xc00070a000, 0xc018d97af8, 0x732e0, 0x8a0a1, 0x1006023b0, 0x100010, 0x8bf2e0, 0x200, ...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:952 +0x1a9 fp=0xc005e58f10 sp=0xc005e58de8 pc=0x58a269
cmd/link/internal/ld.writeBlocks.func1(0xc00015c000, 0xc0028fc0e0, 0xc00014c120, 0xc00015b7a0, 0xc00070a000, 0xc018d97af8, 0x732e0, 0x8a0a1, 0x1006023b0, 0x100010, ...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:909 +0xb1 fp=0xc005e58f78 sp=0xc005e58f10 pc=0x609b51
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1371 +0x1 fp=0xc005e58f80 sp=0xc005e58f78 pc=0x46c9e1
created by cmd/link/internal/ld.writeBlocks
	/usr/local/go/src/cmd/link/internal/ld/data.go:908 +0x565
[signal SIGSEGV: segmentation violation code=0x1 addr=0x7fbdd4c55000 pc=0x46da06]

goroutine 32 [running]:
runtime.throw(0x6dcc2d, 0x5)
	/usr/local/go/src/runtime/panic.go:1117 +0x72 fp=0xc00392cd18 sp=0xc00392cce8 pc=0x436e52
runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:741 +0x268 fp=0xc00392cd50 sp=0xc00392cd18 pc=0x44e548
runtime.memmove(0x7fbdd4c54fe0, 0x7fbe1533445b, 0xa0)
	/usr/local/go/src/runtime/memmove_amd64.s:233 +0x246 fp=0xc00392cd58 sp=0xc00392cd50 pc=0x46da06
cmd/link/internal/ld.(*OutBuf).WriteSym(0xc00015b810, 0xc00070a000, 0x2576bd, 0x8bfda0, 0x13215000, 0x13215030)
	/usr/local/go/src/cmd/link/internal/ld/outbuf.go:300 +0x2bc fp=0xc00392cde8 sp=0xc00392cd58 pc=0x5ebf1c
cmd/link/internal/ld.writeBlock(0xc00015c000, 0xc00015b810, 0xc00070a000, 0xc018d9d060, 0x72833, 0x895f4, 0x100702fe0, 0x1010f0, 0x8bf2e0, 0x200, ...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:952 +0x1a9 fp=0xc00392cf10 sp=0xc00392cde8 pc=0x58a269
cmd/link/internal/ld.writeBlocks.func1(0xc00015c000, 0xc0028fc0e0, 0xc00014c120, 0xc00015b810, 0xc00070a000, 0xc018d9d060, 0x72833, 0x895f4, 0x1007023c0, 0x1010f0, ...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:909 +0xb1 fp=0xc00392cf78 sp=0xc00392cf10 pc=0x609b51
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1371 +0x1 fp=0xc00392cf80 sp=0xc00392cf78 pc=0x46c9e1
created by cmd/link/internal/ld.writeBlocks
	/usr/local/go/src/cmd/link/internal/ld/data.go:908 +0x565
[signal SIGSEGV: segmentation violation code=0x1 addr=0x7fbdd488c000 pc=0x46dbee]

goroutine 28 [running]:
runtime.throw(0x6dcc2d, 0x5)
	/usr/local/go/src/runtime/panic.go:1117 +0x72 fp=0xc0014ded18 sp=0xc0014dece8 pc=0x436e52
runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:741 +0x268 fp=0xc0014ded50 sp=0xc0014ded18 pc=0x44e548
runtime.memmove(0x7fbdd488b650, 0x7fbe814752d9, 0xac0)
	/usr/local/go/src/runtime/memmove_amd64.s:366 +0x42e fp=0xc0014ded58 sp=0xc0014ded50 pc=0x46dbee
cmd/link/internal/ld.(*OutBuf).WriteSym(0xc00015b650, 0xc00070a000, 0x27bbe, 0x8bfda0, 0x135deb00, 0x135deb70)
	/usr/local/go/src/cmd/link/internal/ld/outbuf.go:300 +0x2bc fp=0xc0014dede8 sp=0xc0014ded58 pc=0x5ebf1c
cmd/link/internal/ld.writeBlock(0xc00015c000, 0xc00015b650, 0xc00070a000, 0xc018d876d8, 0x75364, 0x8c125, 0x100339650, 0x100080, 0x8bf2e0, 0x200, ...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:952 +0x1a9 fp=0xc0014def10 sp=0xc0014dede8 pc=0x58a269
cmd/link/internal/ld.writeBlocks.func1(0xc00015c000, 0xc0028fc0e0, 0xc00014c120, 0xc00015b650, 0xc00070a000, 0xc018d876d8, 0x75364, 0x8c125, 0x100301a80, 0x100080, ...)
	/usr/local/go/src/cmd/link/internal/ld/data.go:909 +0xb1 fp=0xc0014def78 sp=0xc0014def10 pc=0x609b51
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:1371 +0x1 fp=0xc0014def80 sp=0xc0014def78 pc=0x46c9e1
created by cmd/link/internal/ld.writeBlocks
	/usr/local/go/src/cmd/link/internal/ld/data.go:908 +0x565
@cherrymui
Copy link
Contributor

@cherrymui cherrymui commented Mar 22, 2021

@yselkowitz yes, that looks similar to this.

@rcbaus
Copy link

@rcbaus rcbaus commented Apr 15, 2021

seeing similar issue attempting to build openshift-installer on Apple M1. I believe its related:

+ test arm64 = arm64
+ LDFLAGS=' -X github.com/openshift/installer/pkg/version.Raw=unreleased-master-4501-gcac3c1228d14710fab0702d03bf58f16d297aca0 -X github.com/openshift/installer/pkg/version.Commit=cac3c1228d14710fab0702d03bf58f16d297aca0 -s -w -linkmode external'
+ export CGO_ENABLED=1
+ CGO_ENABLED=1
+ go build -mod=vendor -ldflags ' -X github.com/openshift/installer/pkg/version.Raw=unreleased-master-4501-gcac3c1228d14710fab0702d03bf58f16d297aca0 -X github.com/openshift/installer/pkg/version.Commit=cac3c1228d14710fab0702d03bf58f16d297aca0 -s -w -linkmode external' -tags ' release' -o bin/openshift-install ./cmd/openshift-install
# github.com/openshift/installer/cmd/openshift-install
/usr/local/go/pkg/tool/darwin_arm64/link: running clang failed: exit status 1
ld: Unable to insert branch island. No insertion point available. for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
@yselkowitz
Copy link

@yselkowitz yselkowitz commented Apr 15, 2021

Note that @rcbaus' error is with forcing CGO_ENABLED=1 and linkmode external. With CGO_ENABLED=0 and default linkmode, the error on M1 Mac is the same that I got cross-compiling from Linux, as above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
9 participants