Skip to content

Commit 8da1e3d

Browse files
authored
[Driver] Have -rdynamic be a no-op on Haiku (#67872)
Do the same as the Haiku GCC patches. haikuports/haikuports@46afdec
1 parent ab6c3d5 commit 8da1e3d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

clang/lib/Driver/ToolChains/Haiku.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,16 @@ void haiku::Linker::ConstructJob(Compilation &C, const JobAction &JA,
4242
// Silence warning for "clang -pie foo.o -o foo"
4343
Args.ClaimAllArgs(options::OPT_pie);
4444

45+
// -rdynamic is a no-op with Haiku. Claim argument to avoid warning.
46+
Args.ClaimAllArgs(options::OPT_rdynamic);
47+
4548
if (!D.SysRoot.empty())
4649
CmdArgs.push_back(Args.MakeArgString("--sysroot=" + D.SysRoot));
4750

4851
CmdArgs.push_back("--eh-frame-hdr");
4952
if (Static) {
5053
CmdArgs.push_back("-Bstatic");
5154
} else {
52-
if (Args.hasArg(options::OPT_rdynamic))
53-
CmdArgs.push_back("-export-dynamic");
5455
if (Shared)
5556
CmdArgs.push_back("-shared");
5657
CmdArgs.push_back("--enable-new-dtags");

clang/test/Driver/haiku.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@
5656
// CHECK-LD-X86_64-SAME: {{^}} "[[SYSROOT]]/boot/system/develop/tools/lib/gcc/x86_64-unknown-haiku/13.2.0/crtendS.o"
5757
// CHECK-LD-X86_64-SAME: {{^}} "[[SYSROOT]]/boot/system/develop/lib/crtn.o"
5858

59+
// Check -rdynamic is a no-op
60+
// RUN: %clang -### -rdynamic %s 2>&1 --target=x86_64-unknown-haiku \
61+
// RUN: | FileCheck --check-prefix=CHECK-RDYNAMIC %s
62+
// CHECK-RDYNAMIC-NOT: "-export-dynamic"
63+
5964
// Check the right flags are present with -shared
6065
// RUN: %clang -### %s -shared 2>&1 --target=x86_64-unknown-haiku \
6166
// RUN: --gcc-toolchain="" \

0 commit comments

Comments
 (0)