[go] cmd/link: add comments for SymKind values

7 views
Skip to first unread message

Ian Lance Taylor (Gerrit)

unread,
Oct 28, 2025, 1:46:28 AM (9 days ago) Oct 28
to Cherry Mui, goph...@pubsubhelper.golang.org, Ian Lance Taylor, golang-co...@googlegroups.com
Attention needed from Cherry Mui

Ian Lance Taylor has uploaded the change for review

Ian Lance Taylor would like Cherry Mui to review this change.

Commit message

cmd/link: add comments for SymKind values
Change-Id: Ie297a19a59362e0f32eae20e511e298a0a87ab6b

Change diff

diff --git a/src/cmd/link/internal/sym/symkind.go b/src/cmd/link/internal/sym/symkind.go
index 0671d9d..6dde6ab 100644
--- a/src/cmd/link/internal/sym/symkind.go
+++ b/src/cmd/link/internal/sym/symkind.go
@@ -41,31 +41,32 @@
//
//go:generate stringer -type=SymKind
const (
+ // An otherwise invalid zero value for the type.
Sxxx SymKind = iota
- STEXT
- STEXTFIPSSTART
- STEXTFIPS
- STEXTFIPSEND
- STEXTEND
- SELFRXSECT
- SMACHOPLT
+ // The text segment, containing executable instructions.
+ STEXT // General executable code.
+ STEXTFIPSSTART // Start of FIPS text section.
+ STEXTFIPS // Instructions hashed for FIPS checks.
+ STEXTFIPSEND // End of FIPS text section.
+ STEXTEND // End of text section.
+ SELFRXSECT // Executable PLT; PPC64 .glink.
+ SMACHOPLT // Mach-O PLT.

- // Read-only sections.
- STYPE
- SSTRING
- SGOSTRING
- SGOFUNC
- SGCBITS
- SRODATA
- SRODATAFIPSSTART
- SRODATAFIPS
- SRODATAFIPSEND
- SRODATAEND
- SFUNCTAB
+ // Read-only, non-executable, segment.
+ STYPE // Type descriptors.
+ SSTRING // Used only for XCOFF runtime.rodata symbol?
+ SGOSTRING // Go string constants.
+ SGOFUNC // Function descriptors and funcdata symbols.
+ SGCBITS // GC bit masks and programs.
+ SRODATA // General read-only data.
+ SRODATAFIPSSTART // Start of FIPS read-only data.
+ SRODATAFIPS // FIPS read-only data.
+ SRODATAFIPSEND // End of FIPS read-only data.
+ SRODATAEND // End of read-only data.
+ SFUNCTAB // Appears to be unused, except for runtime.etypes.
+ SELFROSECT // ELF read-only data: relocs, dynamic linking info.

- SELFROSECT
-
- // Read-only sections with relocations.
+ // Read-only, non-executable, dynamically relocatable segment.
//
// Types STYPE-SFUNCTAB above are written to the .rodata section by default.
// When linking a shared object, some conceptually "read only" types need to
@@ -84,55 +85,59 @@
SGCBITSRELRO
SRODATARELRO
SFUNCTABRELRO
- SELFRELROSECT
- SMACHORELROSECT

- // Part of .data.rel.ro if it exists, otherwise part of .rodata.
- STYPELINK
- SITABLINK
- SSYMTAB
- SPCLNTAB
+ SELFRELROSECT // ELF-specific read-only relocatable: PLT, etc.
+ SMACHORELROSECT // Mach-o specific read-only relocatable.

- // Writable sections.
+ STYPELINK // Type links.
+ SITABLINK // Itab links.
+ SSYMTAB // Used for runtime.symtab, which is always empty.
+ SPCLNTAB // Pclntab data.
+
+ // Allocated writable segment.
SFirstWritable
- SBUILDINFO
- SFIPSINFO
- SELFSECT
- SMACHO
- SMACHOGOT
- SWINDOWS
- SELFGOT
- SNOPTRDATA
- SNOPTRDATAFIPSSTART
- SNOPTRDATAFIPS
- SNOPTRDATAFIPSEND
- SNOPTRDATAEND
- SINITARR
- SDATA
- SDATAFIPSSTART
- SDATAFIPS
- SDATAFIPSEND
- SDATAEND
- SXCOFFTOC
- 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
+ SBUILDINFO // debug/buildinfo data (why is this writable?).
+ SFIPSINFO // go:fipsinfo aka crypto/internal/fips140/check.Linkinfo (why is this writable)?
+ SELFSECT // .got.plt, .plt, .dynamic where appropriate.
+ SMACHO // Used only for .llvmasm?
+ SMACHOGOT // Mach-O GOT.
+ SWINDOWS // Windows dynamic symbols.
+ SELFGOT // Writable ELF GOT section.
+ SNOPTRDATA // Data with no heap pointers.
+ SNOPTRDATAFIPSSTART // Start of FIPS non-pointer writable data.
+ SNOPTRDATAFIPS // FIPS non-pointer writable data.
+ SNOPTRDATAFIPSEND // End of FIPS non-pointer writable data.
+ SNOPTRDATAEND // End of data with no heap pointers.
+ SINITARR // ELF .init_array section.
+ SDATA // Data that may have heap pointers.
+ SDATAFIPSSTART // Start of FIPS writable data.
+ SDATAFIPS // FIPS writable data.
+ SDATAFIPSEND // End of FIPS writable data.
+ SDATAEND // End of data that may have heap pointers.
+ SXCOFFTOC // AIX TOC entries.

- // 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
- // DWARF symbol types
+ // DWARF symbol types created by compiler.
SDWARFCUINFO
SDWARFCONST
SDWARFFCN
@@ -144,9 +149,9 @@
SDWARFLINES
SDWARFADDR

- // SEH symbol types
- SSEHUNWINDINFO
- SSEHSECT
+ // SEH symbol types. These are probably allocated at run time.
+ SSEHUNWINDINFO // Compiler generated Windows SEH info.
+ SSEHSECT // Windows SEH data.
)

