]> Cypherpunks repositories - gostls13.git/commit
cmd/go: elide -rpath when not applicable and used via LDFLAGS
authorShawn Walker-Salas <shawn.walker@oracle.com>
Thu, 17 Sep 2015 22:47:20 +0000 (15:47 -0700)
committerIan Lance Taylor <iant@golang.org>
Fri, 25 Sep 2015 17:53:00 +0000 (17:53 +0000)
commitdc6df1b07093ffa0568a581251e8ddd38f707ed6
tree98909a89dcef2da38d872eb7aaa03f8d60c08fed
parentb07a9efa7841ccd14a694d026a1e62111989f9d1
cmd/go: elide -rpath when not applicable and used via LDFLAGS

Some linker flags should only be applied when performing the final
linking step for a shared library or executable, etc. In other
contexts, they're either invalid, or meaningless to apply (so should
not be specified).

When an external linker is used (either directly by Go or by the
compiler driver used by cgo), -rpath and -rpath-link should only be
specified in the final linking step.  On platforms such as Solaris,
ld(1) will reject its use in any other scenario (such as when linking
relocatable objects).

This change is necessary because Go does not currently offer a way to
specify LDFLAGS based on when they should be applied.

Fixes #12115

Change-Id: If35a18d8eee8ec7ddcca2d4ccd41ab6ffcf93b41
Reviewed-on: https://go-review.googlesource.com/14674
Reviewed-by: Minux Ma <minux@golang.org>
Run-TryBot: Minux Ma <minux@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/go/build.go