[clang] 8da1e3d - [Driver] Have -rdynamic be a no-op on Haiku (#67872)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 12 15:05:54 PDT 2023
Author: Brad Smith
Date: 2023-10-12T18:05:49-04:00
New Revision: 8da1e3dd24a1cc6bc99bf3334009d2d19f21018f
URL: https://github.com/llvm/llvm-project/commit/8da1e3dd24a1cc6bc99bf3334009d2d19f21018f
DIFF: https://github.com/llvm/llvm-project/commit/8da1e3dd24a1cc6bc99bf3334009d2d19f21018f.diff
LOG: [Driver] Have -rdynamic be a no-op on Haiku (#67872)
Do the same as the Haiku GCC patches.
https://github.com/haikuports/haikuports/commit/46afdec05771d126eb6cb6c3b3deb957604617c4
Added:
Modified:
clang/lib/Driver/ToolChains/Haiku.cpp
clang/test/Driver/haiku.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Haiku.cpp b/clang/lib/Driver/ToolChains/Haiku.cpp
index 1985fed9cf32a30..c2653a4a2022edf 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 3888c6732923228..965d3cf97bc36bf 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="" \
More information about the cfe-commits
mailing list