ya.make 2.2 KB

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