Don't pass -pie to linker on windows targets.

This commit is contained in:
Luqman Aden 2021-05-18 03:57:53 -07:00
parent e0d5872503
commit ac5fd90d82

View File

@ -281,8 +281,11 @@ impl<'a> Linker for GccLinker<'a> {
} }
} }
LinkOutputKind::DynamicPicExe => { LinkOutputKind::DynamicPicExe => {
// `-pie` works for both gcc wrapper and ld. // noop on windows w/ gcc & ld, error w/ lld
self.cmd.arg("-pie"); if !self.sess.target.is_like_windows {
// `-pie` works for both gcc wrapper and ld.
self.cmd.arg("-pie");
}
} }
LinkOutputKind::StaticNoPicExe => { LinkOutputKind::StaticNoPicExe => {
// `-static` works for both gcc wrapper and ld. // `-static` works for both gcc wrapper and ld.