// AbiSymKindToSymKind maps values read from object files (which are

Change information

Files:
  • M src/cmd/link/internal/sym/symkind.go
Change size: M
Delta: 1 file changed, 74 insertions(+), 69 deletions(-)
Open in Gerrit

Related details

Attention is currently required from:
  • Cherry Mui
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ie297a19a59362e0f32eae20e511e298a0a87ab6b
Gerrit-Change-Number: 715540
Gerrit-PatchSet: 1
Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Cherry Mui <cher...@google.com>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Attention: Cherry Mui <cher...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Than McIntosh (Gerrit)

unread,
Nov 3, 2025, 4:12:11 PM (3 days ago) Nov 3
to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Than McIntosh, Go LUCI, Cherry Mui, golang-co...@googlegroups.com
Attention needed from Cherry Mui and Ian Lance Taylor

Than McIntosh voted and added 1 comment

Votes added by Than McIntosh

Code-Review+2

1 comment

File src/cmd/link/internal/sym/symkind.go
Line 140, Patchset 2 (Latest): // DWARF symbol types created by compiler.
Than McIntosh . unresolved

very minor nit, linker creates some of these too (ex: SDWARVAR)

Open in Gerrit

Related details

Attention is currently required from:
  • Cherry Mui
  • Ian Lance Taylor
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ie297a19a59362e0f32eae20e511e298a0a87ab6b
Gerrit-Change-Number: 715540
Gerrit-PatchSet: 2
Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Cherry Mui <cher...@google.com>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Than McIntosh <th...@golang.org>
Gerrit-Attention: Cherry Mui <cher...@google.com>
Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
Gerrit-Comment-Date: Mon, 03 Nov 2025 21:12:06 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Ian Lance Taylor (Gerrit)

