aboutsummaryrefslogtreecommitdiff
path: root/misc/cgo/testcshared/test.bash
AgeCommit message (Collapse)Author
2017-08-18misc/cgo/testcshared: rewrite test.bash in GoChristopher Nelson
Change-Id: Id717054cb3c4537452f8ff848445b0c20196a373 Reviewed-on: https://go-review.googlesource.com/33579 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2017-03-30cmd/link: make mach-o dwarf segment properly alignedRuss Cox
Without this, the load fails during kernel exec, which results in the mysterious and completely uninformative "Killed: 9" error. It appears that the stars (or at least the inputs) were properly aligned with earlier versions of Xcode so that this happened accidentally. Make it happen on purpose. Gregory Man bisected the breakage to this change in LLVM, which fits the theory nicely: https://github.com/llvm-mirror/llvm/commit/9a41e59c Fixes #19734. Change-Id: Ice67a09af2de29d3c0d5e3fcde6a769580897c95 Reviewed-on: https://go-review.googlesource.com/38854 Run-TryBot: Russ Cox <rsc@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2017-03-29misc/cgo/testcshared: use the gold linker on android/arm64Elias Naur
The gold linker is used by default in the Android NDK, except on arm64: https://github.com/android-ndk/ndk/issues/148 The Go linker already forces the use of the gold linker on arm and arm64 (CL 22141) for other reasons. However, the test.bash script in testcshared doesn't, resulting in linker errors on android/arm64: warning: liblog.so, needed by ./libgo.so, not found (try using -rpath or -rpath-link) Add -fuse-ld=gold when running testcshared on Android. Fixes the android/arm64 builder. Change-Id: I35ca96f01f136bae72bec56d71b7ca3f344df1ed Reviewed-on: https://go-review.googlesource.com/38832 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2017-03-14*.bash: always use the same string equality operatorDaniel Martí
POSIX Shell only supports = to compare variables inside '[' tests. But this is Bash, where == is an alias for =. In practice they're the same, but the current form is inconsisnent and breaks POSIX for no good reason. Change-Id: I38fa7a5a90658dc51acc2acd143049e510424ed8 Reviewed-on: https://go-review.googlesource.com/38031 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-11-19misc/cgo/testcshared: add explicit ./ to shared library argumentIan Lance Taylor
Use an explicit ./ to make sure we link against the libgo.so we just built, not some other libgo.so that the compiler or linker may decide to seek out. Fixes #17986. Change-Id: Id23f6c95aa2b52f4f42c1b6dac45482c22b4290d Reviewed-on: https://go-review.googlesource.com/33413 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2016-04-03all: fix spelling mistakesEric Engestrom
Signed-off-by: Eric Engestrom <eric@engestrom.ch> Change-Id: I91873aaebf79bdf1c00d38aacc1a1fb8d79656a7 Reviewed-on: https://go-review.googlesource.com/21433 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2016-02-26misc/cgo: fix wrong quote characterJeff R. Allen
Single quotes to not expand variables inside of them. Change-Id: I4a0622c0aebfc1c3f9d299f93f7a8253893b5858 Reviewed-on: https://go-review.googlesource.com/13661 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-01-13cmd/go: -buildmode=c-shared should work on darwin/386Joe Sylve
* Enable c-shared buildmode on darwin/386 * dyld does not support text relocation on i386. Add -read_only_relocs suppress flag to linker Fixes #13904 Change-Id: I9adbd20d3f36ce9bbccf1bffb746b391780d088f Reviewed-on: https://go-review.googlesource.com/18500 Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-05misc/cgo/testcshared: print a little more about GOROOT on failureRuss Cox
For #13789. Change-Id: I83973298a35afcf55627f0a72223098306a51f4b Reviewed-on: https://go-review.googlesource.com/18233 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2016-01-05runtime: disable a signal by restoring the original dispositionIan Lance Taylor
Fixes #13034. Fixes #13042. Update #9896. Change-Id: I189f381090223dd07086848aac2d69d2c00d80c4 Reviewed-on: https://go-review.googlesource.com/18062 Reviewed-by: Russ Cox <rsc@golang.org>
2016-01-04build: prevent the entire repo to be wiped out by cgo test scriptsDidier Spezia
Following the parallelization of some tests, a race condition can occur in testcarchive, testshared and testcshared. In some cases, it can result in the go env GOROOT command returning corrupted data, which are then passed to a rm command. Make the shell script more robust by not trusting the result of the go env GOROOT command. It does not really fix the issue, but at least prevent the entire repository to be deleted. Updates #13789 Change-Id: Iaf04a7bd078ed3a82e724e35c4b86e6f756f2a2f Reviewed-on: https://go-review.googlesource.com/18173 TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org>
2015-12-18runtime: for c-archive/c-shared, don't install unnecessary signal handlersIan Lance Taylor
Only install signal handlers for synchronous signals that become run-time panics. Set the SA_ONSTACK flag for other signal handlers as needed. Fixes #13028. Update #12465. Update #13034. Update #13042. Change-Id: I28375e70641f60630e10f3c86e24b6e4f8a35cc9 Reviewed-on: https://go-review.googlesource.com/17903 Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-29cmd/go: buildmode=c-shared support for linux/arm64David Crawshaw
Change-Id: Ic826dc25b5203b2e9fc253d6fe997e4b41de3789 Reviewed-on: https://go-review.googlesource.com/16453 Reviewed-by: Ian Lance Taylor <iant@golang.org> Run-TryBot: David Crawshaw <crawshaw@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-10-28cmd/go: enable android/amd64 build.Hyang-Ah Hana Kim
For golang/go#10743 Change-Id: Iec047821147a0e28edebf875fefe25993785702b Reviewed-on: https://go-review.googlesource.com/15994 Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-13misc/cgo/testcshared: use -pie for android-L.Hyang-Ah Hana Kim
Also, handle the case where 'read' returns EINVAL instead of EBADF when the descriptor is not ready. (android 4.4.4/cyanogenmod, nexus7) Change-Id: I56c5949d27303d44a4fd0de38951b85e20cef167 Reviewed-on: https://go-review.googlesource.com/15810 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-08cmd/internal/ld: put read-only relocated data into .data.rel.ro when making ↵Michael Hudson-Doyle
a shared object Currently Go produces shared libraries that cannot be shared between processes because they have relocations against the text segment (not text section). This fixes this by moving some data to sections with magic names recognized by the static linker. The change in genasmsym to add STYPELINK to the switch should fix things on darwin/arm64. Fixes #10914 Updates #9210 Change-Id: Iab4a6678dd04cec6114e683caac5cf31b1063309 Reviewed-on: https://go-review.googlesource.com/14306 Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-04Revert "cmd/internal/ld: put read-only relocated data into .data.rel.ro when ↵Dave Cheney
making a shared object" This reverts commit 2c2cbb69c8dad1325f0a4b289417da73fd90f4b0. Broke darwin/arm64 Change-Id: Ibd2dea475d6ce6a8b4b40e2da19a83fc0514025d Reviewed-on: https://go-review.googlesource.com/14301 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-09-04cmd/internal/ld: put read-only relocated data into .data.rel.ro when making ↵Michael Hudson-Doyle
a shared object Currently Go produces shared libraries that cannot be shared between processes because they have relocations against the text segment (not text section). This fixes this by moving some data to sections with magic names recognized by the static linker. Fixes #10914 Updates #9210 Change-Id: I7178daadc0ae87953d5a084aa3d580f4e3b46d47 Reviewed-on: https://go-review.googlesource.com/10300 Run-TryBot: Michael Hudson-Doyle <michael.hudson@canonical.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-06-25misc/cgo/testcshared: don't leave garbages after testMikio Hara
Change-Id: I668b18b1e6901c59cf170e0c1cde9a3923c0cb13 Reviewed-on: https://go-review.googlesource.com/11472 Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-06-19cmd/link/internal/ld, cmd/go: -buildmode=c-shared support for darwin/amd64Srdjan Petrovic
All of the heavy-lifting was done by minux@, with his external-linking support for darwin/arm64: golang.org/cl/8781 Change-Id: I7c9fbc19246f418c065c92fb2c13c00026ff0f82 Reviewed-on: https://go-review.googlesource.com/11127 Run-TryBot: Srdjan Petrovic <spetrovic@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-13misc/cgo/testcshared: remove use of 'env'.Hyang-Ah (Hana) Kim
'env' command is not available on some android devices. Change-Id: I68b1152ef7ea248c8e80c7f71e97da76e3ec6394 Reviewed-on: https://go-review.googlesource.com/9999 Reviewed-by: Minux Ma <minux@golang.org>
2015-05-12misc/cgo/testcshared: fix test for android.Hyang-Ah (Hana) Kim
On android the generated header files are located in pkg/$(go env GOOS)_$(go env GOARCH)_testcshared. The test was broken since https://go-review.googlesource.com/9798. The installation path differs based on codegenArgs (around src/cmd/go/build.go line 389), and the codegenArgs is platform dependent. Change-Id: I01ae9cb957fb7676e399f3b8c067f24c5bd20b9d Reviewed-on: https://go-review.googlesource.com/9980 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2015-05-07cmd/go: install headers for c-archive/c-shared cgo exportsIan Lance Taylor
When using -buildmode=c-archive or c-shared, and when installing packages that use cgo, and when those packages export some functions via //export comments, then for each such package, install a pkg.h header file that declares the functions. This permits C code to #include the header when calling the Go functions. This is a little awkward to use when there are multiple packages that export functions, as you have to "go install" your c-archive/c-shared object and then pull it out of the package directory. When compiling your C code you have to -I pkg/$GOOS_$GOARCH. I haven't thought of any more convenient approach. It's simpler when only the main package has exported functions. When using c-shared you currently have to use a _shared suffix in the -I option; it would be nice to fix that somehow. Change-Id: I5d8cf08914b7d3c2b194120c77791d2732ffd26e Reviewed-on: https://go-review.googlesource.com/9798 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2015-04-24misc/cgo/testcshared: make test.bash resilient against noise.Hyang-Ah Hana Kim
Instead of comparing against the entire output that may include verbose warning messages, use the last line of the output and check it includes the expected success message (PASS). Change-Id: Iafd583ee5529a8aef5439b9f1f6ce0185e4b1331 Reviewed-on: https://go-review.googlesource.com/9304 Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-24misc/cgo/testcshared: add a c-shared test for android/arm.Hyang-Ah Hana Kim
- main3.c tests main.main is exported when compiled for GOOS=android. - wait longer for main2.c (it's slow on android/arm) - rearranged test.bash Fixes #10070. Change-Id: I6e5a98d1c5fae776afa54ecb5da633b59b269316 Reviewed-on: https://go-review.googlesource.com/9296 Reviewed-by: David Crawshaw <crawshaw@golang.org> Run-TryBot: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-04-21misc/cgo/testcshared: add c-shared test with no exportsIan Lance Taylor
The purpose of this test is to make sure that -buildmode=c-shared works even when the shared library can be built without invoking cgo. Change-Id: Id6f95af755992b209aff770440ca9819b74113ab Reviewed-on: https://go-review.googlesource.com/9166 Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-04-17misc/cgo/testcshared: test -buildmode=c-sharedHyang-Ah Hana Kim
Followed the same test pattern in misc/cgo/testcarchive. Change-Id: I2f863b5c24a28f0b38b0128ed3e8a92c17fb5b9f Reviewed-on: https://go-review.googlesource.com/8985 Reviewed-by: David Crawshaw <crawshaw@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>