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
This commit is contained in:
11
cc/binary.go
11
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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user