blob: a6fd87bfeb519efaaa1415b78206f1f31128da80 [file] [log] [blame]
Colin Cross97f0aef2016-07-14 16:05:46 -07001cc_library_static {
2 name: "liblinker_malloc",
Dan Willemsen7ec52b12016-11-28 17:02:25 -08003 defaults: ["linux_bionic_supported"],
Colin Cross97f0aef2016-07-14 16:05:46 -07004
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 {
Dan Willemsen7ec52b12016-11-28 17:02:25 -080015 defaults: ["linux_bionic_supported"],
Colin Cross97f0aef2016-07-14 16:05:46 -070016 srcs: [
17 "dlfcn.cpp",
18 "linker.cpp",
19 "linker_block_allocator.cpp",
Dimitry Ivanov769b33f2016-07-21 11:33:40 -070020 "linker_dlwarning.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -070021 "linker_gdb_support.cpp",
Dimitry Ivanov48ec2882016-08-04 11:50:36 -070022 "linker_globals.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -070023 "linker_libc_support.c",
Dimitry Ivanov3f660572016-09-09 10:00:39 -070024 "linker_main.cpp",
Dimitry Ivanovb943f302016-08-03 16:00:10 -070025 "linker_namespaces.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -070026 "linker_logger.cpp",
27 "linker_mapped_file_fragment.cpp",
28 "linker_phdr.cpp",
29 "linker_sdk_versions.cpp",
Dimitry Ivanov48ec2882016-08-04 11:50:36 -070030 "linker_soinfo.cpp",
Colin Cross97f0aef2016-07-14 16:05:46 -070031 "linker_utils.cpp",
32 "rt.cpp",
33 ],
34
35 arch: {
36 arm: {
37 srcs: ["arch/arm/begin.S"],
38
39 cflags: ["-D__work_around_b_24465209__"],
40 },
41 arm64: {
42 srcs: ["arch/arm64/begin.S"],
43 },
44 x86: {
45 srcs: ["arch/x86/begin.c"],
46
47 cflags: ["-D__work_around_b_24465209__"],
48 },
49 x86_64: {
50 srcs: ["arch/x86_64/begin.S"],
51 },
52 mips: {
53 srcs: [
54 "arch/mips/begin.S",
55 "linker_mips.cpp",
56 ],
57 },
58 mips64: {
59 srcs: [
60 "arch/mips64/begin.S",
61 "linker_mips.cpp",
62 ],
63 },
64 },
65
66 // We need to access Bionic private headers in the linker.
67 include_dirs: ["bionic/libc"],
68
69 // -shared is used to overwrite the -Bstatic and -static
70 // flags triggered by LOCAL_FORCE_STATIC_EXECUTABLE.
71 // This dynamic linker is actually a shared object linked with static libraries.
72 ldflags: [
73 "-shared",
74 "-Wl,-Bsymbolic",
75 "-Wl,--exclude-libs,ALL",
76 ],
77
78 cflags: [
79 "-fno-stack-protector",
80 "-Wstrict-overflow=5",
81 "-fvisibility=hidden",
82 "-Wall",
83 "-Wextra",
84 "-Wunused",
85 "-Werror",
86 ],
87
88 // TODO: split out the asflags.
89 asflags: [
90 "-fno-stack-protector",
91 "-Wstrict-overflow=5",
92 "-fvisibility=hidden",
93 "-Wall",
94 "-Wextra",
95 "-Wunused",
96 "-Werror",
97 ],
98
Colin Cross97f0aef2016-07-14 16:05:46 -070099 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",
Colin Cross97f0aef2016-07-14 16:05:46 -0700112
113 // Important: The liblinker_malloc should be the last library in the list
114 // to overwrite any other malloc implementations by other static libraries.
115 "liblinker_malloc"
116 ],
117 static_executable: true,
118
119 name: "linker",
120 multilib: {
121 lib32: {
122 symlinks: ["linker_asan"],
123 },
124 lib64: {
125 suffix: "64",
126 symlinks: ["linker_asan64"],
127 },
128 },
129 target: {
Dan Willemsen7ec52b12016-11-28 17:02:25 -0800130 android: {
131 static_libs: ["libdebuggerd_client"],
132 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700133 android64: {
134 cflags: ["-DTARGET_IS_64_BIT"],
135 },
Dan Willemsen7ec52b12016-11-28 17:02:25 -0800136 linux_bionic: {
137 cflags: ["-DTARGET_IS_64_BIT"],
138 },
Colin Cross97f0aef2016-07-14 16:05:46 -0700139 },
140 compile_multilib: "both",
141
142 // Leave the symbols in the shared library so that stack unwinders can produce
143 // meaningful name resolution.
144 strip: {
145 keep_symbols: true,
146 },
147
148 // Insert an extra objcopy step to add prefix to symbols. This is needed to prevent gdb
149 // looking up symbols in the linker by mistake.
150 prefix_symbols: "__dl_",
151}