mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
[dev.link] all: merge branch 'master' into dev.link
Fixed a couple of minor conflicts in lib.go and deadcode.go relating to debug logging. Change-Id: I58335fc42ab1f1f3409fd8354da4f26419e8fb22
This commit is contained in:
commit
c0555a2a7a
416 changed files with 15398 additions and 7536 deletions
|
|
@ -400,7 +400,7 @@ func (ctxt *Link) loadlib() {
|
|||
lib := ctxt.Library[i]
|
||||
if lib.Shlib == "" {
|
||||
if ctxt.Debugvlog > 1 {
|
||||
ctxt.Logf("%5.2f autolib: %s (from %s)\n", Cputime(), lib.File, lib.Objref)
|
||||
ctxt.Logf("autolib: %s (from %s)\n", lib.File, lib.Objref)
|
||||
}
|
||||
loadobjfile(ctxt, lib)
|
||||
}
|
||||
|
|
@ -437,7 +437,7 @@ func (ctxt *Link) loadlib() {
|
|||
for _, lib := range ctxt.Library {
|
||||
if lib.Shlib != "" {
|
||||
if ctxt.Debugvlog > 1 {
|
||||
ctxt.Logf("%5.2f autolib: %s (from %s)\n", Cputime(), lib.Shlib, lib.Objref)
|
||||
ctxt.Logf("autolib: %s (from %s)\n", lib.Shlib, lib.Objref)
|
||||
}
|
||||
ldshlibsyms(ctxt, lib.Shlib)
|
||||
}
|
||||
|
|
@ -832,7 +832,7 @@ func loadobjfile(ctxt *Link, lib *sym.Library) {
|
|||
pkg := objabi.PathToPrefix(lib.Pkg)
|
||||
|
||||
if ctxt.Debugvlog > 1 {
|
||||
ctxt.Logf("%5.2f ldobj: %s (%s)\n", Cputime(), lib.File, pkg)
|
||||
ctxt.Logf("ldobj: %s (%s)\n", lib.File, pkg)
|
||||
}
|
||||
f, err := bio.Open(lib.File)
|
||||
if err != nil {
|
||||
|
|
@ -1162,13 +1162,13 @@ func (ctxt *Link) hostlink() {
|
|||
|
||||
switch ctxt.HeadType {
|
||||
case objabi.Hdarwin:
|
||||
argv = append(argv, "-Wl,-headerpad,1144")
|
||||
if !ctxt.Arch.InFamily(sys.ARM, sys.ARM64) {
|
||||
// -headerpad is incompatible with -fembed-bitcode.
|
||||
argv = append(argv, "-Wl,-headerpad,1144")
|
||||
}
|
||||
if ctxt.DynlinkingGo() && !ctxt.Arch.InFamily(sys.ARM, sys.ARM64) {
|
||||
argv = append(argv, "-Wl,-flat_namespace")
|
||||
}
|
||||
if ctxt.BuildMode == BuildModeExe && !ctxt.Arch.InFamily(sys.ARM64) {
|
||||
argv = append(argv, "-Wl,-no_pie")
|
||||
}
|
||||
case objabi.Hopenbsd:
|
||||
argv = append(argv, "-Wl,-nopie")
|
||||
case objabi.Hwindows:
|
||||
|
|
@ -1181,6 +1181,9 @@ func (ctxt *Link) hostlink() {
|
|||
// ancient compatibility hacks.
|
||||
argv = append(argv, "-Wl,--tsaware")
|
||||
|
||||
// Enable DEP
|
||||
argv = append(argv, "-Wl,--nxcompat")
|
||||
|
||||
argv = append(argv, fmt.Sprintf("-Wl,--major-os-version=%d", PeMinimumTargetMajorVersion))
|
||||
argv = append(argv, fmt.Sprintf("-Wl,--minor-os-version=%d", PeMinimumTargetMinorVersion))
|
||||
argv = append(argv, fmt.Sprintf("-Wl,--major-subsystem-version=%d", PeMinimumTargetMajorVersion))
|
||||
|
|
@ -1199,11 +1202,10 @@ func (ctxt *Link) hostlink() {
|
|||
switch ctxt.BuildMode {
|
||||
case BuildModeExe:
|
||||
if ctxt.HeadType == objabi.Hdarwin {
|
||||
if ctxt.Arch.Family == sys.ARM64 {
|
||||
// __PAGEZERO segment size determined empirically.
|
||||
// XCode 9.0.1 successfully uploads an iOS app with this value.
|
||||
argv = append(argv, "-Wl,-pagezero_size,100000000")
|
||||
} else {
|
||||
if ctxt.Arch.Family != sys.ARM64 {
|
||||
argv = append(argv, "-Wl,-no_pie")
|
||||
}
|
||||
if !ctxt.Arch.InFamily(sys.ARM, sys.ARM64) {
|
||||
argv = append(argv, "-Wl,-pagezero_size,4000000")
|
||||
}
|
||||
}
|
||||
|
|
@ -1284,6 +1286,19 @@ func (ctxt *Link) hostlink() {
|
|||
}
|
||||
}
|
||||
|
||||
if ctxt.Arch.Family == sys.ARM64 && objabi.GOOS == "freebsd" {
|
||||
// Switch to ld.bfd on freebsd/arm64.
|
||||
argv = append(argv, "-fuse-ld=bfd")
|
||||
|
||||
// Provide a useful error if ld.bfd is missing.
|
||||
cmd := exec.Command(*flagExtld, "-fuse-ld=bfd", "-Wl,--version")
|
||||
if out, err := cmd.CombinedOutput(); err == nil {
|
||||
if !bytes.Contains(out, []byte("GNU ld")) {
|
||||
log.Fatalf("ARM64 external linker must be ld.bfd (issue #35197), please install devel/binutils")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ctxt.IsELF && len(buildinfo) > 0 {
|
||||
argv = append(argv, fmt.Sprintf("-Wl,--build-id=0x%x", buildinfo))
|
||||
}
|
||||
|
|
@ -1432,7 +1447,7 @@ func (ctxt *Link) hostlink() {
|
|||
}
|
||||
|
||||
if ctxt.Debugvlog != 0 {
|
||||
ctxt.Logf("%5.2f host link:", Cputime())
|
||||
ctxt.Logf("host link:")
|
||||
for _, v := range argv {
|
||||
ctxt.Logf(" %q", v)
|
||||
}
|
||||
|
|
@ -1900,7 +1915,7 @@ func ldshlibsyms(ctxt *Link, shlib string) {
|
|||
}
|
||||
}
|
||||
if ctxt.Debugvlog > 1 {
|
||||
ctxt.Logf("%5.2f ldshlibsyms: found library with name %s at %s\n", Cputime(), shlib, libpath)
|
||||
ctxt.Logf("ldshlibsyms: found library with name %s at %s\n", shlib, libpath)
|
||||
}
|
||||
|
||||
f, err := elf.Open(libpath)
|
||||
|
|
@ -2396,6 +2411,11 @@ func genasmsym(ctxt *Link, put func(*Link, *sym.Symbol, string, SymbolType, int6
|
|||
}
|
||||
put(ctxt, s, s.Name, BSSSym, Symaddr(s), s.Gotype)
|
||||
|
||||
case sym.SUNDEFEXT:
|
||||
if ctxt.HeadType == objabi.Hwindows || ctxt.HeadType == objabi.Haix || ctxt.IsELF {
|
||||
put(ctxt, s, s.Name, UndefinedSym, s.Value, nil)
|
||||
}
|
||||
|
||||
case sym.SHOSTOBJ:
|
||||
if !s.Attr.Reachable() {
|
||||
continue
|
||||
|
|
@ -2433,7 +2453,7 @@ func genasmsym(ctxt *Link, put func(*Link, *sym.Symbol, string, SymbolType, int6
|
|||
}
|
||||
|
||||
if ctxt.Debugvlog != 0 || *flagN {
|
||||
ctxt.Logf("%5.2f symsize = %d\n", Cputime(), uint32(Symsize))
|
||||
ctxt.Logf("symsize = %d\n", uint32(Symsize))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue