[go] cmd/link: make TestTypePlacement work on AIX

3 views
Skip to first unread message

Ian Lance Taylor (Gerrit)

unread,
Jan 30, 2026, 10:17:37 PM (7 days ago) Jan 30
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: make TestTypePlacement work on AIX

The existing code was just wrong. On AIX the go.type section is
folded into the .text section (when internally linking),
or the .data section (when externally linking).
It follows that the data section adjustment is useless when
internally linking, which is currently what happens with this test.
Change-Id: Icf8ac07f754fdcf08b9d3dfffde83b3391c9404b

Change diff

diff --git a/src/cmd/link/link_test.go b/src/cmd/link/link_test.go
index 541733b..19607c3 100644
--- a/src/cmd/link/link_test.go
+++ b/src/cmd/link/link_test.go
@@ -2416,20 +2416,37 @@
case xf != nil:
defer xf.Close()

- for _, sec := range xf.Sections {
- if sec.Name == ".go.type" {
- typeStart = sec.VirtualAddress
- typeEnd = sec.VirtualAddress + sec.Size
- break
+ // On XCOFF the .go.type section,
+ // like all relro sections,
+ // gets folded into the .data section.
+ var typeSym, eTypeSym *xcoff.Symbol
+ for _, sym := range xf.Symbols {
+ switch sym.Name {
+ case "runtime.types":
+ typeSym = sym
+ case "runtime.etypes":
+ eTypeSym = sym
+ case globalName:
+ globalSec := xf.Sections[sym.SectionNumber-1]
+ globalObjAddr = uint64(globalSec.VirtualAddress + sym.Value)
}
}

- for _, sym := range xf.Symbols {
- if sym.Name == globalName {
- globalObjAddr = sym.Value
- break
- }
+ if typeSym == nil {
+ t.Fatal("could not find symbol runtime.types")
}
+ if eTypeSym == nil {
+ t.Fatal("could not find symbol runtime.etypes")
+ }
+ if typeSym.SectionNumber != eTypeSym.SectionNumber {
+ t.Fatalf("runtime.types section %d != runtime.etypes section %d", typeSym.SectionNumber, eTypeSym.SectionNumber)
+ }
+
+ sec := xf.Sections[typeSym.SectionNumber-1]
+
+ typeStart = uint64(sec.VirtualAddress + typeSym.Value)
+
+ typeEnd = uint64(sec.VirtualAddress + eTypeSym.Value)
}

if typeStart == 0 || typeEnd == 0 {
@@ -2440,6 +2457,14 @@
offset := globalExeAddr - globalObjAddr
t.Logf("execution offset: %#x", offset)

+ // On AIX with internal linking the type descriptors are
+ // currently put in the .text section, whereas the global
+ // variable will be in the .data section. We must ignore
+ // the offset. This would change if using external linking.
+ if runtime.GOOS == "aix" {
+ offset = 0
+ }
+
for _, addr := range addrs {
addr -= offset
if addr < typeStart || addr >= typeEnd {

Change information

Files:
  • M src/cmd/link/link_test.go
Change size: S
Delta: 1 file changed, 35 insertions(+), 10 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: Icf8ac07f754fdcf08b9d3dfffde83b3391c9404b
Gerrit-Change-Number: 740821
Gerrit-PatchSet: 1
Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Cherry Mui <cher...@google.com>
Gerrit-Attention: Cherry Mui <cher...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Ian Lance Taylor (Gerrit)

unread,
Jan 30, 2026, 10:17:58 PM (7 days ago) Jan 30
to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Cherry Mui, golang-co...@googlegroups.com
Attention needed from Cherry Mui

Ian Lance Taylor voted and added 1 comment

Votes added by Ian Lance Taylor

Run-TryBot+1

1 comment

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

TRY=aix

Open in Gerrit

Related details

Attention is currently required from:
  • Cherry Mui
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedLegacy-TryBots-Pass
    • 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: Icf8ac07f754fdcf08b9d3dfffde83b3391c9404b
    Gerrit-Change-Number: 740821
    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>
    Gerrit-Comment-Date: Sat, 31 Jan 2026 03:17:54 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Ian Lance Taylor (Gerrit)

    unread,
    Jan 30, 2026, 11:35:38 PM (7 days ago) Jan 30
    to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Gopher Robot, Cherry Mui, golang-co...@googlegroups.com
    Attention needed from Cherry Mui

    Ian Lance Taylor voted and added 1 comment

    Votes added by Ian Lance Taylor

    Commit-Queue+1
    Run-TryBot+0

    1 comment

    Patchset-level comments
    Ian Lance Taylor . resolved

    Amazing. A successful trybot run on AIX.

    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: comment
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: Icf8ac07f754fdcf08b9d3dfffde83b3391c9404b
      Gerrit-Change-Number: 740821
      Gerrit-PatchSet: 1
      Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Cherry Mui <cher...@google.com>
      Gerrit-Reviewer: Gopher Robot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: Cherry Mui <cher...@google.com>
      Gerrit-Comment-Date: Sat, 31 Jan 2026 04:35:32 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      unsatisfied_requirement
      satisfied_requirement
      open
      diffy

      Than McIntosh (Gerrit)

      unread,
      Feb 1, 2026, 6:12:17 PM (5 days ago) Feb 1
      to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Than McIntosh, Go LUCI, Gopher Robot, Cherry Mui, golang-co...@googlegroups.com
      Attention needed from Cherry Mui and Ian Lance Taylor

      Than McIntosh added 1 comment

      Patchset-level comments
      Ian Lance Taylor . resolved

      Amazing. A successful trybot run on AIX.

      Than McIntosh

      I am totally having flashbacks to the linker rewrite -- so many struggles with the AIX trybot back then.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Cherry Mui
      • Ian Lance Taylor
      Submit Requirements:
        • requirement is not 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: Icf8ac07f754fdcf08b9d3dfffde83b3391c9404b
        Gerrit-Change-Number: 740821
        Gerrit-PatchSet: 1
        Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Cherry Mui <cher...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-CC: Than McIntosh <th...@golang.org>
        Gerrit-Attention: Cherry Mui <cher...@google.com>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Comment-Date: Sun, 01 Feb 2026 23:12:13 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Ian Lance Taylor <ia...@golang.org>
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Cherry Mui (Gerrit)

        unread,
        Feb 6, 2026, 5:53:36 PM (10 hours ago) Feb 6
        to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Go LUCI, Than McIntosh, 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 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: Icf8ac07f754fdcf08b9d3dfffde83b3391c9404b
        Gerrit-Change-Number: 740821
        Gerrit-PatchSet: 4
        Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Cherry Mui <cher...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-CC: Than McIntosh <th...@golang.org>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Comment-Date: Fri, 06 Feb 2026 22:53:32 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Ian Lance Taylor (Gerrit)

        unread,
        Feb 6, 2026, 6:05:27 PM (10 hours ago) Feb 6
        to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Cherry Mui, Go LUCI, Than McIntosh, 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

        Thanks.

        Open in Gerrit

        Related details

        Attention set is empty
        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: Icf8ac07f754fdcf08b9d3dfffde83b3391c9404b
        Gerrit-Change-Number: 740821
        Gerrit-PatchSet: 4
        Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Cherry Mui <cher...@google.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-CC: Than McIntosh <th...@golang.org>
        Gerrit-Comment-Date: Fri, 06 Feb 2026 23:05:22 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Michael Pratt (Gerrit)

        unread,
        Feb 6, 2026, 6:29:49 PM (9 hours ago) Feb 6
        to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Michael Pratt, Cherry Mui, Go LUCI, Than McIntosh, Gopher Robot, golang-co...@googlegroups.com
        Attention needed from Ian Lance Taylor

        Michael Pratt voted Code-Review+1

        Code-Review+1
        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: Icf8ac07f754fdcf08b9d3dfffde83b3391c9404b
          Gerrit-Change-Number: 740821
          Gerrit-PatchSet: 4
          Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
          Gerrit-Reviewer: Cherry Mui <cher...@google.com>
          Gerrit-Reviewer: Gopher Robot <go...@golang.org>
          Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
          Gerrit-Reviewer: Michael Pratt <mpr...@google.com>
          Gerrit-CC: Than McIntosh <th...@golang.org>
          Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
          Gerrit-Comment-Date: Fri, 06 Feb 2026 23:29:45 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          open
          diffy

          Gopher Robot (Gerrit)

          unread,
          Feb 6, 2026, 6:30:49 PM (9 hours ago) Feb 6
          to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Michael Pratt, Cherry Mui, Go LUCI, Than McIntosh, golang-co...@googlegroups.com

          Gopher Robot submitted the change

          Change information

          Commit message:
          cmd/link: make TestTypePlacement work on AIX

          The existing code was just wrong. On AIX the go.type section is
          folded into the .text section (when internally linking),
          or the .data section (when externally linking).
          It follows that the data section adjustment is useless when
          internally linking, which is currently what happens with this test.
          Change-Id: Icf8ac07f754fdcf08b9d3dfffde83b3391c9404b
          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/link_test.go
          Change size: S
          Delta: 1 file changed, 35 insertions(+), 10 deletions(-)
          Branch: refs/heads/master
          Submit Requirements:
          • requirement satisfiedCode-Review: +1 by Michael Pratt, +2 by Cherry Mui
          • 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: Icf8ac07f754fdcf08b9d3dfffde83b3391c9404b
          Gerrit-Change-Number: 740821
          Gerrit-PatchSet: 5
          open
          diffy
          satisfied_requirement
          Reply all
          Reply to author
          Forward
          0 new messages