summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/Makefile
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-08-03 22:07:50 +0200
committerAdam Borowski <kilobyte@angband.pl>2013-08-05 05:12:27 +0200
commit7b869e6c3305a8ee07a35d160962811379175a90 (patch)
tree5793af86ba9a16c552cf483bbcd26f46ef5d5ef1 /crawl-ref/source/Makefile
parent6f4baa5f3e9ce644e9ae81f2a46d84eb7c6b779a (diff)
downloadcrawl-ref-7b869e6c3305a8ee07a35d160962811379175a90.tar.gz
crawl-ref-7b869e6c3305a8ee07a35d160962811379175a90.zip
Use gold instead of bfd if possible.
In Debian, gold used to be the default linker when both were installed; after a recent upload of binutils this is no more. That's a big regression, as bfd is slower by a factor of 3-4 in most cases, and over 80 times when bfd's massive memory use makes it hit the swap. On the other hand, gold is now installed in the base binutils package, and can be switched to with -fuse-ld=gold. That's said to be the "upstream default". This syntax is not recognized by older gcc nor clang and thus has to be detected on runtime.
Diffstat (limited to 'crawl-ref/source/Makefile')
-rw-r--r--crawl-ref/source/Makefile4
1 files changed, 4 insertions, 0 deletions
diff --git a/crawl-ref/source/Makefile b/crawl-ref/source/Makefile
index 4428e0e975..e4b96c548f 100644
--- a/crawl-ref/source/Makefile
+++ b/crawl-ref/source/Makefile
@@ -963,6 +963,10 @@ CFWARN := -wd383,810,869,981,1418 -we14,193,304
CFWARN_L :=
endif
+ifeq (,$(shell echo 'int main(){return 1;}'|$(GXX) -x c++ - -o /dev/null -fuse-ld=gold 2>&1))
+ LDFLAGS += -fuse-ld=gold
+endif
+
LDFLAGS += $(CFOPTIMIZE) $(CFOPTIMIZE_L)
ifdef REPORT