From a4b9dd08c02fddb1487f21f526bc8ccc598f237a Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Wed, 16 Jan 2019 22:53:13 +0900 Subject: [PATCH] "bootstrap: true" modules are using bootstrap Bionic If the bootstrap property is set to true, a binary configured to refer to the bootstrap linker at /system/bin/bootstrap/linker[64]. This is for very early processes that are executed before the init makes the linker by bind-mounting it. Bug: 120266448 Test: m init_second_stage and use readelf on the built file DT_INTERP is set to /system/bin/bootstrap/linker64 and Change-Id: I67487701192f127679cc8127ddc9f53e102ba9c4 --- cc/binary.go | 6 +++++- cc/cc.go | 11 ++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cc/binary.go b/cc/binary.go index 4c863712d..d4edc1a16 100644 --- a/cc/binary.go +++ b/cc/binary.go @@ -249,7 +249,11 @@ func (binary *binaryDecorator) linkerFlags(ctx ModuleContext, flags Flags) Flags } else { switch ctx.Os() { case android.Android: - flags.DynamicLinker = "/system/bin/linker" + if ctx.bootstrap() { + flags.DynamicLinker = "/system/bin/bootstrap/linker" + } else { + flags.DynamicLinker = "/system/bin/linker" + } if flags.Toolchain.Is64Bit() { flags.DynamicLinker += "64" } diff --git a/cc/cc.go b/cc/cc.go index 062e6d9ff..58ea5e14e 100644 --- a/cc/cc.go +++ b/cc/cc.go @@ -261,6 +261,7 @@ type ModuleContextIntf interface { apexName() string hasStubsVariants() bool isStubs() bool + bootstrap() bool } type ModuleContext interface { @@ -571,6 +572,10 @@ func (c *Module) HasStubsVariants() bool { return false } +func (c *Module) bootstrap() bool { + return Bool(c.Properties.Bootstrap) +} + type baseModuleContext struct { android.BaseContext moduleContextImpl @@ -741,6 +746,10 @@ func (ctx *moduleContextImpl) isStubs() bool { return ctx.mod.IsStubs() } +func (ctx *moduleContextImpl) bootstrap() bool { + return ctx.mod.bootstrap() +} + func newBaseModule(hod android.HostOrDeviceSupported, multilib android.Multilib) *Module { return &Module{ hod: hod, @@ -1553,7 +1562,7 @@ func (c *Module) depsToPaths(ctx android.ModuleContext) PathDeps { // If not building for APEX, use stubs only when it is from // an APEX (and not from platform) useThisDep = (depInPlatform != depIsStubs) - if c.inRecovery() || Bool(c.Properties.Bootstrap) { + if c.inRecovery() || c.bootstrap() { // However, for recovery or bootstrap modules, // always link to non-stub variant useThisDep = !depIsStubs