Skip to content

Commit a5dc9c9

Browse files
committed
[Driver] Don't pass --dynamic-linker to ld on Solaris
I noticed that clang currently passes --dynamic-linker to ld. This has been the case since Solaris 11 support was added initially back in 2012 by David Chisnall (r150580). I couldn't find any patch submission, let alone a justification, for this, and it seems completely useless: --dynamic-linker is a gld compatibility form of the option, the native option being -I. First of all, however, the dynamic linker passed is simply the default, so there's no reason at all to specify it in the first place. This patch removes passing the option and adjusts the affected testcase accordingly. Tested on x86_64-pc-solaris2.11 and sparcv9-sun-solaris2.11. Differential Revision: https://reviews.llvm.org/D64493 llvm-svn: 366202
1 parent 971ac4c commit a5dc9c9

File tree

6 files changed

+0
-8
lines changed

6 files changed

+0
-8
lines changed

clang/lib/Driver/ToolChains/Solaris.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ void solaris::Linker::ConstructJob(Compilation &C, const JobAction &JA,
6565
CmdArgs.push_back("-Bdynamic");
6666
if (Args.hasArg(options::OPT_shared)) {
6767
CmdArgs.push_back("-shared");
68-
} else {
69-
CmdArgs.push_back("--dynamic-linker");
70-
CmdArgs.push_back(
71-
Args.MakeArgString(getToolChain().GetFilePath("ld.so.1")));
7268
}
7369

7470
// libpthread has been folded into libc since Solaris 10, no need to do

clang/test/Driver/Inputs/solaris_sparc_tree/usr/lib/ld.so.1

Whitespace-only changes.

clang/test/Driver/Inputs/solaris_sparc_tree/usr/lib/sparcv9/ld.so.1

Whitespace-only changes.

clang/test/Driver/Inputs/solaris_x86_tree/usr/lib/amd64/ld.so.1

Whitespace-only changes.

clang/test/Driver/Inputs/solaris_x86_tree/usr/lib/ld.so.1

Whitespace-only changes.

clang/test/Driver/solaris-ld.c

-4
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// CHECK-LD-SPARC32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "sparc-sun-solaris2.11"
1212
// CHECK-LD-SPARC32-SAME: "-isysroot" "[[SYSROOT:[^"]+]]"
1313
// CHECK-LD-SPARC32: "{{.*}}ld{{(.exe)?}}"
14-
// CHECK-LD-SPARC32-SAME: "--dynamic-linker" "[[SYSROOT]]/usr/lib{{/|\\\\}}ld.so.1"
1514
// CHECK-LD-SPARC32-SAME: "[[SYSROOT]]/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2{{/|\\\\}}crt1.o"
1615
// CHECK-LD-SPARC32-SAME: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti.o"
1716
// CHECK-LD-SPARC32-SAME: "[[SYSROOT]]/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2{{/|\\\\}}crtbegin.o"
@@ -35,7 +34,6 @@
3534
// CHECK-LD-SPARC64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "sparcv9-sun-solaris2.11"
3635
// CHECK-LD-SPARC64-SAME: "-isysroot" "[[SYSROOT:[^"]+]]"
3736
// CHECK-LD-SPARC64: "{{.*}}ld{{(.exe)?}}"
38-
// CHECK-LD-SPARC64-SAME: "--dynamic-linker" "[[SYSROOT]]/usr/lib/sparcv9{{/|\\\\}}ld.so.1"
3937
// CHECK-LD-SPARC64-SAME: "[[SYSROOT]]/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/sparcv9{{/|\\\\}}crt1.o"
4038
// CHECK-LD-SPARC64-SAME: "[[SYSROOT]]/usr/lib/sparcv9{{/|\\\\}}crti.o"
4139
// CHECK-LD-SPARC64-SAME: "[[SYSROOT]]/usr/gcc/4.8/lib/gcc/sparc-sun-solaris2.11/4.8.2/sparcv9{{/|\\\\}}crtbegin.o"
@@ -59,7 +57,6 @@
5957
// CHECK-LD-X32: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "i386-pc-solaris2.11"
6058
// CHECK-LD-X32-SAME: "-isysroot" "[[SYSROOT:[^"]+]]"
6159
// CHECK-LD-X32: "{{.*}}ld{{(.exe)?}}"
62-
// CHECK-LD-X32-SAME: "--dynamic-linker" "[[SYSROOT]]/usr/lib{{/|\\\\}}ld.so.1"
6360
// CHECK-LD-X32-SAME: "[[SYSROOT]]/usr/lib{{/|\\\\}}crt1.o"
6461
// CHECK-LD-X32-SAME: "[[SYSROOT]]/usr/lib{{/|\\\\}}crti.o"
6562
// CHECK-LD-X32-SAME: "[[SYSROOT]]/usr/gcc/4.9/lib/gcc/i386-pc-solaris2.11/4.9.4{{/|\\\\}}crtbegin.o"
@@ -83,7 +80,6 @@
8380
// CHECK-LD-X64: {{.*}}clang{{(.exe)?}}" "-cc1" "-triple" "x86_64-pc-solaris2.11"
8481
// CHECK-LD-X64-SAME: "-isysroot" "[[SYSROOT:[^"]+]]"
8582
// CHECK-LD-X64: "{{.*}}ld{{(.exe)?}}"
86-
// CHECK-LD-X64-SAME: "--dynamic-linker" "[[SYSROOT]]/usr/lib/amd64{{/|\\\\}}ld.so.1"
8783
// CHECK-LD-X64-SAME: "[[SYSROOT]]/usr/lib/amd64{{/|\\\\}}crt1.o"
8884
// CHECK-LD-X64-SAME: "[[SYSROOT]]/usr/lib/amd64{{/|\\\\}}crti.o"
8985
// CHECK-LD-X64-SAME: "[[SYSROOT]]/usr/gcc/4.9/lib/gcc/i386-pc-solaris2.11/4.9.4/amd64{{/|\\\\}}crtbegin.o"

0 commit comments

Comments
 (0)