@@ -5,22 +5,8 @@ DEFAULT(LLD_VERSION ${COMPILER_VERSION})
55TOOLCHAIN(lld)
66VERSION(${LLD_VERSION})
77
8- # There is no backward compatibility between LLVM IR versions 16 and 18.
9- # So, we need to select lld18 when using clang18 to compile src in LTO mode.
10- IF (LLD_VERSION == 20)
11- DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE_BY_JSON(LLD_ROOT lld20.json)
12- ELSEIF (LLD_VERSION == 18)
13- DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE_BY_JSON(LLD_ROOT lld18.json)
14- ELSEIF (LLD_VERSION == 16)
15- DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE_BY_JSON(LLD_ROOT lld16.json)
16- ELSEIF (LLD_VERSION == 14)
17- # Allow empty lld 14 for android
18- ELSE()
19- MESSAGE(FATAL_ERROR "Unsupported LLD version ${LLD_VERSION} was required")
20- ENDIF()
21-
228IF (OS_ANDROID)
23- # Use LLD shipped with Android NDK.
9+ DISABLE(PROVIDE_LLD_FROM_RESOURCE) # Use LLD shipped with Android NDK.
2410 LDFLAGS(
2511 -fuse-ld =lld
2612
@@ -53,6 +39,7 @@ IF (OS_ANDROID)
5339 LDFLAGS(-Wl,-z,max-page-size =16384)
5440 ENDIF()
5541ELSEIF (OS_LINUX)
42+ ENABLE(PROVIDE_LLD_FROM_RESOURCE)
5643 LDFLAGS(
5744 -fuse-ld =lld
5845 --ld-path =${LLD_ROOT_RESOURCE_GLOBAL}/bin/ld.lld
@@ -63,20 +50,40 @@ ELSEIF (OS_LINUX)
6350 -Wl,--build-id =sha1
6451 )
6552ELSEIF (OS_FREEBSD)
53+ ENABLE(PROVIDE_LLD_FROM_RESOURCE)
6654 LDFLAGS(
6755 -fuse-ld =lld
6856 --ld-path =${LLD_ROOT_RESOURCE_GLOBAL}/bin/ld.lld
6957 )
7058ELSEIF (OS_DARWIN OR OS_IOS)
59+ ENABLE(PROVIDE_LLD_FROM_RESOURCE)
7160 LDFLAGS(
7261 -fuse-ld =lld
7362 --ld-path =${LLD_ROOT_RESOURCE_GLOBAL}/bin/ld64.lld
7463 )
7564ELSEIF (OS_EMSCRIPTEN)
65+ ENABLE(PROVIDE_LLD_FROM_RESOURCE)
7666 LDFLAGS(
7767 -fuse-ld =${LLD_ROOT_RESOURCE_GLOBAL}/bin/wasm-ld
7868 # FIXME: Linker does not capture "ld-path" and therefore it can not find "wasm-ld"
7969 )
70+ ELSE()
71+ MESSAGE(FATAL_ERROR "Unsupported LLD target OS was required")
72+ ENDIF()
73+
74+ IF (PROVIDE_LLD_FROM_RESOURCE)
75+ # There is no backward compatibility between LLVM IR versions 16 and 18.
76+ # So, we need to select lld18 when using clang18 to compile src in LTO mode.
77+ IF (LLD_VERSION == 20)
78+ DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE_BY_JSON(LLD_ROOT lld20.json)
79+ ELSEIF (LLD_VERSION == 18)
80+ DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE_BY_JSON(LLD_ROOT lld18.json)
81+ ELSEIF (LLD_VERSION == 16)
82+ DECLARE_EXTERNAL_HOST_RESOURCES_BUNDLE_BY_JSON(LLD_ROOT lld16.json)
83+ ELSE()
84+ MESSAGE(FATAL_ERROR "Unsupported LLD version ${LLD_VERSION} was required")
85+ ENDIF()
86+
8087ENDIF()
8188
8289END()
0 commit comments