1//
2// Copyright (C) 2020 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
17cc_library_headers {
18    name: "native_bridge_guest_linker_headers",
19    export_include_dirs: ["include"],
20    host_supported: true,
21    native_bridge_supported: true,
22}
23
24cc_binary {
25    name: "native_bridge_guest_linker",
26    overrides: ["linker"],
27    stem: "linker",
28    defaults: ["linker_bin_template"],
29    srcs: [
30        "__libc_init_main_thread.cpp",
31        "linker_tls.cpp",
32        "linker_translate_path.cpp",
33    ],
34
35    include_dirs: [
36        "bionic/linker",
37    ],
38
39    enabled: false,
40    target: {
41       native_bridge: {
42           enabled: true,
43       }
44    },
45    arch: {
46        arm: {
47            srcs: ["init_static_tls_arm.S"],
48            version_script: "linker.arm.map",
49        },
50        arm64: {
51            srcs: ["init_static_tls_arm64.S"],
52            version_script: "linker.generic.map",
53        },
54    },
55
56    cflags: [
57        // TODO(b/133135269): workaround to skip hardcoded 'bootstrap' directory from guest library search.
58        // See https://android-review.googlesource.com/c/platform/bionic/+/954353/7/linker/linker.cpp#1165
59        "-D__ANDROID_APEX__=native_bridge_apex",
60    ],
61
62    header_libs: ["native_bridge_guest_linker_headers"],
63
64    native_bridge_supported: true,
65
66    multilib: {
67        lib64: {
68            suffix: "64",
69        },
70    },
71
72    compile_multilib: "both",
73
74    static_libs: ["liblinker_debuggerd_stub"],
75}
76