[clang] [Driver] Have -rdynamic be a no-op on Haiku (PR #67872)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 29 19:14:23 PDT 2023
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
<details>
<summary>Changes</summary>
Do the same as the Haiku GCC patches.
https://github.com/haikuports/haikuports/commit/46afdec05771d126eb6cb6c3b3deb957604617c4
---
Full diff: https://github.com/llvm/llvm-project/pull/67872.diff
2 Files Affected:
- (modified) clang/lib/Driver/ToolChains/Haiku.cpp (+3-2)
- (modified) clang/test/Driver/haiku.c (+5)
``````````diff
diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp b/clang/lib/Driver/ToolChains/Haiku.cpp
index 33d71f030e51c51..0f8453ad861f9d3 100644
--- a/clang/lib/Driver/ToolChains/Haiku.cpp
+++ b/clang/lib/Driver/ToolChains/Haiku.cpp
@@ -42,6 +42,9 @@ void haiku::Linker::ConstructJob(Compilation &C, const JobAction &JA,
// Silence warning for "clang -pie foo.o -o foo"
Args.ClaimAllArgs(options::OPT_pie);
+ // -rdynamic is a no-op with Haiku. Claim argument to avoid warning.
+ Args.ClaimAllArgs(options::OPT_rdynamic);
+
if (!D.SysRoot.empty())
CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
@@ -49,8 +52,6 @@ void haiku::Linker::ConstructJob(Compilation &C, const JobAction &JA,
if (Static) {
CmdArgs.push_back("-Bstatic");
} else {
- if (Args.hasArg(options::OPT_rdynamic))
- CmdArgs.push_back("-export-dynamic");
if (Shared)
CmdArgs.push_back("-shared");
CmdArgs.push_back("--enable-new-dtags");
diff --git a/clang/test/Driver/haiku.c b/clang/test/Driver/haiku.c
index 021ab522be06e5c..9dcae3631b98925 100644
--- a/clang/test/Driver/haiku.c
+++ b/clang/test/Driver/haiku.c
@@ -56,6 +56,11 @@
// CHECK-LD-X86_64-SAME: {{^}} "[[SYSROOT]]/boot/system/develop/tools/lib/gcc/x86_64-unknown-haiku/13.2.0/crtendS.o"
// CHECK-LD-X86_64-SAME: {{^}} "[[SYSROOT]]/boot/system/develop/lib/crtn.o"
+// Check -rdynamic is a no-op
+// RUN: %clang -### -rdynamic %s 2>&1 --target=x86_64-unknown-haiku \
+// RUN: | FileCheck --check-prefix=CHECK-RDYNAMIC %s
+// CHECK-RDYNAMIC-NOT: "-export-dynamic"
+
// Check the right flags are present with -shared
// RUN: %clang -### %s -shared 2>&1 --target=x86_64-unknown-haiku \
// RUN: --gcc-toolchain="" \
``````````
</details>
https://github.com/llvm/llvm-project/pull/67872
More information about the cfe-commits
mailing list