[clang] [Driver] Add support for -export-dynamic which can match GCC behavior. (PR #72781)
dong jianqiang via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 18 20:42:43 PST 2023
https://github.com/dongjianqiang2 created https://github.com/llvm/llvm-project/pull/72781
clang splits -export-dynamic into "-e" and "xport-dynamic", and gets ld warning: cannot find entry symbol xport-dynamic; defaulting to XXXX, which is unexpected from user.
Adjust the driver to support -export-dynamic, which can match GCC behavior.
>From 4eb84135489b28f3b06085693dc79928b7b7e3ff Mon Sep 17 00:00:00 2001
From: Dong JianQiang <dongjianqiang2 at huawei.com>
Date: Sun, 19 Nov 2023 11:23:31 +0800
Subject: [PATCH] [Driver] Add support for -export-dynamic which can match GCC
behavior.
clang splits -export-dynamic into "-e" and "xport-dynamic", and gets
ld warning: cannot find entry symbol xport-dynamic; defaulting to XXXX,
which is unexpected from user.
Adjust the driver to support -export-dynamic, which can match GCC behavior.
---
clang/include/clang/Driver/Options.td | 1 +
clang/test/Driver/dynamic-linker.c | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index df12ba8fbcb296a..3bb764a1e46ab8a 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -1453,6 +1453,7 @@ def extract_api_ignores_EQ: CommaJoined<["--"], "extract-api-ignores=">,
HelpText<"Comma separated list of files containing a new line separated list of API symbols to ignore when extracting API information.">,
MarshallingInfoStringVector<FrontendOpts<"ExtractAPIIgnoresFileList">>;
def e : JoinedOrSeparate<["-"], "e">, Flags<[LinkerInput]>, Group<Link_Group>;
+def export_dynamic : Flag<["-"], "export-dynamic">, Flags<[LinkerInput]>, Group<Link_Group>;
def fmax_tokens_EQ : Joined<["-"], "fmax-tokens=">, Group<f_Group>,
Visibility<[ClangOption, CC1Option]>,
HelpText<"Max total number of preprocessed tokens for -Wmax-tokens.">,
diff --git a/clang/test/Driver/dynamic-linker.c b/clang/test/Driver/dynamic-linker.c
index 978907e0adee697..d202f537b44fb98 100644
--- a/clang/test/Driver/dynamic-linker.c
+++ b/clang/test/Driver/dynamic-linker.c
@@ -23,6 +23,12 @@
// RUN: %clang -target powerpc64-unknown-linux-gnu -### -static /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-STATIC %s
// RUN: %clang -target x86_64-unknown-linux-gnu -### -static /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-STATIC %s
+// RUN: %clang -target armv7-unknown-linux-gnueabi -### -export-dynamic /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-RDYNAMIC %s
+// RUN: %clang -target i386-unknown-linux-gnu -### -export-dynamic /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-RDYNAMIC %s
+// RUN: %clang -target mips64-unknown-linux-gnu -### -export-dynamic /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-RDYNAMIC %s
+// RUN: %clang -target powerpc64-unknown-linux-gnu -### -export-dynamic /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-RDYNAMIC %s
+// RUN: %clang -target x86_64-unknown-linux-gnu -### -export-dynamic /dev/null -o /dev/null 2>&1 | FileCheck -check-prefix CHECK-RDYNAMIC %s
+
// CHECK-SHARED: "-shared"
// CHECK-RDYNAMIC: "-export-dynamic"
// CHECK-STATIC: "-{{B?}}static"
More information about the cfe-commits
mailing list