ya.make 2.3 KB

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