Commit 734530e2 authored by Ian Lance Taylor's avatar Ian Lance Taylor
Browse files

[release-branch.go1.4] cmd/go: pass -no-pie along with -Wl,-r to gcc when supported on linux

This is a backport of https://golang.org/cl/18359 to the Go 1.4 branch.
This fixes the Go 1.4 build on systems for which the compiler defaults
to using PIE. Such systems are becoming more common.

Original CL description:

    Go fails to build on a system which has PIE enabled by default like this:

    /usr/bin/ld: -r and -pie may not be used together
    collect2: error: ld returned 1 exit status

    The only system I know that has this property right now is Ubuntu Xenial
    running on s390x, which is hardly the most accessible system, but it's planned
    to enable this on amd64 soon too. The fix is to pass -no-pie along with -Wl,-r
    to the compiler, but unfortunately that flag is very new as well. So this does
    a test compile of a trivial file to see if the flag is supported.

Updates #20276

Change-Id: I80a32fd06e30df1d871a48b5db225ba5bb5d104b
Reviewed-on: https://go-review.googlesource.com/42910


Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent 79d85a49
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment