smeenai created this revision.
smeenai added reviewers: beanz, compnerd, phosek.
Herald added a subscriber: mgorny.
smeenai added a subscriber: alexshap.
LLD also supports order files using the `--symbol-ordering-file` option.
As the name would suggest, the order file format is slightly different
from gold; gold's order files specify section names, whereas LLD's
specify symbol names. Assuming you have an order file in the correct
format though, we should support using it with LLD.
Switch the check to actually use LLVM's linker detection rather than
just checking for the presence of the gold executable, since we might
have a gold executable present but be using LLD (or bfd for that matter)
as our linker.
Repository:
rC Clang
https://reviews.llvm.org/D47669
Files:
tools/driver/CMakeLists.txt
Index: tools/driver/CMakeLists.txt
===================================================================
--- tools/driver/CMakeLists.txt
+++ tools/driver/CMakeLists.txt
@@ -98,13 +98,16 @@
set(TOOL_INFO_BUILD_VERSION)
endif()
-if(CLANG_ORDER_FILE AND (LD64_EXECUTABLE OR GOLD_EXECUTABLE))
+if(CLANG_ORDER_FILE AND
+ (LD64_EXECUTABLE OR LLVM_LINKER_IS_GOLD OR LLVM_LINKER_IS_LLD))
include(CheckLinkerFlag)
if (LD64_EXECUTABLE)
set(LINKER_ORDER_FILE_OPTION "-Wl,-order_file,${CLANG_ORDER_FILE}")
- elseif (GOLD_EXECUTABLE)
+ elseif (LLVM_LINKER_IS_GOLD)
set(LINKER_ORDER_FILE_OPTION
"-Wl,--section-ordering-file,${CLANG_ORDER_FILE}")
+ elseif (LLVM_LINKER_IS_LLD)
+ set(LINKER_ORDER_FILE_OPTION
"-Wl,--symbol-ordering-file,${CLANG_ORDER_FILE}")
endif()
# This is a test to ensure the actual order file works with the linker.
Index: tools/driver/CMakeLists.txt
===================================================================
--- tools/driver/CMakeLists.txt
+++ tools/driver/CMakeLists.txt
@@ -98,13 +98,16 @@
set(TOOL_INFO_BUILD_VERSION)
endif()
-if(CLANG_ORDER_FILE AND (LD64_EXECUTABLE OR GOLD_EXECUTABLE))
+if(CLANG_ORDER_FILE AND
+ (LD64_EXECUTABLE OR LLVM_LINKER_IS_GOLD OR LLVM_LINKER_IS_LLD))
include(CheckLinkerFlag)
if (LD64_EXECUTABLE)
set(LINKER_ORDER_FILE_OPTION "-Wl,-order_file,${CLANG_ORDER_FILE}")
- elseif (GOLD_EXECUTABLE)
+ elseif (LLVM_LINKER_IS_GOLD)
set(LINKER_ORDER_FILE_OPTION "-Wl,--section-ordering-file,${CLANG_ORDER_FILE}")
+ elseif (LLVM_LINKER_IS_LLD)
+ set(LINKER_ORDER_FILE_OPTION "-Wl,--symbol-ordering-file,${CLANG_ORDER_FILE}")
endif()
# This is a test to ensure the actual order file works with the linker.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits