Only pass -pie, -no-pie when linking
Previously, these flags were passed when both compiling and linking code. However, -pie and -no-pie are link-time only options. Usually, this does not cause issues, but when using Clang with -Werror set results in errors:
clang: error: argument unused during compilation: '-nopie' [-Werror,-Wunused-command-line-argument]
This is unused by Clang because this flag has no effect at compile time (it’s called -nopie internally by Clang but called -no-pie in GHC for compatibility with GCC). Just passing these flags at linking time resolves this.
Edited by matthewbauer