Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

[CSL-1002] Add lld linker for macOS #244

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 64 additions & 16 deletions cardano-sl.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,13 @@ library
-fno-warn-orphans
-O2

-- linker speed up for linux
-- linker speed up for linux and macOS
if os(linux)
ghc-options: -optl-fuse-ld=gold
ld-options: -fuse-ld=gold
if os(darwin)
ghc-options: "-pgmc clang" "-pgma clang" "-pgml clang" "-optl-fuse-ld=lld"
ld-options: -fuse-ld=lld
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we using lld in macOS because it doesn't have gold?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And also because it's actually faster than gold.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think lld is in a state where can be used on Mach-O, see my comment.
Also, it's not necessarily faster than gold. In many tests we run it goes from parity to 2x faster (in particular scenarios, e.g. when linking with debuginfo or with some options (e.g. -gdb-index). It's a safe claim to say that's generally at least as fast as gold.


default-extensions: DeriveDataTypeable
DeriveGeneric
Expand Down Expand Up @@ -580,10 +583,13 @@ executable cardano-node
-with-rtsopts=-N
-O2

-- linker speed up for linux
-- linker speed up for linux and macOS
if os(linux)
ghc-options: -optl-fuse-ld=gold
ld-options: -fuse-ld=gold
if os(darwin)
ghc-options: "-pgmc clang" "-pgma clang" "-pgml clang"
ld-options: -fuse-ld=lld

default-extensions: DeriveDataTypeable
DeriveGeneric
Expand Down Expand Up @@ -637,10 +643,13 @@ executable cardano-analyzer
-with-rtsopts=-N
-O2

-- linker speed up for linux
-- linker speed up for linux and macOS
if os(linux)
ghc-options: -optl-fuse-ld=gold
ld-options: -fuse-ld=gold
if os(darwin)
ghc-options: "-pgmc clang" "-pgma clang" "-pgml clang"
ld-options: -fuse-ld=lld

default-extensions: DeriveDataTypeable
DeriveGeneric
Expand Down Expand Up @@ -701,10 +710,13 @@ executable cardano-wallet
-with-rtsopts=-N
-O2

-- linker speed up for linux
-- linker speed up for linux and macOS
if os(linux)
ghc-options: -optl-fuse-ld=gold
ld-options: -fuse-ld=gold
if os(darwin)
ghc-options: "-pgmc clang" "-pgma clang" "-pgml clang"
ld-options: -fuse-ld=lld

default-extensions: DeriveDataTypeable
DeriveGeneric
Expand Down Expand Up @@ -754,10 +766,13 @@ executable cardano-wallet-hs2purs
-with-rtsopts=-N
-O2

-- linker speed up for linux
-- linker speed up for linux and macOS
if os(linux)
ghc-options: -optl-fuse-ld=gold
ld-options: -fuse-ld=gold
if os(darwin)
ghc-options: "-pgmc clang" "-pgma clang" "-pgml clang"
ld-options: -fuse-ld=lld

default-extensions: DeriveDataTypeable
DeriveGeneric
Expand Down Expand Up @@ -831,10 +846,13 @@ executable cardano-smart-generator
-with-rtsopts=-N
-O2

-- linker speed up for linux
-- linker speed up for linux and macOS
if os(linux)
ghc-options: -optl-fuse-ld=gold
ld-options: -fuse-ld=gold
if os(darwin)
ghc-options: "-pgmc clang" "-pgma clang" "-pgml clang"
ld-options: -fuse-ld=lld

default-extensions: DeriveDataTypeable
DeriveGeneric
Expand Down Expand Up @@ -897,10 +915,13 @@ executable cardano-dht-keygen
-with-rtsopts=-N
-O2

-- linker speed up for linux
-- linker speed up for linux and macOS
if os(linux)
ghc-options: -optl-fuse-ld=gold
ld-options: -fuse-ld=gold
if os(darwin)
ghc-options: "-pgmc clang" "-pgma clang" "-pgml clang"
ld-options: -fuse-ld=lld

default-extensions: DeriveDataTypeable
DeriveGeneric
Expand Down Expand Up @@ -937,10 +958,13 @@ executable cardano-web-docs
-with-rtsopts=-N
-O2

