]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/link: move Iself global to ctxt
authorDavid Crawshaw <crawshaw@golang.org>
Sat, 7 Oct 2017 17:43:38 +0000 (13:43 -0400)
committerDavid Crawshaw <crawshaw@golang.org>
Fri, 20 Oct 2017 23:41:16 +0000 (23:41 +0000)
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: Ian Lance Taylor <iant@golang.org>
15 files changed:
src/cmd/link/internal/amd64/asm.go
src/cmd/link/internal/arm/asm.go
src/cmd/link/internal/arm64/asm.go
src/cmd/link/internal/ld/data.go
src/cmd/link/internal/ld/dwarf.go
src/cmd/link/internal/ld/elf.go
src/cmd/link/internal/ld/go.go
src/cmd/link/internal/ld/lib.go
src/cmd/link/internal/ld/link.go
src/cmd/link/internal/ld/main.go
src/cmd/link/internal/mips/asm.go
src/cmd/link/internal/mips64/asm.go
src/cmd/link/internal/ppc64/asm.go
src/cmd/link/internal/s390x/asm.go
src/cmd/link/internal/x86/asm.go

index 0f9775ed7718f6895e1e5d23218e805bb7d6600c..dde47ac7c5f25371ef13ef794eb7f6429e8e7244 100644 (file)
@@ -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()
index 8e980dcd9d985ea660019398a4b308faf43a0ee7..cbb97c3b6bc7e33f9593f0ca2d51f66ed95ef0a9 100644 (file)
@@ -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())
                                }
index 324151e40e7df5cb914642fd37cb1c2f6a300e61..cc7f4d1abf3599f6305c0f93f67c9fb37d7dd3c8 100644 (file)
@@ -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())
                                }
index 3851aa77a0c26c084582967076d936ee8eba808f..11bdf9ce41098519f8bfc065cfb1271cf77364da 100644 (file)
@@ -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
index 3059e7caf11a729e59bae7de48e132bd349fe01d..f4987bd23ac59e28a7dcd60591f34d6a056c1cbd 100644 (file)
@@ -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:
index 470eadf7a0671f7db7d19cc96b07064882e2bfed..4f7162f9affb40120494596b63372527acb93afe 100644 (file)
@@ -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
        }
 
index 537b2e90ba40ec3ce71f825bd309631b0ef35459..c4e6bf6f2f1b0d2785a9942308843961edf5b37c 100644 (file)
@@ -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)
index 53e53c7e91a76fa12a395714284f88ef4cbef826..913b70ec9377b434eeedcd9384b6e27fdbe482a6 100644 (file)
@@ -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)
                        }
 
index ea8dba363f3397012d982cd6c07efd34073413bc..65afd49db963c75ab49c957220762d163aea05ae 100644 (file)
@@ -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
index 4a1e27e38242710683220ff47a7bbed6379e16f2..8c69d297c088a2a912ccb034878ff05826296a4d 100644 (file)
@@ -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")
        }
 
index 1da85c007976a3225cf8a722bf78f3b68537fc2f..4c1be5250ad28fe9ea9bb4fac79cf8ec5eec3845 100644 (file)
@@ -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 {
index eb477577489f5d86e91acb5945e0cca1bf7bb0bb..98ddcad5a3dff1c6cc2faaef31f0a66057888f31 100644 (file)
@@ -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())
                                }
index 41f0c31cd0dcec10f0cc06d45c56820db5590216..ff011c170c9744e791afd2548879dc99b57ec3a3 100644 (file)
@@ -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())
                                }
index d6d73bf88febbeaf3d94a92e82d5e31cca31d1a6..d6dc91cd04ea8ec638f72b732c117d82d32cc7be 100644 (file)
@@ -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 {
index d2928d2706829dbfe2a731b89ebd9a7d94218630..208e26aad124fe8d4cce0464abb69e5884bf9346 100644 (file)
@@ -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())
                                }