unread,
Nov 3, 2025, 5:41:56 PM (3 days ago) Nov 3
to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Than McIntosh, Go LUCI, Cherry Mui, golang-co...@googlegroups.com
Attention needed from Cherry Mui

Ian Lance Taylor added 1 comment

File src/cmd/link/internal/sym/symkind.go
Line 140, Patchset 2 (Latest): // DWARF symbol types created by compiler.
Than McIntosh . resolved

very minor nit, linker creates some of these too (ex: SDWARVAR)

Ian Lance Taylor

Thanks, tweaked the comment.

Open in Gerrit

Related details

Attention is currently required from:
  • Cherry Mui
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ie297a19a59362e0f32eae20e511e298a0a87ab6b
Gerrit-Change-Number: 715540
Gerrit-PatchSet: 2
Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Cherry Mui <cher...@google.com>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Than McIntosh <th...@golang.org>
Gerrit-Attention: Cherry Mui <cher...@google.com>
Gerrit-Comment-Date: Mon, 03 Nov 2025 22:41:50 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Than McIntosh <th...@golang.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Ian Lance Taylor (Gerrit)

unread,
Nov 3, 2025, 5:42:23 PM (3 days ago) Nov 3
to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Cherry Mui

Ian Lance Taylor uploaded new patchset

Ian Lance Taylor uploaded patch set #3 to this change.
Following approvals got outdated and were removed:
  • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit

Related details

Attention is currently required from:
  • Cherry Mui
