You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CL 201358 removes most of the flags incompatible with -fembed-bitcode on iOS. However, -Wl,no_pie is left for darwin/arm because without it, linking fails:
ld: warning: PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic) not allowed in code signed PIE, but used in _runtime.rodata from /var/folders/qq/qxn86k813bn9fjxydm095rxw0000gp/T/workdir-host-darwin-amd64-zenly-ios/tmp/go-link-225285265/go.o. To fix this warning, don't compile with -mdynamic-no-pic or link with -Wl,-no_pie
thought we have removed absolute addressing on darwin/arm. Maybe we only did this for normal symbols but we missed runtime.rodata (which is linker generated)? I could take a look. (but probably not so soon...)
@thanm also expressed interest in digging into this:
The "runtime.rodata" thing seems odd -- runtime.rodata is a linker generated symbol, but looking at the linker code it appears to just be a pseudo-symbol that incorporates all of the rodata for the program. I ran a couple of regular builds on Darwin/amd64 with -buildmode=pie and looked over the relocations in the Go object file, and I don't see anything suspicious (although I'm not sure if that says much).
The error above is a build time error so can readily be reproduced on macOS with the following change applied:
diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go
index d5868c9770..78f493ca9f 100644
--- a/src/cmd/link/internal/ld/lib.go
+++ b/src/cmd/link/internal/ld/lib.go
@@ -1206,7 +1206,7 @@ func (ctxt *Link) hostlink() {
switch ctxt.BuildMode {
case BuildModeExe:
if ctxt.HeadType == objabi.Hdarwin {
- if ctxt.Arch.Family != sys.ARM64 {
+ if !ctxt.Arch.InFamily(sys.ARM, sys.ARM64) {
argv = append(argv, "-Wl,-no_pie")
}
if !ctxt.Arch.InFamily(sys.ARM, sys.ARM64) {
The text was updated successfully, but these errors were encountered:
eliasnaur
changed the title
cmd/link: avoid bitcode incompatible flag -W,no_pie on darwin/arm
cmd/link: avoid bitcode incompatible flag -Wl,no_pie on darwin/arm
Oct 30, 2019
CL 201358 removes most of the flags incompatible with
-fembed-bitcode
on iOS. However,-Wl,no_pie
is left for darwin/arm because without it, linking fails:This error surprised @cherrymui who
@thanm also expressed interest in digging into this:
(from the golang-dev thread)
The error above is a build time error so can readily be reproduced on macOS with the following change applied:
The text was updated successfully, but these errors were encountered: