diff options
| author | Russ Cox <rsc@golang.org> | 2024-10-31 09:49:47 -0400 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-11-07 17:47:42 +0000 |
| commit | 4582f239c3e4589d73dc9e273368f17a196bc09e (patch) | |
| tree | 8428029b87c2216453c17b848df883f3a715afe3 /src/cmd/link/internal/loader/loader.go | |
| parent | 43f889b9e5c45ed53af84419380e8cb69db7c103 (diff) | |
| download | go-4582f239c3e4589d73dc9e273368f17a196bc09e.tar.xz | |
cmd/internal/objabi, cmd/link: introduce SymKind helper methods
These will be necessary when we start using the new FIPS symbols.
Split into a separate CL so that these refactoring changes can be
tested separate from any FIPS-specific changes.
Passes golang.org/x/tools/cmd/toolstash/buildall.
Change-Id: I73e5873fcb677f1f572f0668b4dc6f3951d822bc
Reviewed-on: https://go-review.googlesource.com/c/go/+/625996
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/cmd/link/internal/loader/loader.go')
| -rw-r--r-- | src/cmd/link/internal/loader/loader.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/link/internal/loader/loader.go b/src/cmd/link/internal/loader/loader.go index a391c8ced9..d99dbbd157 100644 --- a/src/cmd/link/internal/loader/loader.go +++ b/src/cmd/link/internal/loader/loader.go @@ -1623,7 +1623,7 @@ func (l *Loader) Aux(i Sym, j int) Aux { // import statement. // (https://webassembly.github.io/spec/core/syntax/modules.html#imports) func (l *Loader) WasmImportSym(fnSymIdx Sym) Sym { - if l.SymType(fnSymIdx) != sym.STEXT { + if !l.SymType(fnSymIdx).IsText() { log.Fatalf("error: non-function sym %d/%s t=%s passed to WasmImportSym", fnSymIdx, l.SymName(fnSymIdx), l.SymType(fnSymIdx).String()) } return l.aux1(fnSymIdx, goobj.AuxWasmImport) @@ -1636,7 +1636,7 @@ func (l *Loader) WasmTypeSym(s Sym) Sym { // SEHUnwindSym returns the auxiliary SEH unwind symbol associated with // a given function symbol. func (l *Loader) SEHUnwindSym(fnSymIdx Sym) Sym { - if l.SymType(fnSymIdx) != sym.STEXT { + if !l.SymType(fnSymIdx).IsText() { log.Fatalf("error: non-function sym %d/%s t=%s passed to SEHUnwindSym", fnSymIdx, l.SymName(fnSymIdx), l.SymType(fnSymIdx).String()) } @@ -1649,7 +1649,7 @@ func (l *Loader) SEHUnwindSym(fnSymIdx Sym) Sym { // lookups, e.f. for function with name XYZ we would then look up // go.info.XYZ, etc. func (l *Loader) GetFuncDwarfAuxSyms(fnSymIdx Sym) (auxDwarfInfo, auxDwarfLoc, auxDwarfRanges, auxDwarfLines Sym) { - if l.SymType(fnSymIdx) != sym.STEXT { + if !l.SymType(fnSymIdx).IsText() { log.Fatalf("error: non-function sym %d/%s t=%s passed to GetFuncDwarfAuxSyms", fnSymIdx, l.SymName(fnSymIdx), l.SymType(fnSymIdx).String()) } r, auxs := l.auxs(fnSymIdx) @@ -2609,7 +2609,7 @@ func (l *Loader) AssignTextSymbolOrder(libs []*sym.Library, intlibs []bool, exts } osym := r.Sym(i) st := sym.AbiSymKindToSymKind[objabi.SymKind(osym.Type())] - if st != sym.STEXT { + if !st.IsText() { continue } dupok := osym.Dupok() |
