blob: 73c0e903d57f93e6b80dde854de7236be78d0526 [file] [log] [blame]
Colin Cross97f0aef2016-07-14 16:05:46 -07001cc_library_static {
2 name: "liblinker_malloc",
3 clang: true,
4
5 srcs: [
6 "linker_allocator.cpp",
7 "linker_memory.cpp",
8 ],
9
10 // We need to access Bionic private headers in the linker.
11 include_dirs: ["bionic/libc"],
12}
13
14cc_binary {
15 clang: true,
16
17 srcs: [
18 "dlfcn.cpp",
19 "linker.cpp",
20 "linker_block_allocator.cpp",
Dimitry Ivanov769b33f2016-07-21 11:33:40 -070021 "linker_dlwarning.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -070022 "linker_gdb_support.cpp",
23 "linker_libc_support.c",
Dimitry Ivanovb943f302016-08-03 16:00:10 -070024 "linker_namespaces.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -070025 "linker_logger.cpp",
26 "linker_mapped_file_fragment.cpp",
27 "linker_phdr.cpp",
28 "linker_sdk_versions.cpp",
29 "linker_utils.cpp",
30 "rt.cpp",
31 ],
32
33 arch: {
34 arm: {
35 srcs: ["arch/arm/begin.S"],
36
37 cflags: ["-D__work_around_b_24465209__"],
38 },
39 arm64: {
40 srcs: ["arch/arm64/begin.S"],
41 },
42 x86: {
43 srcs: ["arch/x86/begin.c"],
44
45 cflags: ["-D__work_around_b_24465209__"],
46 },
47 x86_64: {
48 srcs: ["arch/x86_64/begin.S"],
49 },
50 mips: {
51 srcs: [
52 "arch/mips/begin.S",
53 "linker_mips.cpp",
54 ],
55 },
56 mips64: {
57 srcs: [
58 "arch/mips64/begin.S",
59 "linker_mips.cpp",
60 ],
61 },
62 },
63
64 // We need to access Bionic private headers in the linker.
65 include_dirs: ["bionic/libc"],
66
67 // -shared is used to overwrite the -Bstatic and -static
68 // flags triggered by LOCAL_FORCE_STATIC_EXECUTABLE.
69 // This dynamic linker is actually a shared object linked with static libraries.
70 ldflags: [
71 "-shared",
72 "-Wl,-Bsymbolic",
73 "-Wl,--exclude-libs,ALL",
74 ],
75
76 cflags: [
77 "-fno-stack-protector",
78 "-Wstrict-overflow=5",
79 "-fvisibility=hidden",
80 "-Wall",
81 "-Wextra",
82 "-Wunused",
83 "-Werror",
84 ],
85
86 // TODO: split out the asflags.
87 asflags: [
88 "-fno-stack-protector",
89 "-Wstrict-overflow=5",
90 "-fvisibility=hidden",
91 "-Wall",
92 "-Wextra",
93 "-Wunused",
94 "-Werror",
95 ],
96
97 conlyflags: ["-std=gnu99"],
98
99 cppflags: ["-Wold-style-cast"],
100
101 // we don't want crtbegin.o (because we have begin.o), so unset it
102 // just for this module
103 nocrt: true,
104
105 static_libs: [
106 "libc_nomalloc",
107 "libziparchive",
108 "libutils",
109 "libbase",
110 "libz",
111 "liblog",
112 "libdebuggerd_client",
113
114 // Important: The liblinker_malloc should be the last library in the list
115 // to overwrite any other malloc implementations by other static libraries.
116 "liblinker_malloc"
117 ],
118 static_executable: true,
119
120 name: "linker",
121 multilib: {
122 lib32: {
123 symlinks: ["linker_asan"],
124 },
125 lib64: {
126 suffix: "64",
127 symlinks: ["linker_asan64"],
128 },
129 },
130 target: {
131 android64: {
132 cflags: ["-DTARGET_IS_64_BIT"],
133 },
134 },
135 compile_multilib: "both",
136
137 // Leave the symbols in the shared library so that stack unwinders can produce
138 // meaningful name resolution.
139 strip: {
140 keep_symbols: true,
141 },
142
143 // Insert an extra objcopy step to add prefix to symbols. This is needed to prevent gdb
144 // looking up symbols in the linker by mistake.
145 prefix_symbols: "__dl_",
146}