Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Driver] Make use of AddFilePathLibArgs() on NetBSD. #71371

Merged
merged 1 commit into from
Nov 15, 2023

Conversation

brad0
Copy link
Contributor

@brad0 brad0 commented Nov 6, 2023

This will help using lld or mold as a linker.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Nov 6, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Nov 6, 2023

@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: Brad Smith (brad0)

Changes

This will help using lld or mold as a linker.


Full diff: https://github.com/llvm/llvm-project/pull/71371.diff

2 Files Affected:

  • (modified) clang/lib/Driver/ToolChains/NetBSD.cpp (+1)
  • (modified) clang/test/Driver/netbsd.c (+5)
diff --git a/clang/lib/Driver/ToolChains/NetBSD.cpp b/clang/lib/Driver/ToolChains/NetBSD.cpp
index cfde8d40a77ae16..90b195a007caa78 100644
--- a/clang/lib/Driver/ToolChains/NetBSD.cpp
+++ b/clang/lib/Driver/ToolChains/NetBSD.cpp
@@ -269,6 +269,7 @@ void netbsd::Linker::ConstructJob(Compilation &C, const JobAction &JA,
 
   Args.addAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
                             options::OPT_s, options::OPT_t, options::OPT_r});
+  ToolChain.AddFilePathLibArgs(Args, CmdArgs);
 
   bool NeedsSanitizerDeps = addSanitizerRuntimes(ToolChain, Args, CmdArgs);
   bool NeedsXRayDeps = addXRayRuntime(ToolChain, Args, CmdArgs);
diff --git a/clang/test/Driver/netbsd.c b/clang/test/Driver/netbsd.c
index 760cba4ac4e0c9f..f900205501ee455 100644
--- a/clang/test/Driver/netbsd.c
+++ b/clang/test/Driver/netbsd.c
@@ -461,3 +461,8 @@
 // DRIVER-PASS-INCLUDES:      "-cc1" {{.*}}"-resource-dir" "[[RESOURCE:[^"]+]]"
 // DRIVER-PASS-INCLUDES-SAME: "-internal-isystem" "[[RESOURCE]]{{/|\\\\}}include"
 // DRIVER-PASS-INCLUDES-SAME: {{^}} "-internal-externc-isystem" "{{.*}}/usr/include"
+
+// Check that the driver passes the system library path.
+// RUN: %clang -### %s --target=x86_64-unknown-netbsd 2>&1 \
+// RUN:   | FileCheck %s --check-prefix=DRIVER-PASS-LIB-PATH
+// DRIVER-PASS-LIB-PATH:  "-L/usr/lib"

@brad0 brad0 requested a review from MaskRay November 10, 2023 01:54
@brad0
Copy link
Contributor Author

brad0 commented Nov 14, 2023

Ping.

clang/test/Driver/netbsd.c Outdated Show resolved Hide resolved
This will help using lld or mold as a linker.
@brad0 brad0 force-pushed the clang_driver_netbsd_addfilepathlibargs branch from 00a5cfd to c68ad2b Compare November 15, 2023 16:26
@brad0 brad0 merged commit f0ad2e9 into llvm:main Nov 15, 2023
3 checks passed
@brad0 brad0 deleted the clang_driver_netbsd_addfilepathlibargs branch November 15, 2023 18:36
zahiraam pushed a commit to zahiraam/llvm-project that referenced this pull request Nov 20, 2023
This will help using lld or mold as a linker.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants