Skip to content

Commit

Permalink
apacheGH-40400: Add support for LLD
Browse files Browse the repository at this point in the history
  • Loading branch information
cryos committed Apr 5, 2024
1 parent 074d45f commit 9a857a4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cpp/cmake_modules/DefineOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ takes precedence over ccache if a storage backend is configured" ON)

define_option(ARROW_USE_LD_GOLD "Use ld.gold for linking on Linux (if available)" OFF)

define_option(ARROW_USE_LLD "Use the LLVM lld for linking on Linux (if available)" OFF)

define_option(ARROW_USE_MOLD "Use mold for linking on Linux (if available)" OFF)

define_option(ARROW_USE_PRECOMPILED_HEADERS "Use precompiled headers when compiling"
Expand Down
12 changes: 12 additions & 0 deletions cpp/cmake_modules/SetupCxxFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,18 @@ if(NOT WIN32 AND NOT APPLE)
else()
message(STATUS "Using the default linker because mold isn't found")
endif()
elseif(ARROW_USE_LLD AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# For GCC make sure the compiler flag is supported and use it if so for linking.
set(LLD_LINKER_FLAGS "-fuse-ld=lld")
check_cxx_compiler_flag("${LLD_LINKER_FLAGS}" CXX_SUPPORTS_LLD)
if(CXX_SUPPORTS_LLD)
message(STATUS "Using optional LLVM LLD linker")
string(APPEND CMAKE_EXE_LINKER_FLAGS " ${LLD_LINKER_FLAGS}")
string(APPEND CMAKE_MODULE_LINKER_FLAGS " ${LLD_LINKER_FLAGS}")
string(APPEND CMAKE_SHARED_LINKER_FLAGS " ${LLD_LINKER_FLAGS}")
else()
message(STATUS "Using the default linker because the LLD linker flags don't work")
endif()
endif()
endif()

Expand Down

0 comments on commit 9a857a4

Please sign in to comment.