[flang-commits] [clang] [flang] [flang][Driver] Support -nostdlib and -nodefaultlibs (PR #108868)
Mészáros Gergely via flang-commits
flang-commits at lists.llvm.org
Wed Dec 4 01:24:49 PST 2024
================
@@ -5572,7 +5572,8 @@ def : Flag<["-"], "nocudalib">, Alias<nogpulib>;
def gpulibc : Flag<["-"], "gpulibc">, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>,
HelpText<"Link the LLVM C Library for GPUs">;
def nogpulibc : Flag<["-"], "nogpulibc">, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>;
-def nodefaultlibs : Flag<["-"], "nodefaultlibs">;
+def nodefaultlibs : Flag<["-"], "nodefaultlibs">,
+ Visibility<[ClangOption, FlangOption, CLOption, DXCOption]>;
----------------
Maetveis wrote:
With this change in Options.td:
```diff
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index cb96b5daed9d3a2..842e6c2e6233adb 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5644,4 +5644,3 @@ def gpulibc : Flag<["-"], "gpulibc">, Visibility<[ClangOption, CC1Option, FlangO
def nogpulibc : Flag<["-"], "nogpulibc">, Visibility<[ClangOption, CC1Option, FlangOption, FC1Option]>;
-def nodefaultlibs : Flag<["-"], "nodefaultlibs">,
- Visibility<[ClangOption, FlangOption, CLOption, DXCOption]>;
+def nodefaultlibs : Flag<["-"], "nodefaultlibs">;
def nodriverkitlib : Flag<["-"], "nodriverkitlib">;
```
I'm getting:
```console
> build\bin\clang-cl.exe -nodefaultlibs asd.o
clang-cl: warning: unknown argument ignored in clang-cl: '-nodefaultlibs' [-Wunknown-argument]
```
without it I don't get a warning.
The comment at Options.td:74 also seems to suggest the default is only the gcc compatible driver. https://github.com/llvm/llvm-project/blob/c3536b263f253a69fb336fb0617ee33a01a5c5dd/clang/include/clang/Driver/Options.td#L74-L77
https://github.com/llvm/llvm-project/pull/108868
More information about the flang-commits
mailing list