aboutsummaryrefslogtreecommitdiff
path: root/src/make.bash
diff options
context:
space:
mode:
Diffstat (limited to 'src/make.bash')
-rwxr-xr-xsrc/make.bash12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/make.bash b/src/make.bash
index 13497eb039..b0e33cf6a4 100755
--- a/src/make.bash
+++ b/src/make.bash
@@ -34,6 +34,9 @@
# controls the default behavior of the linker's -linkmode option. The
# default value depends on the system.
#
+# GO_LDSO: Sets the default dynamic linker/loader (ld.so) to be used
+# by the internal linker.
+#
# CC: Command line to run to compile C code for GOHOSTARCH.
# Default is "gcc". Also supported: "clang".
#
@@ -126,6 +129,15 @@ if [ "$(uname -s)" = "GNU/kFreeBSD" ]; then
export CGO_ENABLED=0
fi
+# On Alpine Linux, use the musl dynamic linker/loader
+if [ -f "/etc/alpine-release" ]; then
+ if type readelf >/dev/null 2>&1; then
+ echo "int main() { return 0; }" | ${CC:-gcc} -o ./test-alpine-ldso -x c -
+ export GO_LDSO=$(readelf -l ./test-alpine-ldso | grep 'interpreter:' | sed -e 's/^.*interpreter: \(.*\)[]]/\1/')
+ rm -f ./test-alpine-ldso
+ fi
+fi
+
# Clean old generated file that will cause problems in the build.
rm -f ./runtime/runtime_defs.go