| # Copyright 2021 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| android_root = "//third_party/android/platform" |
| |
| config("linker_config") { |
| cflags = [ |
| "-fno-stack-protector", |
| "-Wstrict-overflow=5", |
| "-fvisibility=hidden", |
| ] |
| |
| asmflags = [ |
| "-fno-stack-protector", |
| "-Wstrict-overflow=5", |
| "-fvisibility=hidden", |
| "-Wall", |
| "-Wextra", |
| "-Wunused", |
| "-Werror", |
| ] |
| |
| cflags_cc = [ "-Wold-style-cast" ] |
| |
| include_dirs = [ |
| "$android_root/bionic/libc", |
| "$android_root/bionic/libc/async_safe/include", |
| "$android_root/system/core/libcutils/include", |
| ] |
| |
| configs = [ |
| "$android_root/bionic/libc:bionic_config", |
| "$android_root/system/libbase:headers", |
| ] |
| } |
| |
| source_set("main") { |
| visibility = [ ":*" ] |
| |
| sources = ["linker_main.cpp"] |
| |
| # Ensure that the compiler won't insert string function calls before ifuncs are resolved. |
| # TODO: If we add this flag, the compiler doesn't find bionic's limits.h header. |
| # cflags = ["-ffreestanding"] |
| |
| configs += [ |
| ":linker_config", |
| ] |
| } |
| |
| source_set("linker") { |
| sources = [ |
| "dlfcn.cpp", |
| "linker.cpp", |
| "linker_block_allocator.cpp", |
| "linker_cfi.cpp", |
| "linker_config.cpp", |
| "linker_debug.cpp", |
| "linker_dlwarning.cpp", |
| "linker_gdb_support.cpp", |
| "linker_globals.cpp", |
| "linker_libc_support.c", |
| "linker_libcxx_support.cpp", |
| "linker_logger.cpp", |
| "linker_mapped_file_fragment.cpp", |
| "linker_namespaces.cpp", |
| "linker_note_gnu_property.cpp", |
| "linker_phdr.cpp", |
| "linker_relocate.cpp", |
| "linker_sdk_versions.cpp", |
| "linker_soinfo.cpp", |
| "linker_tls.cpp", |
| "linker_utils.cpp", |
| "rt.cpp", |
| ] |
| |
| if (target_cpu == "arm64") { |
| sources += [ |
| # "arch/arm64/begin.S", |
| "arch/arm64/tlsdesc_resolver.S", |
| "arch/arm_neon/linker_gnu_hash_neon.cpp", |
| ] |
| } |
| |
| if (target_cpu == "x64") { |
| # sources += [ "arch/x86_64/begin.S" ] |
| } |
| |
| deps = [ |
| ":main", |
| ] |
| |
| configs += [ |
| ":linker_config", |
| ] |
| } |