Skip to content

Commit

Permalink
apacheGH-40400: [C++] Add support for LLD (apache#40927)
Browse files Browse the repository at this point in the history
### Rationale for this change

Add support for the LLD LLVM linker, it is faster than the default linker.

### What changes are included in this PR?

Added `ARROW_USE_LLD` as a CMake option, test if GCC supports the flags and then set the linker flags if so when the option is enabled.

### Are these changes tested?

When this is enabled then the libraries and tests will use the linker flag.

### Are there any user-facing changes?

No
* GitHub Issue: apache#40400

Authored-by: Marcus D. Hanwell <marcus@voltrondata.com>
Signed-off-by: Sutou Kouhei <kou@clear-code.com>
  • Loading branch information
cryos authored and tolleybot committed May 4, 2024
1 parent 253a8cb commit e0361eb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
1 change: 1 addition & 0 deletions ci/scripts/cpp_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ else
-DARROW_USE_CCACHE=${ARROW_USE_CCACHE:-ON} \
-DARROW_USE_GLOG=${ARROW_USE_GLOG:-OFF} \
-DARROW_USE_LD_GOLD=${ARROW_USE_LD_GOLD:-OFF} \
-DARROW_USE_LLD=${ARROW_USE_LLD:-OFF} \
-DARROW_USE_MOLD=${ARROW_USE_MOLD:-OFF} \
-DARROW_USE_PRECOMPILED_HEADERS=${ARROW_USE_PRECOMPILED_HEADERS:-OFF} \
-DARROW_USE_STATIC_CRT=${ARROW_USE_STATIC_CRT:-OFF} \
Expand Down
7 changes: 1 addition & 6 deletions cpp/cmake_modules/SetupCxxFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -679,12 +679,7 @@ if(ARROW_USE_LLD)
)
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "12.0.0")
set(LLD_LINKER_FLAGS "--ld-path=${LD_LLD}")
else()
message(STATUS "Need clang 12.0.0 or later to use LLD linker: ${CMAKE_CXX_COMPILER_VERSION}"
)
endif()
set(LLD_LINKER_FLAGS "--ld-path=${LD_LLD}")
else()
message(STATUS "Using the default linker because compiler doesn't support LLD: ${CMAKE_CXX_COMPILER_ID}"
)
Expand Down

0 comments on commit e0361eb

Please sign in to comment.