aboutsummaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-01-30 22:44:19 -0800
committerColin Cross <ccross@android.com>2017-01-30 22:51:59 -0800
commit7a108bccaddb72b6ef76e1d7cd22136c7cd12c52 (patch)
treee281f123d367cafe62220ebe94daec3a7b0b33a0 /cc
parent5951d3e2bba6c6a5e26728f51942c17954bacb2c (diff)
downloadbuild_soong-7a108bccaddb72b6ef76e1d7cd22136c7cd12c52.tar.gz
build_soong-7a108bccaddb72b6ef76e1d7cd22136c7cd12c52.tar.bz2
build_soong-7a108bccaddb72b6ef76e1d7cd22136c7cd12c52.zip
Allow clang builds to disable -pie
-pie triggers a bug in glibc's linker when used with goma (https://sourceware.org/bugzilla/show_bug.cgi?id=16381). Allow the clang build to disable -pie for host modules through the DISABLE_HOST_PIE environment variable so it can produce a toolchain that works with goma. Bug: 15814177 Bug: 34722791 Change-Id: Ic664a1b821aaeaf2bde14b0afa1a1975e31300cb
Diffstat (limited to 'cc')
-rw-r--r--cc/binary.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/cc/binary.go b/cc/binary.go
index d6a72a26..afc8a990 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -41,6 +41,9 @@ type BinaryLinkerProperties struct {
// extension (if any) appended
Symlinks []string `android:"arch_variant"`
+ // do not pass -pie
+ No_pie *bool `android:"arch_variant"`
+
DynamicLinker string `blueprint:"mutated"`
}
@@ -194,9 +197,11 @@ func (binary *binaryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags
flags = binary.baseLinker.linkerFlags(ctx, flags)
if ctx.Host() && !binary.static() {
- flags.LdFlags = append(flags.LdFlags, "-pie")
- if ctx.Os() == android.Windows {
- flags.LdFlags = append(flags.LdFlags, "-Wl,-e_mainCRTStartup")
+ if !ctx.AConfig().IsEnvTrue("DISABLE_HOST_PIE") {
+ flags.LdFlags = append(flags.LdFlags, "-pie")
+ if ctx.Os() == android.Windows {
+ flags.LdFlags = append(flags.LdFlags, "-Wl,-e_mainCRTStartup")
+ }
}
}