[clang] 18b6e21 - [Driver] Replace usage of -Bshareable linker flag with -shared (#65842)

via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 10 01:36:02 PDT 2023


Author: Brad Smith
Date: 2023-09-10T04:35:58-04:00
New Revision: 18b6e2139ff8520bb33c3057ae6794a4cf6822e9

URL: https://github.com/llvm/llvm-project/commit/18b6e2139ff8520bb33c3057ae6794a4cf6822e9
DIFF: https://github.com/llvm/llvm-project/commit/18b6e2139ff8520bb33c3057ae6794a4cf6822e9.diff

LOG: [Driver] Replace usage of -Bshareable linker flag with -shared (#65842)

The two flags mean the same thing for the bfd / lld linkers so just use
the same flag consistently everywhere.

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/DragonFly.cpp
    clang/lib/Driver/ToolChains/FreeBSD.cpp
    clang/lib/Driver/ToolChains/NetBSD.cpp
    clang/test/Driver/freebsd.c
    clang/test/Driver/netbsd.c

Removed: 
    


################################################################################
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/freebsd.c b/clang/test/Driver/freebsd.c
index 28a888fedf3fe18..8ac0cb011638a8a 100644
--- a/clang/test/Driver/freebsd.c
+++ b/clang/test/Driver/freebsd.c
@@ -128,6 +128,7 @@
 // RUN: %clang --target=x86_64-pc-freebsd -shared %s \
 // RUN:   --sysroot=%S/Inputs/multiarch_freebsd64_tree -### 2>&1 \
 // RUN:   | FileCheck --check-prefix=CHECK-SHARED %s
+// CHECK-SHARED: ld{{.*}}" "--eh-frame-hdr" "-shared"
 // CHECK-SHARED: crti.o
 // CHECK-SHARED: crtbeginS.o
 

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