-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: Darwin build fails with "unknown load command" #25908
Comments
@ianlancetaylor, okay for Go 1.11? |
Change https://golang.org/cl/119115 mentions this issue: |
@gopherbot please consider this for backport to 1.10, it's a regression |
Backport issue(s) opened: #25912 (for 1.10). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
@gopherbot please consider this for backport to 1.9, it's a regression |
@mistydemeo, regression from when? When did it last work? |
@bradfitz It's broken on upcoming Darwin releases, but works on current releases. |
Ah, gotcha. Thanks. I'm cool with both backports in that case. |
Thanks! 👍 Did I do something wrong wrt getting gopherbot to trigger the 1.9 backport? |
/cc @andybons, @FiloSottile for gopherbot cherry-pick question. @mistydemeo, feel free to file a manual cherry-pick bug like a caveperson in the meantime if you'd like. |
It's not you :) the bot doesn't notice commands after the first, it's tracked at #25574. (You can ask for 1.10 and 1.9 in a single message though.) |
Filed #25915 for cherry-pick to 1.9. |
Thanks for opening that! I'm running into an issue pushing the change. This one can't be cherry-picked via Gerrit, since the lines in question moved between 1.9 and 1.10. I have a local patch, and I've followed the instructions here through to the final step. However, it's failing with this message:
It's true that that review is closed, but that's the one that this is backporting. Did I do something wrong with my commit message? This is what I have: From 4002698146b99540f2abc00df91e87826eccd08d Mon Sep 17 00:00:00 2001
From: Misty De Meo <[email protected]>
Date: Fri, 15 Jun 2018 11:25:57 -0700
Subject: [PATCH] [release-branch.go1.9] ld/macho: add all missing load
commands
The ld/macho code currently understands a subset of the mach-o load
commands. I've encountered one of these in the wild in a Go-produced
binary, which tripped up the Go linker because its switch statement
expects its list of load commands to be exhaustive; the rest I've
added for the sake of completion.
The ruby-macho library is a good non-Darwin header resource for these:
https://github.com/homebrew/ruby-macho
Fixes #25915
Change-Id: Ib54c065d27e87d8726a9870df05a2bae24828b98
GitHub-Last-Rev: 655e3f4
GitHub-Pull-Request: golang/go#25906
Reviewed-on: https://go-review.googlesource.com/119115
Reviewed-by: Ian Lance Taylor <[email protected]>
---
.../link/internal/ld/macho_combine_dwarf.go | 73 +++++++++++++------
1 file changed, 52 insertions(+), 21 deletions(-)
diff --git a/src/cmd/link/internal/ld/macho_combine_dwarf.go b/src/cmd/link/internal/ld/macho_combine_dwarf.go
index 8c6c4a86ac..515f798a9c 100644
--- a/src/cmd/link/internal/ld/macho_combine_dwarf.go
+++ b/src/cmd/link/internal/ld/macho_combine_dwarf.go
@@ -21,26 +21,57 @@ var dwarfaddr, linkaddr int64
var linkoffset uint32
const (
- LC_ID_DYLIB = 0xd
- LC_LOAD_DYLINKER = 0xe
- LC_PREBOUND_DYLIB = 0x10
- LC_LOAD_WEAK_DYLIB = 0x18
- LC_UUID = 0x1b
- LC_RPATH = 0x8000001c
- LC_CODE_SIGNATURE = 0x1d
- LC_SEGMENT_SPLIT_INFO = 0x1e
- LC_REEXPORT_DYLIB = 0x8000001f
- LC_ENCRYPTION_INFO = 0x21
- LC_DYLD_INFO = 0x22
- LC_DYLD_INFO_ONLY = 0x80000022
- LC_VERSION_MIN_MACOSX = 0x24
- LC_VERSION_MIN_IPHONEOS = 0x25
- LC_FUNCTION_STARTS = 0x26
- LC_MAIN = 0x80000028
- LC_DATA_IN_CODE = 0x29
- LC_SOURCE_VERSION = 0x2A
- LC_DYLIB_CODE_SIGN_DRS = 0x2B
- LC_ENCRYPTION_INFO_64 = 0x2C
+ LC_SEGMENT = 0x1
+ LC_SYMTAB = 0x2
+ LC_SYMSEG = 0x3
+ LC_THREAD = 0x4
+ LC_UNIXTHREAD = 0x5
+ LC_LOADFVMLIB = 0x6
+ LC_IDFVMLIB = 0x7
+ LC_IDENT = 0x8
+ LC_FVMFILE = 0x9
+ LC_PREPAGE = 0xa
+ LC_DYSYMTAB = 0xb
+ LC_LOAD_DYLIB = 0xc
+ LC_ID_DYLIB = 0xd
+ LC_LOAD_DYLINKER = 0xe
+ LC_ID_DYLINKER = 0xf
+ LC_PREBOUND_DYLIB = 0x10
+ LC_ROUTINES = 0x11
+ LC_SUB_FRAMEWORK = 0x12
+ LC_SUB_UMBRELLA = 0x13
+ LC_SUB_CLIENT = 0x14
+ LC_SUB_LIBRARY = 0x15
+ LC_TWOLEVEL_HINTS = 0x16
+ LC_PREBIND_CKSUM = 0x17
+ LC_LOAD_WEAK_DYLIB = 0x18
+ LC_SEGMENT_64 = 0x19
+ LC_ROUTINES_64 = 0x1a
+ LC_UUID = 0x1b
+ LC_RPATH = 0x8000001c
+ LC_CODE_SIGNATURE = 0x1d
+ LC_SEGMENT_SPLIT_INFO = 0x1e
+ LC_REEXPORT_DYLIB = 0x8000001f
+ LC_LAZY_LOAD_DYLIB = 0x20
+ LC_ENCRYPTION_INFO = 0x21
+ LC_DYLD_INFO = 0x22
+ LC_DYLD_INFO_ONLY = 0x80000022
+ LC_LOAD_UPWARD_DYLIB = 0x80000023
+ LC_VERSION_MIN_MACOSX = 0x24
+ LC_VERSION_MIN_IPHONEOS = 0x25
+ LC_FUNCTION_STARTS = 0x26
+ LC_DYLD_ENVIRONMENT = 0x27
+ LC_MAIN = 0x80000028
+ LC_DATA_IN_CODE = 0x29
+ LC_SOURCE_VERSION = 0x2A
+ LC_DYLIB_CODE_SIGN_DRS = 0x2B
+ LC_ENCRYPTION_INFO_64 = 0x2C
+ LC_LINKER_OPTION = 0x2D
+ LC_LINKER_OPTIMIZATION_HINT = 0x2E
+ LC_VERSION_MIN_TVOS = 0x2F
+ LC_VERSION_MIN_WATCHOS = 0x30
+ LC_VERSION_NOTE = 0x31
+ LC_BUILD_VERSION = 0x32
pageAlign = 12 // 4096 = 1 << 12
)
@@ -242,7 +273,7 @@ func machoCombineDwarf(inexe, dsym, outexe string) error {
err = machoUpdateLoadCommand(reader, &linkEditDataCmd{}, "DataOff")
case LC_ENCRYPTION_INFO, LC_ENCRYPTION_INFO_64:
err = machoUpdateLoadCommand(reader, &encryptionInfoCmd{}, "CryptOff")
- case macho.LoadCmdDylib, macho.LoadCmdThread, macho.LoadCmdUnixThread, LC_PREBOUND_DYLIB, LC_UUID, LC_VERSION_MIN_MACOSX, LC_VERSION_MIN_IPHONEOS, LC_SOURCE_VERSION, LC_MAIN, LC_LOAD_DYLINKER, LC_LOAD_WEAK_DYLIB, LC_REEXPORT_DYLIB, LC_RPATH, LC_ID_DYLIB:
+ case macho.LoadCmdDylib, macho.LoadCmdThread, macho.LoadCmdUnixThread, LC_PREBOUND_DYLIB, LC_UUID, LC_VERSION_MIN_MACOSX, LC_VERSION_MIN_IPHONEOS, LC_SOURCE_VERSION, LC_MAIN, LC_LOAD_DYLINKER, LC_LOAD_WEAK_DYLIB, LC_REEXPORT_DYLIB, LC_RPATH, LC_ID_DYLIB, LC_SYMSEG, LC_LOADFVMLIB, LC_IDFVMLIB, LC_IDENT, LC_FVMFILE, LC_PREPAGE, LC_ID_DYLINKER, LC_ROUTINES, LC_SUB_FRAMEWORK, LC_SUB_UMBRELLA, LC_SUB_CLIENT, LC_SUB_LIBRARY, LC_TWOLEVEL_HINTS, LC_PREBIND_CKSUM, LC_ROUTINES_64, LC_LAZY_LOAD_DYLIB, LC_LOAD_UPWARD_DYLIB, LC_DYLD_ENVIRONMENT, LC_LINKER_OPTION, LC_LINKER_OPTIMIZATION_HINT, LC_VERSION_MIN_TVOS, LC_VERSION_MIN_WATCHOS, LC_VERSION_NOTE, LC_BUILD_VERSION:
// Nothing to update
default:
err = fmt.Errorf("Unknown load command 0x%x (%s)\n", int(cmd.Cmd), cmd.Cmd)
--
2.17.1 |
@mistydemeo It's complaining because you are submitting the change to branch master. The critical step in the instructions is |
Thank you! I could have sworn I'd done that, but it seems to have worked the second try. |
What was the solution?
|
@Unc7e The PRs mentioned earlier were the fixes. It's been fixed in the 1.11 and 1.10 branches, but hasn't yet made it into a stable release of Go. |
@mistydemeo 1.10 is a stable release of Go. |
This commit implements the initial support for docker-worker payloads. So far, only the Image, Command, Env and MaxRunTime fields are supported. It hasn't been extensive tested so features like task cancellation may not work. Also, it doesn't implement custom artifacts and more extensive tests. The support for docker-worker payloads is achieved through build flags. To build with docker-worker paylod, build it with the "docker" flag, like so: $ go build -tags=docker Notice that generic-worker will not be supported in this build. We also needed to upgrade golang due to a bug in the go compiler [1]. [1] golang/go#25908
This commit implements the initial support for docker-worker payloads. So far, only the Image, Command, Env and MaxRunTime fields are supported. It hasn't been extensive tested so features like task cancellation may not work. Also, it doesn't implement custom artifacts and more extensive tests. The support for docker-worker payloads is achieved through build flags. To build with docker-worker paylod, build it with the "docker" flag, like so: $ go build -tags=docker Notice that generic-worker will not be supported in this build. We also needed to upgrade golang due to a bug in the go compiler [1]. [1] golang/go#25908
This commit implements the initial support for docker-worker payloads. So far, only the Image, Command, Env and MaxRunTime fields are supported. It hasn't been extensive tested so features like task cancellation may not work. Also, it doesn't implement custom artifacts and more extensive tests. The support for docker-worker payloads is achieved through build flags. To build with docker-worker paylod, build it with the "docker" flag, like so: $ go build -tags=docker Notice that generic-worker will not be supported in this build. We also needed to upgrade golang due to a bug in the go compiler [1]. [1] golang/go#25908
This commit implements the initial support for docker-worker payloads. So far, only the Image, Command, Env and MaxRunTime fields are supported. It hasn't been extensive tested so features like task cancellation may not work. Also, it doesn't implement custom artifacts and more extensive tests. The support for docker-worker payloads is achieved through build flags. To build with docker-worker paylod, build it with the "docker" flag, like so: $ go build -tags=docker Notice that generic-worker will not be supported in this build. We also needed to upgrade golang due to a bug in the go compiler [1]. [1] golang/go#25908
This commit implements the initial support for docker-worker payloads. So far, only the Image, Command, Env and MaxRunTime fields are supported. It hasn't been extensive tested so features like task cancellation may not work. Also, it doesn't implement custom artifacts and more extensive tests. The support for docker-worker payloads is achieved through build flags. To build with docker-worker paylod, build it with the "docker" flag, like so: $ go build -tags=docker Notice that generic-worker will not be supported in this build. We also needed to upgrade golang due to a bug in the go compiler [1]. [1] golang/go#25908
This commit implements the initial support for docker-worker payloads. So far, only the Image, Command, Env and MaxRunTime fields are supported. It hasn't been extensive tested so features like task cancellation may not work. Also, it doesn't implement custom artifacts and more extensive tests. The support for docker-worker payloads is achieved through build flags. To build with docker-worker paylod, build it with the "docker" flag, like so: $ go build -tags=docker Notice that generic-worker will not be supported in this build. We also needed to upgrade golang due to a bug in the go compiler [1]. [1] golang/go#25908
This commit implements the initial support for docker-worker payloads. So far, only the Image, Command, Env and MaxRunTime fields are supported. It hasn't been extensive tested so features like task cancellation may not work. Also, it doesn't implement custom artifacts and more extensive tests. The support for docker-worker payloads is achieved through build flags. To build with docker-worker paylod, build it with the "docker" flag, like so: $ go build -tags=docker Notice that generic-worker will not be supported in this build. We also needed to upgrade golang due to a bug in the go compiler [1]. [1] golang/go#25908
This commit implements the initial support for docker-worker payloads. So far, only the Image, Command, Env and MaxRunTime fields are supported. It hasn't been extensive tested so features like task cancellation may not work. Also, it doesn't implement custom artifacts and more extensive tests. The support for docker-worker payloads is achieved through build flags. To build with docker-worker paylod, build it with the "docker" flag, like so: $ go build -tags=docker Notice that generic-worker will not be supported in this build. We also needed to upgrade golang due to a bug in the go compiler [1]. [1] golang/go#25908
This commit implements the initial support for docker-worker payloads. So far, only the Image, Command, Env and MaxRunTime fields are supported. It hasn't been extensive tested so features like task cancellation may not work. Also, it doesn't implement custom artifacts and more extensive tests. The support for docker-worker payloads is achieved through build flags. To build with docker-worker paylod, build it with the "docker" flag, like so: $ go build -tags=docker Notice that generic-worker will not be supported in this build. We also needed to upgrade golang due to a bug in the go compiler [1]. [1] golang/go#25908
This commit implements the initial support for docker-worker payloads. So far, only the Image, Command, Env and MaxRunTime fields are supported. It hasn't been extensive tested so features like task cancellation may not work. Also, it doesn't implement custom artifacts and more extensive tests. The support for docker-worker payloads is achieved through build flags. To build with docker-worker paylod, build it with the "docker" flag, like so: $ go build -tags=docker Notice that generic-worker will not be supported in this build. We also needed to upgrade golang due to a bug in the go compiler [1]. [1] golang/go#25908
This commit implements the initial support for docker-worker payloads. So far, only the Image, Command, Env and MaxRunTime fields are supported. It hasn't been extensive tested so features like task cancellation may not work. Also, it doesn't implement custom artifacts and more extensive tests. The support for docker-worker payloads is achieved through build flags. To build with docker-worker paylod, build it with the "docker" flag, like so: $ go build -tags=docker Notice that generic-worker will not be supported in this build. We also needed to upgrade golang due to a bug in the go compiler [1]. [1] golang/go#25908
This commit implements the initial support for docker-worker payloads. So far, only the Image, Command, Env and MaxRunTime fields are supported. It hasn't been extensive tested so features like task cancellation may not work. Also, it doesn't implement custom artifacts and more extensive tests. The support for docker-worker payloads is achieved through build flags. To build with docker-worker paylod, build it with the "docker" flag, like so: $ go build -tags=docker Notice that generic-worker will not be supported in this build. We also needed to upgrade golang due to a bug in the go compiler [1]. [1] golang/go#25908
This commit implements the initial support for docker-worker payloads. So far, only the Image, Command, Env and MaxRunTime fields are supported. It hasn't been extensive tested so features like task cancellation may not work. Also, it doesn't implement custom artifacts and more extensive tests. The support for docker-worker payloads is achieved through build flags. To build with docker-worker paylod, build it with the "docker" flag, like so: $ go build -tags=docker Notice that generic-worker will not be supported in this build. We also needed to upgrade golang due to a bug in the go compiler [1]. [1] golang/go#25908
This commit implements the initial support for docker-worker payloads. So far, only the Image, Command, Env and MaxRunTime fields are supported. It hasn't been extensive tested so features like task cancellation may not work. Also, it doesn't implement custom artifacts and more extensive tests. The support for docker-worker payloads is achieved through build flags. To build with docker-worker paylod, build it with the "docker" flag, like so: $ go build -tags=docker Notice that generic-worker will not be supported in this build. We also needed to upgrade golang due to a bug in the go compiler [1]. [1] golang/go#25908
This commit implements the initial support for docker-worker payloads. So far, only the Image, Command, Env and MaxRunTime fields are supported. It hasn't been extensive tested so features like task cancellation may not work. Also, it doesn't implement custom artifacts and more extensive tests. The support for docker-worker payloads is achieved through build flags. To build with docker-worker paylod, build it with the "docker" flag, like so: $ go build -tags=docker Notice that generic-worker will not be supported in this build. We also needed to upgrade golang due to a bug in the go compiler [1]. [1] golang/go#25908
This commit implements the initial support for docker-worker payloads. So far, only the Image, Command, Env and MaxRunTime fields are supported. It hasn't been extensive tested so features like task cancellation may not work. Also, it doesn't implement custom artifacts and more extensive tests. The support for docker-worker payloads is achieved through build flags. To build with docker-worker paylod, build it with the "docker" flag, like so: $ go build -tags=docker Notice that generic-worker will not be supported in this build. We also needed to upgrade golang due to a bug in the go compiler [1]. [1] golang/go#25908
This commit implements the initial support for docker-worker payloads. So far, only the Image, Command, Env and MaxRunTime fields are supported. It hasn't been extensive tested so features like task cancellation may not work. Also, it doesn't implement custom artifacts and more extensive tests. The support for docker-worker payloads is achieved through build flags. To build with docker-worker paylod, build it with the "docker" flag, like so: $ go build -tags=docker Notice that generic-worker will not be supported in this build. We also needed to upgrade golang due to a bug in the go compiler [1]. [1] golang/go#25908
This commit implements the initial support for docker-worker payloads. So far, only the Image, Command, Env and MaxRunTime fields are supported. It hasn't been extensive tested so features like task cancellation may not work. Also, it doesn't implement custom artifacts and more extensive tests. The support for docker-worker payloads is achieved through build flags. To build with docker-worker paylod, build it with the "docker" flag, like so: $ go build -tags=docker Notice that generic-worker will not be supported in this build. We also needed to upgrade golang due to a bug in the go compiler [1]. [1] golang/go#25908
it's gone when i upgrade to go1.11.4. |
I am also meet this error in 1.10.3, upgrade to 1.11.x is fixed. |
What version of Go are you using (
go version
)?go version go1.10.3 darwin/amd64
Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?What did you do?
Attempted to build https://github.com/sstephenson/launch_socket_server, a Go program with libc linkage.
What did you expect to see?
Build succeeds.
What did you see instead?
Notes
This is fixed by #25906.
The text was updated successfully, but these errors were encountered: