[clang] [Driver] Replace usage of -Bshareable linker flag with -shared (PR #65842)
Brad Smith via cfe-commits
cfe-commits at lists.llvm.org
Sat Sep 9 00:47:44 PDT 2023
https://github.com/brad0 created https://github.com/llvm/llvm-project/pull/65842:
The two flags mean the same thing for the bfd / lld linkers so just use the same flag consistently everywhere.
>From 42f0ede652ebf38cb21fb07549e3dfcbbd43f3d1 Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Sat, 9 Sep 2023 03:43:57 -0400
Subject: [PATCH] [Driver] Replace usage of -Bshareable linker flag with
-shared
The two flags mean the same thing for the bfd / lld linkers so just
use the same flag consistently everywhere.
---
clang/lib/Driver/ToolChains/DragonFly.cpp | 2 +-
clang/lib/Driver/ToolChains/FreeBSD.cpp | 2 +-
clang/lib/Driver/ToolChains/NetBSD.cpp | 2 +-
clang/test/Driver/netbsd.c | 12 ++++++------
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/clang/lib/Driver/ToolChains/DragonFly.cpp b/clang/lib/Driver/ToolChains/DragonFly.cpp
index 6f46864105e9c0c..900be9e305c902a 100644
--- a/clang/lib/Driver/ToolChains/DragonFly.cpp
+++ b/clang/lib/Driver/ToolChains/DragonFly.cpp
@@ -69,7 +69,7 @@ void dragonfly::Linker::ConstructJob(Compilation &C, const JobAction &JA,
if (Args.hasArg(options::OPT_rdynamic))
CmdArgs.push_back("-export-dynamic");
if (Args.hasArg(options::OPT_shared))
- CmdArgs.push_back("-Bshareable");
+ CmdArgs.push_back("-shared");
else if (!Args.hasArg(options::OPT_r)) {
CmdArgs.push_back("-dynamic-linker");
CmdArgs.push_back("/usr/libexec/ld-elf.so.2");
diff --git a/clang/lib/Driver/ToolChains/FreeBSD.cpp b/clang/lib/Driver/ToolChains/FreeBSD.cpp
index b6e025aac29b046..4c46861bbbd74ef 100644
--- a/clang/lib/Driver/ToolChains/FreeBSD.cpp
+++ b/clang/lib/Driver/ToolChains/FreeBSD.cpp
@@ -161,7 +161,7 @@ void freebsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
if (Args.hasArg(options::OPT_rdynamic))
CmdArgs.push_back("-export-dynamic");
if (Args.hasArg(options::OPT_shared)) {
- CmdArgs.push_back("-Bshareable");
+ CmdArgs.push_back("-shared");
} else if (!Args.hasArg(options::OPT_r)) {
CmdArgs.push_back("-dynamic-linker");
CmdArgs.push_back("/libexec/ld-elf.so.1");
diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp b/clang/lib/Driver/ToolChains/NetBSD.cpp
index ceabb06c14105b3..1ec8f1b7da4c662 100644
--- a/clang/lib/Driver/ToolChains/NetBSD.cpp
+++ b/clang/lib/Driver/ToolChains/NetBSD.cpp
@@ -139,7 +139,7 @@ void netbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
if (Args.hasArg(options::OPT_rdynamic))
CmdArgs.push_back("-export-dynamic");
if (Args.hasArg(options::OPT_shared)) {
- CmdArgs.push_back("-Bshareable");
+ CmdArgs.push_back("-shared");
} else if (!Args.hasArg(options::OPT_r)) {
Args.AddAllArgs(CmdArgs, options::OPT_pie);
CmdArgs.push_back("-dynamic-linker");
diff --git a/clang/test/Driver/netbsd.c b/clang/test/Driver/netbsd.c
index 4daa35a4a7f94fc..67c048c6e91515f 100644
--- a/clang/test/Driver/netbsd.c
+++ b/clang/test/Driver/netbsd.c
@@ -116,20 +116,20 @@
// STATIC: ld{{.*}}" "--eh-frame-hdr"
// STATIC-NOT: "-pie"
-// STATIC-NOT: "-Bshareable"
+// STATIC-NOT: "-shared"
// STATIC: "-dynamic-linker" "/libexec/ld.elf_so"
// STATIC-NOT: "-pie"
-// STATIC-NOT: "-Bshareable"
+// STATIC-NOT: "-shared"
// STATIC: "{{.*}}/usr/lib{{/|\\\\}}crt0.o"
// STATIC: "{{.*}}/usr/lib{{/|\\\\}}crti.o" "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o"
// STATIC: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
// STATIC-PIE: ld{{.*}}" "--eh-frame-hdr"
// STATIC-PIE-NOT: "-dynamic-linker" "/libexec/ld.elf_so"
-// STATIC-PIE-NOT: "-Bshareable"
+// STATIC-PIE-NOT: "-shared"
// STATIC-PIE: "-pie"
// STATIC-PIE-NOT: "-dynamic-linker" "/libexec/ld.elf_so"
-// STATIC-PIE-NOT: "-Bshareable"
+// STATIC-PIE-NOT: "-shared"
// STATIC-PIE: "{{.*}}/usr/lib{{/|\\\\}}crt0.o"
// STATIC-PIE: "{{.*}}/usr/lib{{/|\\\\}}crti.o" "{{.*}}/usr/lib{{/|\\\\}}crtbeginS.o"
// STATIC-PIE: "{{.*}}/usr/lib{{/|\\\\}}crtendS.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
@@ -142,9 +142,9 @@
// SHARED: "{{.*}}/usr/lib{{/|\\\\}}crtendS.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
// PIE: ld{{.*}}" "--eh-frame-hdr"
-// PIE-NOT: "-Bshareable"
+// PIE-NOT: "-shared"
// PIE: "-pie" "-dynamic-linker" "/libexec/ld.elf_so"
-// PIE-NOT: "-Bshareable"
+// PIE-NOT: "-shared"
// PIE: "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
// PIE: "{{.*}}/usr/lib{{/|\\\\}}crtbeginS.o"
// PIE: "{{.*}}/usr/lib{{/|\\\\}}crtendS.o"
More information about the cfe-commits
mailing list