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