[flang-commits] [clang] [flang] [Flang, Clang] Enable and test 'rdynamic' flag (PR #75598)

via flang-commits flang-commits at lists.llvm.org
Fri Dec 15 04:37:28 PST 2023


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Radu Salavat (Radu2k)

<details>
<summary>Changes</summary>

Enable and test 'rdynamic' flag

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


2 Files Affected:

- (modified) clang/include/clang/Driver/Options.td (+2-1) 
- (added) flang/test/Driver/rdynamic-check.f90 (+10) 


``````````diff
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 1b02087425b751..9678165bfd98e8 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5308,7 +5308,8 @@ def rewrite_objc : Flag<["-"], "rewrite-objc">, Flags<[NoXarchOption]>,
 def rewrite_legacy_objc : Flag<["-"], "rewrite-legacy-objc">,
   Flags<[NoXarchOption]>,
   HelpText<"Rewrite Legacy Objective-C source to C++">;
-def rdynamic : Flag<["-"], "rdynamic">, Group<Link_Group>;
+def rdynamic : Flag<["-"], "rdynamic">, Group<Link_Group>,
+  Visibility<[ClangOption, FlangOption]>;
 def resource_dir : Separate<["-"], "resource-dir">,
   Flags<[NoXarchOption, HelpHidden]>,
   Visibility<[ClangOption, CC1Option, CLOption, DXCOption]>,
diff --git a/flang/test/Driver/rdynamic-check.f90 b/flang/test/Driver/rdynamic-check.f90
new file mode 100644
index 00000000000000..6892d8ac67f212
--- /dev/null
+++ b/flang/test/Driver/rdynamic-check.f90
@@ -0,0 +1,10 @@
+! Verify that rdynamic flag adds -export-dynamic flag and passes it on to the linker.
+
+! RUN: %flang -### --target=x86_64-linux-gnu -rdynamic %s 2>&1 | FileCheck --check-prefixes=GNU-LINKER-OPTIONS %s
+! RUN: %flang -### --target=aarch64-linux-none -rdynamic %s 2>&1 | FileCheck --check-prefixes=AARCH-LINKER-OPTIONS %s
+
+! GNU-LINKER-OPTIONS: "{{.*}}ld"
+! GNU-LINKER-OPTIONS-SAME: "-export-dynamic"
+
+! AARCH-LINKER-OPTIONS: "{{.*}}ld"
+! AARCH-LINKER-OPTIONS-SAME: "-export-dynamic"

``````````

</details>


https://github.com/llvm/llvm-project/pull/75598


More information about the flang-commits mailing list