cmd/link: add comments for SymKind values

Change-Id: Ie297a19a59362e0f32eae20e511e298a0a87ab6b
Reviewed-on: https://go-review.googlesource.com/c/go/+/715540
Reviewed-by: Than McIntosh <thanm@golang.org>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
This commit is contained in:
Ian Lance Taylor 2025-10-27 22:37:13 -07:00 committed by Gopher Robot
parent 16705b962e
commit 8e2bd267b5

View file

@ -41,31 +41,32 @@ type SymKind uint8
// //
//go:generate stringer -type=SymKind //go:generate stringer -type=SymKind
const ( const (
// An otherwise invalid zero value for the type.
Sxxx SymKind = iota Sxxx SymKind = iota
STEXT // The text segment, containing executable instructions.
STEXTFIPSSTART STEXT // General executable code.
STEXTFIPS STEXTFIPSSTART // Start of FIPS text section.
STEXTFIPSEND STEXTFIPS // Instructions hashed for FIPS checks.
STEXTEND STEXTFIPSEND // End of FIPS text section.
SELFRXSECT STEXTEND // End of text section.
SMACHOPLT SELFRXSECT // Executable PLT; PPC64 .glink.
SMACHOPLT // Mach-O PLT.
// Read-only sections. // Read-only, non-executable, segment.
STYPE STYPE // Type descriptors.
SSTRING SSTRING // Used only for XCOFF runtime.rodata symbol?
SGOSTRING SGOSTRING // Go string constants.
SGOFUNC SGOFUNC // Function descriptors and funcdata symbols.
SGCBITS SGCBITS // GC bit masks and programs.
SRODATA SRODATA // General read-only data.
SRODATAFIPSSTART SRODATAFIPSSTART // Start of FIPS read-only data.
SRODATAFIPS SRODATAFIPS // FIPS read-only data.
SRODATAFIPSEND SRODATAFIPSEND // End of FIPS read-only data.
SRODATAEND SRODATAEND // End of read-only data.
SFUNCTAB SFUNCTAB // Appears to be unused, except for runtime.etypes.
SELFROSECT // ELF read-only data: relocs, dynamic linking info.
SELFROSECT // Read-only, non-executable, dynamically relocatable segment.
// Read-only sections with relocations.
// //
// Types STYPE-SFUNCTAB above are written to the .rodata section by default. // Types STYPE-SFUNCTAB above are written to the .rodata section by default.
// When linking a shared object, some conceptually "read only" types need to // When linking a shared object, some conceptually "read only" types need to
@ -84,55 +85,59 @@ const (
SGCBITSRELRO SGCBITSRELRO
SRODATARELRO SRODATARELRO
SFUNCTABRELRO SFUNCTABRELRO
SELFRELROSECT
SMACHORELROSECT
// Part of .data.rel.ro if it exists, otherwise part of .rodata. SELFRELROSECT // ELF-specific read-only relocatable: PLT, etc.
STYPELINK SMACHORELROSECT // Mach-O specific read-only relocatable.
SITABLINK
SSYMTAB
SPCLNTAB
// Writable sections. STYPELINK // Type links.
SITABLINK // Itab links.
SSYMTAB // Used for runtime.symtab, which is always empty.
SPCLNTAB // Pclntab data.
// Allocated writable segment.
SFirstWritable SFirstWritable
SBUILDINFO SBUILDINFO // debug/buildinfo data (why is this writable?).
SFIPSINFO SFIPSINFO // go:fipsinfo aka crypto/internal/fips140/check.Linkinfo (why is this writable)?
SELFSECT SELFSECT // .got.plt, .plt, .dynamic where appropriate.
SMACHO SMACHO // Used only for .llvmasm?
SMACHOGOT SMACHOGOT // Mach-O GOT.
SWINDOWS SWINDOWS // Windows dynamic symbols.
SELFGOT SELFGOT // Writable ELF GOT section.
SNOPTRDATA SNOPTRDATA // Data with no heap pointers.
SNOPTRDATAFIPSSTART SNOPTRDATAFIPSSTART // Start of FIPS non-pointer writable data.
SNOPTRDATAFIPS SNOPTRDATAFIPS // FIPS non-pointer writable data.
SNOPTRDATAFIPSEND SNOPTRDATAFIPSEND // End of FIPS non-pointer writable data.
SNOPTRDATAEND SNOPTRDATAEND // End of data with no heap pointers.
SINITARR SINITARR // ELF .init_array section.
SDATA SDATA // Data that may have heap pointers.
SDATAFIPSSTART SDATAFIPSSTART // Start of FIPS writable data.
SDATAFIPS SDATAFIPS // FIPS writable data.
SDATAFIPSEND SDATAFIPSEND // End of FIPS writable data.
SDATAEND SDATAEND // End of data that may have heap pointers.
SXCOFFTOC SXCOFFTOC // AIX TOC entries.
SBSS
SNOPTRBSS
SLIBFUZZER_8BIT_COUNTER
SCOVERAGE_COUNTER
SCOVERAGE_AUXVAR
STLSBSS
SXREF
SMACHOSYMSTR
SMACHOSYMTAB
SMACHOINDIRECTPLT
SMACHOINDIRECTGOT
SFILEPATH
SDYNIMPORT
SHOSTOBJ
SUNDEFEXT // Undefined symbol for resolution by external linker
// Sections for debugging information // Allocated zero-initialized segment.
SBSS // Zeroed data that may have heap pointers.
SNOPTRBSS // Zeroed data with no heap pointers.
SLIBFUZZER_8BIT_COUNTER // Fuzzer counters.
SCOVERAGE_COUNTER // Coverage counters.
SCOVERAGE_AUXVAR // Compiler generated coverage symbols.
STLSBSS // Thread-local zeroed data.
// Unallocated segment.
SXREF // Reference from non-Go object file.
SMACHOSYMSTR // Mach-O string table.
SMACHOSYMTAB // Mach-O symbol table.
SMACHOINDIRECTPLT // Mach-O indirect PLT.
SMACHOINDIRECTGOT // Mach-O indirect GOT.
SFILEPATH // Unused?
SDYNIMPORT // Reference to symbol defined in shared library.
SHOSTOBJ // Symbol defined in non-Go object file.
SUNDEFEXT // Undefined symbol for resolution by external linker.
// Unallocated DWARF debugging segment.
SDWARFSECT SDWARFSECT
// DWARF symbol types // DWARF symbol types created by compiler or linker.
SDWARFCUINFO SDWARFCUINFO
SDWARFCONST SDWARFCONST
SDWARFFCN SDWARFFCN
@ -144,9 +149,9 @@ const (
SDWARFLINES SDWARFLINES
SDWARFADDR SDWARFADDR
// SEH symbol types // SEH symbol types. These are probably allocated at run time.
SSEHUNWINDINFO SSEHUNWINDINFO // Compiler generated Windows SEH info.
SSEHSECT SSEHSECT // Windows SEH data.
) )
// AbiSymKindToSymKind maps values read from object files (which are // AbiSymKindToSymKind maps values read from object files (which are