aboutsummaryrefslogtreecommitdiff
path: root/misc/cgo/testcshared/test.bash
diff options
context:
space:
mode:
authorMichael Hudson-Doyle <michael.hudson@canonical.com>2015-05-21 13:07:19 +1200
committerMichael Hudson-Doyle <michael.hudson@canonical.com>2015-09-04 05:25:10 +0000
commit2c2cbb69c8dad1325f0a4b289417da73fd90f4b0 (patch)
tree1c2c56c4895538fa8bac8ce67dc88bca27f06b53 /misc/cgo/testcshared/test.bash
parenteaea5ade2b5f60c6dfd72a08c9243e1651778332 (diff)
downloadgo-2c2cbb69c8dad1325f0a4b289417da73fd90f4b0.tar.xz
cmd/internal/ld: put read-only relocated data into .data.rel.ro when making 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>
Diffstat (limited to 'misc/cgo/testcshared/test.bash')
-rwxr-xr-xmisc/cgo/testcshared/test.bash7
1 files changed, 7 insertions, 0 deletions
diff --git a/misc/cgo/testcshared/test.bash b/misc/cgo/testcshared/test.bash
index 57221bc36d..1b7fec1549 100755
--- a/misc/cgo/testcshared/test.bash
+++ b/misc/cgo/testcshared/test.bash
@@ -81,6 +81,13 @@ GOPATH=$(pwd) go install -buildmode=c-shared $suffix libgo
GOPATH=$(pwd) go build -buildmode=c-shared $suffix -o libgo.$libext src/libgo/libgo.go
binpush libgo.$libext
+if [ "$goos" == "linux" ]; then
+ if readelf -d libgo.$libext | grep TEXTREL >/dev/null; then
+ echo "libgo.$libext has TEXTREL set"
+ exit 1
+ fi
+fi
+
# test0: exported symbols in shared lib are accessible.
# TODO(iant): using _shared here shouldn't really be necessary.
$(go env CC) $(go env GOGCCFLAGS) -I ${installdir} -o testp main0.c libgo.$libext