From dba99b7155459440c6f48f9518b234b4df7d39fb Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Fri, 23 Nov 2018 08:41:39 +0100 Subject: [PATCH] Add and compile LLVM linker (LLD) This linker can cross-link for different architecure. Unfortunately, I haven't found a way how to tell clang to use this linker by default so one has to link manually by using the ld.lld command. --- .gitmodules | 3 +++ Makefile | 7 +++++-- lld | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) create mode 160000 lld diff --git a/.gitmodules b/.gitmodules index 30730ea..115792b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "HerculesCompiler"] path = HerculesCompiler url = https://iis-git.ee.ethz.ch/H2020-Compiler/HerculesCompiler-public +[submodule "lld"] + path = lld + url = https://github.com/llvm-mirror/lld diff --git a/Makefile b/Makefile index 7cf318e..96794c3 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,9 @@ build/bin/opt: build/build.ninja llvm/tools/clang: ln -s ../../clang $@ +llvm/tools/lld: + ln -s ../../lld $@ + llvm/projects/openmp: ln -s ../../openmp $@ @@ -60,11 +63,11 @@ libpremnotify: export CC=$(DEB_HOST_GNU_TYPE)-gcc-5 endif -build/build.ninja: | build llvm/tools/clang llvm/projects/openmp +build/build.ninja: | build llvm/tools/clang llvm/tools/lld llvm/projects/openmp cd $(@D) && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$(PREFIX)" \ -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_BACKTRACES=ON -DLLVM_ENABLE_WERROR=OFF \ -DBUILD_SHARED_LIBS=OFF -DLLVM_ENABLE_RTTI=ON $(LLVM_CROSS_FLAGS) \ - -DLLVM_ENABLE_LLD=ON \ + -DLLVM_ENABLE_LLD=ON -DLLVM_TOOL_LLD_BUILD=ON \ -DCMAKE_CXX_FLAGS='-DHERCULES_PASS_ROOT=\"$(PREFIX)/lib/hercules/src/passes/\" -DOPENMP_NVPTX_COMPUTE_CAPABILITY=62 $(if $(USE_GPUGUARD),-DUSE_GPUGUARD)' \ -DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITY="62" \ -G"Ninja" $(CURDIR)/llvm diff --git a/lld b/lld new file mode 160000 index 0000000..c97a502 --- /dev/null +++ b/lld @@ -0,0 +1 @@ +Subproject commit c97a5023afb2fe46956bc95818d924831ed1400f -- 2.39.2