-- linker speed ups for linux
-- linker speed ups for linux and macOS
if os(linux)
ghc-options: -optl-fuse-ld=gold
ld-options: -fuse-ld=gold
if os(darwin)
ghc-options: "-pgmc clang" "-pgma clang" "-pgml clang"
ld-options: -fuse-ld=lld

default-extensions: DeriveDataTypeable
DeriveGeneric
Expand Down Expand Up @@ -984,10 +1008,13 @@ executable cardano-wallet-web-docs
-with-rtsopts=-N
-O2

-- linker speed up for linux
-- linker speed up for linux and macOS
if os(linux)
ghc-options: -optl-fuse-ld=gold
ld-options: -fuse-ld=gold
if os(darwin)
ghc-options: "-pgmc clang" "-pgma clang" "-pgml clang"
ld-options: -fuse-ld=lld

default-extensions: DeriveDataTypeable
DeriveGeneric
Expand Down Expand Up @@ -1036,10 +1063,13 @@ executable cardano-wallet-web-api-swagger
-with-rtsopts=-N
-O2

-- linker speed up for linux
-- linker speed up for linux and macOS
if os(linux)
ghc-options: -optl-fuse-ld=gold
ld-options: -fuse-ld=gold
if os(darwin)
ghc-options: "-pgmc clang" "-pgma clang" "-pgml clang"
ld-options: -fuse-ld=lld

default-extensions: NoImplicitPrelude
build-tools: cpphs >= 1.19
Expand All @@ -1058,10 +1088,13 @@ executable cardano-checks
-Wall
-O2

-- linker speed up for linux
-- linker speed up for linux and macOS
if os(linux)
ghc-options: -optl-fuse-ld=gold
ld-options: -fuse-ld=gold
if os(darwin)
ghc-options: "-pgmc clang" "-pgma clang" "-pgml clang"
ld-options: -fuse-ld=lld

default-extensions: OverloadedStrings

Expand All @@ -1082,10 +1115,13 @@ executable cardano-genupdate
-Wall
-O2

-- linker speed up for linux
-- linker speed up for linux and macOS
if os(linux)
ghc-options: -optl-fuse-ld=gold
ld-options: -fuse-ld=gold
if os(darwin)
ghc-options: "-pgmc clang" "-pgma clang" "-pgml clang"
ld-options: -fuse-ld=lld

default-extensions: OverloadedStrings
NoImplicitPrelude
Expand Down Expand Up @@ -1122,10 +1158,13 @@ executable cardano-keygen
-with-rtsopts=-N
-O2

-- linker speed up for linux
-- linker speed up for linux and macOS
if os(linux)
ghc-options: -optl-fuse-ld=gold
ld-options: -fuse-ld=gold
if os(darwin)
ghc-options: "-pgmc clang" "-pgma clang" "-pgml clang"
ld-options: -fuse-ld=lld

default-extensions: DeriveDataTypeable
DeriveGeneric
Expand Down Expand Up @@ -1169,10 +1208,13 @@ executable cardano-launcher
-Wall
-O2

-- linker speed up for linux
-- linker speed up for linux and macOS
if os(linux)
ghc-options: -optl-fuse-ld=gold
ld-options: -fuse-ld=gold
if os(darwin)
ghc-options: "-pgmc clang" "-pgma clang" "-pgml clang"
ld-options: -fuse-ld=lld

default-extensions: OverloadedStrings
RecordWildCards
Expand Down Expand Up @@ -1260,10 +1302,13 @@ test-suite cardano-test
-fno-warn-orphans
-with-rtsopts=-N

-- linker speed up for linux
-- linker speed up for linux and macOS
if os(linux)
ghc-options: -optl-fuse-ld=gold
ld-options: -fuse-ld=gold
if os(darwin)
ghc-options: "-pgmc clang" "-pgma clang" "-pgml clang"
ld-options: -fuse-ld=lld

default-extensions: DeriveDataTypeable
DeriveGeneric
Expand Down Expand Up @@ -1316,10 +1361,13 @@ benchmark cardano-bench-criterion
-fno-warn-orphans
-O2

-- linker speed up for linux
-- linker speed up for linux and macOS
if os(linux)
ghc-options: -optl-fuse-ld=gold
ld-options: -fuse-ld=gold
if os(darwin)
ghc-options: "-pgmc clang" "-pgma clang" "-pgml clang"
ld-options: -fuse-ld=lld

default-extensions: DeriveDataTypeable
DeriveGeneric
Expand Down