aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/internal/objabi
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2024-10-31 09:49:47 -0400
committerGopher Robot <gobot@golang.org>2024-11-07 17:47:42 +0000
commit4582f239c3e4589d73dc9e273368f17a196bc09e (patch)
tree8428029b87c2216453c17b848df883f3a715afe3 /src/cmd/internal/objabi
parent43f889b9e5c45ed53af84419380e8cb69db7c103 (diff)
downloadgo-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/internal/objabi')
-rw-r--r--src/cmd/internal/objabi/symkind.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cmd/internal/objabi/symkind.go b/src/cmd/internal/objabi/symkind.go
index 463b77689c..d4ba5f361e 100644
--- a/src/cmd/internal/objabi/symkind.go
+++ b/src/cmd/internal/objabi/symkind.go
@@ -79,3 +79,19 @@ const (
SSEHUNWINDINFO
// Update cmd/link/internal/sym/AbiSymKindToSymKind for new SymKind values.
)
+
+// IsText reports whether t is one of the text kinds.
+func (t SymKind) IsText() bool {
+ return t == STEXT || t == STEXTFIPS
+}
+
+// IsDATA reports whether t is one of the DATA kinds (SDATA or SDATAFIPS,
+// excluding NOPTRDATA, RODATA, BSS, and so on).
+func (t SymKind) IsDATA() bool {
+ return t == SDATA || t == SDATAFIPS
+}
+
+// IsFIPS reports whether t is one fo the FIPS kinds.
+func (t SymKind) IsFIPS() bool {
+ return t == STEXTFIPS || t == SRODATAFIPS || t == SNOPTRDATAFIPS || t == SDATAFIPS
+}