I am using clang to link two object files on windows.
If i link them without -fsanitize=address with the following command
clang -fuse-ld=lld -v input runtime.lib
it is successful, and prints the invocation
"C:\\Users\\mofio\\Documents\\rlc-infrastructure\\llvm-install-release\\bin\\lld-link"
"-out:.\\test\\Output\\alternative_to_string.rl.tmp.exe"
-defaultlib:libcmt
-defaultlib:oldnames
"-libpath:C:\\Users\\mofio\\Documents\\rlc-infrastructure\\llvm-install-release\\lib\\clang\\18\\lib\\windows"
-nologo
"input"
"runtime.lib"
while if i compile the two object files with sanitizers, then it fails to link because it cannot find puts, scanf and printf, which were the only 3 standard libraries functions used in my files.
clang -fuse-ld=lld -v -fsanitize=address input asa_runtime.lib
"C:\\Users\\mofio\\Documents\\rlc-infrastructure\\llvm-install-release\\bin\\lld-link"
"-out:.\\test\\Output\\alternative_to_string.rl.tmp.exe"
-defaultlib:libcmt
-defaultlib:oldnames
"-libpath:C:\\Users\\mofio\\Documents\\rlc-infrastructure\\llvm-install-release\\lib\\clang\\18\\lib\\windows"
-nologo
-debug
-incremental:no
"C:\\Users\\mofio\\Documents\\rlc-infrastructure\\llvm-install-release\\lib\\clang\\18\\lib\\windows\\clang_rt.asan-x86_64.lib"
"-wholearchive:C:\\Users\\mofio\\Documents\\rlc-infrastructure\\llvm-install-release\\lib\\clang\\18\\lib\\windows\\clang_rt.asan-x86_64.lib"
"C:\\Users\\mofio\\Documents\\rlc-infrastructure\\llvm-install-release\\lib\\clang\\18\\lib\\windows\\clang_rt.asan_cxx-x86_64.lib"
"-wholearchive:C:\\Users\\mofio\\Documents\\rlc-infrastructure\\llvm-install-release\\lib\\clang\\18\\lib\\windows\\clang_rt.asan_cxx-x86_64.lib"
"input"
"asan_runtime.lib"
i am not sure what is going on here, since the two invocations differ only by the extra libraries added to link against asan. I guess it is missing some extra library, but i tried to manually link against all runtimes installed along with clang, but it did not helped. Not really sure how to debug this.