1
0
mirror of https://github.com/golang/go synced 2024-11-22 03:44:39 -07:00

cmd/internal/objabi, cmd/link: add FIPS symbol kinds

Add FIPS symbol kinds that will be needed for FIPS support.
This is a separate CL to keep the re-generated changes in
the string methods separate from hand-written changes.

The separate symbol kinds will let us group the FIPS-related
code and data together, so that it can be checksummed at
startup, as required by FIPS.

It's also separate because it breaks buildall, by changing the
on-disk symbol kind enumeration. We want non-buildall
changes to be as simple as possible.

For #69536.

Change-Id: I2d5a238498929fff8b24736ee54330c17323bd86
Reviewed-on: https://go-review.googlesource.com/c/go/+/625995
Auto-Submit: Russ Cox <rsc@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
Russ Cox 2024-10-31 10:53:48 -04:00 committed by Gopher Robot
parent 2e97c30d8d
commit 43f889b9e5
4 changed files with 133 additions and 83 deletions

View File

@ -44,12 +44,16 @@ const (
Sxxx SymKind = iota
// Executable instructions
STEXT
STEXTFIPS
// Read only static data
SRODATA
SRODATAFIPS
// Static data that does not contain any pointers
SNOPTRDATA
SNOPTRDATAFIPS
// Static data
SDATA
SDATAFIPS
// Statically data that is initially all 0s
SBSS
// Statically data that is initially all 0s and does not contain pointers

View File

@ -10,30 +10,34 @@ func _() {
var x [1]struct{}
_ = x[Sxxx-0]
_ = x[STEXT-1]
_ = x[SRODATA-2]
_ = x[SNOPTRDATA-3]
_ = x[SDATA-4]
_ = x[SBSS-5]
_ = x[SNOPTRBSS-6]
_ = x[STLSBSS-7]
_ = x[SDWARFCUINFO-8]
_ = x[SDWARFCONST-9]
_ = x[SDWARFFCN-10]
_ = x[SDWARFABSFCN-11]
_ = x[SDWARFTYPE-12]
_ = x[SDWARFVAR-13]
_ = x[SDWARFRANGE-14]
_ = x[SDWARFLOC-15]
_ = x[SDWARFLINES-16]
_ = x[SLIBFUZZER_8BIT_COUNTER-17]
_ = x[SCOVERAGE_COUNTER-18]
_ = x[SCOVERAGE_AUXVAR-19]
_ = x[SSEHUNWINDINFO-20]
_ = x[STEXTFIPS-2]
_ = x[SRODATA-3]
_ = x[SRODATAFIPS-4]
_ = x[SNOPTRDATA-5]
_ = x[SNOPTRDATAFIPS-6]
_ = x[SDATA-7]
_ = x[SDATAFIPS-8]
_ = x[SBSS-9]
_ = x[SNOPTRBSS-10]
_ = x[STLSBSS-11]
_ = x[SDWARFCUINFO-12]
_ = x[SDWARFCONST-13]
_ = x[SDWARFFCN-14]
_ = x[SDWARFABSFCN-15]
_ = x[SDWARFTYPE-16]
_ = x[SDWARFVAR-17]
_ = x[SDWARFRANGE-18]
_ = x[SDWARFLOC-19]
_ = x[SDWARFLINES-20]
_ = x[SLIBFUZZER_8BIT_COUNTER-21]
_ = x[SCOVERAGE_COUNTER-22]
_ = x[SCOVERAGE_AUXVAR-23]
_ = x[SSEHUNWINDINFO-24]
}
const _SymKind_name = "SxxxSTEXTSRODATASNOPTRDATASDATASBSSSNOPTRBSSSTLSBSSSDWARFCUINFOSDWARFCONSTSDWARFFCNSDWARFABSFCNSDWARFTYPESDWARFVARSDWARFRANGESDWARFLOCSDWARFLINESSLIBFUZZER_8BIT_COUNTERSCOVERAGE_COUNTERSCOVERAGE_AUXVARSSEHUNWINDINFO"
const _SymKind_name = "SxxxSTEXTSTEXTFIPSSRODATASRODATAFIPSSNOPTRDATASNOPTRDATAFIPSSDATASDATAFIPSSBSSSNOPTRBSSSTLSBSSSDWARFCUINFOSDWARFCONSTSDWARFFCNSDWARFABSFCNSDWARFTYPESDWARFVARSDWARFRANGESDWARFLOCSDWARFLINESSLIBFUZZER_8BIT_COUNTERSCOVERAGE_COUNTERSCOVERAGE_AUXVARSSEHUNWINDINFO"
var _SymKind_index = [...]uint8{0, 4, 9, 16, 26, 31, 35, 44, 51, 63, 74, 83, 95, 105, 114, 125, 134, 145, 168, 185, 201, 215}
var _SymKind_index = [...]uint16{0, 4, 9, 18, 25, 36, 46, 60, 65, 74, 78, 87, 94, 106, 117, 126, 138, 148, 157, 168, 177, 188, 211, 228, 244, 258}
func (i SymKind) String() string {
if i >= SymKind(len(_SymKind_index)-1) {

View File

@ -43,6 +43,10 @@ type SymKind uint8
const (
Sxxx SymKind = iota
STEXT
STEXTFIPSSTART
STEXTFIPS
STEXTFIPSEND
STEXTEND
SELFRXSECT
SMACHOPLT
@ -53,6 +57,10 @@ const (
SGOFUNC
SGCBITS
SRODATA
SRODATAFIPSSTART
SRODATAFIPS
SRODATAFIPSEND
SRODATAEND
SFUNCTAB
SELFROSECT
@ -87,14 +95,23 @@ const (
// Writable sections.
SFirstWritable
SBUILDINFO
SFIPSINFO
SELFSECT
SMACHO
SMACHOGOT
SWINDOWS
SELFGOT
SNOPTRDATA
SNOPTRDATAFIPSSTART
SNOPTRDATAFIPS
SNOPTRDATAFIPSEND
SNOPTRDATAEND
SINITARR
SDATA
SDATAFIPSSTART
SDATAFIPS
SDATAFIPSEND
SDATAEND
SXCOFFTOC
SBSS
SNOPTRBSS
@ -135,9 +152,13 @@ const (
var AbiSymKindToSymKind = [...]SymKind{
objabi.Sxxx: Sxxx,
objabi.STEXT: STEXT,
objabi.STEXTFIPS: STEXTFIPS,
objabi.SRODATA: SRODATA,
objabi.SRODATAFIPS: SRODATAFIPS,
objabi.SNOPTRDATA: SNOPTRDATA,
objabi.SNOPTRDATAFIPS: SNOPTRDATAFIPS,
objabi.SDATA: SDATA,
objabi.SDATAFIPS: SDATAFIPS,
objabi.SBSS: SBSS,
objabi.SNOPTRBSS: SNOPTRBSS,
objabi.STLSBSS: STLSBSS,
@ -166,6 +187,10 @@ var ReadOnly = []SymKind{
SGOFUNC,
SGCBITS,
SRODATA,
SRODATAFIPSSTART,
SRODATAFIPS,
SRODATAFIPSEND,
SRODATAEND,
SFUNCTAB,
}

View File

@ -10,71 +10,88 @@ func _() {
var x [1]struct{}
_ = x[Sxxx-0]
_ = x[STEXT-1]
_ = x[SELFRXSECT-2]
_ = x[SMACHOPLT-3]
_ = x[STYPE-4]
_ = x[SSTRING-5]
_ = x[SGOSTRING-6]
_ = x[SGOFUNC-7]
_ = x[SGCBITS-8]
_ = x[SRODATA-9]
_ = x[SFUNCTAB-10]
_ = x[SELFROSECT-11]
_ = x[STYPERELRO-12]
_ = x[SSTRINGRELRO-13]
_ = x[SGOSTRINGRELRO-14]
_ = x[SGOFUNCRELRO-15]
_ = x[SGCBITSRELRO-16]
_ = x[SRODATARELRO-17]
_ = x[SFUNCTABRELRO-18]
_ = x[SELFRELROSECT-19]
_ = x[STYPELINK-20]
_ = x[SITABLINK-21]
_ = x[SSYMTAB-22]
_ = x[SPCLNTAB-23]
_ = x[SFirstWritable-24]
_ = x[SBUILDINFO-25]
_ = x[SELFSECT-26]
_ = x[SMACHO-27]
_ = x[SMACHOGOT-28]
_ = x[SWINDOWS-29]
_ = x[SELFGOT-30]
_ = x[SNOPTRDATA-31]
_ = x[SINITARR-32]
_ = x[SDATA-33]
_ = x[SXCOFFTOC-34]
_ = x[SBSS-35]
_ = x[SNOPTRBSS-36]
_ = x[SLIBFUZZER_8BIT_COUNTER-37]
_ = x[SCOVERAGE_COUNTER-38]
_ = x[SCOVERAGE_AUXVAR-39]
_ = x[STLSBSS-40]
_ = x[SXREF-41]
_ = x[SMACHOSYMSTR-42]
_ = x[SMACHOSYMTAB-43]
_ = x[SMACHOINDIRECTPLT-44]
_ = x[SMACHOINDIRECTGOT-45]
_ = x[SFILEPATH-46]
_ = x[SDYNIMPORT-47]
_ = x[SHOSTOBJ-48]
_ = x[SUNDEFEXT-49]
_ = x[SDWARFSECT-50]
_ = x[SDWARFCUINFO-51]
_ = x[SDWARFCONST-52]
_ = x[SDWARFFCN-53]
_ = x[SDWARFABSFCN-54]
_ = x[SDWARFTYPE-55]
_ = x[SDWARFVAR-56]
_ = x[SDWARFRANGE-57]
_ = x[SDWARFLOC-58]
_ = x[SDWARFLINES-59]
_ = x[SSEHUNWINDINFO-60]
_ = x[SSEHSECT-61]
_ = x[STEXTFIPSSTART-2]
_ = x[STEXTFIPS-3]
_ = x[STEXTFIPSEND-4]
_ = x[STEXTEND-5]
_ = x[SELFRXSECT-6]
_ = x[SMACHOPLT-7]
_ = x[STYPE-8]
_ = x[SSTRING-9]
_ = x[SGOSTRING-10]
_ = x[SGOFUNC-11]
_ = x[SGCBITS-12]
_ = x[SRODATA-13]
_ = x[SRODATAFIPSSTART-14]
_ = x[SRODATAFIPS-15]
_ = x[SRODATAFIPSEND-16]
_ = x[SRODATAEND-17]
_ = x[SFUNCTAB-18]
_ = x[SELFROSECT-19]
_ = x[STYPERELRO-20]
_ = x[SSTRINGRELRO-21]
_ = x[SGOSTRINGRELRO-22]
_ = x[SGOFUNCRELRO-23]
_ = x[SGCBITSRELRO-24]
_ = x[SRODATARELRO-25]
_ = x[SFUNCTABRELRO-26]
_ = x[SELFRELROSECT-27]
_ = x[STYPELINK-28]
_ = x[SITABLINK-29]
_ = x[SSYMTAB-30]
_ = x[SPCLNTAB-31]
_ = x[SFirstWritable-32]
_ = x[SBUILDINFO-33]
_ = x[SFIPSINFO-34]
_ = x[SELFSECT-35]
_ = x[SMACHO-36]
_ = x[SMACHOGOT-37]
_ = x[SWINDOWS-38]
_ = x[SELFGOT-39]
_ = x[SNOPTRDATA-40]
_ = x[SNOPTRDATAFIPSSTART-41]
_ = x[SNOPTRDATAFIPS-42]
_ = x[SNOPTRDATAFIPSEND-43]
_ = x[SNOPTRDATAEND-44]
_ = x[SINITARR-45]
_ = x[SDATA-46]
_ = x[SDATAFIPSSTART-47]
_ = x[SDATAFIPS-48]
_ = x[SDATAFIPSEND-49]
_ = x[SDATAEND-50]
_ = x[SXCOFFTOC-51]
_ = x[SBSS-52]
_ = x[SNOPTRBSS-53]
_ = x[SLIBFUZZER_8BIT_COUNTER-54]
_ = x[SCOVERAGE_COUNTER-55]
_ = x[SCOVERAGE_AUXVAR-56]
_ = x[STLSBSS-57]
_ = x[SXREF-58]
_ = x[SMACHOSYMSTR-59]
_ = x[SMACHOSYMTAB-60]
_ = x[SMACHOINDIRECTPLT-61]
_ = x[SMACHOINDIRECTGOT-62]
_ = x[SFILEPATH-63]
_ = x[SDYNIMPORT-64]
_ = x[SHOSTOBJ-65]
_ = x[SUNDEFEXT-66]
_ = x[SDWARFSECT-67]
_ = x[SDWARFCUINFO-68]
_ = x[SDWARFCONST-69]
_ = x[SDWARFFCN-70]
_ = x[SDWARFABSFCN-71]
_ = x[SDWARFTYPE-72]
_ = x[SDWARFVAR-73]
_ = x[SDWARFRANGE-74]
_ = x[SDWARFLOC-75]
_ = x[SDWARFLINES-76]
_ = x[SSEHUNWINDINFO-77]
_ = x[SSEHSECT-78]
}
const _SymKind_name = "SxxxSTEXTSELFRXSECTSMACHOPLTSTYPESSTRINGSGOSTRINGSGOFUNCSGCBITSSRODATASFUNCTABSELFROSECTSTYPERELROSSTRINGRELROSGOSTRINGRELROSGOFUNCRELROSGCBITSRELROSRODATARELROSFUNCTABRELROSELFRELROSECTSTYPELINKSITABLINKSSYMTABSPCLNTABSFirstWritableSBUILDINFOSELFSECTSMACHOSMACHOGOTSWINDOWSSELFGOTSNOPTRDATASINITARRSDATASXCOFFTOCSBSSSNOPTRBSSSLIBFUZZER_8BIT_COUNTERSCOVERAGE_COUNTERSCOVERAGE_AUXVARSTLSBSSSXREFSMACHOSYMSTRSMACHOSYMTABSMACHOINDIRECTPLTSMACHOINDIRECTGOTSFILEPATHSDYNIMPORTSHOSTOBJSUNDEFEXTSDWARFSECTSDWARFCUINFOSDWARFCONSTSDWARFFCNSDWARFABSFCNSDWARFTYPESDWARFVARSDWARFRANGESDWARFLOCSDWARFLINESSSEHUNWINDINFOSSEHSECT"
const _SymKind_name = "SxxxSTEXTSTEXTFIPSSTARTSTEXTFIPSSTEXTFIPSENDSTEXTENDSELFRXSECTSMACHOPLTSTYPESSTRINGSGOSTRINGSGOFUNCSGCBITSSRODATASRODATAFIPSSTARTSRODATAFIPSSRODATAFIPSENDSRODATAENDSFUNCTABSELFROSECTSTYPERELROSSTRINGRELROSGOSTRINGRELROSGOFUNCRELROSGCBITSRELROSRODATARELROSFUNCTABRELROSELFRELROSECTSTYPELINKSITABLINKSSYMTABSPCLNTABSFirstWritableSBUILDINFOSFIPSINFOSELFSECTSMACHOSMACHOGOTSWINDOWSSELFGOTSNOPTRDATASNOPTRDATAFIPSSTARTSNOPTRDATAFIPSSNOPTRDATAFIPSENDSNOPTRDATAENDSINITARRSDATASDATAFIPSSTARTSDATAFIPSSDATAFIPSENDSDATAENDSXCOFFTOCSBSSSNOPTRBSSSLIBFUZZER_8BIT_COUNTERSCOVERAGE_COUNTERSCOVERAGE_AUXVARSTLSBSSSXREFSMACHOSYMSTRSMACHOSYMTABSMACHOINDIRECTPLTSMACHOINDIRECTGOTSFILEPATHSDYNIMPORTSHOSTOBJSUNDEFEXTSDWARFSECTSDWARFCUINFOSDWARFCONSTSDWARFFCNSDWARFABSFCNSDWARFTYPESDWARFVARSDWARFRANGESDWARFLOCSDWARFLINESSSEHUNWINDINFOSSEHSECT"
var _SymKind_index = [...]uint16{0, 4, 9, 19, 28, 33, 40, 49, 56, 63, 70, 78, 88, 98, 110, 124, 136, 148, 160, 173, 186, 195, 204, 211, 219, 233, 243, 251, 257, 266, 274, 281, 291, 299, 304, 313, 317, 326, 349, 366, 382, 389, 394, 406, 418, 435, 452, 461, 471, 479, 488, 498, 510, 521, 530, 542, 552, 561, 572, 581, 592, 606, 614}
var _SymKind_index = [...]uint16{0, 4, 9, 23, 32, 44, 52, 62, 71, 76, 83, 92, 99, 106, 113, 129, 140, 154, 164, 172, 182, 192, 204, 218, 230, 242, 254, 267, 280, 289, 298, 305, 313, 327, 337, 346, 354, 360, 369, 377, 384, 394, 413, 427, 444, 457, 465, 470, 484, 493, 505, 513, 522, 526, 535, 558, 575, 591, 598, 603, 615, 627, 644, 661, 670, 680, 688, 697, 707, 719, 730, 739, 751, 761, 770, 781, 790, 801, 815, 823}
func (i SymKind) String() string {
if i >= SymKind(len(_SymKind_index)-1) {