[go] Revert "cmd/cgo: use --no-gc-sections if available"

2 views
Skip to first unread message

Ian Lance Taylor (Gerrit)

unread,
May 20, 2022, 6:50:21 PM5/20/22
to Bryan Mills, Gerrit Bot, Gopher Robot, Michael Matloob, goph...@pubsubhelper.golang.org, Motiejus Jakštys, Russ Cox, Cherry Mui, Ian Lance Taylor, golang-co...@googlegroups.com

Attention is currently required from: Bryan Mills, Ian Lance Taylor, Michael Matloob.

Ian Lance Taylor would like Bryan Mills, Gerrit Bot, Ian Lance Taylor, Gopher Robot and Michael Matloob to review this change.

View Change

Revert "cmd/cgo: use --no-gc-sections if available"

This reverts CL 405414.

Reason for revert: Breaks on AIX and iOS.

Change-Id: I4681c6f2fd69616691660916ebf0853e3a6a67ca
---
M src/cmd/go/internal/work/exec.go
1 file changed, 20 insertions(+), 22 deletions(-)

diff --git a/src/cmd/go/internal/work/exec.go b/src/cmd/go/internal/work/exec.go
index 7a45a25..15b9e1e 100644
--- a/src/cmd/go/internal/work/exec.go
+++ b/src/cmd/go/internal/work/exec.go
@@ -2528,13 +2528,6 @@
a = append(a, "-Qunused-arguments")
}

- // zig cc passes --gc-sections to the underlying linker, which then causes
- // undefined symbol errors when compiling with cgo but without C code.
- // https://github.com/golang/go/issues/52690
- if b.gccSupportsFlag(compiler, "-Wl,--no-gc-sections") {
- a = append(a, "-Wl,--no-gc-sections")
- }
-
// disable word wrapping in error messages
a = append(a, "-fmessage-length=0")

@@ -2601,21 +2594,13 @@
defer os.Remove(tmp)
}

