BUILD.gn 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. # Copyright 2014 The Chromium Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. import("//build/config/android/config.gni")
  5. import("//build/config/sysroot.gni")
  6. assert(is_android)
  7. shared_library("chromium_android_linker") {
  8. sources = [
  9. "legacy_linker_jni.cc",
  10. "legacy_linker_jni.h",
  11. "linker_jni.cc",
  12. "linker_jni.h",
  13. "linker_jni_onload.cc",
  14. "modern_linker_jni.cc",
  15. "modern_linker_jni.h",
  16. ]
  17. # The NDK contains the crazy_linker here:
  18. # '<(android_ndk_root)/crazy_linker.gyp:crazy_linker'
  19. # However, we use our own fork. See bug 384700.
  20. deps = [
  21. "//build:buildflag_header_h",
  22. "//third_party/android_crazy_linker",
  23. ]
  24. # Export JNI symbols.
  25. configs -= [ "//build/config/android:hide_all_but_jni_onload" ]
  26. configs += [ "//build/config/android:hide_all_but_jni" ]
  27. # Disable coverage to avoid linker issue.
  28. configs -= [ "//build/config/coverage:default_coverage" ]
  29. # ThinLTO optimizations save a few bytes of binary size.
  30. configs -= [ "//build/config/compiler:thinlto_optimize_default" ]
  31. configs += [ "//build/config/compiler:thinlto_optimize_max" ]
  32. # Disable orderfile instrumentation. Code in this target is in a different
  33. # .so, cannot call unexported instrumentation functions from another one (link
  34. # time error).
  35. configs -= [ "//build/config/android:default_orderfile_instrumentation" ]
  36. # Avoid linking libc++ and support libraries, to avoid 100 kiB of
  37. # un-necessary code.
  38. no_default_deps = true
  39. # The linker is used on Android platforms that do not support GNU-style
  40. # hash tables, so ensure one isn't included in it to save space (since the SysV
  41. # format is always supported). It would be nice to also remove the GNU version
  42. # tables, for the same reason, but a linker flag to disable them doesn't seem
  43. # to exist. This saves 52 bytes on ARM.
  44. ldflags = [ "-Wl,--hash-style=sysv" ]
  45. }