This repository has been archived by the owner on Nov 8, 2023. It is now read-only.
mirrored from https://android.googlesource.com/platform/bionic.git
/
Android.bp
157 lines (139 loc) · 3.84 KB
/
Android.bp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
cc_library_static {
name: "liblinker_malloc",
defaults: ["linux_bionic_supported"],
srcs: [
"linker_allocator.cpp",
"linker_memory.cpp",
],
// We need to access Bionic private headers in the linker.
include_dirs: ["bionic/libc"],
}
cc_binary {
defaults: ["linux_bionic_supported"],
srcs: [
"dlfcn.cpp",
"linker.cpp",
"linker_block_allocator.cpp",
"linker_dlwarning.cpp",
"linker_cfi.cpp",
"linker_gdb_support.cpp",
"linker_globals.cpp",
"linker_libc_support.c",
"linker_main.cpp",
"linker_namespaces.cpp",
"linker_logger.cpp",
"linker_mapped_file_fragment.cpp",
"linker_phdr.cpp",
"linker_sdk_versions.cpp",
"linker_soinfo.cpp",
"linker_utils.cpp",
"rt.cpp",
],
arch: {
arm: {
srcs: ["arch/arm/begin.S"],
cflags: ["-D__work_around_b_24465209__"],
},
arm64: {
srcs: ["arch/arm64/begin.S"],
},
x86: {
srcs: ["arch/x86/begin.c"],
cflags: ["-D__work_around_b_24465209__"],
},
x86_64: {
srcs: ["arch/x86_64/begin.S"],
},
mips: {
srcs: [
"arch/mips/begin.S",
"linker_mips.cpp",
],
},
mips64: {
srcs: [
"arch/mips64/begin.S",
"linker_mips.cpp",
],
},
},
// We need to access Bionic private headers in the linker.
include_dirs: ["bionic/libc"],
// -shared is used to overwrite the -Bstatic and -static
// flags triggered by LOCAL_FORCE_STATIC_EXECUTABLE.
// This dynamic linker is actually a shared object linked with static libraries.
ldflags: [
"-shared",
"-Wl,-Bsymbolic",
"-Wl,--exclude-libs,ALL",
],
cflags: [
"-fno-stack-protector",
"-Wstrict-overflow=5",
"-fvisibility=hidden",
"-Wall",
"-Wextra",
"-Wunused",
"-Werror",
],
// TODO: split out the asflags.
asflags: [
"-fno-stack-protector",
"-Wstrict-overflow=5",
"-fvisibility=hidden",
"-Wall",
"-Wextra",
"-Wunused",
"-Werror",
],
cppflags: ["-Wold-style-cast"],
// we are going to link libc++_static manually because
// when stl is not set to "none" build system adds libdl
// to the list of static libraries which needs to be
// avoided in the case of building loader.
stl: "none",
// we don't want crtbegin.o (because we have begin.o), so unset it
// just for this module
nocrt: true,
static_libs: [
"libc_nomalloc",
"libziparchive",
"libutils",
"libbase",
"libz",
"liblog",
"libc++_static",
"libdebuggerd_handler",
// Important: The liblinker_malloc should be the last library in the list
// to overwrite any other malloc implementations by other static libraries.
"liblinker_malloc"
],
static_executable: true,
name: "linker",
symlinks: ["linker_asan"],
multilib: {
lib64: {
suffix: "64",
},
},
target: {
android: {
static_libs: ["libdebuggerd_client"],
},
android64: {
cflags: ["-DTARGET_IS_64_BIT"],
},
linux_bionic: {
cflags: ["-DTARGET_IS_64_BIT"],
},
},
compile_multilib: "both",
// Leave the symbols in the shared library so that stack unwinders can produce
// meaningful name resolution.
strip: {
keep_symbols: true,
},
// Insert an extra objcopy step to add prefix to symbols. This is needed to prevent gdb
// looking up symbols in the linker by mistake.
prefix_symbols: "__dl_",
}