- Support user specified linker (with option -fuse-ld=)
- Support user specified linker script (with option -T)
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang/lib/Driver/ToolChains/AVR.cpp | ||
---|---|---|
461 | This check is no longer needed, since we will check if (!llvm::sys::fs::can_execute(FullPath)) at above lines. | |
524 | I am not familiar with avr-ld internal, but it will implicitly:
|
clang/lib/Driver/ToolChains/AVR.cpp | ||
---|---|---|
434–436 | You can just call ToolChain.GetLinkerPath(). I don't think checking can_execute is necessary. |
clang/lib/Driver/ToolChains/AVR.cpp | ||
---|---|---|
528 | I am concerned with the magic here. Shouldn't you let users specify explicit -T? |
clang/lib/Driver/ToolChains/AVR.cpp | ||
---|---|---|
434–436 | Thanks. This way makes my code more clear. | |
528 | I have changed the logic to
|
clang/lib/Driver/ToolChains/AVR.cpp | ||
---|---|---|
461 | This check is still unnecessary, since the driver will complaint invalid linker ... if avr-ld is invalid. |
clang/lib/Driver/ToolChains/AVR.cpp | ||
---|---|---|
534 | Though I can seperate my AVR project to two steps,
it is much more convenient if we can use a single clang ... command including all. |
I am still uncomfortable with such a change. Trying to be smart sometimes may get in the way.
I have removed the guess of default linker script. Currently my patch only does
- Support linking with lld if user specifed -fuse-ld=lld
- Support user specifed linker script
I have a bit confused, why clang --target=x86_64 -fuse-ld=lld needs not to be explicitly specified with a linker script and produces a runnable x86_64 ELF? How does lld arrange code/data addresses for x86_64 by default ?
My original will is clang --target=avr -fuse-lld abc.c can correctly produce an AVR ELF, as both clang --target=x86_64 -fuse-ld=lld abc.c and avr-gcc abc.c do. The avr-gcc abc.c command will use the default linker script inside avr-libc.
ping ....
I have simplified my patch. Only support -T and -fuse-ld=lld according to user specification.
clang/lib/Driver/ToolChains/AVR.cpp | ||
---|---|---|
507 | Just do Args.AddAllArgs. Please check how Gnu.cpp passes -T |
clang/lib/Driver/ToolChains/AVR.cpp | ||
---|---|---|
507 | Thanks. Args.AddAllArgs does make code more clear. |
We are seeing Clang driver test failures after this patch. On Fuchsia's mac clang builder, Clang :: Driver/avr-ld.c and Clang :: Driver/avr-toolchain.c are failing.
Failed build task: https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci/clang-mac-x64/b8811424628472375921/overview Error message:
Clang :: Driver/avr-toolchain.c;
Script: -- : 'RUN: at line 4'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c --target=avr --sysroot=/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree -resource-dir=/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/resource_dir 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck --check-prefix=CHECK1 /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 15'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c --target=avr --sysroot=/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree_2/opt/local -S 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck --check-prefix=CHECK2 /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 21'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c --target=avr --sysroot=/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree_2 -S 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck --check-prefix=CHECK3 /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 27'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c --target=avr 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck -check-prefix=CC1 /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 30'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c --target=avr -fuse-init-array -fuse-cxa-atexit 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck -check-prefix=CHECK4 /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 35'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c --target=avr --sysroot=/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree 2>&1 -nostdinc | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck --check-prefix=NOSTDINC /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 36'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c --target=avr --sysroot=/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree 2>&1 -nostdlibinc | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck --check-prefix=NOSTDINC /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 39'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr --sysroot=/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree -mmcu=atmega328 /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck --check-prefix=NOWARN /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 40'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr --sysroot=/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree -mmcu=atmega328 -S /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck --check-prefix=NOWARN /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 41'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr --sysroot=/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/ -mmcu=atmega328 -S /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck --check-prefix=NOWARN /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 44'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr --sysroot=/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree -S /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck --check-prefixes=NOMCU,LINKA /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 45'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr --sysroot=/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/ -S /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck --check-prefixes=NOMCU,LINKA /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 46'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr --sysroot=/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck --check-prefixes=NOMCU,LINKB /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 55'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr --sysroot=/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/ -mmcu=atmega328 /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck --check-prefixes=NOGCC /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 61'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr --sysroot=/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree -mmcu=atmega328 /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c -fuse-ld=avrld 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck --check-prefix=NOLD /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 64'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr --sysroot=/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree -mmcu=atmega328 /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c -fuse-ld=lld 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck --check-prefix=LLD /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 69'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr --sysroot=/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree -mmcu=atmega328 /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c -T avr.lds 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck --check-prefix=LDS0 /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 72'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr --sysroot=/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree -mmcu=atmega328 /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c -fuse-ld=lld -T avr.lds 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck --check-prefix=LDS1 /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c -- Exit Code: 1 Command Output (stderr): -- /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c:11:12: error: CHECK1: expected string not found in input // CHECK1: avr-ld" ^ <stdin>:8:889: note: scanning from here "/opt/s/w/ir/x/w/staging/llvm_build/bin/clang-15" "-cc1" "-triple" "avr" "-emit-obj" "-mrelax-all" "--mrelax-relocations" "-disable-free" "-clear-ast-before-backend" "-main-file-name" "avr-toolchain.c" "-mrelocation-model" "static" "-mframe-pointer=all" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-fno-use-init-array" "-fno-use-cxa-atexit" "-mllvm" "-treat-scalable-fixed-error-as-warning" "-debugger-tuning=gdb" "-target-linker-version" "609.5" "-fcoverage-compilation-dir=/opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver" "-resource-dir" "/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/resource_dir" "-isysroot" "/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree" "-internal-isystem" "/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree/usr/lib/gcc/avr/5.4.0/../../../avr/include" "-fdebug-compilation-dir=/opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver" "-ferror-limit" "19" "-fgnuc-version=4.2.1" "-faddrsig" "-o" "/opt/s/w/ir/x/t/lit-tmp-688ggc9o/avr-toolchain-1844e8.o" "-x" "c" "/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c" ^ <stdin>:8:1070: note: possible intended match here "/opt/s/w/ir/x/w/staging/llvm_build/bin/clang-15" "-cc1" "-triple" "avr" "-emit-obj" "-mrelax-all" "--mrelax-relocations" "-disable-free" "-clear-ast-before-backend" "-main-file-name" "avr-toolchain.c" "-mrelocation-model" "static" "-mframe-pointer=all" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-fno-use-init-array" "-fno-use-cxa-atexit" "-mllvm" "-treat-scalable-fixed-error-as-warning" "-debugger-tuning=gdb" "-target-linker-version" "609.5" "-fcoverage-compilation-dir=/opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver" "-resource-dir" "/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/resource_dir" "-isysroot" "/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree" "-internal-isystem" "/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree/usr/lib/gcc/avr/5.4.0/../../../avr/include" "-fdebug-compilation-dir=/opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver" "-ferror-limit" "19" "-fgnuc-version=4.2.1" "-faddrsig" "-o" "/opt/s/w/ir/x/t/lit-tmp-688ggc9o/avr-toolchain-1844e8.o" "-x" "c" "/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c" ^ Input file: <stdin> Check file: /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c -dump-input=help explains the following input dump. Input was: <<<<<< 1: clang-15: warning: no target microcontroller specified on command line, cannot link standard libraries, please pass -mmcu=<mcu name> [-Wavr-rtlib-linking-quirks] 2: Fuchsia clang version 15.0.0 (https://llvm.googlesource.com/a/llvm-project 145cc9db2b442fc0533e275b92943a9894e33337) 3: Target: avr 4: Thread model: posix 5: InstalledDir: /opt/s/w/ir/x/w/staging/llvm_build/bin 6: clang-15: warning: standard library not linked and so no interrupt vector table or compiler runtime routines will be linked [-Wavr-rtlib-linking-quirks] 7: clang-15: warning: support for passing the data section address to the linker for microcontroller '' is not implemented [-Wavr-rtlib-linking-quirks] 8: "/opt/s/w/ir/x/w/staging/llvm_build/bin/clang-15" "-cc1" "-triple" "avr" "-emit-obj" "-mrelax-all" "--mrelax-relocations" "-disable-free" "-clear-ast-before-backend" "-main-file-name" "avr-toolchain.c" "-mrelocation-model" "static" "-mframe-pointer=all" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-fno-use-init-array" "-fno-use-cxa-atexit" "-mllvm" "-treat-scalable-fixed-error-as-warning" "-debugger-tuning=gdb" "-target-linker-version" "609.5" "-fcoverage-compilation-dir=/opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver" "-resource-dir" "/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/resource_dir" "-isysroot" "/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree" "-internal-isystem" "/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree/usr/lib/gcc/avr/5.4.0/../../../avr/include" "-fdebug-compilation-dir=/opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver" "-ferror-limit" "19" "-fgnuc-version=4.2.1" "-faddrsig" "-o" "/opt/s/w/ir/x/t/lit-tmp-688ggc9o/avr-toolchain-1844e8.o" "-x" "c" "/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-toolchain.c" check:11'0 X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found check:11'1 ? possible intended match 9: "/opt/s/w/ir/x/w/staging/llvm_build/bin/ld.lld" "/opt/s/w/ir/x/t/lit-tmp-688ggc9o/avr-toolchain-1844e8.o" "-o" "a.out" "--gc-sections" check:11'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>>>>> --
Clang :: Driver/avr-ld.c:
Script: -- : 'RUN: at line 1'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr -mmcu=at90s2313 --sysroot /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck -check-prefix LINKA /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c : 'RUN: at line 4'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr -mmcu=at90s8515 --sysroot /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck -check-prefix LINKB /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c : 'RUN: at line 7'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr -mmcu=attiny13 --sysroot /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck -check-prefix LINKC /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c : 'RUN: at line 10'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr -mmcu=attiny44 --sysroot /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck -check-prefix LINKD /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c : 'RUN: at line 13'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr -mmcu=atmega103 --sysroot /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck -check-prefix LINKE /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c : 'RUN: at line 16'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr -mmcu=atmega8u2 --sysroot /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck -check-prefix LINKF /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c : 'RUN: at line 19'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr -mmcu=atmega48pa --sysroot /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck -check-prefix LINKG /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c : 'RUN: at line 22'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr -mmcu=atmega328 --sysroot /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck -check-prefix LINKH /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c : 'RUN: at line 25'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr -mmcu=atmega1281 --sysroot /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck -check-prefix LINKI /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c : 'RUN: at line 28'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr -mmcu=atmega2560 --sysroot /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck -check-prefix LINKJ /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c : 'RUN: at line 31'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr -mmcu=attiny10 --sysroot /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck -check-prefix LINKK /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c : 'RUN: at line 34'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr -mmcu=atxmega16a4 --sysroot /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck -check-prefix LINKL /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c : 'RUN: at line 37'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr -mmcu=atxmega64b3 --sysroot /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck -check-prefix LINKM /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c : 'RUN: at line 40'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr -mmcu=atxmega128a3u --sysroot /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck -check-prefix LINKN /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c : 'RUN: at line 43'; /opt/s/w/ir/x/w/staging/llvm_build/bin/clang -### --target=avr -mmcu=atxmega128a1 --sysroot /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c 2>&1 | /opt/s/w/ir/x/w/staging/llvm_build/bin/FileCheck -check-prefix LINKO /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c -- Exit Code: 1 Command Output (stderr): -- /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c:2:11: error: LINKA: expected string not found in input // LINKA: {{".*ld.*"}} {{.*}} {{"-L.*tiny-stack"}} {{.*}} "-Tdata=0x800060" "--start-group" {{.*}} "-lat90s2313" "--end-group" "-mavr2" ^ <stdin>:1:1: note: scanning from here Fuchsia clang version 15.0.0 (https://llvm.googlesource.com/a/llvm-project 145cc9db2b442fc0533e275b92943a9894e33337) ^ Input file: <stdin> Check file: /opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c -dump-input=help explains the following input dump. Input was: <<<<<< 1: Fuchsia clang version 15.0.0 (https://llvm.googlesource.com/a/llvm-project 145cc9db2b442fc0533e275b92943a9894e33337) check:2 X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found 2: Target: avr check:2 ~~~~~~~~~~~~ 3: Thread model: posix check:2 ~~~~~~~~~~~~~~~~~~~~ 4: InstalledDir: /opt/s/w/ir/x/w/staging/llvm_build/bin check:2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5: "/opt/s/w/ir/x/w/staging/llvm_build/bin/clang-15" "-cc1" "-triple" "avr" "-emit-obj" "-mrelax-all" "--mrelax-relocations" "-disable-free" "-clear-ast-before-backend" "-main-file-name" "avr-ld.c" "-mrelocation-model" "static" "-mframe-pointer=all" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-fno-use-init-array" "-fno-use-cxa-atexit" "-target-cpu" "at90s2313" "-mllvm" "-treat-scalable-fixed-error-as-warning" "-debugger-tuning=gdb" "-target-linker-version" "609.5" "-fcoverage-compilation-dir=/opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver" "-resource-dir" "/opt/s/w/ir/x/w/staging/llvm_build/lib/clang/15.0.0" "-isysroot" "/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree" "-internal-isystem" "/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree/usr/lib/gcc/avr/5.4.0/../../../avr/include" "-fdebug-compilation-dir=/opt/s/w/ir/x/w/staging/llvm_build/tools/clang/test/Driver" "-ferror-limit" "19" "-fgnuc-version=4.2.1" "-faddrsig" "-o" "/opt/s/w/ir/x/t/lit-tmp-688ggc9o/avr-ld-7bfa74.o" "-x" "c" "/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/avr-ld.c" check:2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 6: "/opt/s/w/ir/x/w/staging/llvm_build/bin/ld.lld" "/opt/s/w/ir/x/t/lit-tmp-688ggc9o/avr-ld-7bfa74.o" "-o" "a.out" "--gc-sections" "-L/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree/usr/lib/gcc/avr/5.4.0/../../../avr/lib/tiny-stack" "-L/opt/s/w/ir/x/w/llvm-llvm-project/clang/test/Driver/Inputs/basic_avr_tree/usr/lib/gcc/avr/5.4.0/tiny-stack" "-Tdata=0x800060" "--start-group" "-l:crtat90s2313.o" "-lgcc" "-lm" "-lc" "-lat90s2313" "--end-group" check:2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>>>>> --
Clang :: Driver/avr-ld.c also failed on Fuchsia's Clang Windows builder as well: https://ci.chromium.org/ui/p/fuchsia/builders/toolchain.ci/clang-windows-x64/b8811369240303052481/overview. Could you take a look please? If it takes a long time to fix, could you revert your change first? Thanks.
I already reverted the change in https://github.com/llvm/llvm-project/commit/7fae15f9251d3b392058e2fc84898b53619d36ad . It is likely the breakage is caused by the fact that Fuchsia's Clang by default use lld, see clang/cmake/caches/Fuchsia-stage2.cmake:set(CLANG_DEFAULT_LINKER lld CACHE STRING "") . Please let me know if you need to test your new patch with this configuration. I am happy to help.
I think I have fixed in another patch https://reviews.llvm.org/D127814, could you please have a look?
I have not your environment, my patch works on my ubuntu system, could you please try it on your build machine ?
I have uploaded a new version of my patch, which should fixes the issue on your platfrom that lld is default. Could you please help me test ? Please ignore another patch.
Emmm, I applied your latest patch on top of main(6e02e27536b9de25a651cfc9c2966ce471169355) but I still get a test failure on Clang :: Driver/avr-toolchain.c.
Clang :: Driver/avr-ld.c no longer fail.
Error message:
FAIL: Clang :: Driver/avr-toolchain.c (7349 of 16540) ******************** TEST 'Clang :: Driver/avr-toolchain.c' FAILED ******************** Script: -- : 'RUN: at line 4'; /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/clang -### /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c --target=avr --sysroot=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree -resource-dir=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/resource_dir 2>&1 | /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/FileCheck --check-prefix=CHECK1 /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 15'; /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/clang -### /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c --target=avr --sysroot=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree _2/opt/local -S 2>&1 | /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/FileCheck --check-prefix=CHECK2 /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 21'; /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/clang -### /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c --target=avr --sysroot=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree _2 -S 2>&1 | /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/FileCheck --check-prefix=CHECK3 /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 27'; /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/clang -### /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c --target=avr 2>&1 | /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/FileCheck -check-pre fix=CC1 /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 30'; /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/clang -### /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c --target=avr -fuse-init-array -fuse-cxa-atexit 2>&1 | /mnt/nvme_sec/SRC/llvm-project/build-re vert-test/bin/FileCheck -check-prefix=CHECK4 /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 35'; /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/clang -### /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c --target=avr --sysroot=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree 2>&1 -nostdinc | /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/FileCheck --check-prefix=NOSTDINC /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 36'; /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/clang -### /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c --target=avr --sysroot=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree 2>&1 -nostdlibinc | /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/FileCheck --check-prefix=NOSTDINC /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 39'; /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/clang -### --target=avr --sysroot=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree -mmcu=atmega328 /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver /avr-toolchain.c 2>&1 | /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/FileCheck --check-prefix=NOWARN /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 40'; /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/clang -### --target=avr --sysroot=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree -mmcu=atmega328 -S /mnt/nvme_sec/SRC/llvm-project/clang/test/Dri ver/avr-toolchain.c 2>&1 | /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/FileCheck --check-prefix=NOWARN /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 41'; /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/clang -### --target=avr --sysroot=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/ -mmcu=atmega328 -S /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolch ain.c 2>&1 | /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/FileCheck --check-prefix=NOWARN /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 44'; /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/clang -### --target=avr --sysroot=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree -S /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchai n.c 2>&1 | /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/FileCheck --check-prefixes=NOMCU,LINKA /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 45'; /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/clang -### --target=avr --sysroot=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/ -S /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c 2>&1 | /mn t/nvme_sec/SRC/llvm-project/build-revert-test/bin/FileCheck --check-prefixes=NOMCU,LINKA /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 46'; /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/clang -### --target=avr --sysroot=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c 2>&1 | /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/FileCheck --check-prefixes=NOMCU,LINKB /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 55'; /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/clang -### --target=avr --sysroot=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/ -mmcu=atmega328 /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain .c 2>&1 | /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/FileCheck --check-prefixes=NOGCC /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 61'; /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/clang -### --target=avr --sysroot=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree -mmcu=atmega328 /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver /avr-toolchain.c -fuse-ld=avrld 2>&1 | /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/FileCheck --check-prefix=NOLD /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 64'; /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/clang -### --target=avr --sysroot=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree -mmcu=atmega328 /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver /avr-toolchain.c -fuse-ld=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree/usr/bin/ld.lld 2>&1 | /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/FileCheck --check-prefix=LLD /mnt/nvme_sec/SRC/llvm-project/clang/test/Dr iver/avr-toolchain.c : 'RUN: at line 69'; /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/clang -### --target=avr --sysroot=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree -mmcu=atmega328 /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver /avr-toolchain.c -T avr.lds 2>&1 | /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/FileCheck --check-prefix=LDS0 /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c : 'RUN: at line 72'; /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/clang -### --target=avr --sysroot=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree -mmcu=atmega328 /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver /avr-toolchain.c -fuse-ld=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree/usr/bin/ld.lld -T avr.lds 2>&1 | /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/FileCheck --check-prefix=LDS1 /mnt/nvme_sec/SRC/llvm-project/c lang/test/Driver/avr-toolchain.c -- Exit Code: 1 Command Output (stderr): -- /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c:65:9: error: LLD: expected string not found in input // LLD: {{".*lld"}} ^ <stdin>:1:1: note: scanning from here Fuchsia clang version 15.0.0 (git@github.com:llvm/llvm-project.git 6e02e27536b9de25a651cfc9c2966ce471169355) ^ <stdin>:5:139: note: possible intended match here clang-15: error: invalid linker name in argument '-fuse-ld=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree/usr/bin/ld.lld' ^ Input file: <stdin> Check file: /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c -dump-input=help explains the following input dump. Input was: <<<<<< 1: Fuchsia clang version 15.0.0 (git@github.com:llvm/llvm-project.git 6e02e27536b9de25a651cfc9c2966ce471169355) check:65'0 X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found 2: Target: avr check:65'0 ~~~~~~~~~~~~ 3: Thread model: posix check:65'0 ~~~~~~~~~~~~~~~~~~~~ 4: InstalledDir: /mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin check:65'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5: clang-15: error: invalid linker name in argument '-fuse-ld=/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree/usr/bin/ld.lld' check:65'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ check:65'1 ? possible intended match 6: "/mnt/nvme_sec/SRC/llvm-project/build-revert-test/bin/clang-15" "-cc1" "-triple" "avr" "-emit-obj" "-mrelax-all" "--mrelax-relocations" "-disable-free" "-clear-ast-before-backend" "-main-file-name" "avr-toolchain.c" "-mrelocation -model" "static" "-mframe-pointer=all" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-fno-use-init-array" "-fno-use-cxa-atexit" "-target-cpu" "atmega328" "-mllvm" "-treat-scalable-fixed-error-as-warning" "-debug ger-tuning=gdb" "-fcoverage-compilation-dir=/mnt/nvme_sec/SRC/llvm-project/build-revert-test/tools/clang/test/Driver" "-resource-dir" "/mnt/nvme_sec/SRC/llvm-project/build-revert-test/lib/clang/15.0.0" "-isysroot" "/mnt/nvme_sec/SRC/llvm-project /clang/test/Driver/Inputs/basic_avr_tree" "-internal-isystem" "/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree/usr/lib/gcc/avr/5.4.0/../../../avr/include" "-fdebug-compilation-dir=/mnt/nvme_sec/SRC/llvm-project/build-rever t-test/tools/clang/test/Driver" "-ferror-limit" "19" "-fgnuc-version=4.2.1" "-faddrsig" "-o" "/tmp/lit-tmp-a4e1rfqj/avr-toolchain-f24e25.o" "-x" "c" "/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/avr-toolchain.c" check:65'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 7: "/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree/usr/lib/gcc/avr/5.4.0/../../../../bin/avr-ld" "/tmp/lit-tmp-a4e1rfqj/avr-toolchain-f24e25.o" "-o" "a.out" "--gc-sections" "-L/mnt/nvme_sec/SRC/llvm-project/c lang/test/Driver/Inputs/basic_avr_tree/usr/lib/gcc/avr/5.4.0/../../../avr/lib/avr5" "-L/mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree/usr/lib/gcc/avr/5.4.0/avr5" "-Tdata=0x800100" "--start-group" "-l:crtatmega328.o" "-lgc c" "-lm" "-lc" "-latmega328" "--end-group" "-mavr5" check:65'0 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>>>>> -- ******************** ********************
Do you have an empty file /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree/usr/bin/ld.lld on your disk ?
It seems the file /mnt/nvme_sec/SRC/llvm-project/clang/test/Driver/Inputs/basic_avr_tree/usr/bin/ld.lld is missing on your machine, which I have newly created in current patch.
That file was missing. For some reason, it was missing from the patch I downloaded from phabricator( if you look at https://reviews.llvm.org/file/data/2wqpf52swpb3xkcz7lip/PHID-FILE-filks6eto62wxww6m23w/D126192.vson.id436992.diff).
After manually create clang/test/Driver/Inputs/basic_avr_tree/usr/bin/ld.lld and set permission to 0755 (test will fail if I don't do it). All tests will pass under linux-x64. I will need to test it on a Windows host to make sure it all pass, which will take a while.
I tested this patch on our windows builder and it passed as well.
This patch LGTM. (I cannot click accept as the this review is already closed)
You can just call ToolChain.GetLinkerPath(). I don't think checking can_execute is necessary.