On platforms where we use libc for syscalls, we dynamically link
with libc and therefore dynamic linking cannot be disabled. Exit
early when -d is specified.
Update #42459.
Change-Id: I05abfe111df723b5ee512ceafef734e3804dd0a8
Reviewed-on: https://go-review.googlesource.com/c/go/+/365658
Trust: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
usage()
}
+ if *FlagD && ctxt.UsesLibc() {
+ Exitf("dynamic linking required on %s; -d flag cannot be used", buildcfg.GOOS)
+ }
+
checkStrictDups = *FlagStrictDups
if !buildcfg.Experiment.RegabiWrappers {
func (t *Target) IsBigEndian() bool {
return t.Arch.ByteOrder == binary.BigEndian
}
+
+func (t *Target) UsesLibc() bool {
+ t.mustSetHeadType()
+ switch t.HeadType {
+ case objabi.Haix, objabi.Hdarwin, objabi.Hopenbsd, objabi.Hsolaris, objabi.Hwindows:
+ // platforms where we use libc for syscalls.
+ return true
+ }
+ return false
+}
}
func (ctxt *Link) doxcoff() {
- if *FlagD {
- // All XCOFF files have dynamic symbols because of the syscalls.
- Exitf("-d is not available on AIX")
- }
ldr := ctxt.loader
// TOC