[PATCH] D97993: [Driver] Suppress GCC detection under -B

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 22 20:53:45 PDT 2021


MaskRay added a comment.

In D97993#2643318 <https://reviews.llvm.org/D97993#2643318>, @vvereschaka wrote:

> `CHECK: "-internal-isystem" "/usr/local/include"` didn't break the test on the cross builders before.
>
> Also, the `// CHECK: "-L[[TOOLCHAIN]]/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5/../../../.."` check now is failing also (line 31).

The bot (despite being on Windows) has a default sysroot: `"--sysroot=C:/buildbot/.aarch64-ubuntu"`, which seems to interact badly with --gcc-toolchain.
Perhaps a `--sysroot=` should be added.

> I tried to temporary disable a check at line 31 and I got two more problems:
>
> 1. I noticed a wrong place for `2>&1` in `RUN` statement, it should be placed in front of `|` (lines 34-35, 37-38 in gcc-toolchain.cpp)

`2>&1` can be anywhere in the command. The convention is at the end, but it is not a must.

> 2. The second problem. Here is an output for Aarch64 cross toolchain win-x-ubuntu linux:
>
>   "c:\\buildbot\\temp\\build\\bin\\ld.lld" 
>   "--sysroot=C:/buildbot/.aarch64-ubuntu" 
>   "-EL" "--eh-frame-hdr" "-m" "aarch64linux" 
>   "-dynamic-linker" "/lib/ld-linux-aarch64.so.1" 
>   "-o" "C:\\buildbot\\temp\\build\\tools\\clang\\test\\Driver\\Output\\gcc-toolchain.cpp.tmp" 
>   "C:/buildbot/.aarch64-ubuntu/usr/lib/aarch64-linux-gnu\\crt1.o" 
>   "C:/buildbot/.aarch64-ubuntu/usr/lib/aarch64-linux-gnu\\crti.o" 
>   "C:\\buildbot\\temp\\llvm-project\\clang\\test\\Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/aarch64-suse-linux/4.8\\crtbegin.o" 
>   "-LC:\\buildbot\\temp\\llvm-project\\clang\\test\\Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/aarch64-suse-linux/4.8" 
>   "-LC:/buildbot/.aarch64-ubuntu/lib/aarch64-linux-gnu" 
>   "-LC:/buildbot/.aarch64-ubuntu/usr/lib/aarch64-linux-gnu" 
>   "-LC:/buildbot/.aarch64-ubuntu/lib" 
>   "-LC:/buildbot/.aarch64-ubuntu/usr/lib" 
>   "C:\\Users\\buildbot\\AppData\\Local\\Temp\\2\\gcc-toolchain-addcda.o" 
>   "-lstdc++" "-lm" "-lgcc_s" "-lgcc" "-lc" "-lgcc_s" "-lgcc" 
>   "C:\\buildbot\\temp\\llvm-project\\clang\\test\\Driver/Inputs/opensuse_42.2_aarch64_tree/usr/lib64/gcc/aarch64-suse-linux/4.8\\crtend.o" 
>   "C:/buildbot/.aarch64-ubuntu/usr/lib/aarch64-linux-gnu\\crtn.o" 
>
> the `Inputs{{[^"]+}}aarch64-suse-linux/{{[^"]+}}crt1.o"` check is looking for `crt1.o` "under" aarch64-suse-linux triple, but it is "under" the default triple for the toolchain -  aarch64-linux-gnu.
> The only `crtbegin.o` and `crtend.o` files are "under" expected triple - aarch64-suse-linux. So, I suppose, there is a bug in the test or somewhere in the implementation.

`--sysroot=` may help `crt1.o`. I cannot test so hope you can verify it and make the change:)

In the end, testing Linux cross compiling on Windows gives us plethora issues due to backslashes. This actually works on x86-64 Windows machines so perhaps that is fine. And I think we've identified the root issue on aarch64 Windows.
If turns out to be more issues, I'd just suggest `UNSUPPORTED: system-windows`...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97993/new/

https://reviews.llvm.org/D97993



More information about the cfe-commits mailing list