ya.make 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. RESOURCES_LIBRARY()
  2. DEFAULT(LLD_VERSION ${CLANG_VER})
  3. TOOLCHAIN(lld)
  4. VERSION(${LLD_VERSION})
  5. IF (LLD_VERSION == 14)
  6. DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE_BY_JSON(LLD_ROOT lld14.json)
  7. ELSE()
  8. # fallback on latest version
  9. DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE_BY_JSON(LLD_ROOT lld16.json)
  10. ENDIF()
  11. IF (OS_ANDROID)
  12. # Use LLD shipped with Android NDK.
  13. LDFLAGS(
  14. -fuse-ld=lld
  15. )
  16. IF (ANDROID_API < 29)
  17. # Dynamic linker on Android does not support lld's default rosegment
  18. # prior to API Level 29 (Android Q)
  19. # See:
  20. # https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#additional-required-arguments
  21. # https://github.com/android/ndk/issues/1196
  22. LDFLAGS(
  23. -Wl,--no-rosegment
  24. )
  25. ENDIF()
  26. # Enable optimized relocations format (e.g. .rela.dyn section) to reduce binary size
  27. # See:
  28. # https://android.googlesource.com/platform/ndk/+/master/docs/BuildSystemMaintainers.md#relr-and-relocation-packing
  29. IF (ANDROID_API >= 30)
  30. LDFLAGS(-Wl,--pack-dyn-relocs=android+relr)
  31. ELSEIF (ANDROID_API >= 28)
  32. LDFLAGS(-Wl,--pack-dyn-relocs=android+relr,--use-android-relr-tags)
  33. ELSEIF (ANDROID_API >= 23)
  34. LDFLAGS(-Wl,--pack-dyn-relocs=android)
  35. ENDIF()
  36. ELSEIF (OS_LINUX)
  37. LDFLAGS(
  38. -fuse-ld=lld
  39. --ld-path=${LLD_ROOT_RESOURCE_GLOBAL}/bin/ld.lld
  40. # dynlinker on auld ubuntu versions can not handle .rodata stored in standalone segment [citation needed]
  41. -Wl,--no-rosegment
  42. # add build-id to binaries to allow external tools check equality of binaries
  43. -Wl,--build-id=sha1
  44. )
  45. ELSEIF (OS_DARWIN OR OS_IOS)
  46. IF (MAPSMOBI_BUILD_TARGET AND XCODE)
  47. LDFLAGS(
  48. -fuse-ld=${LLD_ROOT_RESOURCE_GLOBAL}/bin/ld64.lld
  49. )
  50. ELSEIF (XCODE)
  51. LDFLAGS(-DYA_XCODE)
  52. ELSE()
  53. LDFLAGS(
  54. -fuse-ld=lld
  55. --ld-path=${LLD_ROOT_RESOURCE_GLOBAL}/bin/ld64.lld
  56. # FIXME: Remove fake linker version flag when clang 16 version arrives
  57. -mlinker-version=705
  58. )
  59. ENDIF()
  60. ELSEIF (OS_EMSCRIPTEN)
  61. LDFLAGS(
  62. -fuse-ld=${LLD_ROOT_RESOURCE_GLOBAL}/bin/wasm-ld
  63. # FIXME: Linker does not capture "ld-path" and therefore it can not find "wasm-ld"
  64. )
  65. ENDIF()
  66. END()