[PATCH] D77780: Remove -implicit-check-not=foo from X86/disassemble-functions.test

Xiang Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 8 23:57:56 PDT 2020


xiangzhangllvm created this revision.
Herald added subscribers: llvm-commits, rupprecht, MaskRay.
Herald added a reviewer: jhenderson.
Herald added a project: LLVM.
xiangzhangllvm edited the summary of this revision.
xiangzhangllvm added reviewers: craig.topper, LuoYuanke, annita.zhang, pengfei.
xiangzhangllvm added a comment.
xiangzhangllvm added a reviewer: MaskRay.

@jhenderson I find the test is changed by you. Why you do not want to check "foo" here. Thank you.


xiangzhangllvm added a comment.

   5 Disassembly of section .text:
   6
   7 0000000000000000 foo:
   8        0: 55                            pushq   %rbp
   9        1: 48 89 e5                      movq    %rsp, %rbp
  10        4: 8b 04 25 a8 00 00 00          movl    168, %eax
  11        b: 5d                            popq    %rbp
  12        c: c3                            retq
  13        d: 0f 1f 00                      nopl    (%rax)
  14
  15 Disassembly of section .anothertext:
  16
  17 0000000000000010 main:
  18       10: 55                            pushq   %rbp
  19       11: 48 89 e5                      movq    %rsp, %rbp
  20       14: 48 83 ec 20                   subq    $32, %rsp
  21       18: 48 8d 04 25 a8 00 00 00       leaq    168, %rax
  22       20: c7 45 fc 00 00 00 00          movl    $0, -4(%rbp)
  23       27: 48 89 45 f0                   movq    %rax, -16(%rbp)
  24       2b: 48 8b 45 f0                   movq    -16(%rbp), %rax
  25       2f: 8b 08                         movl    (%rax), %ecx
  26       31: 89 4d ec                      movl    %ecx, -20(%rbp)
  27       34: e8 c7 ff ff ff                callq   -57 </tmp/a.c>        // =call 0x00000000,   someone reflected there will be <foo> // objdump will dump "foo" here
  28       39: 8b 4d ec                      movl    -20(%rbp), %ecx
  29       3c: 01 c1                         addl    %eax, %ecx
  30       3e: 89 c8                         movl    %ecx, %eax
  31       40: 48 83 c4 20                   addq    $32, %rsp
  32       44: 5d                            popq    %rbp


Some people reflect that the test will failed randomly.
I didn't reproduce the error in my local, but I read the llvm-objdump source code,  I think I find out the reason:

1, In fact this test-self is not good,  (should not use -implicit-check*-not*='foo'). //objdump tool will show foo here.

2, This simple-executable-x86_64.yaml file will generate un-relocatable obj file by tool yaml2obj.

3,For un-relocatable obj file,  llvm-objdump will find a target address(related with a symbol) at follow ways:

  3-1: collect all symbol with its section.
  
  3-2: sort the sections with the start address order.
  
  3-3: find which section the target address in.
  
  3-4: find the right symbol in that section.

4, the error for this test is that, there are several sections have the some start address 0x00000000. So

it random go to the wrong section to find the target address's symbol. In other word, it some times don't know

which section is right when there more than one sections have the same target address the instruction needed.

ymbol table '.symtab' contains 12 entries:
Num: Value Size Type Bind Vis Ndx Name
0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND
1: 0000000000000000 0 SECTION LOCAL DEFAULT 1 .text
2: 0000000000000010 0 SECTION LOCAL DEFAULT 2 .anothertext
3: 0000000000000050 0 SECTION LOCAL DEFAULT 3 .eh_frame
4: 00000000000000a8 0 SECTION LOCAL DEFAULT 4 .data
5: 0000000000000000 0 SECTION LOCAL DEFAULT 5 .comment
6: 0000000000000000 0 FILE LOCAL DEFAULT UND /tmp/a.c
7: 0000000000000000 0 FILE LOCAL DEFAULT UND
8: 0000000000000045 0 OBJECT GLOBAL DEFAULT 2 somedata
9: 0000000000000010 63 FUNC GLOBAL DEFAULT 2 main
10: 0000000000000000 13 FUNC GLOBAL DEFAULT 1 foo
11: 00000000000000a8 4 OBJECT GLOBAL DEFAULT 4 a


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77780

Files:
  llvm/test/tools/llvm-objdump/X86/disassemble-functions.test


Index: llvm/test/tools/llvm-objdump/X86/disassemble-functions.test
===================================================================
--- llvm/test/tools/llvm-objdump/X86/disassemble-functions.test
+++ llvm/test/tools/llvm-objdump/X86/disassemble-functions.test
@@ -3,7 +3,7 @@
 
 # RUN: yaml2obj -o %t.out %p/Inputs/simple-executable-x86_64.yaml
 # RUN: llvm-objdump -d %t.out --disassemble-symbols=main \
-# RUN:   | FileCheck %s --check-prefix=MAIN --implicit-check-not="<foo>:" --implicit-check-not=somedata
+# RUN:   | FileCheck %s --check-prefix=MAIN --implicit-check-not=somedata
 # RUN: llvm-objdump -d %t.out --disassemble-symbols=main,foo \
 # RUN:   | FileCheck %s --check-prefixes=MAIN,FOO --implicit-check-not=somedata
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77780.256197.patch
Type: text/x-patch
Size: 735 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200409/84360256/attachment-0001.bin>


More information about the llvm-commits mailing list