1 /*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 // This is the default linker namespace for a vendor process (a process started
18 // from /vendor/bin/*).
19
20 #include "linkerconfig/environment.h"
21 #include "linkerconfig/namespacebuilder.h"
22
23 using android::linkerconfig::modules::AsanPath;
24 using android::linkerconfig::modules::Namespace;
25
26 namespace android {
27 namespace linkerconfig {
28 namespace contents {
BuildProductDefaultNamespace(const Context & ctx)29 Namespace BuildProductDefaultNamespace([[maybe_unused]] const Context& ctx) {
30 Namespace ns("default", /*is_isolated=*/true, /*is_visible=*/true);
31
32 ns.AddSearchPath(Var("PRODUCT", "product") + "/${LIB}",
33 AsanPath::WITH_DATA_ASAN);
34 ns.AddPermittedPath(Var("PRODUCT", "product"), AsanPath::WITH_DATA_ASAN);
35
36 ns.GetLink(ctx.GetSystemNamespaceName())
37 .AddSharedLib(
38 {Var("LLNDK_LIBRARIES_PRODUCT"), Var("SANITIZER_DEFAULT_PRODUCT")});
39 ns.GetLink("vndk").AddSharedLib({Var("VNDK_SAMEPROCESS_LIBRARIES_PRODUCT"),
40 Var("VNDK_CORE_LIBRARIES_PRODUCT")});
41 if (android::linkerconfig::modules::IsVndkInSystemNamespace()) {
42 ns.GetLink("vndk_in_system")
43 .AddSharedLib(Var("VNDK_USING_CORE_VARIANT_LIBRARIES"));
44 }
45 ns.AddRequires(std::vector{
46 "libneuralnetworks.so",
47 });
48 return ns;
49 }
50 } // namespace contents
51 } // namespace linkerconfig
52 } // namespace android
53