Skip to content

Commit f0ad2e9

Browse files
authored
[Driver] Make use of AddFilePathLibArgs() on NetBSD. (#71371)
This will help using lld or mold as a linker.
1 parent 8e516d4 commit f0ad2e9

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

clang/lib/Driver/ToolChains/NetBSD.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ void netbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
269269

270270
Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
271271
options::OPT_s, options::OPT_t, options::OPT_r});
272+
ToolChain.AddFilePathLibArgs(Args, CmdArgs);
272273

273274
bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
274275
bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);

clang/test/Driver/netbsd.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@
134134
// STATIC-NOT: "-shared"
135135
// STATIC: "{{.*}}/usr/lib{{/|\\\\}}crt0.o"
136136
// STATIC: "{{.*}}/usr/lib{{/|\\\\}}crti.o" "{{.*}}/usr/lib{{/|\\\\}}crtbegin.o"
137+
// STATIC: "-L{{.*}}/usr/lib"
137138
// STATIC: "{{.*}}/usr/lib{{/|\\\\}}crtend.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
138139

139140
// STATIC-PIE: ld{{.*}}" "--eh-frame-hdr"
@@ -144,13 +145,15 @@
144145
// STATIC-PIE-NOT: "-shared"
145146
// STATIC-PIE: "{{.*}}/usr/lib{{/|\\\\}}crt0.o"
146147
// STATIC-PIE: "{{.*}}/usr/lib{{/|\\\\}}crti.o" "{{.*}}/usr/lib{{/|\\\\}}crtbeginS.o"
148+
// STATIC-PIE: "-L{{.*}}/usr/lib"
147149
// STATIC-PIE: "{{.*}}/usr/lib{{/|\\\\}}crtendS.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
148150

149151
// SHARED: ld{{.*}}" "--eh-frame-hdr"
150152
// SHARED-NOT: "-pie"
151153
// SHARED-NOT: "-dynamic-linker"
152154
// SHARED-NOT: "{{.*}}/usr/lib{{/|\\\\}}crt0.o"
153155
// SHARED: "{{.*}}/usr/lib{{/|\\\\}}crti.o" "{{.*}}/usr/lib{{/|\\\\}}crtbeginS.o"
156+
// SHARED: "-L{{.*}}/usr/lib"
154157
// SHARED: "{{.*}}/usr/lib{{/|\\\\}}crtendS.o" "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
155158

156159
// PIE: ld{{.*}}" "--eh-frame-hdr"
@@ -159,6 +162,7 @@
159162
// PIE-NOT: "-shared"
160163
// PIE: "{{.*}}/usr/lib{{/|\\\\}}crt0.o" "{{.*}}/usr/lib{{/|\\\\}}crti.o"
161164
// PIE: "{{.*}}/usr/lib{{/|\\\\}}crtbeginS.o"
165+
// PIE: "-L{{.*}}/usr/lib"
162166
// PIE: "{{.*}}/usr/lib{{/|\\\\}}crtendS.o"
163167
// PIE: "{{.*}}/usr/lib{{/|\\\\}}crtn.o"
164168

0 commit comments

Comments
 (0)