aboutsummaryrefslogtreecommitdiffstats
path: root/cc
diff options
context:
space:
mode:
authorIvan Lozano <ivanlozano@google.com>2018-11-27 14:33:03 -0800
committerIvan Lozano <ivanlozano@google.com>2018-11-28 09:17:26 -0800
commitbd721269d39788acb0e528a9568fb0c0a5151c7d (patch)
tree1409a45207689411f5dfb4ce8a5a2870062afc84 /cc
parent328b077e20483ec5eeb59c540c2d58d8c9a4c46e (diff)
downloadbuild_soong-bd721269d39788acb0e528a9568fb0c0a5151c7d.tar.gz
build_soong-bd721269d39788acb0e528a9568fb0c0a5151c7d.tar.bz2
build_soong-bd721269d39788acb0e528a9568fb0c0a5151c7d.zip
Disable AArch64 XOM when not using lld.
AArch64 execute-only memory is only supported when using lld as the linker. There's still a few modules which don't use lld, so in those cases we need to disable this option. Bug: 77958880 Test: Module with use_clang_lld false builds without XOM Test: Module without use_clang_lld defined builds with XOM Change-Id: I4ab961c4d7342c54c6b40b9facfe18a45ed883bd
Diffstat (limited to 'cc')
-rw-r--r--cc/cc.go6
-rw-r--r--cc/xom.go3
2 files changed, 8 insertions, 1 deletions
diff --git a/cc/cc.go b/cc/cc.go
index 9fa7c3a8..4d06c609 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -247,6 +247,7 @@ type ModuleContextIntf interface {
baseModuleName() string
getVndkExtendsModuleName() string
isPgoCompile() bool
+ useClangLld(actx ModuleContext) bool
}
type ModuleContext interface {
@@ -287,6 +288,7 @@ type linker interface {
linkerDeps(ctx DepsContext, deps Deps) Deps
linkerFlags(ctx ModuleContext, flags Flags) Flags
linkerProps() []interface{}
+ useClangLld(actx ModuleContext) bool
link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path
appendLdflags([]string)
@@ -635,6 +637,10 @@ func (ctx *moduleContextImpl) selectedStl() string {
return ""
}
+func (ctx *moduleContextImpl) useClangLld(actx ModuleContext) bool {
+ return ctx.mod.linker.useClangLld(actx)
+}
+
func (ctx *moduleContextImpl) baseModuleName() string {
return ctx.mod.ModuleBase.BaseModuleName()
}
diff --git a/cc/xom.go b/cc/xom.go
index f65fc240..182069fb 100644
--- a/cc/xom.go
+++ b/cc/xom.go
@@ -66,7 +66,8 @@ func (xom *xom) flags(ctx ModuleContext, flags Flags) Flags {
// Enable execute-only if none of the dependencies disable it,
// also if it's explicitly set true (allows overriding dependencies disabling it).
if !disableXom || (xom.Properties.Xom != nil && *xom.Properties.Xom) {
- if ctx.Arch().ArchType == android.Arm64 {
+ // XOM is only supported on AArch64 when using lld.
+ if ctx.Arch().ArchType == android.Arm64 && ctx.useClangLld(ctx) {
flags.LdFlags = append(flags.LdFlags, "-Wl,-execute-only")
}
}