Submit Requirements:
    • requirement satisfiedCode-Review
    • requirement satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    • requirement is not satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: newpatchset
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: Ie297a19a59362e0f32eae20e511e298a0a87ab6b
    Gerrit-Change-Number: 715540
    Gerrit-PatchSet: 3
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Cherry Mui (Gerrit)

    unread,
    Nov 4, 2025, 12:01:06 PM (2 days ago) Nov 4
    to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Go LUCI, Than McIntosh, golang-co...@googlegroups.com
    Attention needed from Ian Lance Taylor

    Cherry Mui voted Code-Review+2

    Code-Review+2
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ian Lance Taylor
    Submit Requirements:
      • requirement satisfiedCode-Review
      • requirement satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedReview-Enforcement
      • requirement satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Ie297a19a59362e0f32eae20e511e298a0a87ab6b
      Gerrit-Change-Number: 715540
      Gerrit-PatchSet: 3
      Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Cherry Mui <cher...@google.com>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Than McIntosh <th...@golang.org>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Comment-Date: Tue, 04 Nov 2025 17:00:59 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Michael Pratt (Gerrit)

      unread,
      Nov 4, 2025, 4:39:58 PM (2 days ago) Nov 4
      to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Michael Pratt, Cherry Mui, Go LUCI, Than McIntosh, golang-co...@googlegroups.com
      Attention needed from Ian Lance Taylor

      Michael Pratt voted and added 1 comment

      Votes added by Michael Pratt

      Code-Review+2

      1 comment

      Patchset-level comments
      File-level comment, Patchset 3 (Latest):
      Michael Pratt . resolved

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Ian Lance Taylor
      Submit Requirements:
        • requirement satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement satisfiedReview-Enforcement
        • requirement satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: Ie297a19a59362e0f32eae20e511e298a0a87ab6b
        Gerrit-Change-Number: 715540
        Gerrit-PatchSet: 3
        Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Cherry Mui <cher...@google.com>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
        Gerrit-Reviewer: Than McIntosh <th...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Comment-Date: Tue, 04 Nov 2025 21:39:55 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        open
        diffy

        Ian Lance Taylor (Gerrit)

        unread,
        Nov 4, 2025, 7:08:52 PM (2 days ago) Nov 4
        to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
        Attention needed from Ian Lance Taylor

        Ian Lance Taylor uploaded new patchset

        Ian Lance Taylor uploaded patch set #4 to this change.
        Following approvals got outdated and were removed:
        • TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI

        Related details

        Attention is currently required from:
        • Ian Lance Taylor
        Submit Requirements:
          • requirement satisfiedCode-Review
          • requirement satisfiedNo-Unresolved-Comments
          • requirement satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: newpatchset
          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: Ie297a19a59362e0f32eae20e511e298a0a87ab6b
          Gerrit-Change-Number: 715540
          Gerrit-PatchSet: 4
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Ian Lance Taylor (Gerrit)

          unread,
          Nov 4, 2025, 7:09:31 PM (2 days ago) Nov 4
          to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Michael Pratt, Cherry Mui, Go LUCI, Than McIntosh, golang-co...@googlegroups.com

          Ian Lance Taylor voted and added 1 comment

          Votes added by Ian Lance Taylor

          Auto-Submit+1

          1 comment

          Patchset-level comments
          File-level comment, Patchset 4 (Latest):
          Ian Lance Taylor . resolved

          Thanks.

          Open in Gerrit

          Related details

          Attention set is empty
          Submit Requirements:
          • requirement satisfiedCode-Review
          • requirement satisfiedNo-Unresolved-Comments
          • requirement satisfiedReview-Enforcement
          • requirement is not satisfiedTryBots-Pass
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: comment
          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: Ie297a19a59362e0f32eae20e511e298a0a87ab6b
          Gerrit-Change-Number: 715540
          Gerrit-PatchSet: 4
          Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
          Gerrit-Reviewer: Cherry Mui <cher...@google.com>
          Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
          Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
          Gerrit-Reviewer: Than McIntosh <th...@golang.org>
          Gerrit-Comment-Date: Wed, 05 Nov 2025 00:09:26 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Gopher Robot (Gerrit)

          unread,
          Nov 4, 2025, 7:27:42 PM (2 days ago) Nov 4
          to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Go LUCI, Michael Pratt, Cherry Mui, Than McIntosh, golang-co...@googlegroups.com

          Gopher Robot submitted the change with unreviewed changes

          Unreviewed changes

          3 is the latest approved patch-set.
          The change was submitted with unreviewed changes in the following files:

          ```
          The name of the file: src/cmd/link/internal/sym/symkind.go
          Insertions: 1, Deletions: 1.

          @@ -87,7 +87,7 @@
          SFUNCTABRELRO


          SELFRELROSECT // ELF-specific read-only relocatable: PLT, etc.
          -	SMACHORELROSECT // Mach-o specific read-only relocatable.
          + SMACHORELROSECT // Mach-O specific read-only relocatable.

          STYPELINK // Type links.
          SITABLINK // Itab links.
          ```

          Change information

          Commit message:
          cmd/link: add comments for SymKind values
          Change-Id: Ie297a19a59362e0f32eae20e511e298a0a87ab6b
          Reviewed-by: Than McIntosh <th...@golang.org>
          Auto-Submit: Ian Lance Taylor <ia...@golang.org>
          Reviewed-by: Cherry Mui <cher...@google.com>
          Reviewed-by: Michael Pratt <mpr...@google.com>
          Files:
          • M src/cmd/link/internal/sym/symkind.go
          Change size: M
          Delta: 1 file changed, 74 insertions(+), 69 deletions(-)
          Branch: refs/heads/master
          Submit Requirements:
          • requirement satisfiedCode-Review: +2 by Cherry Mui, +2 by Than McIntosh, +2 by Michael Pratt
          • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
          Open in Gerrit
          Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
          Gerrit-MessageType: merged
          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: Ie297a19a59362e0f32eae20e511e298a0a87ab6b
          Gerrit-Change-Number: 715540
          Gerrit-PatchSet: 5
          Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
          Gerrit-Reviewer: Cherry Mui <cher...@google.com>
          Gerrit-Reviewer: Gopher Robot <go...@golang.org>
          open
          diffy
          satisfied_requirement
          Reply all
          Reply to author
          Forward
          0 new messages