Skip to content

Commit

Permalink
[Driver] Have -rdynamic be a no-op on Haiku (#67872)
Browse files Browse the repository at this point in the history
Do the same as the Haiku GCC patches.

haikuports/haikuports@46afdec
  • Loading branch information
brad0 committed Oct 12, 2023
1 parent ab6c3d5 commit 8da1e3d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions clang/lib/Driver/ToolChains/Haiku.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,16 @@ 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));

CmdArgs.push_back("--eh-frame-hdr");
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");
Expand Down
5 changes: 5 additions & 0 deletions clang/test/Driver/haiku.c
Original file line number Diff line number Diff line change
Expand Up @@ -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="" \
Expand Down

0 comments on commit 8da1e3d

Please sign in to comment.