[lld] [LLD] [MinGW] Ignore the -rpath option (PR #102886)
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 12 05:07:29 PDT 2024
https://github.com/mstorsjo created https://github.com/llvm/llvm-project/pull/102886
GNU ld silently accepts the -rpath option for Windows targets, as a no-op.
This has lead to some build systems (and users) passing this option while building for Windows/MinGW, even if Windows doesn't have any concept like rpath.
Older versions of Conan did include -rpath in the pkg-config files it generated, see e.g.
https://github.com/conan-io/conan/blob/17c58f0c61931f9de218ac571cd97a8e0befa68e/conans/client/generators/pkg_config.py#L104-L114 and
https://github.com/conan-io/conan/blob/17c58f0c61931f9de218ac571cd97a8e0befa68e/conans/client/build/compiler_flags.py#L26-L34 - and see https://github.com/mstorsjo/llvm-mingw/issues/300 for user reports about this issue.
Silently ignore the option in LLD for MinGW targets, to improve drop-in compatibility compared to GNU ld.
>From fc3106c24a2be7e719b615e88e7f9a2f4aa03038 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <martin at martin.st>
Date: Mon, 12 Aug 2024 14:59:39 +0300
Subject: [PATCH] [LLD] [MinGW] Ignore the -rpath option
GNU ld silently accepts the -rpath option for Windows targets,
as a no-op.
This has lead to some build systems (and users) passing this
option while building for Windows/MinGW, even if Windows doesn't
have any concept like rpath.
Older versions of Conan did include -rpath in the pkg-config
files it generated, see e.g.
https://github.com/conan-io/conan/blob/17c58f0c61931f9de218ac571cd97a8e0befa68e/conans/client/generators/pkg_config.py#L104-L114
and
https://github.com/conan-io/conan/blob/17c58f0c61931f9de218ac571cd97a8e0befa68e/conans/client/build/compiler_flags.py#L26-L34
- and see https://github.com/mstorsjo/llvm-mingw/issues/300
for user reports about this issue.
Silently ignore the option in LLD for MinGW targets, to improve
drop-in compatibility compared to GNU ld.
---
lld/MinGW/Options.td | 1 +
1 file changed, 1 insertion(+)
diff --git a/lld/MinGW/Options.td b/lld/MinGW/Options.td
index 56f67e3dd96c42..1d2e03cbae9393 100644
--- a/lld/MinGW/Options.td
+++ b/lld/MinGW/Options.td
@@ -239,6 +239,7 @@ defm: EqNoHelp<"minor-image-version">;
def: F<"no-undefined">;
def: F<"pic-executable">;
defm: EqNoHelp<"plugin">;
+defm: EqNoHelp<"rpath">;
defm: EqNoHelp<"sysroot">;
def: F<"sort-common">;
def: F<"start-group">;
More information about the llvm-commits
mailing list