diff options
author | Yifan Hong <elsk@google.com> | 2020-01-21 17:04:13 -0800 |
---|---|---|
committer | Yifan Hong <elsk@google.com> | 2020-01-22 16:54:18 -0800 |
commit | cf4832c8bc3f4cc7e4ed779831cf857a0cd57197 (patch) | |
tree | 8486b72e9bf576f88cff1d2aee16ca0c8247ee45 /cc/linker.go | |
parent | 82db735fbc47641b9239542a32b4b30070abecb6 (diff) | |
download | build_soong-cf4832c8bc3f4cc7e4ed779831cf857a0cd57197.tar.gz build_soong-cf4832c8bc3f4cc7e4ed779831cf857a0cd57197.tar.bz2 build_soong-cf4832c8bc3f4cc7e4ed779831cf857a0cd57197.zip |
Add target.ramdisk
Add the following:
- exclude_shared_libs
- exclude_static_libs
- static_libs
Allow to customize linking for ramdisk variant.
Test: pass
Bug: 147347110
Change-Id: I6f55f11a6fdad8029d85833a3eedc2e95a712d51
Diffstat (limited to 'cc/linker.go')
-rw-r--r-- | cc/linker.go | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/cc/linker.go b/cc/linker.go index 6f2e5b7d..c2b4a3a5 100644 --- a/cc/linker.go +++ b/cc/linker.go @@ -141,6 +141,19 @@ type BaseLinkerProperties struct { // of the C/C++ module. Exclude_header_libs []string } + Ramdisk struct { + // list of static libs that only should be used to build the recovery + // variant of the C/C++ module. + Static_libs []string + + // list of shared libs that should not be used to build + // the ramdisk variant of the C/C++ module. + Exclude_shared_libs []string + + // list of static libs that should not be used to build + // the ramdisk variant of the C/C++ module. + Exclude_static_libs []string + } } // make android::build:GetBuildNumber() available containing the build ID. @@ -223,6 +236,15 @@ func (linker *baseLinker) linkerDeps(ctx DepsContext, deps Deps) Deps { deps.WholeStaticLibs = removeListFromList(deps.WholeStaticLibs, linker.Properties.Target.Recovery.Exclude_static_libs) } + if ctx.inRamdisk() { + deps.SharedLibs = removeListFromList(deps.SharedLibs, linker.Properties.Target.Recovery.Exclude_shared_libs) + deps.ReexportSharedLibHeaders = removeListFromList(deps.ReexportSharedLibHeaders, linker.Properties.Target.Recovery.Exclude_shared_libs) + deps.StaticLibs = append(deps.StaticLibs, linker.Properties.Target.Recovery.Static_libs...) + deps.StaticLibs = removeListFromList(deps.StaticLibs, linker.Properties.Target.Recovery.Exclude_static_libs) + deps.ReexportStaticLibHeaders = removeListFromList(deps.ReexportStaticLibHeaders, linker.Properties.Target.Recovery.Exclude_static_libs) + deps.WholeStaticLibs = removeListFromList(deps.WholeStaticLibs, linker.Properties.Target.Recovery.Exclude_static_libs) + } + if ctx.toolchain().Bionic() { // libclang_rt.builtins and libatomic have to be last on the command line if !Bool(linker.Properties.No_libcrt) { |