Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang] -rdynamic option #72089

Closed
wants to merge 1 commit into from
Closed

[clang] -rdynamic option #72089

wants to merge 1 commit into from

Conversation

ghost
Copy link

@ghost ghost commented Nov 13, 2023

-rdynamic option should not use with -static, as shown in the following code

if (IsStatic) {
CmdArgs.push_back("-static");
} else {
if (Args.hasArg(options::OPT_rdynamic))
CmdArgs.push_back("-export-dynamic");
if (!Args.hasArg(options::OPT_shared) && !IsStaticPIE &&
!Args.hasArg(options::OPT_r)) {
CmdArgs.push_back("-dynamic-linker");
CmdArgs.push_back(Args.MakeArgString(Twine(D.DyldPrefix) +
ToolChain.getDynamicLinker(Args)));
}
}

So I think the code in line 420-421 should be deleted.

if (Args.hasArg(options::OPT_rdynamic))
CmdArgs.push_back("-export-dynamic");

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Nov 13, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Nov 13, 2023

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-driver

Author: None (ls-Mou)

Changes

-rdynamic option should not use with -static, as shown in the following code

if (IsStatic) {
CmdArgs.push_back("-static");
} else {
if (Args.hasArg(options::OPT_rdynamic))
CmdArgs.push_back("-export-dynamic");
if (!Args.hasArg(options::OPT_shared) && !IsStaticPIE &&
!Args.hasArg(options::OPT_r)) {
CmdArgs.push_back("-dynamic-linker");
CmdArgs.push_back(Args.MakeArgString(Twine(D.DyldPrefix) +
ToolChain.getDynamicLinker(Args)));
}
}

So I think the code in line 420-421 should be deleted.

if (Args.hasArg(options::OPT_rdynamic))
CmdArgs.push_back("-export-dynamic");


Full diff: https://github.com/llvm/llvm-project/pull/72089.diff

1 Files Affected:

  • (modified) clang/lib/Driver/ToolChains/Gnu.cpp (-3)
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index 19dff4ec4d45e08..6c0041279de5a27 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -417,9 +417,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
     CmdArgs.push_back("text");
   }
 
-  if (Args.hasArg(options::OPT_rdynamic))
-    CmdArgs.push_back("-export-dynamic");
-
   if (Args.hasArg(options::OPT_s))
     CmdArgs.push_back("-s");
 

-rdynamic option should not use with -static
@ghost ghost closed this Nov 16, 2023
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants