Commit d05f82a1 authored by David Crawshaw's avatar David Crawshaw

cmd/link: move Iself global to ctxt

For #22095

Change-Id: Iba3dffc782cecc15ea0e90a971a2734729984945
Reviewed-on: https://go-review.googlesource.com/70834
Run-TryBot: David Crawshaw <crawshaw@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent 6738c494
......@@ -250,7 +250,7 @@ func adddynrel(ctxt *ld.Link, s *sym.Symbol, r *sym.Reloc) bool {
return true
case objabi.R_ADDR:
if s.Type == sym.STEXT && ld.Iself {
if s.Type == sym.STEXT && ctxt.IsELF {
if ld.Headtype == objabi.Hsolaris {
addpltsym(ctxt, targ)
r.Sym = ctxt.Syms.Lookup(".plt", 0)
......@@ -316,7 +316,7 @@ func adddynrel(ctxt *ld.Link, s *sym.Symbol, r *sym.Reloc) bool {
}
}
if ld.Iself {
if ctxt.IsELF {
// TODO: We generate a R_X86_64_64 relocation for every R_ADDR, even
// though it would be more efficient (for the dynamic linker) if we
// generated R_X86_RELATIVE instead.
......@@ -569,7 +569,7 @@ func addpltsym(ctxt *ld.Link, s *sym.Symbol) {
ld.Adddynsym(ctxt, s)
if ld.Iself {
if ctxt.IsELF {
plt := ctxt.Syms.Lookup(".plt", 0)
got := ctxt.Syms.Lookup(".got.plt", 0)
rela := ctxt.Syms.Lookup(".rela.plt", 0)
......@@ -640,7 +640,7 @@ func addgotsym(ctxt *ld.Link, s *sym.Symbol) {
s.Got = int32(got.Size)
got.AddUint64(ctxt.Arch, 0)
if ld.Iself {
if ctxt.IsELF {
rela := ctxt.Syms.Lookup(".rela", 0)
rela.AddAddrPlus(ctxt.Arch, got, int64(s.Got))
rela.AddUint64(ctxt.Arch, ld.ELF64_R_INFO(uint32(s.Dynid), uint32(elf.R_X86_64_GLOB_DAT)))
......@@ -661,7 +661,7 @@ func asmb(ctxt *ld.Link) {
ctxt.Logf("%5.2f codeblk\n", ld.Cputime())
}
if ld.Iself {
if ctxt.IsELF {
ld.Asmbelfsetup()
}
......@@ -763,7 +763,7 @@ func asmb(ctxt *ld.Link) {
ctxt.Out.SeekSet(symo)
switch ld.Headtype {
default:
if ld.Iself {
if ctxt.IsELF {
ctxt.Out.SeekSet(symo)
ld.Asmelfsym(ctxt)
ctxt.Out.Flush()
......
......@@ -238,7 +238,7 @@ func adddynrel(ctxt *ld.Link, s *sym.Symbol, r *sym.Reloc) bool {
if s.Type != sym.SDATA {
break
}
if ld.Iself {
if ctxt.IsELF {
ld.Adddynsym(ctxt, targ)
rel := ctxt.Syms.Lookup(".rel", 0)
rel.AddAddrPlus(ctxt.Arch, s, int64(r.Off))
......@@ -671,7 +671,7 @@ func addpltsym(ctxt *ld.Link, s *sym.Symbol) {
ld.Adddynsym(ctxt, s)
if ld.Iself {
if ctxt.IsELF {
plt := ctxt.Syms.Lookup(".plt", 0)
got := ctxt.Syms.Lookup(".got.plt", 0)
rel := ctxt.Syms.Lookup(".rel.plt", 0)
......@@ -713,7 +713,7 @@ func addgotsyminternal(ctxt *ld.Link, s *sym.Symbol) {
got.AddAddrPlus(ctxt.Arch, s, 0)
if ld.Iself {
if ctxt.IsELF {
} else {
ld.Errorf(s, "addgotsyminternal: unsupported binary format")
}
......@@ -729,7 +729,7 @@ func addgotsym(ctxt *ld.Link, s *sym.Symbol) {
s.Got = int32(got.Size)
got.AddUint32(ctxt.Arch, 0)
if ld.Iself {
if ctxt.IsELF {
rel := ctxt.Syms.Lookup(".rel", 0)
rel.AddAddrPlus(ctxt.Arch, got, int64(s.Got))
rel.AddUint32(ctxt.Arch, ld.ELF32_R_INFO(uint32(s.Dynid), uint32(elf.R_ARM_GLOB_DAT)))
......@@ -743,7 +743,7 @@ func asmb(ctxt *ld.Link) {
ctxt.Logf("%5.2f asmb\n", ld.Cputime())
}
if ld.Iself {
if ctxt.IsELF {
ld.Asmbelfsetup()
}
......@@ -797,7 +797,7 @@ func asmb(ctxt *ld.Link) {
}
switch ld.Headtype {
default:
if ld.Iself {
if ctxt.IsELF {
symo = uint32(ld.Segdwarf.Fileoff + ld.Segdwarf.Filelen)
symo = uint32(ld.Rnd(int64(symo), int64(*ld.FlagRound)))
}
......@@ -812,7 +812,7 @@ func asmb(ctxt *ld.Link) {
ctxt.Out.SeekSet(int64(symo))
switch ld.Headtype {
default:
if ld.Iself {
if ctxt.IsELF {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f elfsym\n", ld.Cputime())
}
......
......@@ -379,7 +379,7 @@ func asmb(ctxt *ld.Link) {
ctxt.Logf("%5.2f asmb\n", ld.Cputime())
}
if ld.Iself {
if ctxt.IsELF {
ld.Asmbelfsetup()
}
......@@ -433,7 +433,7 @@ func asmb(ctxt *ld.Link) {
}
switch ld.Headtype {
default:
if ld.Iself {
if ctxt.IsELF {
symo = uint32(ld.Segdwarf.Fileoff + ld.Segdwarf.Filelen)
symo = uint32(ld.Rnd(int64(symo), int64(*ld.FlagRound)))
}
......@@ -448,7 +448,7 @@ func asmb(ctxt *ld.Link) {
ctxt.Out.SeekSet(int64(symo))
switch ld.Headtype {
default:
if ld.Iself {
if ctxt.IsELF {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f elfsym\n", ld.Cputime())
}
......
......@@ -189,7 +189,7 @@ func relocsym(ctxt *Link, s *sym.Symbol) {
case objabi.R_TLS_LE:
isAndroidX86 := objabi.GOOS == "android" && (ctxt.Arch.InFamily(sys.AMD64, sys.I386))
if ctxt.LinkMode == LinkExternal && Iself && !isAndroidX86 {
if ctxt.LinkMode == LinkExternal && ctxt.IsELF && !isAndroidX86 {
r.Done = false
if r.Sym == nil {
r.Sym = ctxt.Tlsg
......@@ -203,7 +203,7 @@ func relocsym(ctxt *Link, s *sym.Symbol) {
break
}
if Iself && ctxt.Arch.Family == sys.ARM {
if ctxt.IsELF && ctxt.Arch.Family == sys.ARM {
// On ELF ARM, the thread pointer is 8 bytes before
// the start of the thread-local data block, so add 8
// to the actual TLS offset (r->sym->value).
......@@ -212,7 +212,7 @@ func relocsym(ctxt *Link, s *sym.Symbol) {
// related to the fact that our own TLS storage happens
// to take up 8 bytes.
o = 8 + r.Sym.Value
} else if Iself || Headtype == objabi.Hplan9 || Headtype == objabi.Hdarwin || isAndroidX86 {
} else if ctxt.IsELF || Headtype == objabi.Hplan9 || Headtype == objabi.Hdarwin || isAndroidX86 {
o = int64(ctxt.Tlsoffset) + r.Add
} else if Headtype == objabi.Hwindows {
o = r.Add
......@@ -222,7 +222,7 @@ func relocsym(ctxt *Link, s *sym.Symbol) {
case objabi.R_TLS_IE:
isAndroidX86 := objabi.GOOS == "android" && (ctxt.Arch.InFamily(sys.AMD64, sys.I386))
if ctxt.LinkMode == LinkExternal && Iself && !isAndroidX86 {
if ctxt.LinkMode == LinkExternal && ctxt.IsELF && !isAndroidX86 {
r.Done = false
if r.Sym == nil {
r.Sym = ctxt.Tlsg
......@@ -235,7 +235,7 @@ func relocsym(ctxt *Link, s *sym.Symbol) {
}
break
}
if ctxt.BuildMode == BuildModePIE && Iself {
if ctxt.BuildMode == BuildModePIE && ctxt.IsELF {
// We are linking the final executable, so we
// can optimize any TLS IE relocation to LE.
if Thearch.TLSIEtoLE == nil {
......@@ -268,7 +268,7 @@ func relocsym(ctxt *Link, s *sym.Symbol) {
r.Xsym = rs
o = r.Xadd
if Iself {
if ctxt.IsELF {
if ctxt.Arch.Family == sys.AMD64 {
o = 0
}
......@@ -336,7 +336,7 @@ func relocsym(ctxt *Link, s *sym.Symbol) {
r.Xadd = r.Add + Symaddr(r.Sym) - int64(r.Sym.Sect.Vaddr)
o = r.Xadd
if Iself && ctxt.Arch.Family == sys.AMD64 {
if ctxt.IsELF && ctxt.Arch.Family == sys.AMD64 {
o = 0
}
break
......@@ -390,7 +390,7 @@ func relocsym(ctxt *Link, s *sym.Symbol) {
r.Xsym = rs
o = r.Xadd
if Iself {
if ctxt.IsELF {
if ctxt.Arch.Family == sys.AMD64 {
o = 0
}
......@@ -576,7 +576,7 @@ func dynreloc(ctxt *Link, data *[sym.SXREF][]*sym.Symbol) {
dynrelocsym(ctxt, s)
}
}
if Iself {
if ctxt.IsELF {
elfdynhash(ctxt)
}
}
......@@ -1289,7 +1289,7 @@ func (ctxt *Link) dodata() {
if len(data[sym.STLSBSS]) > 0 {
var sect *sym.Section
if Iself && (ctxt.LinkMode == LinkExternal || !*FlagD) {
if ctxt.IsELF && (ctxt.LinkMode == LinkExternal || !*FlagD) {
sect = addsection(ctxt.Arch, &Segdata, ".tbss", 06)
sect.Align = int32(ctxt.Arch.PtrSize)
sect.Vaddr = 0
......@@ -1320,7 +1320,7 @@ func (ctxt *Link) dodata() {
* segtext.
*/
var segro *sym.Segment
if Iself && ctxt.LinkMode == LinkInternal {
if ctxt.IsELF && ctxt.LinkMode == LinkInternal {
segro = &Segrodata
} else {
segro = &Segtext
......@@ -1690,7 +1690,7 @@ func dodataSect(ctxt *Link, symn sym.SymKind, syms []*sym.Symbol) (result []*sym
syms[len(syms)-1] = tail
}
if Iself && symn == sym.SELFROSECT {
if ctxt.IsELF && symn == sym.SELFROSECT {
// Make .rela and .rela.plt contiguous, the ELF ABI requires this
// and Solaris actually cares.
reli, plti := -1, -1
......@@ -1732,7 +1732,7 @@ func dodataSect(ctxt *Link, symn sym.SymKind, syms []*sym.Symbol) (result []*sym
// at the very beginning of the text segment.
// This ``header'' is read by cmd/go.
func (ctxt *Link) textbuildid() {
if Iself || ctxt.BuildMode == BuildModePlugin || *flagBuildid == "" {
if ctxt.IsELF || ctxt.BuildMode == BuildModePlugin || *flagBuildid == "" {
return
}
......@@ -1840,7 +1840,7 @@ func assignAddress(ctxt *Link, sect *sym.Section, n int, s *sym.Symbol, va uint6
// Only break at outermost syms.
if ctxt.Arch.InFamily(sys.PPC64) && s.Outer == nil && Iself && ctxt.LinkMode == LinkExternal && va-sect.Vaddr+funcsize+maxSizeTrampolinesPPC64(s, isTramp) > 0x1c00000 {
if ctxt.Arch.InFamily(sys.PPC64) && s.Outer == nil && ctxt.IsELF && ctxt.LinkMode == LinkExternal && va-sect.Vaddr+funcsize+maxSizeTrampolinesPPC64(s, isTramp) > 0x1c00000 {
// Set the length for the previous text section
sect.Length = va - sect.Vaddr
......@@ -1941,11 +1941,11 @@ func (ctxt *Link) address() {
var bss *sym.Section
var noptrbss *sym.Section
for i, s := range Segdata.Sections {
if Iself && s.Name == ".tbss" {
if ctxt.IsELF && s.Name == ".tbss" {
continue
}
vlen := int64(s.Length)
if i+1 < len(Segdata.Sections) && !(Iself && Segdata.Sections[i+1].Name == ".tbss") {
if i+1 < len(Segdata.Sections) && !(ctxt.IsELF && Segdata.Sections[i+1].Name == ".tbss") {
vlen = int64(Segdata.Sections[i+1].Vaddr - s.Vaddr)
}
s.Vaddr = va
......
......@@ -1508,7 +1508,7 @@ func dwarfgeneratedebugsyms(ctxt *Link) {
if ctxt.LinkMode == LinkExternal {
switch {
case Iself:
case ctxt.IsELF:
case Headtype == objabi.Hdarwin:
case Headtype == objabi.Hwindows:
default:
......
......@@ -453,8 +453,6 @@ const (
)
var (
Iself bool
Nelfsym = 1
elf64 bool
......@@ -485,7 +483,7 @@ var buildinfo []byte
we write section and prog headers.
*/
func Elfinit(ctxt *Link) {
Iself = true
ctxt.IsELF = true
if ctxt.Arch.InFamily(sys.AMD64, sys.ARM64, sys.MIPS64, sys.PPC64, sys.S390X) {
elfRelType = ".rela"
......@@ -1008,7 +1006,7 @@ havelib:
}
func elfdynhash(ctxt *Link) {
if !Iself {
if !ctxt.IsELF {
return
}
......@@ -1429,7 +1427,7 @@ func addgonote(ctxt *Link, sectionName string, tag uint32, desc []byte) {
}
func (ctxt *Link) doelf() {
if !Iself {
if !ctxt.IsELF {
return
}
......
......@@ -298,7 +298,7 @@ func adddynlib(ctxt *Link, lib string) {
}
seenlib[lib] = true
if Iself {
if ctxt.IsELF {
s := ctxt.Syms.Lookup(".dynstr", 0)
if s.Size == 0 {
Addstring(s, "")
......@@ -314,7 +314,7 @@ func Adddynsym(ctxt *Link, s *sym.Symbol) {
return
}
if Iself {
if ctxt.IsELF {
elfadddynsym(ctxt, s)
} else if Headtype == objabi.Hdarwin {
Errorf(s, "adddynsym: missed symbol (Extname=%s)", s.Extname)
......
......@@ -154,7 +154,7 @@ func (ctxt *Link) CanUsePlugins() bool {
func (ctxt *Link) UseRelro() bool {
switch ctxt.BuildMode {
case BuildModeCArchive, BuildModeCShared, BuildModeShared, BuildModePIE, BuildModePlugin:
return Iself
return ctxt.IsELF
default:
return ctxt.linkShared
}
......@@ -594,7 +594,7 @@ func (ctxt *Link) loadlib() {
}
if ctxt.Arch == sys.Arch386 {
if (ctxt.BuildMode == BuildModeCArchive && Iself) || (ctxt.BuildMode == BuildModeCShared && Headtype != objabi.Hwindows) || ctxt.BuildMode == BuildModePIE || ctxt.DynlinkingGo() {
if (ctxt.BuildMode == BuildModeCArchive && ctxt.IsELF) || (ctxt.BuildMode == BuildModeCShared && Headtype != objabi.Hwindows) || ctxt.BuildMode == BuildModePIE || ctxt.DynlinkingGo() {
got := ctxt.Syms.Lookup("_GLOBAL_OFFSET_TABLE_", 0)
got.Type = sym.SDYNIMPORT
got.Attr |= sym.AttrReachable
......@@ -1151,7 +1151,7 @@ func (ctxt *Link) hostlink() {
}
}
if Iself && ctxt.DynlinkingGo() {
if ctxt.IsELF && ctxt.DynlinkingGo() {
// We force all symbol resolution to be done at program startup
// because lazy PLT resolution can use large amounts of stack at
// times we cannot allow it to do so.
......@@ -1185,7 +1185,7 @@ func (ctxt *Link) hostlink() {
}
}
if Iself && len(buildinfo) > 0 {
if ctxt.IsELF && len(buildinfo) > 0 {
argv = append(argv, fmt.Sprintf("-Wl,--build-id=0x%x", buildinfo))
}
......@@ -1207,7 +1207,7 @@ func (ctxt *Link) hostlink() {
}
// Force global symbols to be exported for dlopen, etc.
if Iself {
if ctxt.IsELF {
argv = append(argv, "-rdynamic")
}
......@@ -1291,7 +1291,7 @@ func (ctxt *Link) hostlink() {
// we added it. We do it in this order, rather than
// only adding -rdynamic later, so that -*extldflags
// can override -rdynamic without using -static.
if Iself && p == "-static" {
if ctxt.IsELF && p == "-static" {
for i := range argv {
if argv[i] == "-rdynamic" {
argv[i] = "-static"
......@@ -2043,7 +2043,7 @@ func genasmsym(ctxt *Link, put func(*Link, *sym.Symbol, string, SymbolType, int6
put(ctxt, s, s.Name, BSSSym, Symaddr(s), s.Gotype)
case sym.SHOSTOBJ:
if Headtype == objabi.Hwindows || Iself {
if Headtype == objabi.Hwindows || ctxt.IsELF {
put(ctxt, s, s.Name, UndefinedSym, s.Value, nil)
}
......
......@@ -60,6 +60,8 @@ type Link struct {
Loaded bool // set after all inputs have been loaded as symbols
IsELF bool
linkShared bool // link against installed Go shared libraries
LinkMode LinkMode
BuildMode BuildMode
......
......@@ -166,7 +166,7 @@ func Main(arch *sys.Arch, theArch Arch) {
ctxt.computeTLSOffset()
Thearch.Archinit(ctxt)
if ctxt.linkShared && !Iself {
if ctxt.linkShared && !ctxt.IsELF {
Exitf("-linkshared can only be used on elf systems")
}
......
......@@ -172,7 +172,7 @@ func asmb(ctxt *ld.Link) {
ctxt.Logf("%5.2f asmb\n", ld.Cputime())
}
if ld.Iself {
if ctxt.IsELF {
ld.Asmbelfsetup()
}
......@@ -209,7 +209,7 @@ func asmb(ctxt *ld.Link) {
ld.Lcsize = 0
symo := uint32(0)
if !*ld.FlagS {
if !ld.Iself {
if !ctxt.IsELF {
ld.Errorf(nil, "unsupported executable format")
}
if ctxt.Debugvlog != 0 {
......
......@@ -179,7 +179,7 @@ func asmb(ctxt *ld.Link) {
ctxt.Logf("%5.2f asmb\n", ld.Cputime())
}
if ld.Iself {
if ctxt.IsELF {
ld.Asmbelfsetup()
}
......@@ -228,7 +228,7 @@ func asmb(ctxt *ld.Link) {
}
switch ld.Headtype {
default:
if ld.Iself {
if ctxt.IsELF {
symo = uint32(ld.Segdwarf.Fileoff + ld.Segdwarf.Filelen)
symo = uint32(ld.Rnd(int64(symo), int64(*ld.FlagRound)))
}
......@@ -240,7 +240,7 @@ func asmb(ctxt *ld.Link) {
ctxt.Out.SeekSet(int64(symo))
switch ld.Headtype {
default:
if ld.Iself {
if ctxt.IsELF {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f elfsym\n", ld.Cputime())
}
......
......@@ -806,7 +806,7 @@ func addpltsym(ctxt *ld.Link, s *sym.Symbol) {
ld.Adddynsym(ctxt, s)
if ld.Iself {
if ctxt.IsELF {
plt := ctxt.Syms.Lookup(".plt", 0)
rela := ctxt.Syms.Lookup(".rela.plt", 0)
if plt.Size == 0 {
......@@ -909,7 +909,7 @@ func asmb(ctxt *ld.Link) {
ctxt.Logf("%5.2f asmb\n", ld.Cputime())
}
if ld.Iself {
if ctxt.IsELF {
ld.Asmbelfsetup()
}
......@@ -960,7 +960,7 @@ func asmb(ctxt *ld.Link) {
}
switch ld.Headtype {
default:
if ld.Iself {
if ctxt.IsELF {
symo = uint32(ld.Segdwarf.Fileoff + ld.Segdwarf.Filelen)
symo = uint32(ld.Rnd(int64(symo), int64(*ld.FlagRound)))
}
......@@ -972,7 +972,7 @@ func asmb(ctxt *ld.Link) {
ctxt.Out.SeekSet(int64(symo))
switch ld.Headtype {
default:
if ld.Iself {
if ctxt.IsELF {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f elfsym\n", ld.Cputime())
}
......
......@@ -425,7 +425,7 @@ func addpltsym(ctxt *ld.Link, s *sym.Symbol) {
ld.Adddynsym(ctxt, s)
if ld.Iself {
if ctxt.IsELF {
plt := ctxt.Syms.Lookup(".plt", 0)
got := ctxt.Syms.Lookup(".got", 0)
rela := ctxt.Syms.Lookup(".rela.plt", 0)
......@@ -491,7 +491,7 @@ func addgotsym(ctxt *ld.Link, s *sym.Symbol) {
s.Got = int32(got.Size)
got.AddUint64(ctxt.Arch, 0)
if ld.Iself {
if ctxt.IsELF {
rela := ctxt.Syms.Lookup(".rela", 0)
rela.AddAddrPlus(ctxt.Arch, got, int64(s.Got))
rela.AddUint64(ctxt.Arch, ld.ELF64_R_INFO(uint32(s.Dynid), uint32(elf.R_390_GLOB_DAT)))
......@@ -506,7 +506,7 @@ func asmb(ctxt *ld.Link) {
ctxt.Logf("%5.2f asmb\n", ld.Cputime())
}
if ld.Iself {
if ctxt.IsELF {
ld.Asmbelfsetup()
}
......@@ -549,7 +549,7 @@ func asmb(ctxt *ld.Link) {
ld.Lcsize = 0
symo := uint32(0)
if !*ld.FlagS {
if !ld.Iself {
if !ctxt.IsELF {
ld.Errorf(nil, "unsupported executable format")
}
if ctxt.Debugvlog != 0 {
......
......@@ -58,7 +58,7 @@ func gentext(ctxt *ld.Link) {
} else {
switch ctxt.BuildMode {
case ld.BuildModeCArchive:
if !ld.Iself {
if !ctxt.IsELF {
return
}
case ld.BuildModePIE, ld.BuildModeCShared, ld.BuildModePlugin:
......@@ -306,7 +306,7 @@ func adddynrel(ctxt *ld.Link, s *sym.Symbol, r *sym.Reloc) bool {
if s.Type != sym.SDATA {
break
}
if ld.Iself {
if ctxt.IsELF {
ld.Adddynsym(ctxt, targ)
rel := ctxt.Syms.Lookup(".rel", 0)
rel.AddAddrPlus(ctxt.Arch, s, int64(r.Off))
......@@ -541,7 +541,7 @@ func addpltsym(ctxt *ld.Link, s *sym.Symbol) {
ld.Adddynsym(ctxt, s)
if ld.Iself {
if ctxt.IsELF {
plt := ctxt.Syms.Lookup(".plt", 0)
got := ctxt.Syms.Lookup(".got.plt", 0)
rel := ctxt.Syms.Lookup(".rel.plt", 0)
......@@ -604,7 +604,7 @@ func addgotsym(ctxt *ld.Link, s *sym.Symbol) {
s.Got = int32(got.Size)
got.AddUint32(ctxt.Arch, 0)
if ld.Iself {
if ctxt.IsELF {
rel := ctxt.Syms.Lookup(".rel", 0)
rel.AddAddrPlus(ctxt.Arch, got, int64(s.Got))
rel.AddUint32(ctxt.Arch, ld.ELF32_R_INFO(uint32(s.Dynid), uint32(elf.R_386_GLOB_DAT)))
......@@ -620,7 +620,7 @@ func asmb(ctxt *ld.Link) {
ctxt.Logf("%5.2f asmb\n", ld.Cputime())
}
if ld.Iself {
if ctxt.IsELF {
ld.Asmbelfsetup()
}
......@@ -675,7 +675,7 @@ func asmb(ctxt *ld.Link) {
}
switch ld.Headtype {
default:
if ld.Iself {
if ctxt.IsELF {
symo = uint32(ld.Segdwarf.Fileoff + ld.Segdwarf.Filelen)
symo = uint32(ld.Rnd(int64(symo), int64(*ld.FlagRound)))
}
......@@ -694,7 +694,7 @@ func asmb(ctxt *ld.Link) {
ctxt.Out.SeekSet(int64(symo))
switch ld.Headtype {
default:
if ld.Iself {
if ctxt.IsELF {
if ctxt.Debugvlog != 0 {
ctxt.Logf("%5.2f elfsym\n", ld.Cputime())
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment