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/go: build for armv7s with -buildmode=c-archive #35050

Open
nathan-fiscaletti opened this issue Oct 21, 2019 · 2 comments

Comments

@nathan-fiscaletti
Copy link

@nathan-fiscaletti nathan-fiscaletti commented Oct 21, 2019

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

$ go version
go version go1.13.3 darwin/amd64

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

go env Output
$ go env
GO111MODULE=""
GOARCH="arm"
GOBIN=""
GOCACHE="/Users/vagrant/Library/Caches/go-build"
GOENV="/Users/vagrant/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/usr/local/go/go_packages"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
GOARM="7"
AR="/Library/Developer/CommandLineTools/usr/bin/ar"
CC="/Library/Developer/CommandLineTools/usr/bin/clang"
CXX="/Library/Developer/CommandLineTools/usr/bin/clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk -miphoneos-version-min=10.0"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-arch armv7s -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.4.sdk -miphoneos-version-min=10.0"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -marm -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/k6/wch_wxzx43z04wmzdf61znqr0000gn/T/go-build140873070=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Tried to build using the above environment configuration and the result was an archive that was both armv7 and armv7s.

nm libvcb.a | grep armv7
libvcb.a(go.o) (for architecture armv7):
libvcb.a(000000.o) (for architecture armv7s):
libvcb.a(000001.o) (for architecture armv7s):
libvcb.a(000002.o) (for architecture armv7s):
libvcb.a(000003.o) (for architecture armv7s):
libvcb.a(000004.o) (for architecture armv7s):
libvcb.a(000005.o) (for architecture armv7s):
libvcb.a(000006.o) (for architecture armv7s):
libvcb.a(000007.o) (for architecture armv7s):
libvcb.a(000008.o) (for architecture armv7s):
libvcb.a(000009.o) (for architecture armv7s):
libvcb.a(000010.o) (for architecture armv7s):
libvcb.a(000011.o) (for architecture armv7s):
libvcb.a(000012.o) (for architecture armv7s):
libvcb.a(000013.o) (for architecture armv7s):
libvcb.a(000014.o) (for architecture armv7s):
libvcb.a(000015.o) (for architecture armv7s):
libvcb.a(000016.o) (for architecture armv7s):
libvcb.a(000017.o) (for architecture armv7s):
libvcb.a(000018.o) (for architecture armv7s):
libvcb.a(000019.o) (for architecture armv7s):
libvcb.a(000020.o) (for architecture armv7s):
libvcb.a(000021.o) (for architecture armv7s):
libvcb.a(000022.o) (for architecture armv7s):
libvcb.a(000023.o) (for architecture armv7s):
libvcb.a(000024.o) (for architecture armv7s):

What did you expect to see?

A fully armv7s archive file.

What did you see instead?

An armv7s archive file that was both armv7 and armv7s.

I don't see an option for GOARM that is 7s, but that's essentially what i'm looking for.

Related issue that was closed without a response: #14691

@dmitshur

This comment has been minimized.

Copy link
Member

@dmitshur dmitshur commented Oct 22, 2019

I'm not very familiar with different ARM architectures. The cmd/go documentation at https://golang.org/cmd/go/#hdr-Environment_variables says that the only valid values for GOARM environment variable are 5, 6, and 7. 7s is not a supported value.

Documentation for build modes at https://golang.org/cmd/go/#hdr-Build_modes does not say anything ARM-specific about -buildmode=c-archive.

/cc @ianlancetaylor @eliasnaur

@dmitshur dmitshur changed the title build for armv7s with -buildmode=c-archive cmd/go: build for armv7s with -buildmode=c-archive Oct 22, 2019
@nathan-fiscaletti

This comment has been minimized.

Copy link
Author

@nathan-fiscaletti nathan-fiscaletti commented Oct 22, 2019

armv7s is the slightly altered configuration of the armv7 architecture Apple introduced with the iPhone5 specifically for the Bionic A6 SoC. However, upon further investigation it seems that armv7 code runs on the A6, meaning you don't "need" the armv7s architecture.

I'm not sure if there are other use cases for armv7s, but for iOS it seems that it is not a requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.