[go] cmd/link: move pclntab out of relro section

8 views
Skip to first unread message

Ian Lance Taylor (Gerrit)

unread,
Nov 5, 2025, 7:15:00 PM (5 days ago) Nov 5
to goph...@pubsubhelper.golang.org, Ian Lance Taylor, golang-co...@googlegroups.com

Ian Lance Taylor has uploaded the change for review

Commit message

cmd/link: move pclntab out of relro section

The .gopclntab section should not have any relocations.
Move it out of relro to regular rodata.

Note that this is tested by tests like TestNoTextrel in
cmd/cgo/internal/testshared.

For #76038
Change-Id: I7f837e423bf1e802509277f5dc7fdd1ed0228e32

Change diff

diff --git a/src/cmd/link/internal/ld/data.go b/src/cmd/link/internal/ld/data.go
index fcc3272..e7e202f 100644
--- a/src/cmd/link/internal/ld/data.go
+++ b/src/cmd/link/internal/ld/data.go
@@ -1581,7 +1581,7 @@
// the relro data.
isRelro = true
}
- case sym.SGOFUNC:
+ case sym.SGOFUNC, sym.SPCLNTAB:
// The only SGOFUNC symbols that contain relocations are .stkobj,
// and their relocations are of type objabi.R_ADDROFF,
// which always get resolved during linking.
@@ -2119,6 +2119,21 @@
}
}

+ /* gopclntab */
+ sect = state.allocateNamedSectionAndAssignSyms(segro, ".gopclntab", sym.SPCLNTAB, sym.SRODATA, 04)
+ ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.pclntab", 0), sect)
+ ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.pcheader", 0), sect)
+ ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.funcnametab", 0), sect)
+ ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.cutab", 0), sect)
+ ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.filetab", 0), sect)
+ ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.pctab", 0), sect)
+ ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.functab", 0), sect)
+ ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.epclntab", 0), sect)
+ setCarrierSize(sym.SPCLNTAB, int64(sect.Length))
+ if ctxt.HeadType == objabi.Haix {
+ xcoffUpdateOuterSize(ctxt, int64(sect.Length), sym.SPCLNTAB)
+ }
+
/* read-only ELF, Mach-O sections */
state.allocateSingleSymSections(segro, sym.SELFROSECT, sym.SRODATA, 04)

@@ -2238,21 +2253,6 @@
state.checkdatsize(sym.SITABLINK)
sect.Length = uint64(state.datsize) - sect.Vaddr

- /* gopclntab */
- sect = state.allocateNamedSectionAndAssignSyms(seg, genrelrosecname(".gopclntab"), sym.SPCLNTAB, sym.SRODATA, relroSecPerm)
- ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.pclntab", 0), sect)
- ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.pcheader", 0), sect)
- ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.funcnametab", 0), sect)
- ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.cutab", 0), sect)
- ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.filetab", 0), sect)
- ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.pctab", 0), sect)
- ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.functab", 0), sect)
- ldr.SetSymSect(ldr.LookupOrCreateSym("runtime.epclntab", 0), sect)
- setCarrierSize(sym.SPCLNTAB, int64(sect.Length))
- if ctxt.HeadType == objabi.Haix {
- xcoffUpdateOuterSize(ctxt, int64(sect.Length), sym.SPCLNTAB)
- }
-
// 6g uses 4-byte relocation offsets, so the entire segment must fit in 32 bits.
if state.datsize != int64(uint32(state.datsize)) {
Errorf("read-only data segment too large: %d", state.datsize)
diff --git a/src/cmd/link/internal/ld/elf.go b/src/cmd/link/internal/ld/elf.go
index 8981f1c..90f9388 100644
--- a/src/cmd/link/internal/ld/elf.go
+++ b/src/cmd/link/internal/ld/elf.go
@@ -1250,11 +1250,12 @@

func elfshreloc(arch *sys.Arch, sect *sym.Section) *ElfShdr {
// If main section is SHT_NOBITS, nothing to relocate.
- // Also nothing to relocate in .shstrtab or notes.
+ // Also nothing to relocate in .shstrtab or notes or .gopclntab.
if sect.Vaddr >= sect.Seg.Vaddr+sect.Seg.Filelen {
return nil
}
- if sect.Name == ".shstrtab" || sect.Name == ".tbss" {
+ switch sect.Name {
+ case ".shstrtab", ".tbss", ".gopclntab":
return nil
}
if sect.Elfsect.(*ElfShdr).Type == uint32(elf.SHT_NOTE) {
@@ -1469,6 +1470,7 @@
}
shstrtabAddstring(".elfdata")
shstrtabAddstring(".rodata")
+ shstrtabAddstring(".gopclntab")
// See the comment about data.rel.ro.FOO section names in data.go.
relro_prefix := ""
if ctxt.UseRelro() {
@@ -1477,7 +1479,6 @@
}
shstrtabAddstring(relro_prefix + ".typelink")
shstrtabAddstring(relro_prefix + ".itablink")
- shstrtabAddstring(relro_prefix + ".gopclntab")

if ctxt.IsExternal() {
*FlagD = true
@@ -1486,7 +1487,6 @@
shstrtabAddstring(elfRelType + ".rodata")
shstrtabAddstring(elfRelType + relro_prefix + ".typelink")
shstrtabAddstring(elfRelType + relro_prefix + ".itablink")
- shstrtabAddstring(elfRelType + relro_prefix + ".gopclntab")
shstrtabAddstring(elfRelType + ".noptrdata")
shstrtabAddstring(elfRelType + ".data")
if ctxt.UseRelro() {
diff --git a/src/cmd/link/internal/ld/elf_test.go b/src/cmd/link/internal/ld/elf_test.go
index c2a1bc0..c56d27f 100644
--- a/src/cmd/link/internal/ld/elf_test.go
+++ b/src/cmd/link/internal/ld/elf_test.go
@@ -408,7 +408,7 @@
}

// This program is intended to be just big/complicated enough that
-// we wind up with decent-sized .data.rel.ro.{typelink,itablink,gopclntab}
+// we wind up with decent-sized .data.rel.ro.{typelink,itablink}
// sections.
const ifacecallsProg = `
package main
diff --git a/src/cmd/link/internal/sym/symkind.go b/src/cmd/link/internal/sym/symkind.go
index 9f62e80..8709e7b 100644
--- a/src/cmd/link/internal/sym/symkind.go
+++ b/src/cmd/link/internal/sym/symkind.go
@@ -64,6 +64,7 @@
SRODATAFIPSEND // End of FIPS read-only data.
SRODATAEND // End of read-only data.
SFUNCTAB // Appears to be unused, except for runtime.etypes.
+ SPCLNTAB // Pclntab data.
SELFROSECT // ELF read-only data: relocs, dynamic linking info.

// Read-only, non-executable, dynamically relocatable segment.
@@ -91,7 +92,6 @@

STYPELINK // Type links.
SITABLINK // Itab links.
- SPCLNTAB // Pclntab data.

// Allocated writable segment.
SFirstWritable
diff --git a/src/cmd/link/internal/sym/symkind_string.go b/src/cmd/link/internal/sym/symkind_string.go
index 4e3a0a3..019e7c7 100644
--- a/src/cmd/link/internal/sym/symkind_string.go
+++ b/src/cmd/link/internal/sym/symkind_string.go
@@ -27,19 +27,19 @@
_ = 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[SMACHORELROSECT-28]
- _ = x[STYPELINK-29]
- _ = x[SITABLINK-30]
- _ = x[SPCLNTAB-31]
+ _ = x[SPCLNTAB-19]
+ _ = x[SELFROSECT-20]
+ _ = x[STYPERELRO-21]
+ _ = x[SSTRINGRELRO-22]
+ _ = x[SGOSTRINGRELRO-23]
+ _ = x[SGOFUNCRELRO-24]
+ _ = x[SGCBITSRELRO-25]
+ _ = x[SRODATARELRO-26]
+ _ = x[SFUNCTABRELRO-27]
+ _ = x[SELFRELROSECT-28]
+ _ = x[SMACHORELROSECT-29]
+ _ = x[STYPELINK-30]
+ _ = x[SITABLINK-31]
_ = x[SFirstWritable-32]
_ = x[SBUILDINFO-33]
_ = x[SFIPSINFO-34]
@@ -90,9 +90,9 @@
_ = x[SSEHSECT-79]
}

-const _SymKind_name = "SxxxSTEXTSTEXTFIPSSTARTSTEXTFIPSSTEXTFIPSENDSTEXTENDSELFRXSECTSMACHOPLTSTYPESSTRINGSGOSTRINGSGOFUNCSGCBITSSRODATASRODATAFIPSSTARTSRODATAFIPSSRODATAFIPSENDSRODATAENDSFUNCTABSELFROSECTSTYPERELROSSTRINGRELROSGOSTRINGRELROSGOFUNCRELROSGCBITSRELROSRODATARELROSFUNCTABRELROSELFRELROSECTSMACHORELROSECTSTYPELINKSITABLINKSPCLNTABSFirstWritableSBUILDINFOSFIPSINFOSELFSECTSMACHOSMACHOGOTSWINDOWSSELFGOTSNOPTRDATASNOPTRDATAFIPSSTARTSNOPTRDATAFIPSSNOPTRDATAFIPSENDSNOPTRDATAENDSINITARRSDATASDATAFIPSSTARTSDATAFIPSSDATAFIPSENDSDATAENDSXCOFFTOCSBSSSNOPTRBSSSLIBFUZZER_8BIT_COUNTERSCOVERAGE_COUNTERSCOVERAGE_AUXVARSTLSBSSSFirstUnallocatedSXREFSMACHOSYMSTRSMACHOSYMTABSMACHOINDIRECTPLTSMACHOINDIRECTGOTSDYNIMPORTSHOSTOBJSUNDEFEXTSDWARFSECTSDWARFCUINFOSDWARFCONSTSDWARFFCNSDWARFABSFCNSDWARFTYPESDWARFVARSDWARFRANGESDWARFLOCSDWARFLINESSDWARFADDRSSEHUNWINDINFOSSEHSECT"
+const _SymKind_name = "SxxxSTEXTSTEXTFIPSSTARTSTEXTFIPSSTEXTFIPSENDSTEXTENDSELFRXSECTSMACHOPLTSTYPESSTRINGSGOSTRINGSGOFUNCSGCBITSSRODATASRODATAFIPSSTARTSRODATAFIPSSRODATAFIPSENDSRODATAENDSFUNCTABSPCLNTABSELFROSECTSTYPERELROSSTRINGRELROSGOSTRINGRELROSGOFUNCRELROSGCBITSRELROSRODATARELROSFUNCTABRELROSELFRELROSECTSMACHORELROSECTSTYPELINKSITABLINKSFirstWritableSBUILDINFOSFIPSINFOSELFSECTSMACHOSMACHOGOTSWINDOWSSELFGOTSNOPTRDATASNOPTRDATAFIPSSTARTSNOPTRDATAFIPSSNOPTRDATAFIPSENDSNOPTRDATAENDSINITARRSDATASDATAFIPSSTARTSDATAFIPSSDATAFIPSENDSDATAENDSXCOFFTOCSBSSSNOPTRBSSSLIBFUZZER_8BIT_COUNTERSCOVERAGE_COUNTERSCOVERAGE_AUXVARSTLSBSSSFirstUnallocatedSXREFSMACHOSYMSTRSMACHOSYMTABSMACHOINDIRECTPLTSMACHOINDIRECTGOTSDYNIMPORTSHOSTOBJSUNDEFEXTSDWARFSECTSDWARFCUINFOSDWARFCONSTSDWARFFCNSDWARFABSFCNSDWARFTYPESDWARFVARSDWARFRANGESDWARFLOCSDWARFLINESSDWARFADDRSSEHUNWINDINFOSSEHSECT"

-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, 295, 304, 313, 321, 335, 345, 354, 362, 368, 377, 385, 392, 402, 421, 435, 452, 465, 473, 478, 492, 501, 513, 521, 530, 534, 543, 566, 583, 599, 606, 623, 628, 640, 652, 669, 686, 696, 704, 713, 723, 735, 746, 755, 767, 777, 786, 797, 806, 817, 827, 841, 849}
+var _SymKind_index = [...]uint16{0, 4, 9, 23, 32, 44, 52, 62, 71, 76, 83, 92, 99, 106, 113, 129, 140, 154, 164, 172, 180, 190, 200, 212, 226, 238, 250, 262, 275, 288, 303, 312, 321, 335, 345, 354, 362, 368, 377, 385, 392, 402, 421, 435, 452, 465, 473, 478, 492, 501, 513, 521, 530, 534, 543, 566, 583, 599, 606, 623, 628, 640, 652, 669, 686, 696, 704, 713, 723, 735, 746, 755, 767, 777, 786, 797, 806, 817, 827, 841, 849}

func (i SymKind) String() string {
if i >= SymKind(len(_SymKind_index)-1) {

Change information

Files:
  • M src/cmd/link/internal/ld/data.go
  • M src/cmd/link/internal/ld/elf.go
  • M src/cmd/link/internal/ld/elf_test.go
  • M src/cmd/link/internal/sym/symkind.go
  • M src/cmd/link/internal/sym/symkind_string.go
Change size: M
Delta: 5 files changed, 37 insertions(+), 37 deletions(-)
Open in Gerrit

Related details

Attention set is empty
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: I7f837e423bf1e802509277f5dc7fdd1ed0228e32
Gerrit-Change-Number: 718065
Gerrit-PatchSet: 1
Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
unsatisfied_requirement
satisfied_requirement
open
diffy

Ian Lance Taylor (Gerrit)

unread,
Nov 5, 2025, 7:15:37 PM (5 days ago) Nov 5
to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Ian Lance Taylor voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention set is empty
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: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I7f837e423bf1e802509277f5dc7fdd1ed0228e32
Gerrit-Change-Number: 718065
Gerrit-PatchSet: 1
Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
Gerrit-Comment-Date: Thu, 06 Nov 2025 00:15:30 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Ian Lance Taylor (Gerrit)

unread,
Nov 5, 2025, 10:59:46 PM (5 days ago) Nov 5
to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Cherry Mui and Russ Cox

Ian Lance Taylor uploaded new patchset

Ian Lance Taylor uploaded patch set #2 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
  • Russ Cox
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: newpatchset
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I7f837e423bf1e802509277f5dc7fdd1ed0228e32
Gerrit-Change-Number: 718065
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: Russ Cox <r...@golang.org>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Attention: Russ Cox <r...@golang.org>
Gerrit-Attention: Cherry Mui <cher...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Ian Lance Taylor (Gerrit)

unread,
Nov 5, 2025, 11:00:27 PM (5 days ago) Nov 5
to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Go LUCI, Cherry Mui, Russ Cox, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Cherry Mui and Russ Cox

Ian Lance Taylor voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Cherry Mui
  • Russ Cox
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: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I7f837e423bf1e802509277f5dc7fdd1ed0228e32
Gerrit-Change-Number: 718065
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: Russ Cox <r...@golang.org>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Attention: Russ Cox <r...@golang.org>
Gerrit-Attention: Cherry Mui <cher...@google.com>
Gerrit-Comment-Date: Thu, 06 Nov 2025 04:00:24 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Russ Cox (Gerrit)

unread,
Nov 6, 2025, 5:30:16 AM (5 days ago) Nov 6
to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Russ Cox, Go LUCI, Cherry Mui, Gopher Robot, golang-co...@googlegroups.com
Attention needed from Cherry Mui and Ian Lance Taylor

Russ Cox voted and added 1 comment

Votes added by Russ Cox

Code-Review+2

1 comment

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Russ Cox . resolved

I think being in relro is left over from when functab contained actual pointers.

Open in Gerrit

Related details

Attention is currently required from:
  • Cherry Mui
  • 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: I7f837e423bf1e802509277f5dc7fdd1ed0228e32
Gerrit-Change-Number: 718065
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: Russ Cox <r...@golang.org>
Gerrit-CC: Gopher Robot <go...@golang.org>
Gerrit-Attention: Cherry Mui <cher...@google.com>
Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
Gerrit-Comment-Date: Thu, 06 Nov 2025 10:30:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Cherry Mui (Gerrit)

unread,
Nov 6, 2025, 9:53:46 AM (5 days ago) Nov 6
to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Russ Cox, Go LUCI, Gopher Robot, 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 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: I7f837e423bf1e802509277f5dc7fdd1ed0228e32
    Gerrit-Change-Number: 718065
    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: Russ Cox <r...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Comment-Date: Thu, 06 Nov 2025 14:53:42 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Ian Lance Taylor (Gerrit)

    unread,
    Nov 6, 2025, 12:55:49 PM (4 days ago) Nov 6
    to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Cherry Mui, Russ Cox, Go LUCI, Gopher Robot, 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
    Ian Lance Taylor . resolved

    Tnanks.

    Open in Gerrit

    Related details

    Attention set is empty
    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: I7f837e423bf1e802509277f5dc7fdd1ed0228e32
    Gerrit-Change-Number: 718065
    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: Russ Cox <r...@golang.org>
    Gerrit-CC: Gopher Robot <go...@golang.org>
    Gerrit-Comment-Date: Thu, 06 Nov 2025 17:55:45 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    Gopher Robot (Gerrit)

    unread,
    Nov 6, 2025, 12:58:49 PM (4 days ago) Nov 6
    to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Cherry Mui, Russ Cox, Go LUCI, golang-co...@googlegroups.com

    Gopher Robot submitted the change

    Change information

    Commit message:
    cmd/link: move pclntab out of relro section

    The .gopclntab section should not have any relocations.
    Move it out of relro to regular rodata.

    Note that this is tested by tests like TestNoTextrel in
    cmd/cgo/internal/testshared.

    The existing test TestMachoSectionsReadOnly looks for sections in a
    Mach-O file that are read-only after relocations are applied
    (this is marked by a segment with a flags field set to 0x10).
    We remove the __gopclntab section, as that section is now read-only
    at all times, not only after relocating.

    For #76038
    Change-Id: I7f837e423bf1e802509277f5dc7fdd1ed0228e32
    Reviewed-by: Russ Cox <r...@golang.org>
    Reviewed-by: Cherry Mui <cher...@google.com>
    Auto-Submit: Ian Lance Taylor <ia...@golang.org>
    Files:
      • M src/cmd/link/internal/ld/data.go
      • M src/cmd/link/internal/ld/elf.go
      • M src/cmd/link/internal/ld/elf_test.go
      • M src/cmd/link/internal/ld/macho_test.go
      • M src/cmd/link/internal/sym/symkind.go
      • M src/cmd/link/internal/sym/symkind_string.go
      Change size: M
      Delta: 6 files changed, 43 insertions(+), 42 deletions(-)
      Branch: refs/heads/master
      Submit Requirements:
      • requirement satisfiedCode-Review: +2 by Cherry Mui, +2 by Russ Cox
      • 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: I7f837e423bf1e802509277f5dc7fdd1ed0228e32
      Gerrit-Change-Number: 718065
      Gerrit-PatchSet: 3
      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