lld

Emitting a single IR bitcode File with LLVM LLD using CMake

强颜欢笑 提交于 2021-02-08 05:14:44
问题 I'm using Ubuntu 16.04 x86_64 and LLVM 5.0 and would like to compile a project to a single LLVM IR bitcode file using CMake. I know there is a way to do this using the GOLD Linker with the LLVM Plugin and add the CMake linker flags " -fuse-ld=gold -Wl,-plugin-opt=emit-llvm " and the CXX flag " -flto ". But when I try to compile the project with the LLVM LLD linker and the " -fuse-ld=lld -Wl,-plugin-opt=emit-llvm " respectively " -flto " Flag, the linker is generating a native executable and

Using -fuse-ld=lld with Clang on macOS

元气小坏坏 提交于 2021-01-27 16:43:40
问题 I am using Clang 10 (not AppleClang) on macOS 10.15 and am trying to link with LLD by specifying -fuse-ld=lld in the CMake flags CMAKE_EXE_LINKER_FLAGS . However, I am getting the following error when I try to use LLD: The C++ compiler "/Users/XXX/llvm/bin/clang++" is not able to compile a simple test program. It fails with the following output: ld64.lld: warning: ignoring unknown argument: -platform_version ld64.lld: warning: ignoring unknown argument: -search_paths_first ld64.lld: warning:

Using -fuse-ld=lld with Clang on macOS

£可爱£侵袭症+ 提交于 2021-01-27 16:41:27
问题 I am using Clang 10 (not AppleClang) on macOS 10.15 and am trying to link with LLD by specifying -fuse-ld=lld in the CMake flags CMAKE_EXE_LINKER_FLAGS . However, I am getting the following error when I try to use LLD: The C++ compiler "/Users/XXX/llvm/bin/clang++" is not able to compile a simple test program. It fails with the following output: ld64.lld: warning: ignoring unknown argument: -platform_version ld64.lld: warning: ignoring unknown argument: -search_paths_first ld64.lld: warning:

How do I change the default rustc / Cargo linker?

假如想象 提交于 2020-12-26 05:51:54
问题 I would like to make rustc use lld as a linker instead of ld in a particular crate. So I create .cargo/config in my project directory with the following: [target.x86_64-unknown-linux-gnu] linker = "ld.lld" Which leads to linker errors: $ cargo build ... = note: ld.lld: error: unable to find library -ldl ld.lld: error: unable to find library -lrt ld.lld: error: unable to find library -lpthread ld.lld: error: unable to find library -lgcc_s ld.lld: error: unable to find library -lc ld.lld: error

How do I change the default rustc / Cargo linker?

邮差的信 提交于 2020-12-26 05:51:05
问题 I would like to make rustc use lld as a linker instead of ld in a particular crate. So I create .cargo/config in my project directory with the following: [target.x86_64-unknown-linux-gnu] linker = "ld.lld" Which leads to linker errors: $ cargo build ... = note: ld.lld: error: unable to find library -ldl ld.lld: error: unable to find library -lrt ld.lld: error: unable to find library -lpthread ld.lld: error: unable to find library -lgcc_s ld.lld: error: unable to find library -lc ld.lld: error

Unable to link C runtime library (libcmt.lib) using lld-link.exe (Windows)

江枫思渺然 提交于 2020-08-08 04:29:05
问题 I'm writing a language using LLVM. I'd like to avoid having to package clang and simply use the LLVM tools (ex. lld, lld-link). I've been trying to invoke the printf function from my simple IR code ( testinput.ll ): ; ModuleID = 'Test2' source_filename = "entry" @str_0 = private unnamed_addr constant [13 x i8] c"Hello world!\00" declare i32 @printf(i8*, ...) define i32 @main() { entry: %anonymous_10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @str_0, i32 0,

Is the lld linker a drop-in replacement for ld and gold?

不羁岁月 提交于 2019-12-23 07:07:13
问题 The linker from the LLVM project lld is currently developed with new features added week by week. Its developers promise that lld is faster than ld . How does it compete compared to gold ? Is lld a drop-in replacement for ld ? With gold there are some hoops to jump through. 回答1: One of the LLD developers, Rui Ueyama, looks back at the progress LLD did in 2016, see http://lists.llvm.org/pipermail/llvm-dev/2016-December/107981.html. "Now I'm pretty sure that that [LLD] is going to be a serious

Is the lld linker a drop-in replacement for ld and gold?

百般思念 提交于 2019-12-23 07:07:06
问题 The linker from the LLVM project lld is currently developed with new features added week by week. Its developers promise that lld is faster than ld . How does it compete compared to gold ? Is lld a drop-in replacement for ld ? With gold there are some hoops to jump through. 回答1: One of the LLD developers, Rui Ueyama, looks back at the progress LLD did in 2016, see http://lists.llvm.org/pipermail/llvm-dev/2016-December/107981.html. "Now I'm pretty sure that that [LLD] is going to be a serious

What's the difference between `-rpath-link` and `-L`?

余生颓废 提交于 2019-12-20 09:20:32
问题 The man for gold states: -L DIR, --library-path DIR Add directory to search path --rpath-link DIR Add DIR to link time shared library search path The man for bfd ld makes it sort of sound like -rpath-link is used for recursively included sos. ld.lld doesn't even list it as an argument. Could somebody clarify this situation for me? 回答1: Here is a demo, for GNU ld , of the difference between -L and -rpath-link - and for good measure, the difference between -rpath-link and -rpath . foo.c