secilc is using bootstrap Bionic
secilc is a program that is executed very early by init. Mark it as
'bootstrap: true' so that DT_INTERP is set to point to the dynamic
linker for the bootstrap processes. Also RPATH is set to the bootstrap
Bionic path so that this executable can search Bionic libs even before
init makes them visible to the ordinary search path of /system/lib.
Bug: 120266448
Test: m secilc
Inspect DT_INTERP and RPATH with readelf
DT_INTERP: /system/bin/bootstrap/linker64
RPATH: /system/${LIB}/bootstrap
Change-Id: Icb6e2fd37dced18c4cac83fb38e8a28739b34cab
diff --git a/secilc/Android.bp b/secilc/Android.bp
index 6334bf8..9c097f9 100644
--- a/secilc/Android.bp
+++ b/secilc/Android.bp
@@ -11,4 +11,13 @@
srcs: ["secilc.c"],
static_libs: ["libsepol"],
stl: "none",
+ // secilc is a program that is executed very early by init.
+ // Since it is before the mount namespaces are setup, /system/bin/linker
+ // and /system/lib/libc.so point to the mount points where nothing
+ // is mounted on yet. Therefore, secilc has to have explicit knowledge about
+ // the paths where the bootstrap Bionic is. bootstrap:true sets DT_INTERP to
+ // /system/bin/bootstrap/linker. RPATH is explicitly set to /system/lib/bootstrap
+ // where the bootstrap libc.so is.
+ bootstrap: true,
+ ldflags: ["-Wl,--rpath,/system/${LIB}/bootstrap"],
}