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
This commit is contained in:
6
cc/cc.go
6
cc/cc.go
@@ -247,6 +247,7 @@ type ModuleContextIntf interface {
|
|||||||
baseModuleName() string
|
baseModuleName() string
|
||||||
getVndkExtendsModuleName() string
|
getVndkExtendsModuleName() string
|
||||||
isPgoCompile() bool
|
isPgoCompile() bool
|
||||||
|
useClangLld(actx ModuleContext) bool
|
||||||
}
|
}
|
||||||
|
|
||||||
type ModuleContext interface {
|
type ModuleContext interface {
|
||||||
@@ -287,6 +288,7 @@ type linker interface {
|
|||||||
linkerDeps(ctx DepsContext, deps Deps) Deps
|
linkerDeps(ctx DepsContext, deps Deps) Deps
|
||||||
linkerFlags(ctx ModuleContext, flags Flags) Flags
|
linkerFlags(ctx ModuleContext, flags Flags) Flags
|
||||||
linkerProps() []interface{}
|
linkerProps() []interface{}
|
||||||
|
useClangLld(actx ModuleContext) bool
|
||||||
|
|
||||||
link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path
|
link(ctx ModuleContext, flags Flags, deps PathDeps, objs Objects) android.Path
|
||||||
appendLdflags([]string)
|
appendLdflags([]string)
|
||||||
@@ -635,6 +637,10 @@ func (ctx *moduleContextImpl) selectedStl() string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ctx *moduleContextImpl) useClangLld(actx ModuleContext) bool {
|
||||||
|
return ctx.mod.linker.useClangLld(actx)
|
||||||
|
}
|
||||||
|
|
||||||
func (ctx *moduleContextImpl) baseModuleName() string {
|
func (ctx *moduleContextImpl) baseModuleName() string {
|
||||||
return ctx.mod.ModuleBase.BaseModuleName()
|
return ctx.mod.ModuleBase.BaseModuleName()
|
||||||
}
|
}
|
||||||
|
@@ -66,7 +66,8 @@ func (xom *xom) flags(ctx ModuleContext, flags Flags) Flags {
|
|||||||
// Enable execute-only if none of the dependencies disable it,
|
// Enable execute-only if none of the dependencies disable it,
|
||||||
// also if it's explicitly set true (allows overriding dependencies disabling it).
|
// also if it's explicitly set true (allows overriding dependencies disabling it).
|
||||||
if !disableXom || (xom.Properties.Xom != nil && *xom.Properties.Xom) {
|
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")
|
flags.LdFlags = append(flags.LdFlags, "-Wl,-execute-only")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user