if supportsDynlink(thearch.LinkArch.Arch) {
flag.BoolVar(&flag_shared, "shared", false, "generate code that can be linked into a shared library")
flag.BoolVar(&flag_dynlink, "dynlink", false, "support references to Go symbols defined in other shared libraries")
+ flag.BoolVar(&Ctxt.Flag_linkshared, "linkshared", false, "generate code that will be linked against Go shared libraries")
}
flag.StringVar(&cpuprofile, "cpuprofile", "", "write cpu profile to `file`")
flag.StringVar(&memprofile, "memprofile", "", "write memory profile to `file`")
// -ldflags '[pattern=]arg list'
// arguments to pass on each go tool link invocation.
// -linkshared
-// link against shared libraries previously created with
-// -buildmode=shared.
+// build code that will be linked against shared libraries previously
+// created with -buildmode=shared.
// -mod mode
// module download mode to use: readonly or vendor.
// See 'go help modules' for more.
-ldflags '[pattern=]arg list'
arguments to pass on each go tool link invocation.
-linkshared
- link against shared libraries previously created with
- -buildmode=shared.
+ build code that will be linked against shared libraries previously
+ created with -buildmode=shared.
-mod mode
module download mode to use: readonly or vendor.
See 'go help modules' for more.
base.Fatalf("-linkshared not supported on %s\n", platform)
}
codegenArg = "-dynlink"
+ forcedGcflags = append(forcedGcflags, "-linkshared")
// TODO(mwhudson): remove -w when that gets fixed in linker.
forcedLdflags = append(forcedLdflags, "-linkshared", "-w")
}
Debugpcln string
Flag_shared bool
Flag_dynlink bool
+ Flag_linkshared bool
Flag_optimize bool
Flag_locationlists bool
Flag_newobj bool // use new object file format
var idx, nonpkgidx int32 = 0, 0
ctxt.traverseSyms(traverseDefs, func(s *LSym) {
- if asm || s.Pkg == "_" || s.DuplicateOK() {
+ if asm || s.Pkg == "_" || s.DuplicateOK() || ctxt.Flag_linkshared {
s.PkgIdx = goobj2.PkgIdxNone
s.SymIdx = nonpkgidx
if nonpkgidx != int32(len(ctxt.nonpkgdefs)) {