ya.make 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. LDFLAGS(
  43. -fuse-ld=lld
  44. --ld-path=${LLD_ROOT_RESOURCE_GLOBAL}/bin/ld64.lld
  45. )
  46. ELSEIF (OS_EMSCRIPTEN)
  47. LDFLAGS(
  48. -fuse-ld=${LLD_ROOT_RESOURCE_GLOBAL}/bin/wasm-ld
  49. # FIXME: Linker does not capture "ld-path" and therefore it can not find "wasm-ld"
  50. )
  51. ENDIF()
  52. END()