You are not logged in.

#1 2023-12-12 10:04:50

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 876

no-as-needed linker option equivalent for Clang

I'd need to know which linker flag for Clang does the same job that --no-as-needed does for GCC. I searched the web with no success, and I'm afraid to go through the documentation of all the Clang linker options, so if someone can give me a quick answer this would save me a lot of time and pain.
Thanks in advance.

Offline

#2 2023-12-12 13:08:46

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 12,977

Re: no-as-needed linker option equivalent for Clang

compiler and linker are separate entities and it is possible to use different linkers with a specific compiler.
(gcc can use atleast 3 linkers) .
--no-as-needed is a ld.so option , and you can use that with  llvm/clang .

The llvm project has ld.lld (project name is lld) as linker, are you trying to use that ?

That linker supports --no-as-needed .

https://man.archlinux.org/man/extra/lld/ld.lld.1.en wrote:

--no-as-needed
    Always set DT_NEEDED for shared libraries.

Last edited by Lone_Wolf (2023-12-12 13:09:11)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#3 2023-12-12 13:56:36

snack
Member
From: Italy
Registered: 2009-01-13
Posts: 876

Re: no-as-needed linker option equivalent for Clang

I was trying to help a friend using macOS and seeing a strange linker (ld) behavior resulting in some libraries not being linked to the executable, as can happen when the linker defaults to `--as-needed`. Turned out it was a problem related to running in a python virtual environment, so in the end nothing related to the linker itself. Thanks anyway for the help.

Offline

Board footer

Powered by FluxBB