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

Go link tool need to find gcc on Arm platform #242

Merged
merged 1 commit into from
Jun 25, 2018

Conversation

lubinszARM
Copy link
Contributor

Signed-off-by: Bin Lu [email protected]

@lubinszARM
Copy link
Contributor Author

lubinszARM commented Jun 25, 2018

Hi all,
I added a workaround for go link on Arm platform.
On Arm platform, go link tool need some features of gcc to complete the job, but on x86 platform, go link tool does not need gcc.
So, I added the path for 'gcc' in the patch. If without this patch, google/gvisor will be compiled failed on Arm platform.
Please see my test log as more reference:

On Arm platform:

root@bin:/home/bblu/test# exec env - /bin/bash -c '/usr/local/go/bin/go tool link -s -v -o test test.a'
HEADER = -H4 -T0x11000 -D0x0 -R0x10000
searching for runtime.a in /usr/local/go/pkg/linux_arm64/runtime.a
0.00 deadcode
0.02 pclntab=612447 bytes, funcdata total 118962 bytes
0.03 dodata
0.03 dwarf
0.05 symsize = 0
0.08 reloc
0.10 asmb
0.10 datblk
0.11 sym
0.11 elfsym
0.11 symsize = 121488
0.11 symsize = 122016
0.13 header
0.14 host link: "gcc" "-s" "-o" "test" "-rdynamic" "/tmp/go-link-335745272/go.o" "/tmp/go-link-335745272/000000.o" "/tmp/go-link-335745272/000001.o" "/tmp/go-link-335745272/000002.o" "/tmp/go-link-335745272/000003.o" "/tmp/go-link-335745272/000004.o" "/tmp/go-link-335745272/000005.o" "/tmp/go-link-335745272/000006.o" "/tmp/go-link-335745272/000007.o" "/tmp/go-link-335745272/000008.o" "/tmp/go-link-335745272/000009.o" "/tmp/go-link-335745272/000010.o" "/tmp/go-link-335745272/000011.o" "/tmp/go-link-335745272/000012.o" "/tmp/go-link-335745272/000013.o" "-g" "-O2" "-g" "-O2" "-lpthread"
/usr/local/go/pkg/tool/linux_arm64/link: running gcc failed: exec: "gcc": executable file not found in $PATH


On X86 platform:

root@os:~/bblu/test# exec env - /bin/bash -c '/usr/local/go/bin/go tool link -s -v -o test test.a'
HEADER = -H4 -T0x401000 -D0x0 -R0x1000
searching for runtime.a in /usr/local/go/pkg/linux_amd64/runtime.a
0.00 deadcode
0.03 pclntab=624716 bytes, funcdata total 116096 bytes
0.03 dodata
0.03 dynreloc
0.04 reloc
0.04 asmb
0.04 codeblk
0.05 rodatblk
0.05 datblk
0.05 headr
0.05 cpu time
47771 symbols
68020 liveness data

Copy link
Contributor

@jayconrod jayconrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jayconrod jayconrod merged commit 6a3945e into bazel-contrib:master Jun 25, 2018
alexandruavadanii added a commit to alexandruavadanii/rules_go that referenced this pull request Mar 4, 2019
Original patch [1], backported based on instructions in [2].

[1] bazel-contrib/bazel-gazelle#242
[2] clnperez/envoy-ppc64le#4

Signed-off-by: Alexandru Avadanii <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants