Open meongmeongasd opened 2 years ago
Here the video example The case is shown after minute 2:45
diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp
index 07b60673577e..6f75aebda1fd 100644
--- a/lld/COFF/Driver.cpp
+++ b/lld/COFF/Driver.cpp
@@ -1343,12 +1343,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) {
}
}
- if (!args.hasArg(OPT_INPUT, OPT_wholearchive_file)) {
- if (args.hasArg(OPT_deffile))
- config->noEntry = true;
- else
- fatal("no input files");
- }
+
// Construct search path list.
searchPaths.push_back("");
diff --git a/lld/tools/lld/lld.cpp b/lld/tools/lld/lld.cpp
index cad97f2153c2..75ab500f3464 100644
--- a/lld/tools/lld/lld.cpp
+++ b/lld/tools/lld/lld.cpp
@@ -137,7 +137,7 @@ static Flavor parseFlavor(std::vector<const char *> &v) {
/// Universal linker main(). This linker emulates the gnu, darwin, or
/// windows linker based on the argv[0] or -flavor option.
static int lldMain(int argc, const char **argv, llvm::raw_ostream &stdoutOS,
- llvm::raw_ostream &stderrOS, bool exitEarly = true) {
+ llvm::raw_ostream &stderrOS, bool exitEarly = false) {
std::vector<const char *> args(argv, argv + argc);
switch (parseFlavor(args)) {
case Gnu:
I don't understand why this is closed as completed, because proposed patch has not landed. https://github.com/llvm/llvm-project/blob/9b57b167bb4d849b6803e28f638b970f493511f9/lld/COFF/Driver.cpp#L1557-L1562
@llvm/issue-subscribers-lld-coff
The issue, as I see it, is that by default, LLD exits with TerminateProcess
by default:
https://github.com/llvm/llvm-project/blob/04ba475e85cb97e9006a130855b76479b5149f47/lld/Common/DriverDispatcher.cpp#L167
https://github.com/llvm/llvm-project/blob/04ba475e85cb97e9006a130855b76479b5149f47/llvm/lib/Support/Windows/Process.inc#L524
This is why the profraw files are empty.
I was about to say that this is working-as-intended, but I was surprised to discover that there is no flag to disable this behavior, the same way we have for clang -disable-free
. The only way to opt out it seems is to set LLD_IN_TEST in the environment:
https://github.com/llvm/llvm-project/blob/135e5216ba996b755c677ac22bea76a58a41d0a6/lld/tools/lld/lld.cpp#L64-L66
And, I doubt this is documented anywhere, and it should be.
Indeed, as a workaround @Endilll @meongmeongasd you can set LLD_IN_TEST=1
just before calling your ninja
command. But in my mind @rnk this was never meant as stable API. Probably on the short term we should flush the profraw buffers in lld::exitLld()
like we do for other things there.
Do I read comments above correctly that this should be left open until this is addressed in a proper way?
Do I read comments above correctly that this should be left open until this is addressed in a proper way?
Yes, what you're describing is a bug and it should work out-of-the-box without extra gymnastics from the user.
from https://github.com/llvm/llvm-project/issues/52836
Windows 11 Windows SDK 10.0.22523.0 Microsoft (R) C/C++ Optimizing Compiler Version 19.31.30818 for x64 Copyright (C) Microsoft Corporation. All rights reserved.
build -DLLVM_ENABLE_PROJECTS=clang;compiler-rt;lld;polly trunk using cl build instrumented -DLLVM_ENABLE_PROJECTS=clang;lld;polly trunk with just build clang-cl set LLVM_PROFILE_FILE=code-%p.profraw //or anything, up to u, as long not replace just made profraw as user variable or system wide build -DLLVM_ENABLE_PROJECTS=clang;lld;polly trunk with just build instrumented clang-cl //this to produce profraw files //can use other opensource porject with cmakelists,txt //all release build check in profraw output folder or list of .profraw files, is there any empty profraw?
that empty profraw in my case, produced by instrumented lld-link when called by ninja linking cxx executable <insert .exe name >
reproduced by me by deleting the .exe and let ninja link the exe again sry for my bad english