Skip to content

misc/cgo: shared libs tests fail on arm64 with segmentation fault [1.10 backport] #24873

@NightTsarina

Description

@NightTsarina

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

go version go1.10.1 linux/arm64

Does this issue reproduce with the latest release?

Yes

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

GOARCH="arm64"
GOHOSTARCH="arm64"
GOHOSTOS="linux"
GOOS="linux"

What did you do?

##### ../misc/cgo/testshared
--- FAIL: TestTrivialExecutable (4.80s)
	shared_test.go:41: executing ./bin/trivial (trivial executable) failed signal: segmentation fault:
--- FAIL: TestDivisionExecutable (0.81s)
	shared_test.go:41: executing ./bin/division (division executable) failed signal: segmentation fault:
--- FAIL: TestCgoExecutable (1.81s)
	shared_test.go:41: executing ./bin/execgo (cgo executable) failed signal: segmentation fault:
--- FAIL: TestGopathShlib (7.71s)
	shared_test.go:41: executing ./bin/exe (executable linked to GOPATH library) failed signal: segmentation fault:
--- FAIL: TestTwoGopathShlibs (11.75s)
	shared_test.go:41: executing ./bin/exe2 (executable linked to GOPATH library) failed signal: segmentation fault:
--- FAIL: TestThreeGopathShlibs (16.35s)
	shared_test.go:41: executing ./bin/exe3 (executable linked to GOPATH library) failed signal: segmentation fault:
--- FAIL: TestABIChecking (11.67s)
	shared_test.go:860: exe failed, but without line "abi mismatch detected between the executable and libdepBase.so"; got output:
--- FAIL: TestImplicitInclusion (1.65s)
	shared_test.go:41: executing ./bin/implicitcmd (running executable linked against library that contains same package as it) failed signal: segmentation fault:
--- FAIL: TestInterface (2.34s)
	shared_test.go:41: executing ./bin/iface (running type/itab uniqueness tester) failed signal: segmentation fault:
--- FAIL: TestGlobal (1.72s)
	shared_test.go:41: executing ./bin/global (global executable) failed signal: segmentation fault:
FAIL
exit status 1
FAIL	_/home/tincho/golang-1.10-1.10.1/misc/cgo/testshared	105.922s

Building the golang Debian package, misc/cgo/testshared tests fail under arm64 with segmentation fault when trying to execute the test binaries. This is an excerpt from running the tests manually:

BUILD_PATH_PREFIX_MAP='/tmp/go-build=$WORK:' /home/tincho/golang-1.10-1.10.1/pkg/tool/linux_arm64/link -o $WORK/b001/exe/a.out -importcfg $WORK/b001/importcfg.link -installsuffix 5577006791947779410_dynlink -buildmode=exe -buildid=92XVtLk4PlkWixEVRrmR/n3h36TPs9SIEPj3leryp/C0fUIo1GQNMhmBX1v56H/92XVtLk4PlkWixEVRrmR -linkshared -w -extld=gcc $WORK/b001/_pkg_.a
/home/tincho/golang-1.10-1.10.1/pkg/tool/linux_arm64/buildid -w $WORK/b001/exe/a.out # internal
mkdir -p /tmp/testshared261540010/bin/
mv $WORK/b001/exe/a.out /tmp/testshared261540010/bin/exe3
rm -r $WORK/b001/
--- FAIL: TestThreeGopathShlibs (20.88s)
	shared_test.go:41: executing ./bin/exe3 (executable linked to GOPATH library) failed signal: segmentation fault:

Running the binaries under gdb fails immediately without any useful stack trace, seems like a linking issue:

$ gdb /tmp/testshared261540010/bin/exe3
GNU gdb (Debian 7.12-6+b1) 7.12.0.20161007-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "aarch64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /tmp/testshared261540010/bin/exe3...(no debugging symbols found)...done.
(gdb) n
The program is not being run.
(gdb) start
Temporary breakpoint 1 at 0x400be0
Starting program: /tmp/testshared261540010/bin/exe3 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x0000ffffb79366e0 in __libc_start_main () from /lib/aarch64-linux-gnu/libc.so.6
#2  0x0000000000400b1c in _start ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions