[PATCH] D156363: [Driver] -###: exit with code 1 if hasErrorOccurred

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 31 07:47:05 PDT 2023


MaskRay added a comment.

In D156363#4546818 <https://reviews.llvm.org/D156363#4546818>, @dyung wrote:

> In D156363#4546171 <https://reviews.llvm.org/D156363#4546171>, @dyung wrote:
>
>> In D156363#4545474 <https://reviews.llvm.org/D156363#4545474>, @MaskRay wrote:
>>
>>> In D156363#4545215 <https://reviews.llvm.org/D156363#4545215>, @dyung wrote:
>>>
>>>> If you cannot reproduce this issue, I can take my buildbot offline and try to reproduce it to pinpoint which command is causing the problem, but I won’t be able to do so until Monday.
>>>
>>> Thank you, knowing which command caused the failure will be very helpful.
>>> `clang/test/Driver/fsanitize.c` has the most mysterious failure I have dealt with for this patch.
>>>
>>> FWIW I've checked that the test passes even if `/usr` does not exist (emulated by proot) => there is as if no host GCC installation that could affect Driver's behavior
>>>
>>>   % cat /tmp/Rel/bin/xxx
>>>   #!/bin/zsh
>>>   d=$(dirname "$0")
>>>   exec proot -R /tmp -b /bin -b /lib64 -b /lib $d/clang --target=aarch64-linux-musl "$@"
>>>   % cd clang/test/Driver
>>>   % CLANG=/tmp/Rel/bin/xxx /tmp/Rel/bin/llvm-lit -vv fsanitize.c
>>>   .. passed
>>
>> I have to run, but I did a quick -vv run with this commit and it seems to fail on the RUN line on 588:
>>
>>   + : 'RUN: at line 581'
>>   + /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/bin/clang --target=i386-apple-ios-simulator -fsanitize=leak /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/clang/test/Driver/fsanitize.c -###
>>   + /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/bin/FileCheck /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/clang/test/Driver/fsanitize.c --check-prefix=CHECK-LSAN-I386-IOSSIMULATOR
>>   + : 'RUN: at line 584'
>>   + /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/bin/clang --target=i386-apple-tvos-simulator -fsanitize=leak /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/clang/test/Driver/fsanitize.c -###
>>   + /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/bin/FileCheck /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/clang/test/Driver/fsanitize.c --check-prefix=CHECK-LSAN-I386-TVOSSIMULATOR
>>   + : 'RUN: at line 588'
>>   + not /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/bin/clang --target=x86_64-linux-gnu -fvisibility=hidden -fsanitize=cfi -flto -c /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/clang/test/Driver/fsanitize.c -###
>>   + /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/bin/FileCheck /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/clang/test/Driver/fsanitize.c --check-prefix=CHECK-CFI
>>   
>>   --
>>   
>>   ********************
>>   ********************
>>   Failed Tests (1):
>>     Clang :: Driver/fsanitize.c
>>
>> I'll try to look more later when I get more time.
>
> It appears that the clang command in the RUN line returns 0 which the `not` you added inverts it causing the test to fail:
>
>   buildbot at 6a3c0c51ae89:~/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/clang/test/Driver$ /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/bin/clang --target=x86_64-linux-gnu -fvisibility=hidden -fsanitize=cfi -flto -c /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/clang/test/Driver/fsanitize2.c -###
>   clang version 18.0.0 (https://github.com/llvm/llvm-project.git 8c3550b1a78fde7bf28f420da8447d9fde37017f)
>   Target: x86_64-unknown-linux-gnu
>   Thread model: posix
>   InstalledDir: /home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/bin
>    (in-process)
>    "/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/bin/clang-18" "-cc1" "-triple" "x86_64-unknown-linux-gnu" "-emit-llvm-bc" "-flto=full" "-flto-unit" "-disable-free" "-clear-ast-before-backend" "-main-file-name" "fsanitize2.c" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=all" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-debugger-tuning=gdb" "-fcoverage-compilation-dir=/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/clang/test/Driver" "-resource-dir" "/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/lib/clang/18" "-internal-isystem" "/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/lib/clang/18/include" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include" "-internal-externc-isystem" "/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-fdebug-compilation-dir=/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/clang/test/Driver" "-ferror-limit" "19" "-fvisibility=hidden" "-fsanitize=cfi-derived-cast,cfi-icall,cfi-mfcall,cfi-unrelated-cast,cfi-nvcall,cfi-vcall" "-fsanitize-trap=cfi-derived-cast,cfi-icall,cfi-mfcall,cfi-unrelated-cast,cfi-nvcall,cfi-vcall" "-fsanitize-system-ignorelist=/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/build/lib/clang/18/share/cfi_ignorelist.txt" "-fno-sanitize-memory-param-retval" "-fsanitize-cfi-canonical-jump-tables" "-fno-sanitize-address-use-odr-indicator" "-fgnuc-version=4.2.1" "-fcolor-diagnostics" "-fsplit-lto-unit" "-faddrsig" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o" "fsanitize2.o" "-x" "c" "/home/buildbot/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/clang/test/Driver/fsanitize2.c"
>   buildbot at 6a3c0c51ae89:~/buildbot-root/llvm-clang-x86_64-gcc-ubuntu/llvm-project/clang/test/Driver$ echo $?
>   0

Thank you! Theree is an error depending on whether the `cfi` target is built (whether `cfi_ignorelist.txt` exists).

  % /tmp/Rel/bin/clang --target=x86_64-linux-gnu -fvisibility=hidden -fsanitize=cfi -flto -c fsanitize.c '-###'
  clang version 18.0.0
  Target: x86_64-unknown-linux-gnu
  Thread model: posix
  InstalledDir: /tmp/Rel/bin
  clang: error: missing sanitizer ignorelist: '/tmp/Rel/lib/clang/18/share/cfi_ignorelist.txt'
   (in-process)
  ...

It seems that the most portable fix is `%clang --target=x86_64-linux-gnu -fvisibility=hidden -fsanitize=cfi -flto -c fsanitize.c '-###' 2> %t.err || true`, then check `%t.err`.

I am curious what @phosek 's failures were about.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156363



More information about the cfe-commits mailing list