fi
rm -rf libgo4.a libgo4.h testp pkg
+rm -f testar
+cat >testar <<EOF
+#!/usr/bin/env bash
+while expr \$1 : '[-]' >/dev/null; do
+ shift
+done
+echo "testar" > \$1
+echo "testar" > $(pwd)/testar.ran
+EOF
+chmod +x testar
+rm -f testar.ran
+GOPATH=$(pwd) go build -buildmode=c-archive -ldflags=-extar=$(pwd)/testar -o libgo4.a libgo4
+if ! test -f testar.ran; then
+ echo "FAIL test5"
+ status=1
+fi
+rm -rf libgo4.a libgo4.h testar testar.ran pkg
+
exit $status
The dynamic header is on by default, even without any
references to dynamic libraries, because many common
system tools now assume the presence of the header.
+ -extar ar
+ Set the external archive program (default "ar").
+ Used only for -buildmode=c-archive.
-extld linker
Set the external linker (default "clang" or "gcc").
-extldflags flags
tmpdir string
extld string
extldflags string
+ extar string
libgccfile string
debug_s int // backup old value of debug['s']
Ctxt *Link
return
}
+ if extar == "" {
+ extar = "ar"
+ }
+
mayberemoveoutfile()
- argv := []string{"ar", "-q", "-c", "-s", outfile}
+ argv := []string{extar, "-q", "-c", "-s", outfile}
argv = append(argv, fmt.Sprintf("%s/go.o", tmpdir))
argv = append(argv, hostobjCopy()...)
flag.Var(&Buildmode, "buildmode", "set build `mode`")
obj.Flagcount("c", "dump call graph", &Debug['c'])
obj.Flagcount("d", "disable dynamic executable", &Debug['d'])
+ obj.Flagstr("extar", "archive program for buildmode=c-archive", &extar)
obj.Flagstr("extld", "use `linker` when linking in external mode", &extld)
obj.Flagstr("extldflags", "pass `flags` to external linker", &extldflags)
obj.Flagcount("f", "ignore version mismatch", &Debug['f'])