Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/link: cgo generates incorrect symbols on macOS 13 beta 5 #54482

Closed
kevmo314 opened this issue Aug 16, 2022 · 32 comments
Closed

cmd/link: cgo generates incorrect symbols on macOS 13 beta 5 #54482

kevmo314 opened this issue Aug 16, 2022 · 32 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@kevmo314
Copy link

kevmo314 commented Aug 16, 2022

What version of Go are you using (go version)?

% go version
go version go1.19 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
% go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/kevin/Library/Caches/go-build"
GOENV="/Users/kevin/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/kevin/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/kevin/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.19"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/9s/xwtpw2qs21163sxc3_s54_cw0000gn/T/go-build1102081114=/tmp/go-build -gno-record-gcc-switches -fno-common"
% sw_vers
ProductName:            macOS
ProductVersion:         13.0
BuildVersion:           22A5321d

What did you do?

cpoc.go

package main

// #include "cpoc.h"
import "C"
import (
	"fmt"
)

//export goLogger
func goLogger() {
	fmt.Println("goLogger")
}

func main() {
	C.cLogger()
}

cpoc.c

#include "cpoc.h"

void cLogger(void)
{
    printf("cLogger\n");
    goLogger();
}

cpoc.h

#include <stdlib.h>
#include <stdio.h>

extern void goLogger(void);

void cLogger(void);

What did you expect to see?

Correctly compiled cgo binary.

What did you see instead?

% go run cpoc.go 
# command-line-arguments
/usr/local/go/pkg/tool/darwin_amd64/link: running clang failed: exit status 1
ld: warning: -no_pie is deprecated when targeting new OS versions
ld: warning: non-standard -pagezero_size is deprecated when targeting macOS 13.0 or later
Undefined symbols for architecture x86_64:
  "_cLogger", referenced from:
      __cgo_267e1da4216b_Cfunc_cLogger in 000001.o
     (maybe you meant: __cgo_267e1da4216b_Cfunc_cLogger)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I'm guessing this is due to the beta-ness of the OS. Happy to provide more debug info to get this working.

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Aug 16, 2022
@mknyszek mknyszek added this to the Go1.20 milestone Aug 17, 2022
@cherrymui
Copy link
Member

What version of the C linker are you using? I.e. the output of ld -v. Thanks.

@kevmo314
Copy link
Author

