gold-linker

Is it possible to compile & link Clang/LLVM using the gold linker?

半腔热情 提交于 2020-01-24 05:42:05
问题 I'm writing a custom pass for LLVM/Clang, and recompiling tends to take a while and use a lot of memory. I've heard that the gold linker (1) takes less time and (2) uses less memory than the standard ld linker. Is there a way to pass flags into the LLVM/Clang build process and change to the gold linker? As per this answer, I've been attempting to use an override file, but I don't seem to be having a lot of success. I'll also note that I'm compiling the latest Clang/LLVM build (4.0) using

Clang build is extremely slow and hangs up in the middle

▼魔方 西西 提交于 2020-01-05 07:13:29
问题 I am getting started with writing my own clang tools. These are the steps I have followed so far: Checked out llvm 7.0 release build Checked out clang 7.0 release build Built clang and llvm using ninja with following flags (It was hanging up on me constantly without these) -DLLVM_USE_LINKER=gold -DLLVM_PARALLEL_LINK_JOBS=1 -DLLVM_LINK_LLVM_DYLIB=true -DLLVM_USE_SPLIT_DWARF=ON -DBUILD_SHARED_LIBS=ON Installed clang Now I want to set clang as it's own compiler. So I have set these flags in

Generate LLVM IR for httpd

六月ゝ 毕业季﹏ 提交于 2019-12-24 12:21:42
问题 I am trying to compile apache2 with LLVM, to generate final binaries in LLVM IR. I used flto option in compiling and linking and passed "also-emit-llvm" to the linker through clang. It seems to work for most steps, however I had two concerns 1) Earlier I used LLVM 3.6, whose gold plugin doesn't accept also-emit-llvm, but has emit-llvm only, basically it will emit only elf or llvm. Which the Autotools build system doesn't like. The configure and make script want binaries, while I want llvm.

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

Replacing ld with gold - any experience?

本秂侑毒 提交于 2019-12-17 05:41:11
问题 Has anyone tried to use gold instead of ld ? gold promises to be much faster than ld , so it may help speeding up test cycles for large C++ applications, but can it be used as drop-in replacement for ld? Can gcc / g++ directly call gold .? Are there any know bugs or problems? Although gold is part of the GNU binutils since a while, I have found almost no "success stories" or even "Howtos" in the Web. ( Update: added links to gold and blog entry explaining it ) 回答1: At the moment it is

-fsanitize not using gold linker in GCC-6.1

穿精又带淫゛_ 提交于 2019-12-04 09:03:06
问题 Update (30-Sept-2016) The Ubuntu build of gcc-6.2 ((Ubuntu 6.2.0-3ubuntu11~16.04) 6.2.0 20160901) no longer has this issue. I'm using the Ubuntu build of gcc-6.1[1] ((Ubuntu 6.1.1-3ubuntu11~14.04.1) 6.1.1 20160511), GNU binutils 2.24, and libstdc++ with GLIBCXX_3.4.22 support. Even on a simple "hello world" program, specifying a sanitizer is not forcing use of the gold linker. main.cpp #include <iostream> int main() { std::cout << "Hello, world!\n"; } Compiling and linking g++ -fsanitize

How to link with the GNU gold linker instead of ld in Haskell

拟墨画扇 提交于 2019-12-03 18:32:32
问题 My Haskell project spends lots of time in Linking dist/build/myapp/myapp ... and also in loading shared libraries when executing TemplateHaskell code. I suspect this is because ld is slow. How can I improve link times by switching to the gold linker? 回答1: Link 3x faster with gold Since GHC 7.8, you can tell GHC and cabal (at run time without having to recompile GHC) to link with GNU gold. You need in your .cabal file: library: ghc-options: -optl-fuse-ld=gold ld-options: -fuse-ld=gold

-fsanitize not using gold linker in GCC-6.1

末鹿安然 提交于 2019-12-03 01:46:48
Update (30-Sept-2016) The Ubuntu build of gcc-6.2 ((Ubuntu 6.2.0-3ubuntu11~16.04) 6.2.0 20160901) no longer has this issue. I'm using the Ubuntu build of gcc-6.1[1] ((Ubuntu 6.1.1-3ubuntu11~14.04.1) 6.1.1 20160511), GNU binutils 2.24, and libstdc++ with GLIBCXX_3.4.22 support. Even on a simple "hello world" program, specifying a sanitizer is not forcing use of the gold linker. main.cpp #include <iostream> int main() { std::cout << "Hello, world!\n"; } Compiling and linking g++ -fsanitize=address -c -o main main.cpp g++ -fsanitize=address -o main main.o gives the error /usr/bin/ld: unrecognized

Is binary linked with gold linker running faster?

不问归期 提交于 2019-12-02 07:03:26
问题 Running simulation code using GEANT4 (large Monte Carlo C++ simulation framework, lots of shared libraries). Compiled and linked GEANT and my app with gold linker and with standard BFD based linker. Looks like gold one is running a bit faster (1'47" vs 1'51"). Could someone shed a light what would be the reason for the difference? Ubuntu 15.04, 64bit, GCC 4.9.2. Run each test about 10 times, lowest time taken, no other activity, one terminal. 回答1: Naturally, different linkers will produce

static link stdc++ without STB_GNU_UNIQUE cause memory leak when dlclose

送分小仙女□ 提交于 2019-12-02 03:32:49
问题 I have to make a dso that static link stdc++ and need can unload from memory dynamic. So I tried with compile gcc with --disable-gnu-unique-object and use gold link with -Wl,--no-gnu-unique options. But both contains memory leak issue even I do nothing except call dlopen() dlclose() in main. The test code like: int main() { for(int i=0;i<1000;i++) { void * h=dlopen(filepath); if(h) dlclose(h); } return 0; } Than I checked the memory cat /proc/pid/maps before and after I found only heap