On Tue, 25 Mar 2025 04:10:53 GMT, SendaoYan <s...@openjdk.org> wrote:

>> Hi all,
>> 
>> There is an extra a.out file generated located in repository root directory 
>> after execute the configure command with llvm/clang compiler sometimes, not 
>> always. The a.out was generate by `$LINKER -Wl,-v 2>&1 | $HEAD -n 1`, shows 
>> as below. This PR  add a command to remove the extra a.out file. No risk.
>> 
>> 
>>> rm -rf a.out ; date ; ~/software/acc/x86_64/bin/clang -Wl,-v 2>&1 | head -n 
>>> 1 ; stat a.out ; ls -lh a.out ; file a.out
>> Thu Mar 20 02:46:13 PM CST 2025
>> GNU ld (GNU Binutils) 2.43.50.20240909
>>   File: a.out
>>   Size: 792 Blocks: 8 IO Block: 4096 regular file
>> Device: 10303h/66307d Inode: 2355308 Links: 1
>> Access: (0640/-rw-r-----) Uid: ( 995/yansendao) Gid: ( 992/yansendao)
>> Access: 2025-03-20 14:46:13.682967228 +0800
>> Modify: 2025-03-20 14:46:13.682967228 +0800
>> Change: 2025-03-20 14:46:13.682967228 +0800
>>  Birth: 2025-03-20 14:46:13.674966977 +0800
>> -rw-r----- 1 yansendao yansendao 792 Mar 20 14:46 a.out
>> a.out: data
>
> SendaoYan has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Redirecte stderr to /dev/null

And no, passing `-fuse-ld=lld` to the linker at all time does not make this a 
big PR. Try something like this (untested, but should work):


diff --git a/make/autoconf/toolchain.m4 b/make/autoconf/toolchain.m4
index c240b9098bc..315017c48c4 100644
--- a/make/autoconf/toolchain.m4
+++ b/make/autoconf/toolchain.m4
@@ -620,6 +620,11 @@ AC_DEFUN_ONCE([TOOLCHAIN_DETECT_TOOLCHAIN_CORE],
     # All other toolchains use the compiler to link.
     LD="$CC"
     LDCXX="$CXX"
+    # Force use of lld, since that is what we expect when setting flags later 
on
+    if test "x$TOOLCHAIN_TYPE" = xclang; then
+      LD="$LD -fuse-ld=lld"
+      LDCXX="$LDCXX -fuse-ld=lld"
+    fi
   fi
   AC_SUBST(LD)
   # FIXME: it should be CXXLD, according to standard (cf CXXCPP)

-------------

PR Comment: https://git.openjdk.org/jdk/pull/24125#issuecomment-2750960047

Reply via email to