% ld -v
@(#)PROGRAM:ld  PROJECT:ld64-819.6
BUILD 15:07:11 Aug  3 2022
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 14.0.0, (clang-1400.0.29.102) (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 14.0.0 (tapi-1400.0.11)

@maraino
Copy link

maraino commented Aug 25, 2022

Installing Xcode-beta on macOS 12, you get the first error, but the build succeeds:

$ go build main.go
# command-line-arguments
ld: warning: -no_pie is deprecated when targeting new OS versions
$ ld -v
@(#)PROGRAM:ld  PROJECT:ld64-819.1.2
BUILD 18:34:18 Jun 30 2022
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 14.0.0, (clang-1400.0.28.1) (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 14.0.0 (tapi-1400.0.11)

@ping-localhost
Copy link

ping-localhost commented Sep 13, 2022

I am running into the same issue, with the addition that it causes GoLand to fail my tests.

$ go version
go version go1.19.1 darwin/amd64
$ ld -v

@(#)PROGRAM:ld  PROJECT:ld64-819.6
BUILD 14:58:37 Aug  5 2022
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 14.0.0, (clang-1400.0.29.102) (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 14.0.0 (tapi-1400.0.11)

image

@k-yang
Copy link

k-yang commented Sep 13, 2022

I'm having this issue too. Seems like it started happening after installing XCode 14.

go version

go version go1.19.1 darwin/amd64
ld -v

@(#)PROGRAM:ld  PROJECT:ld64-819.6
BUILD 14:58:37 Aug  5 2022
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 14.0.0, (clang-1400.0.29.102) (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 14.0.0 (tapi-1400.0.11)

MacOS 12.5 (21G72)

@duvis-alejandro
Copy link

duvis-alejandro commented Sep 13, 2022

Tengo el mismo problema, mis configuraciones son las siguientes:

MacOs version 12.6

go version
go version go1.18 darwin/amd64

ld -v
@(#)PROGRAM:ld PROJECT:ld64-819.6 BUILD 14:58:37 Aug 5 2022 configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em LTO support using: LLVM version 14.0.0, (clang-1400.0.29.102) (static support for 29, runtime is 29) TAPI support using: Apple TAPI version 14.0.0 (tapi-1400.0.11)

Mensaje de error obtenido:
/usr/local/go/bin/go test -json -race ./...
ld: warning: -no_pie is deprecated when targeting new OS versions

@MitchStephan
Copy link

MitchStephan commented Sep 13, 2022

Same problem after installing mac updates today :(

go version                    
go version go1.18 darwin/amd64
ld -v
@(#)PROGRAM:ld  PROJECT:ld64-764
BUILD 11:22:50 Apr 28 2022
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 13.1.6, (clang-1316.0.21.2.5) (static support for 28, runtime is 28)
TAPI support using: Apple TAPI version 13.1.6 (tapi-1316.0.7.3)
sw_vers
ProductName:    macOS
ProductVersion: 12.6
BuildVersion:   21G115

@cherrymui
Copy link
Member

For anyone who see the "same problem", are you seeing the Undefined symbols error, or just the warning about -no_pie etc.? I think they are separate issues.

I can reproduce the warning, but I have never been able to reproduce the error.

The warnings are not errors. The build should still succeed, generate a binary that should run fine. (We still want to address that. But it doesn't block you from building your code.)

Thanks.

@MitchStephan
Copy link

Hi! Thanks for the reply.

I was referring to ld: warning: -no_pie is deprecated when targeting new OS versions. The warning also causes go tests to fail when run via Intellij/GoLand as @ping-localhost also mentioned.

@cherrymui
Copy link
Member

@MitchStephan thanks! Yeah, although it is just a warning we still want to address it. It is also affects tests in the Go distribution.

@kevmo314
Copy link
Author

@cherrymui any debug info I can help with? I'm still seeing the error which prevents the listed code snippet from running

@duvis-alejandro
Copy link

I don't know if this can help, however, after upgrading to MacOs Monterrey 12.6 I started getting the warning message
ld: warning: -no_pie is deprecated when targeting new OS versions

In itself this shouldn't be a problem, when I run a test for a single file it shows the warning but runs the tests normally, just as I would expect.
SuccessTest

However, when I try to run all the tests of the application, the warning message is taken as an error, the command used is the following:
/usr/local/go/bin/go test -json -race ./...

And the result obtained is:
Failed test

@gopherbot
Copy link

Change https://go.dev/cl/430936 mentions this issue: cmd/link: stop passing -pagezero_size to darwin linker

@cherrymui
Copy link
Member

@duvis-alejandro

Does the go test command make it an error, or the IDE? Could you try running the same go test -json -race ./... command in a terminal and see if it passes (zero status)? For me the warning doesn't make it fail.

(To be clear, we still want to fix the warning. Just for better understanding. Thanks.)

@gopherbot
Copy link

Change https://go.dev/cl/430937 mentions this issue: cmd/link: suppress -no_pie deprecation warning on darwin

@krohmag
Copy link

krohmag commented Sep 15, 2022

@duvis-alejandro

Does the go test command make it an error, or the IDE? Could you try running the same go test -json -race ./... command in a terminal and see if it passes (zero status)? For me the warning doesn't make it fail.

(To be clear, we still want to fix the warning. Just for better understanding. Thanks.)

If I run tests outside of my IDE, I still get the warning, but I do not get the fail. I only get the fail on bulk test runs within the scope of my IDE, making me think it's a configuration issue in the IDE and not go that's failing the test runs.

gopherbot pushed a commit that referenced this issue Sep 15, 2022
We added -pagezero_size in CL 72730, where it was intented for iOS.
The current code passes it only on macOS/AMD64 instead. It is not
really necessary there. Also, the new darwin linker starts to emit
a warning about deprecation of the flag. Stop passing it.

For #54482.

Change-Id: If9db7a1645c37d4284e48f075856912df8d8c1a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/430936
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
@duvis-alejandro
Copy link

@krohmag
When I run the tests from the terminal I get the following:
Executed command test

Same warning message as in IDE, and no evidence of test execution either.

gopherbot pushed a commit that referenced this issue Sep 16, 2022
Apparently the new darwin linker starts to emit a warning about
-no_pie deprecation. Maybe we want to switch to PIE by default.
For now, suppress the warning. This also makes it easier for
backporting to previous releases.

For #54482.

Change-Id: I1a3b74c237a9d00ec3b030fc3a9940a31e5cd37e
Reviewed-on: https://go-review.googlesource.com/c/go/+/430937
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
@cherrymui
Copy link
Member

With the two CLs above submitted it should no longer emit the warnings. I'll work on backport the fix to 1.18 and 1.19 releases. Thanks.

@gopherbot
Copy link

Change https://go.dev/cl/431515 mentions this issue: [release-branch.go1.19] cmd/link: stop passing -pagezero_size to darwin linker

@gopherbot
Copy link

Change https://go.dev/cl/431516 mentions this issue: [release-branch.go1.18] cmd/link: stop passing -pagezero_size to darwin linker

@gopherbot
Copy link

Change https://go.dev/cl/431517 mentions this issue: [release-branch.go1.19] cmd/link: suppress -no_pie deprecation warning on darwin

@gopherbot
Copy link

Change https://go.dev/cl/431518 mentions this issue: [release-branch.go1.18] cmd/link: suppress -no_pie deprecation warning on darwin

@cherrymui
Copy link
Member

@kevmo314 could you try updating Xcode? Also run go clean -cache to make sure we start from a clean state. If you still see the errors, could you provide the C compiler and linker version (clang -v, ld- v) (after update)?

@kevmo314
Copy link
Author

Sure, I updated to Xcode 14 (not beta) and am still seeing the error

kevin@MugitBook cpoc % go clean -cache
kevin@MugitBook cpoc % go run cpoc.go
# command-line-arguments
/usr/local/go/pkg/tool/darwin_amd64/link: running clang failed: exit status 1
ld: warning: -no_pie is deprecated when targeting new OS versions
ld: warning: non-standard -pagezero_size is deprecated when targeting macOS 13.0 or later
Undefined symbols for architecture x86_64:
  "_cLogger", referenced from:
      __cgo_d51494f6b2b9_Cfunc_cLogger in 000001.o
     (maybe you meant: __cgo_d51494f6b2b9_Cfunc_cLogger)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

kevin@MugitBook cpoc % clang -v
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: x86_64-apple-darwin22.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
kevin@MugitBook cpoc % ld -v
@(#)PROGRAM:ld  PROJECT:ld64-819.6
BUILD 14:58:37 Aug  5 2022
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 14.0.0, (clang-1400.0.29.102) (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 14.0.0 (tapi-1400.0.11)

@cherrymui
Copy link
Member

go run cpoc.go

With this command the go command only sees cpoc.go file, not the cpoc.c file. You'll need to put your go, c, and h files in a directory and use go run .. You'll need to create a go.mod file in that directory if not already (go mod init <whatever>).

@cherrymui cherrymui added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Sep 16, 2022
@kevmo314
Copy link
Author

go run cpoc.go

With this command the go command only sees cpoc.go file, not the cpoc.c file. You'll need to put your go, c, and h files in a directory and use go run .. You'll need to create a go.mod file in that directory if not already (go mod init <whatever>).

Ohhhhh okay that solved it. That was somewhat unexpected, thanks!

@duvis-alejandro
Copy link

duvis-alejandro commented Sep 19, 2022

Con las dos CL anteriores enviadas, ya no debería emitir las advertencias. Trabajaré en la adaptación de la corrección a las versiones 1.18 y 1.19. Gracias.

Excuse me @cherrymui, what should I do to prevent the warnings from appearing?
I have tried to reinstall go v1.18 but I get the same message

@cherrymui
Copy link
Member

Excuse me, what should I do to prevent the warnings from appearing?

There are a few options:

  • wait for the next Go 1.19.x and 1.18.x releases, probably early next month
  • build Go from the master branch
  • pass -buildmode=pie flag to go build and go test for a workaround
  • use older version of the system linker

@mojotx
Copy link

mojotx commented Sep 19, 2022

FWIW, I see this warning when building Go from the branch release-branch.go1.19 on macOS Monterey 12.6, with the Xcode 14 command-line tools installed. The warning causes some of the stdio tests to fail.

$ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables
package-id: com.apple.pkg.CLTools_Executables
version: 14.0.0.0.1.1661618636
volume: /
location: /
install-time: 1663186173
groups: com.apple.FindSystemFiles.pkg-group
$ ld -v
@(#)PROGRAM:ld  PROJECT:ld64-819.6
BUILD 14:58:37 Aug  5 2022
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
LTO support using: LLVM version 14.0.0, (clang-1400.0.29.102) (static support for 29, runtime is 29)
TAPI support using: Apple TAPI version 14.0.0 (tapi-1400.0.11)
$ sw_vers
ProductName:	macOS
ProductVersion:	12.6
BuildVersion:	21G115
##### ../misc/cgo/stdio
--- FAIL: TestTestRun (3.15s)
    stdio_test.go:60: go run /usr/local/go/test/run.go - .: exit status 1
        # go run run.go -- chain.go
        output does not match expected in chain.out. Instead saw
        # command-line-arguments
        ld: warning: -no_pie is deprecated when targeting new OS versions
        0
        1
        2
        3
        4
        5
        6
        7
        8
        9
        10
        0
        1
        2
        3
        4
        5
        6
        7
        8
        9
        10
        0
        1
        2
        3
        4
        5
        6
        7
        8
        9
        10
        0
        1
        2
        3
        4
        5
        6
        7
        8
        9
        10
        0
        1
        2
        3
        4
        5
        6
        7
        8
        9
        10

        FAIL	chain.go	2.347s
        # go run run.go -- fib.go
        output does not match expected in fib.out. Instead saw
        # command-line-arguments
        ld: warning: -no_pie is deprecated when targeting new OS versions
        0
        1
        1
        2
        3
        5
        8
        13
        21
        34
        55
        89
        144
        233
        377
        610
        987
        1597
        2584
        4181
        6765
        10946
        17711
        28657
        46368
        75025
        121393
        196418
        317811
        514229
        832040
        1346269
        2178309
        3524578
        5702887
        9227465
        14930352
        24157817
        39088169
        63245986
        102334155
        165580141
        267914296
        433494437
        701408733
        1134903170
        1836311903
        2971215073
        4807526976
        7778742049
        12586269025
        20365011074
        32951280099
        53316291173
        86267571272
        139583862445
        225851433717
        365435296162
        591286729879
        956722026041
        1548008755920
        2504730781961
        4052739537881
        6557470319842
        10610209857723
        17167680177565
        27777890035288
        44945570212853
        72723460248141
        117669030460994
        190392490709135
        308061521170129
        498454011879264
        806515533049393
        1304969544928657
        2111485077978050
        3416454622906707
        5527939700884757
        8944394323791464
        14472334024676221
        23416728348467685
        37889062373143906
        61305790721611591
        99194853094755497
        160500643816367088
        259695496911122585
        420196140727489673
        679891637638612258
        1100087778366101931
        1779979416004714189
        2880067194370816120

        FAIL	fib.go	2.237s
        # go run run.go -- hello.go
        output does not match expected in hello.out. Instead saw
        # command-line-arguments
        ld: warning: -no_pie is deprecated when targeting new OS versions
        hello, world

        FAIL	hello.go	2.124s
        exit status 1
FAIL
go tool dist: Failed: exit status 1

gopherbot pushed a commit that referenced this issue Sep 21, 2022
…in linker

We added -pagezero_size in CL 72730, where it was intented for iOS.
The current code passes it only on macOS/AMD64 instead. It is not
really necessary there. Also, the new darwin linker starts to emit
a warning about deprecation of the flag. Stop passing it.

For #55113
Updates #54482, #55112.

Change-Id: If9db7a1645c37d4284e48f075856912df8d8c1a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/430936
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
(cherry picked from commit 5231ba2)
Reviewed-on: https://go-review.googlesource.com/c/go/+/431516
Reviewed-by: Austin Clements <austin@google.com>
gopherbot pushed a commit that referenced this issue Sep 21, 2022
…in linker

We added -pagezero_size in CL 72730, where it was intented for iOS.
The current code passes it only on macOS/AMD64 instead. It is not
really necessary there. Also, the new darwin linker starts to emit
a warning about deprecation of the flag. Stop passing it.

For #55114.
Updates #55112, #54482.

Change-Id: If9db7a1645c37d4284e48f075856912df8d8c1a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/430936
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
(cherry picked from commit 5231ba2)
Reviewed-on: https://go-review.googlesource.com/c/go/+/431515
Reviewed-by: Austin Clements <austin@google.com>
gopherbot pushed a commit that referenced this issue Sep 21, 2022
…g on darwin

Apparently the new darwin linker starts to emit a warning about
-no_pie deprecation. Maybe we want to switch to PIE by default.
For now, suppress the warning. This also makes it easier for
backporting to previous releases.

Fixes #55114.
Updates #55112, #54482.

Change-Id: I1a3b74c237a9d00ec3b030fc3a9940a31e5cd37e
Reviewed-on: https://go-review.googlesource.com/c/go/+/430937
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 706d84f)
Reviewed-on: https://go-review.googlesource.com/c/go/+/431517
gopherbot pushed a commit that referenced this issue Sep 21, 2022
…g on darwin

Apparently the new darwin linker starts to emit a warning about
-no_pie deprecation. Maybe we want to switch to PIE by default.
For now, suppress the warning. This also makes it easier for
backporting to previous releases.

Fixes #55113.
Updates #55112, #54482.

Change-Id: I1a3b74c237a9d00ec3b030fc3a9940a31e5cd37e
Reviewed-on: https://go-review.googlesource.com/c/go/+/430937
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 706d84f)
Reviewed-on: https://go-review.googlesource.com/c/go/+/431518
Reviewed-by: Austin Clements <austin@google.com>
@huanghy6268
Copy link

huanghy6268 commented Sep 26, 2022

Excuse me @cherrymui, if I need to use -race flag as well in the command go test like this go test -buildmode=pie -race, is will tigger another error:

-buildmode=pie not supported when -race is enabled

have any suggestion to solve this conflict if I want prevent the warnings and pass -race?

bradfitz pushed a commit to tailscale/go that referenced this issue Oct 5, 2022
…in linker

We added -pagezero_size in CL 72730, where it was intented for iOS.
The current code passes it only on macOS/AMD64 instead. It is not
really necessary there. Also, the new darwin linker starts to emit
a warning about deprecation of the flag. Stop passing it.

For golang#55114.
Updates golang#55112, golang#54482.

Change-Id: If9db7a1645c37d4284e48f075856912df8d8c1a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/430936
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
(cherry picked from commit 5231ba2)
Reviewed-on: https://go-review.googlesource.com/c/go/+/431515
Reviewed-by: Austin Clements <austin@google.com>
bradfitz pushed a commit to tailscale/go that referenced this issue Oct 5, 2022
…g on darwin

Apparently the new darwin linker starts to emit a warning about
-no_pie deprecation. Maybe we want to switch to PIE by default.
For now, suppress the warning. This also makes it easier for
backporting to previous releases.

Fixes golang#55114.
Updates golang#55112, golang#54482.

Change-Id: I1a3b74c237a9d00ec3b030fc3a9940a31e5cd37e
Reviewed-on: https://go-review.googlesource.com/c/go/+/430937
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 706d84f)
Reviewed-on: https://go-review.googlesource.com/c/go/+/431517
bradfitz pushed a commit to tailscale/go that referenced this issue Oct 5, 2022
…in linker

We added -pagezero_size in CL 72730, where it was intented for iOS.
The current code passes it only on macOS/AMD64 instead. It is not
really necessary there. Also, the new darwin linker starts to emit
a warning about deprecation of the flag. Stop passing it.

For golang#55114.
Updates golang#55112, golang#54482.

Change-Id: If9db7a1645c37d4284e48f075856912df8d8c1a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/430936
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
(cherry picked from commit 5231ba2)
Reviewed-on: https://go-review.googlesource.com/c/go/+/431515
Reviewed-by: Austin Clements <austin@google.com>
bradfitz pushed a commit to tailscale/go that referenced this issue Oct 5, 2022
…g on darwin

Apparently the new darwin linker starts to emit a warning about
-no_pie deprecation. Maybe we want to switch to PIE by default.
For now, suppress the warning. This also makes it easier for
backporting to previous releases.

Fixes golang#55114.
Updates golang#55112, golang#54482.

Change-Id: I1a3b74c237a9d00ec3b030fc3a9940a31e5cd37e
Reviewed-on: https://go-review.googlesource.com/c/go/+/430937
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 706d84f)
Reviewed-on: https://go-review.googlesource.com/c/go/+/431517
bradfitz pushed a commit to tailscale/go that referenced this issue Oct 5, 2022
…in linker

We added -pagezero_size in CL 72730, where it was intented for iOS.
The current code passes it only on macOS/AMD64 instead. It is not
really necessary there. Also, the new darwin linker starts to emit
a warning about deprecation of the flag. Stop passing it.

For golang#55114.
Updates golang#55112, golang#54482.

Change-Id: If9db7a1645c37d4284e48f075856912df8d8c1a0
Reviewed-on: https://go-review.googlesource.com/c/go/+/430936
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
(cherry picked from commit 5231ba2)
Reviewed-on: https://go-review.googlesource.com/c/go/+/431515
Reviewed-by: Austin Clements <austin@google.com>
bradfitz pushed a commit to tailscale/go that referenced this issue Oct 5, 2022
…g on darwin

Apparently the new darwin linker starts to emit a warning about
-no_pie deprecation. Maybe we want to switch to PIE by default.
For now, suppress the warning. This also makes it easier for
backporting to previous releases.

Fixes golang#55114.
Updates golang#55112, golang#54482.

Change-Id: I1a3b74c237a9d00ec3b030fc3a9940a31e5cd37e
Reviewed-on: https://go-review.googlesource.com/c/go/+/430937
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
(cherry picked from commit 706d84f)
Reviewed-on: https://go-review.googlesource.com/c/go/+/431517
@Deleplace
Copy link
Contributor

I upgraded from go1.19 darwin/amd64 to go1.19.3 darwin/arm64 and this solved the problem for me. Thank you

@gopherbot
Copy link

Change https://go.dev/cl/461697 mentions this issue: cmd/go: default to PIE linking on darwin/amd64

gopherbot pushed a commit that referenced this issue Aug 4, 2023
The recent version of darwin linker ld64 emits an warning about
deprecation of the -no_pie flag. Further, the new darwin linker
ld-prime ignores -no_pie flag and generates a PIE binary anyway.
Switch to building PIE binaries by default.

Updates #54482.
Updates #61229.

Change-Id: I81294dcd07a368a20e1349d56556ee2fdcb8df44
Reviewed-on: https://go-review.googlesource.com/c/go/+/461697
Run-TryBot: Cherry Mui <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

14 participants