- // We used to write an empty C file, but that gets complicated with go
- // build -n. We tried using a file that does not exist, but that fails on
- // systems with GCC version 4.2.1; that is the last GPLv2 version of GCC,
- // so some systems have frozen on it. Now we pass an empty file on stdin,
- // which should work at least for GCC and clang.
- //
- // If the argument is "-Wl,", then it's testing the linker. In that case,
- // skip "-c". If it's not "-Wl,", then we are testing the compiler and
- // can emit the linking step with "-c".
- cmdArgs := str.StringList(compiler, flag)
- if !strings.HasPrefix(flag, "-Wl,") /* linker flag */ {
- cmdArgs = append(cmdArgs, "-c")
- }
- cmdArgs = append(cmdArgs, "-x", "c", "-", "-o", tmp)
-
+ // We used to write an empty C file, but that gets complicated with
+ // go build -n. We tried using a file that does not exist, but that
+ // fails on systems with GCC version 4.2.1; that is the last GPLv2
+ // version of GCC, so some systems have frozen on it.
+ // Now we pass an empty file on stdin, which should work at least for
+ // GCC and clang.
+ cmdArgs := str.StringList(compiler, flag, "-c", "-x", "c", "-", "-o", tmp)
if cfg.BuildN || cfg.BuildX {
b.Showcmd(b.WorkDir, "%s || true", joinUnambiguously(cmdArgs))
if cfg.BuildN {

To view, visit change 407634. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I4681c6f2fd69616691660916ebf0853e3a6a67ca
Gerrit-Change-Number: 407634
Gerrit-PatchSet: 1
Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
Gerrit-Reviewer: Gerrit Bot <letsus...@gmail.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
Gerrit-CC: Cherry Mui <cher...@google.com>
Gerrit-CC: Motiejus Jakštys <desir...@gmail.com>
Gerrit-CC: Russ Cox <r...@golang.org>
Gerrit-Attention: Bryan Mills <bcm...@google.com>
Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
Gerrit-Attention: Michael Matloob <mat...@golang.org>
Gerrit-MessageType: newchange

Ian Lance Taylor (Gerrit)

unread,
May 20, 2022, 6:51:09 PM5/20/22
to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Cherry Mui, Bryan Mills, Gerrit Bot, Gopher Robot, Michael Matloob, Motiejus Jakštys, golang-co...@googlegroups.com

Attention is currently required from: Bryan Mills, Cherry Mui, Ian Lance Taylor, Michael Matloob.

Patch set 1:Run-TryBot +1

View Change

    To view, visit change 407634. To unsubscribe, or for help writing mail filters, visit settings.

    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I4681c6f2fd69616691660916ebf0853e3a6a67ca
    Gerrit-Change-Number: 407634
    Gerrit-PatchSet: 1
    Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
    Gerrit-Reviewer: Cherry Mui <cher...@google.com>
    Gerrit-Reviewer: Gerrit Bot <letsus...@gmail.com>
    Gerrit-Reviewer: Gopher Robot <go...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
    Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
    Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
    Gerrit-CC: Motiejus Jakštys <desir...@gmail.com>
    Gerrit-Attention: Bryan Mills <bcm...@google.com>
    Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
    Gerrit-Attention: Michael Matloob <mat...@golang.org>
    Gerrit-Attention: Cherry Mui <cher...@google.com>
    Gerrit-Comment-Date: Fri, 20 May 2022 22:51:05 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    Gerrit-MessageType: comment

    Ian Lance Taylor (Gerrit)

    unread,
    May 20, 2022, 6:51:40 PM5/20/22
    to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Cherry Mui, Bryan Mills, Gerrit Bot, Gopher Robot, Michael Matloob, Motiejus Jakštys, golang-co...@googlegroups.com

    Attention is currently required from: Bryan Mills, Cherry Mui, Ian Lance Taylor, Michael Matloob.

    Patch set 1:Auto-Submit +1

    View Change

      To view, visit change 407634. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I4681c6f2fd69616691660916ebf0853e3a6a67ca
      Gerrit-Change-Number: 407634
      Gerrit-PatchSet: 1
      Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
      Gerrit-Reviewer: Cherry Mui <cher...@google.com>
      Gerrit-Reviewer: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Gopher Robot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Motiejus Jakštys <desir...@gmail.com>
      Gerrit-Attention: Bryan Mills <bcm...@google.com>
      Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
      Gerrit-Attention: Michael Matloob <mat...@golang.org>
      Gerrit-Attention: Cherry Mui <cher...@google.com>
      Gerrit-Comment-Date: Fri, 20 May 2022 22:51:37 +0000

      Ian Lance Taylor (Gerrit)

      unread,
      May 20, 2022, 6:58:26 PM5/20/22
      to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

      Attention is currently required from: Bryan Mills, Cherry Mui, Ian Lance Taylor, Ian Lance Taylor, Michael Matloob.

      Ian Lance Taylor uploaded patch set #2 to this change.

      View Change

      The following approvals got outdated and were removed: Auto-Submit+1 by Ian Lance Taylor, Run-TryBot+1 by Ian Lance Taylor

      Revert "cmd/cgo: use --no-gc-sections if available"

      This reverts CL 405414.

      Reason for revert: Breaks on AIX and iOS.

      For #52815


      Change-Id: I4681c6f2fd69616691660916ebf0853e3a6a67ca
      ---
      M src/cmd/go/internal/work/exec.go
      1 file changed, 22 insertions(+), 22 deletions(-)

      To view, visit change 407634. To unsubscribe, or for help writing mail filters, visit settings.

      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I4681c6f2fd69616691660916ebf0853e3a6a67ca
      Gerrit-Change-Number: 407634
      Gerrit-PatchSet: 2
      Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
      Gerrit-Reviewer: Cherry Mui <cher...@google.com>
      Gerrit-Reviewer: Gerrit Bot <letsus...@gmail.com>
      Gerrit-Reviewer: Gopher Robot <go...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
      Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
      Gerrit-CC: Motiejus Jakštys <desir...@gmail.com>
      Gerrit-Attention: Bryan Mills <bcm...@google.com>
      Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
      Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
      Gerrit-Attention: Michael Matloob <mat...@golang.org>
      Gerrit-Attention: Cherry Mui <cher...@google.com>
      Gerrit-MessageType: newpatchset

      Ian Lance Taylor (Gerrit)

      unread,
      May 20, 2022, 6:58:39 PM5/20/22
      to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Cherry Mui, Bryan Mills, Gerrit Bot, Gopher Robot, Michael Matloob, Motiejus Jakštys, golang-co...@googlegroups.com

      Attention is currently required from: Bryan Mills, Cherry Mui, Ian Lance Taylor, Michael Matloob.

      Patch set 2:Run-TryBot +1Auto-Submit +1

      View Change

        To view, visit change 407634. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I4681c6f2fd69616691660916ebf0853e3a6a67ca
        Gerrit-Change-Number: 407634
        Gerrit-PatchSet: 2
        Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Cherry Mui <cher...@google.com>
        Gerrit-Reviewer: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
        Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
        Gerrit-CC: Motiejus Jakštys <desir...@gmail.com>
        Gerrit-Attention: Bryan Mills <bcm...@google.com>
        Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
        Gerrit-Attention: Michael Matloob <mat...@golang.org>
        Gerrit-Attention: Cherry Mui <cher...@google.com>
        Gerrit-Comment-Date: Fri, 20 May 2022 22:58:35 +0000

        Ian Lance Taylor (Gerrit)

        unread,
        May 20, 2022, 6:59:26 PM5/20/22
        to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

        Attention is currently required from: Bryan Mills, Cherry Mui, Ian Lance Taylor, Ian Lance Taylor, Michael Matloob.

        Ian Lance Taylor uploaded patch set #3 to this change.

        View Change

        The following approvals got outdated and were removed: Auto-Submit+1 by Ian Lance Taylor, Run-TryBot+1 by Ian Lance Taylor

        Revert "cmd/cgo: use --no-gc-sections if available"

        This reverts CL 405414.

        Reason for revert: Breaks on AIX and iOS.

        Change-Id: I4681c6f2fd69616691660916ebf0853e3a6a67ca
        ---
        M src/cmd/go/internal/work/exec.go
        1 file changed, 20 insertions(+), 22 deletions(-)

        To view, visit change 407634. To unsubscribe, or for help writing mail filters, visit settings.

        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I4681c6f2fd69616691660916ebf0853e3a6a67ca
        Gerrit-Change-Number: 407634
        Gerrit-PatchSet: 3
        Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
        Gerrit-Reviewer: Cherry Mui <cher...@google.com>
        Gerrit-Reviewer: Gerrit Bot <letsus...@gmail.com>
        Gerrit-Reviewer: Gopher Robot <go...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
        Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
        Gerrit-CC: Motiejus Jakštys <desir...@gmail.com>
        Gerrit-Attention: Bryan Mills <bcm...@google.com>
        Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
        Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
        Gerrit-Attention: Michael Matloob <mat...@golang.org>
        Gerrit-Attention: Cherry Mui <cher...@google.com>
        Gerrit-MessageType: newpatchset

        Ian Lance Taylor (Gerrit)

        unread,
        May 20, 2022, 6:59:34 PM5/20/22
        to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Cherry Mui, Bryan Mills, Gerrit Bot, Gopher Robot, Michael Matloob, Motiejus Jakštys, golang-co...@googlegroups.com

        Attention is currently required from: Bryan Mills, Cherry Mui, Ian Lance Taylor, Michael Matloob.

        Patch set 3:Run-TryBot +1Auto-Submit +1

        View Change

          To view, visit change 407634. To unsubscribe, or for help writing mail filters, visit settings.

          Gerrit-Project: go
          Gerrit-Branch: master
          Gerrit-Change-Id: I4681c6f2fd69616691660916ebf0853e3a6a67ca
          Gerrit-Change-Number: 407634
          Gerrit-PatchSet: 3
          Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
          Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
          Gerrit-Reviewer: Cherry Mui <cher...@google.com>
          Gerrit-Reviewer: Gerrit Bot <letsus...@gmail.com>
          Gerrit-Reviewer: Gopher Robot <go...@golang.org>
          Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
          Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
          Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
          Gerrit-CC: Motiejus Jakštys <desir...@gmail.com>
          Gerrit-Attention: Bryan Mills <bcm...@google.com>
          Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
          Gerrit-Attention: Michael Matloob <mat...@golang.org>
          Gerrit-Attention: Cherry Mui <cher...@google.com>
          Gerrit-Comment-Date: Fri, 20 May 2022 22:59:31 +0000

          Cherry Mui (Gerrit)

          unread,
          May 20, 2022, 7:06:45 PM5/20/22
          to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Bryan Mills, Gerrit Bot, Gopher Robot, Michael Matloob, Motiejus Jakštys, golang-co...@googlegroups.com

          Attention is currently required from: Bryan Mills, Ian Lance Taylor, Ian Lance Taylor, Michael Matloob.

          Patch set 3:Code-Review +2

          View Change

            To view, visit change 407634. To unsubscribe, or for help writing mail filters, visit settings.

            Gerrit-Project: go
            Gerrit-Branch: master
            Gerrit-Change-Id: I4681c6f2fd69616691660916ebf0853e3a6a67ca
            Gerrit-Change-Number: 407634
            Gerrit-PatchSet: 3
            Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
            Gerrit-Reviewer: Cherry Mui <cher...@google.com>
            Gerrit-Reviewer: Gerrit Bot <letsus...@gmail.com>
            Gerrit-Reviewer: Gopher Robot <go...@golang.org>
            Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
            Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
            Gerrit-CC: Motiejus Jakštys <desir...@gmail.com>
            Gerrit-Attention: Bryan Mills <bcm...@google.com>
            Gerrit-Attention: Ian Lance Taylor <ia...@google.com>
            Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
            Gerrit-Attention: Michael Matloob <mat...@golang.org>
            Gerrit-Comment-Date: Fri, 20 May 2022 23:06:40 +0000

            Ian Lance Taylor (Gerrit)

            unread,
            May 20, 2022, 7:37:07 PM5/20/22
            to Ian Lance Taylor, goph...@pubsubhelper.golang.org, Gopher Robot, Cherry Mui, Bryan Mills, Gerrit Bot, Michael Matloob, Motiejus Jakštys, golang-co...@googlegroups.com

            Attention is currently required from: Bryan Mills, Ian Lance Taylor, Michael Matloob.

            Patch set 3:Code-Review +1

            View Change

              To view, visit change 407634. To unsubscribe, or for help writing mail filters, visit settings.

              Gerrit-Project: go
              Gerrit-Branch: master
              Gerrit-Change-Id: I4681c6f2fd69616691660916ebf0853e3a6a67ca
              Gerrit-Change-Number: 407634
              Gerrit-PatchSet: 3
              Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
              Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
              Gerrit-Reviewer: Cherry Mui <cher...@google.com>
              Gerrit-Reviewer: Gerrit Bot <letsus...@gmail.com>
              Gerrit-Reviewer: Gopher Robot <go...@golang.org>
              Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
              Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
              Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
              Gerrit-CC: Motiejus Jakštys <desir...@gmail.com>
              Gerrit-Attention: Bryan Mills <bcm...@google.com>
              Gerrit-Attention: Ian Lance Taylor <ia...@golang.org>
              Gerrit-Attention: Michael Matloob <mat...@golang.org>
              Gerrit-Comment-Date: Fri, 20 May 2022 23:37:02 +0000

              Gopher Robot (Gerrit)

              unread,
              May 20, 2022, 7:37:47 PM5/20/22
              to Ian Lance Taylor, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Cherry Mui, Bryan Mills, Gerrit Bot, Michael Matloob, Motiejus Jakštys, golang-co...@googlegroups.com

              Gopher Robot submitted this change.

              View Change


              Approvals: Gopher Robot: TryBots succeeded Ian Lance Taylor: Run TryBots; Automatically submit change Ian Lance Taylor: Looks good to me, but someone else must approve Cherry Mui: Looks good to me, approved
              Revert "cmd/cgo: use --no-gc-sections if available"

              This reverts CL 405414.

              Reason for revert: Breaks on AIX and iOS.

              Change-Id: I4681c6f2fd69616691660916ebf0853e3a6a67ca
              Reviewed-on: https://go-review.googlesource.com/c/go/+/407634
              Reviewed-by: Cherry Mui <cher...@google.com>
              Run-TryBot: Ian Lance Taylor <ia...@golang.org>
              TryBot-Result: Gopher Robot <go...@golang.org>
              Reviewed-by: Ian Lance Taylor <ia...@google.com>
              Auto-Submit: Ian Lance Taylor <ia...@golang.org>
              ---
              M src/cmd/go/internal/work/exec.go
              1 file changed, 26 insertions(+), 22 deletions(-)

              To view, visit change 407634. To unsubscribe, or for help writing mail filters, visit settings.

              Gerrit-Project: go
              Gerrit-Branch: master
              Gerrit-Change-Id: I4681c6f2fd69616691660916ebf0853e3a6a67ca
              Gerrit-Change-Number: 407634
              Gerrit-PatchSet: 4
              Gerrit-Owner: Ian Lance Taylor <ia...@golang.org>
              Gerrit-Reviewer: Bryan Mills <bcm...@google.com>
              Gerrit-Reviewer: Cherry Mui <cher...@google.com>
              Gerrit-Reviewer: Gerrit Bot <letsus...@gmail.com>
              Gerrit-Reviewer: Gopher Robot <go...@golang.org>
              Gerrit-Reviewer: Ian Lance Taylor <ia...@golang.org>
              Gerrit-Reviewer: Ian Lance Taylor <ia...@google.com>
              Gerrit-Reviewer: Michael Matloob <mat...@golang.org>
              Gerrit-CC: Motiejus Jakštys <desir...@gmail.com>
              Gerrit-MessageType: merged
              Reply all
              Reply to author
              Forward
              0 new messages