[PATCH] D77780: Remove -implicit-check-not=foo from X86/disassemble-functions.test
James Henderson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 9 03:13:37 PDT 2020
jhenderson added a comment.
In D77780#1971509 <https://reviews.llvm.org/D77780#1971509>, @xiangzhangllvm wrote:
> OK, I'll recheck the --disassemble-symbols, that is really strange for me the "--disassemble-symbols=main" will mask the other symbols in "main".
I'm not sure what you mean by "mask the other symbols", but I suspect you are misunderstanding the purpose of the test. On my machine with a recent build of llvm-objdump (post the recent fix I made), the output of this test is:
C:\llvm\build\test\tools\llvm-objdump\X86\Output\disassemble-functions.test.tmp.out: file format elf64-x86-64
Disassembly of section .anothertext:
0000000000000010 <main>:
10: 55 pushq %rbp
11: 48 89 e5 movq %rsp, %rbp
14: 48 83 ec 20 subq $32, %rsp
18: 48 8d 04 25 a8 00 00 00 leaq 168, %rax
20: c7 45 fc 00 00 00 00 movl $0, -4(%rbp)
27: 48 89 45 f0 movq %rax, -16(%rbp)
2b: 48 8b 45 f0 movq -16(%rbp), %rax
2f: 8b 08 movl (%rax), %ecx
31: 89 4d ec movl %ecx, -20(%rbp)
34: e8 c7 ff ff ff callq 0x0 </tmp/a.c>
39: 8b 4d ec movl -20(%rbp), %ecx
3c: 01 c1 addl %eax, %ecx
3e: 89 c8 movl %ecx, %eax
40: 48 83 c4 20 addq $32, %rsp
44: 5d popq %rbp
Without the --disassemble-symbols=main, the output is:
Disassembly of section .text:
0000000000000000 <foo>:
0: 55 pushq %rbp
1: 48 89 e5 movq %rsp, %rbp
4: 8b 04 25 a8 00 00 00 movl 168, %eax
b: 5d popq %rbp
c: c3 retq
d: 0f 1f 00 nopl (%rax)
Disassembly of section .anothertext:
0000000000000010 <main>:
10: 55 pushq %rbp
11: 48 89 e5 movq %rsp, %rbp
14: 48 83 ec 20 subq $32, %rsp
18: 48 8d 04 25 a8 00 00 00 leaq 168, %rax
20: c7 45 fc 00 00 00 00 movl $0, -4(%rbp)
27: 48 89 45 f0 movq %rax, -16(%rbp)
2b: 48 8b 45 f0 movq -16(%rbp), %rax
2f: 8b 08 movl (%rax), %ecx
31: 89 4d ec movl %ecx, -20(%rbp)
34: e8 c7 ff ff ff callq 0x0 </tmp/a.c>
39: 8b 4d ec movl -20(%rbp), %ecx
3c: 01 c1 addl %eax, %ecx
3e: 89 c8 movl %ecx, %eax
40: 48 83 c4 20 addq $32, %rsp
44: 5d popq %rbp
0000000000000045 <somedata>:
45: 74 65 73 74 20 73 74 72 test str
4d: 00 c3 ..
By adding `--implicit-check-not=<foo>:` to the FileCheck call, we show that the <foo> function is not disassembled, i.e. it is not printed before or after the disassembly of <main>. If you remove it, you will stop the test trying to test what it is for. For example, if llvm-objdump started disassembling the <foo> function, the test would no longer fail.
The current --implicit-check-not pattern does not prevent other appearances of foo in the output, such as because of the callq within the main function (note the improved implicit-check-not pattern I mentioned from commit rG27f303924e0b32e22820fa38cb659e9694954784 <https://reviews.llvm.org/rG27f303924e0b32e22820fa38cb659e9694954784>). However, the current (stable) output of llvm-objdump does not cause `foo` to appear in main anyway, so even then, I don't think this is an issue. With my in-progress change, you will see <foo> appear as the target of callq:
0000000000000010 <main>:
10: 55 pushq %rbp
11: 48 89 e5 movq %rsp, %rbp
14: 48 83 ec 20 subq $32, %rsp
18: 48 8d 04 25 a8 00 00 00 leaq 168, %rax
20: c7 45 fc 00 00 00 00 movl $0, -4(%rbp)
27: 48 89 45 f0 movq %rax, -16(%rbp)
2b: 48 8b 45 f0 movq -16(%rbp), %rax
2f: 8b 08 movl (%rax), %ecx
31: 89 4d ec movl %ecx, -20(%rbp)
34: e8 c7 ff ff ff callq 0x0 <foo>
39: 8b 4d ec movl -20(%rbp), %ecx
3c: 01 c1 addl %eax, %ecx
3e: 89 c8 movl %ecx, %eax
40: 48 83 c4 20 addq $32, %rsp
44: 5d popq %rbp
but this test will still pass with the existing --implicit-check-not pattern, because there is no ':' after `<foo>` in the call target.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D77780/new/
https://reviews.llvm.org/D77780
More information about the llvm-commits
mailing list