arrow icon indicating copy to clipboard operation
arrow copied to clipboard

[C++] Add support for LLD

Open kou opened this issue 1 year ago • 3 comments
trafficstars

Describe the enhancement requested

https://lld.llvm.org/

LLD is the LLVM Linker. It's faster than GNU ld.

Component(s)

C++

kou avatar Mar 07 '24 13:03 kou

LLD is a drop-in replacement for the GNU linkers that accepts the same command line arguments and linker scripts as GNU.

Do we even need to add anything explicitly if this is the case?

assignUser avatar Mar 07 '24 15:03 assignUser

We need to pass -fuse-ld=lld argument to gcc/g++. See also: https://gcc.gnu.org/onlinedocs/gcc/Link-Options.html

kou avatar Mar 08 '24 02:03 kou

Ah I see, I thought it had a setup like mold that pretends to be ld ^^

assignUser avatar Mar 08 '24 03:03 assignUser

As I look at the linker logic I am struck that we could end up trying to use multiple linkers, I was thinking that we might add an option to choose the linker by name, and populate that from the boolean flags. If we want to keep it simple maybe just warn that multiple linkers were selected and that we will use X, where we would then need to determine the default if all, etc. I can put something together and let you both take a look.

cryos avatar Apr 01 '24 17:04 cryos

You're suggesting ARROW_LINKER=gold|mold|lld or something instead of ARROW_USE_LD_GOLD/ARROW_USE_MOLD/ARROW_USE_LLD, right? I'm OK with it. (I don't have a strong opinion for this.)

BTW, I think that we can drop support for ARROW_USE_LD_GOLD after we add support for mold and LLD.

kou avatar Apr 02 '24 02:04 kou

You're suggesting ARROW_LINKER=gold|mold|lld or something instead of ARROW_USE_LD_GOLD/ARROW_USE_MOLD/ARROW_USE_LLD, right? I'm OK with it. (I don't have a strong opinion for this.)

Yes, just to ensure we only request one linker, or what I added with a default in an if, elseif block.

BTW, I think that we can drop support for ARROW_USE_LD_GOLD after we add support for mold and LLD.

Yeah? It does look a little overly complex, but I wasn't sure on the history there.

cryos avatar Apr 02 '24 13:04 cryos

Issue resolved by pull request 40927 https://github.com/apache/arrow/pull/40927

kou avatar Apr 05 '24 23:04 kou