Skip to content

Conversation

@amsen20
Copy link
Contributor

@amsen20 amsen20 commented Jun 25, 2025

This PR adds a minimal version of UnwindInfoChecker described in here.

This implementation looks into the modified registers by each instruction and checks:

  • If one of them is the CFA register, and it informs the user if the CFA data is not modified as well.
  • If one of them is used in another register's unwinding rule, it informs the user if the unwind info is not modified after this instruction.

This implementation does not support DWARF expressions and treats them as unknown unwinding rules.

Amirhossein Pashaeehir added 30 commits June 25, 2025 03:55
- Changing the register and not informing it using cfi directives
- Changing the CFA and report it wrong
- Load a register from another register stored location
@petrhosek petrhosek merged commit db03408 into llvm:main Jul 9, 2025
9 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 9, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-aarch64-darwin running on doug-worker-4 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/23071

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: DWARFCFIChecker/X86/empty-section.s' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/llvm-mc -triple x86_64-pc-linux-gnu /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/DWARFCFIChecker/X86/empty-section.s --validate-cfi --filetype=null 2>&1 | /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/DWARFCFIChecker/X86/empty-section.s --allow-empty --implicit-check-not warning: --implicit-check-not error: # RUN: at line 1
+ /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/llvm-mc -triple x86_64-pc-linux-gnu /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/DWARFCFIChecker/X86/empty-section.s --validate-cfi --filetype=null
+ /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/DWARFCFIChecker/X86/empty-section.s --allow-empty --implicit-check-not warning: --implicit-check-not error:
�[1mcommand line:1:22: �[0m�[0;1;31merror: �[0m�[1mIMPLICIT-CHECK-NOT: excluded string found in input
�[0m-implicit-check-not='error:'
�[0;1;32m                     ^
�[0m�[1m<stdin>:1:65: �[0m�[0;1;30mnote: �[0m�[1mfound here
�[0m/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/llvm-mc: error: unable to get target for 'x86_64-pc-linux-gnu', see --version and --triple.
�[0;1;32m                                                                ^~~~~~
�[0m
Input file: <stdin>
Check file: /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/DWARFCFIChecker/X86/empty-section.s

-dump-input=help explains the following input dump.

Input was:
<<<<<<
�[1m�[0m�[0;1;30m          1: �[0m�[1m�[0;1;46m/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/llvm-mc: error: unable to get target for 'x86_64-pc-linux-gnu', see --version and --triple.�[0m
�[0;1;32meof:3                                                                                                                                                          ^
�[0m�[0;1;32mnot:imp1     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
�[0m�[0;1;31mnot:imp2                                                                     !~~~~~                                                                             error: no match expected
�[0m>>>>>>

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 9, 2025

LLVM Buildbot has detected a new failure on builder clang-aarch64-quick running on linaro-clang-aarch64-quick while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/65/builds/19256

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: DWARFCFIChecker/X86/spill-two-reg.s' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/llvm-mc -triple x86_64-pc-linux-gnu /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/DWARFCFIChecker/X86/spill-two-reg.s --validate-cfi --filetype=null 2>&1 | /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/DWARFCFIChecker/X86/spill-two-reg.s # RUN: at line 1
+ /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/llvm-mc -triple x86_64-pc-linux-gnu /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/DWARFCFIChecker/X86/spill-two-reg.s --validate-cfi --filetype=null
+ /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/DWARFCFIChecker/X86/spill-two-reg.s
/home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/DWARFCFIChecker/X86/spill-two-reg.s:16:11: error: CHECK: expected string not found in input
 # CHECK: warning: CFA offset is changed from 8 to 16, and CFA register RSP is modified, but validating the modification amount is not implemented yet
          ^
<stdin>:1:1: note: scanning from here
/home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/llvm-mc: error: unable to get target for 'x86_64-pc-linux-gnu', see --version and --triple.
^

Input file: <stdin>
Check file: /home/tcwg-buildbot/worker/clang-aarch64-quick/llvm/llvm/test/DWARFCFIChecker/X86/spill-two-reg.s

-dump-input=help explains the following input dump.

Input was:
<<<<<<
          1: /home/tcwg-buildbot/worker/clang-aarch64-quick/stage1/bin/llvm-mc: error: unable to get target for 'x86_64-pc-linux-gnu', see --version and --triple.
check:16     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
>>>>>>

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 9, 2025

LLVM Buildbot has detected a new failure on builder clang-armv8-quick running on linaro-clang-armv8-quick while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/154/builds/18461

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: DWARFCFIChecker/X86/single-func-missed-cfi-directive.s' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
not /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/llvm-mc -triple x86_64-pc-linux-gnu /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/DWARFCFIChecker/X86/single-func-missed-cfi-directive.s --validate-cfi --filetype=null 2>&1 | /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/DWARFCFIChecker/X86/single-func-missed-cfi-directive.s # RUN: at line 1
+ not /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/llvm-mc -triple x86_64-pc-linux-gnu /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/DWARFCFIChecker/X86/single-func-missed-cfi-directive.s --validate-cfi --filetype=null
+ /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/DWARFCFIChecker/X86/single-func-missed-cfi-directive.s
/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/DWARFCFIChecker/X86/single-func-missed-cfi-directive.s:16:11: error: CHECK: expected string not found in input
 # CHECK: error: changed register RBP, that register RBP's unwinding rule uses, but there is no CFI directives about it
          ^
<stdin>:1:1: note: scanning from here
/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/llvm-mc: error: unable to get target for 'x86_64-pc-linux-gnu', see --version and --triple.
^

Input file: <stdin>
Check file: /home/tcwg-buildbot/worker/clang-armv8-quick/llvm/llvm/test/DWARFCFIChecker/X86/single-func-missed-cfi-directive.s

-dump-input=help explains the following input dump.

Input was:
<<<<<<
          1: /home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/llvm-mc: error: unable to get target for 'x86_64-pc-linux-gnu', see --version and --triple.
check:16     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
>>>>>>

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 9, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-win-x-aarch64 running on as-builder-2 while building llvm at step 9 "test-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/193/builds/8938

Here is the relevant piece of the build log for the reference
Step 9 (test-check-llvm) failure: Test just built components: check-llvm completed (failure)
******************** TEST 'LLVM :: DWARFCFIChecker/X86/cfa-corner-cases.s' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
not c:\buildbot\as-builder-2\x-aarch64\build\bin\llvm-mc.exe -triple x86_64-pc-linux-gnu C:\buildbot\as-builder-2\x-aarch64\llvm-project\llvm\test\DWARFCFIChecker\X86\cfa-corner-cases.s --validate-cfi --filetype=null 2>&1 | c:\buildbot\as-builder-2\x-aarch64\build\bin\filecheck.exe C:\buildbot\as-builder-2\x-aarch64\llvm-project\llvm\test\DWARFCFIChecker\X86\cfa-corner-cases.s
# executed command: not 'c:\buildbot\as-builder-2\x-aarch64\build\bin\llvm-mc.exe' -triple x86_64-pc-linux-gnu 'C:\buildbot\as-builder-2\x-aarch64\llvm-project\llvm\test\DWARFCFIChecker\X86\cfa-corner-cases.s' --validate-cfi --filetype=null
# executed command: 'c:\buildbot\as-builder-2\x-aarch64\build\bin\filecheck.exe' 'C:\buildbot\as-builder-2\x-aarch64\llvm-project\llvm\test\DWARFCFIChecker\X86\cfa-corner-cases.s'
# .---command stderr------------
# | C:\buildbot\as-builder-2\x-aarch64\llvm-project\llvm\test\DWARFCFIChecker\X86\cfa-corner-cases.s:17:11: error: CHECK: expected string not found in input
# |  # CHECK: error: modified CFA register RSP but not changed CFA rule
# |           ^
# | <stdin>:1:1: note: scanning from here
# | c:\buildbot\as-builder-2\x-aarch64\build\bin\llvm-mc.exe: error: unable to get target for 'x86_64-pc-linux-gnu', see --version and --triple.
# | ^
# | <stdin>:1:59: note: possible intended match here
# | c:\buildbot\as-builder-2\x-aarch64\build\bin\llvm-mc.exe: error: unable to get target for 'x86_64-pc-linux-gnu', see --version and --triple.
# |                                                           ^
# | 
# | Input file: <stdin>
# | Check file: C:\buildbot\as-builder-2\x-aarch64\llvm-project\llvm\test\DWARFCFIChecker\X86\cfa-corner-cases.s
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |             1: c:\buildbot\as-builder-2\x-aarch64\build\bin\llvm-mc.exe: error: unable to get target for 'x86_64-pc-linux-gnu', see --version and --triple.
# | check:17'0     X~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error: no match found
# | check:17'1                                                               ?                                                                                  possible intended match
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@dyung
Copy link
Collaborator

dyung commented Jul 9, 2025

It looks like we need a lit.local.cfg file to mark the tests as unsupported if X86 is not in the built targets?

@amsen20
Copy link
Contributor Author

amsen20 commented Jul 9, 2025

It looks like we need a lit.local.cfg file to mark the tests as unsupported if X86 is not in the built targets?

I submitted a PR that fixes it, if it doesn't get fixed I'll add Required: x86 to the tests

@amsen20
Copy link
Contributor Author

amsen20 commented Jul 9, 2025

lit.local.cfg

@dyung I changed the PR and added lit.local.cfg that ignores the target if it doesn't support X86, but I cannot test it on Mac by myself.
Do you have any idea how I can test if it fixes it or not?

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 9, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-win-x-armv7l running on as-builder-1 while building llvm at step 9 "test-check-llvm".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/38/builds/4318

Here is the relevant piece of the build log for the reference
Step 9 (test-check-llvm) failure: Test just built components: check-llvm completed (failure)
******************** TEST 'LLVM :: DWARFCFIChecker/X86/empty-nested-frames.s' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 1
c:\buildbot\as-builder-1\x-armv7l\build\bin\llvm-mc.exe -triple x86_64-pc-linux-gnu C:\buildbot\as-builder-1\x-armv7l\llvm-project\llvm\test\DWARFCFIChecker\X86\empty-nested-frames.s --validate-cfi --filetype=null 2>&1 | c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe C:\buildbot\as-builder-1\x-armv7l\llvm-project\llvm\test\DWARFCFIChecker\X86\empty-nested-frames.s --allow-empty --implicit-check-not warning: --implicit-check-not error:
# executed command: 'c:\buildbot\as-builder-1\x-armv7l\build\bin\llvm-mc.exe' -triple x86_64-pc-linux-gnu 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\llvm\test\DWARFCFIChecker\X86\empty-nested-frames.s' --validate-cfi --filetype=null
# note: command had no output on stdout or stderr
# error: command failed with exit status: 1
# executed command: 'c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe' 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\llvm\test\DWARFCFIChecker\X86\empty-nested-frames.s' --allow-empty --implicit-check-not warning: --implicit-check-not error:
# .---command stderr------------
# | command line:1:22: error: IMPLICIT-CHECK-NOT: excluded string found in input
# | -implicit-check-not='error:'
# |                      ^
# | <stdin>:1:58: note: found here
# | c:\buildbot\as-builder-1\x-armv7l\build\bin\llvm-mc.exe: error: unable to get target for 'x86_64-pc-linux-gnu', see --version and --triple.
# |                                                          ^~~~~~
# | 
# | Input file: <stdin>
# | Check file: C:\buildbot\as-builder-1\x-armv7l\llvm-project\llvm\test\DWARFCFIChecker\X86\empty-nested-frames.s
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |           1: c:\buildbot\as-builder-1\x-armv7l\build\bin\llvm-mc.exe: error: unable to get target for 'x86_64-pc-linux-gnu', see --version and --triple.
# | not:imp2                                                              !~~~~~                                                                             error: no match expected
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

********************


@dyung
Copy link
Collaborator

dyung commented Jul 9, 2025

lit.local.cfg

@dyung I changed the PR and added lit.local.cfg that ignores the target if it doesn't support X86, but I cannot test it on Mac by myself. Do you have any idea how I can test if it fixes it or not?

Thanks! It looks like this fixed the issue. From your change, I didn't see anything that was Mac-specific, so it shouldn't have really required a Mac to test (and from it passing it proves it did not).

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 9, 2025

LLVM Buildbot has detected a new failure on builder clang-solaris11-sparcv9 running on solaris11-sparcv9 while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/13/builds/8258

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'LLVM :: DWARFCFIChecker/X86/empty-nested-frames.s' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/bin/llvm-mc -triple x86_64-pc-linux-gnu /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/test/DWARFCFIChecker/X86/empty-nested-frames.s --validate-cfi --filetype=null 2>&1 | /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/bin/FileCheck /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/test/DWARFCFIChecker/X86/empty-nested-frames.s --allow-empty --implicit-check-not warning: --implicit-check-not error: # RUN: at line 1
+ /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/bin/llvm-mc -triple x86_64-pc-linux-gnu /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/test/DWARFCFIChecker/X86/empty-nested-frames.s --validate-cfi --filetype=null
+ /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/bin/FileCheck /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/test/DWARFCFIChecker/X86/empty-nested-frames.s --allow-empty --implicit-check-not warning: --implicit-check-not error:
command line:1:22: error: IMPLICIT-CHECK-NOT: excluded string found in input
-implicit-check-not='error:'
                     ^
<stdin>:1:87: note: found here
/opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/bin/llvm-mc: error: unable to get target for 'x86_64-pc-linux-gnu', see --version and --triple.
                                                                                      ^~~~~~

Input file: <stdin>
Check file: /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/llvm/llvm/test/DWARFCFIChecker/X86/empty-nested-frames.s

-dump-input=help explains the following input dump.

Input was:
<<<<<<
          1: /opt/llvm-buildbot/home/solaris11-sparcv9/clang-solaris11-sparcv9/stage1/bin/llvm-mc: error: unable to get target for 'x86_64-pc-linux-gnu', see --version and --triple.
not:imp2                                                                                           !~~~~~                                                                             error: no match expected
>>>>>>

--

********************


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants