[llvm-branch-commits] [lld] r362273 - Merging part of r358975:

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri May 31 15:44:16 PDT 2019


Author: tstellar
Date: Fri May 31 15:44:16 2019
New Revision: 362273

URL: http://llvm.org/viewvc/llvm-project?rev=362273&view=rev
Log:
Merging part of r358975:

Only merged the test changes in files that were also changed in r360405.

------------------------------------------------------------------------
r358975 | maskray | 2019-04-23 04:47:28 -0700 (Tue, 23 Apr 2019) | 18 lines

[PPC][PPC64] Improve some llvm-objdump -d -D tests

Various improvement:

Some offsets in disassembly are incorrect after several layout adjustment. Fix them.
llvm-objdump -D should not be used. -D dumps unrelated non-text sections. Replace them with llvm-objdump -d, llvm-readelf -x, etc
Many llvm-objdump -d tests use {{.*}} . Add the option --no-show-raw-insn to avoid check hex bytes.

ppc64-long-branch.s does not need a shared object. Delete it.
Make ppc64-ifunc.s check 2 ifuncs.

Reviewers: ruiu, espindola

Subscribers: emaste, nemanjai, arichardson, kbarton, jsji, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D60998
------------------------------------------------------------------------

Modified:
    lld/branches/release_80/test/ELF/ppc64-call-reach.s
    lld/branches/release_80/test/ELF/ppc64-ifunc.s
    lld/branches/release_80/test/ELF/ppc64-toc-restore-recursive-call.s
    lld/branches/release_80/test/ELF/ppc64-toc-restore.s

Modified: lld/branches/release_80/test/ELF/ppc64-call-reach.s
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_80/test/ELF/ppc64-call-reach.s?rev=362273&r1=362272&r2=362273&view=diff
==============================================================================
--- lld/branches/release_80/test/ELF/ppc64-call-reach.s (original)
+++ lld/branches/release_80/test/ELF/ppc64-call-reach.s Fri May 31 15:44:16 2019
@@ -3,16 +3,16 @@
 # RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
 # RUN: ld.lld --defsym callee=0x12010010 --defsym tail_callee=0x12010020 \
 # RUN: %t.o -o %t
-# RUN: llvm-objdump -d %t | FileCheck %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
 # RUN: ld.lld --defsym callee=0x12010010 --defsym tail_callee=0x12010020 \
 # RUN: %t.o -o %t
-# RUN: llvm-objdump -d %t | FileCheck %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
 # RUN: ld.lld --defsym callee=0xE010014 --defsym tail_callee=0xE010024 \
 # RUN: %t.o -o %t
-# RUN: llvm-objdump -d %t | FileCheck --check-prefix=NEGOFFSET  %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=NEGOFFSET  %s
 # RUN: ld.lld --defsym callee=0x12010018 --defsym tail_callee=0x12010028 \
 # RUN: %t.o -o %t
-# RUN: llvm-objdump -d %t | FileCheck --check-prefix=THUNK %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=THUNK %s
 # RUN: llvm-readelf --sections %t | FileCheck --check-prefix=BRANCHLT %s
 # RUN: not ld.lld --defsym callee=0x1001002D --defsym tail_callee=0x1001002F \
 # RUN: %t.o -o %t 2>&1 | FileCheck --check-prefix=MISSALIGNED %s
@@ -20,16 +20,16 @@
 # RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
 # RUN: ld.lld --defsym callee=0x12010010 --defsym tail_callee=0x12010020 \
 # RUN: %t.o -o %t
-# RUN: llvm-objdump -d %t | FileCheck %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
 # RUN: ld.lld --defsym callee=0x12010010 --defsym tail_callee=0x12010020 \
 # RUN: %t.o -o %t
-# RUN: llvm-objdump -d %t | FileCheck %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
 # RUN: ld.lld --defsym callee=0xE010014 --defsym tail_callee=0xE010024 \
 # RUN: %t.o -o %t
-# RUN: llvm-objdump -d %t | FileCheck --check-prefix=NEGOFFSET  %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=NEGOFFSET  %s
 # RUN: ld.lld --defsym callee=0x12010018 --defsym tail_callee=0x12010028 \
 # RUN: %t.o -o %t
-# RUN: llvm-objdump -d %t | FileCheck --check-prefix=THUNK %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=THUNK %s
 # RUN: llvm-readelf --sections %t | FileCheck --check-prefix=BRANCHLT %s
 # RUN: not ld.lld --defsym callee=0x1001002D --defsym tail_callee=0x1001002F \
 # RUN: %t.o -o %t 2>&1 | FileCheck --check-prefix=MISSALIGNED %s
@@ -58,23 +58,23 @@ test:
 # Check that we are branching to the definitions, and not range-extending
 # thunks.
 # CHECK-LABEL: test
-# CHECK:  10010014: {{.*}}  bl .+33554428
-# CHECK:  10010024: {{.*}}  b  .+33554428
+# CHECK:  10010014:       bl .+33554428
+# CHECK:  10010024:       b  .+33554428
 
 # NEGOFFSET-LABEL: test
-# NEGOFFSET:  10010014: {{.*}}  bl .-33554432
-# NEGOFFSET:  10010024: {{.*}}  b  .+33554432
+# NEGOFFSET:  10010014:       bl .-33554432
+# NEGOFFSET:  10010024:       b  .+33554432
 
 # .branch_lt[0]
 # THUNK-LABEL: __long_branch_callee:
-# THUNK-NEXT: 10010000: {{.*}} addis 12, 2, -1
+# THUNK-NEXT: 10010000:        addis 12, 2, -1
 # THUNK-NEXT:                  ld 12, -32768(12)
 # THUNK-NEXT:                  mtctr 12
 # THUNK-NEXT:                  bctr
 
 # .branch_lt[1]
 # THUNK-LABEL: __long_branch_tail_callee:
-# THUNK-NEXT: 10010010: {{.*}} addis 12, 2, -1
+# THUNK-NEXT: 10010010:        addis 12, 2, -1
 # THUNK-NEXT:                  ld 12, -32760(12)
 # THUNK-NEXT:                  mtctr 12
 # THUNK-NEXT:                  bctr
@@ -83,12 +83,11 @@ test:
 # the offset is interpreted as a signed 26 bit value so 67108812 is actually
 # -52.
 # THUNK-LABEL: test:
-# THUNK: 10010034: {{.*}}  bl .-52
-# THUNK: 10010044: {{.*}}  b .+67108812
+# THUNK: 10010034:       bl .-52
+# THUNK: 10010044:       b .+67108812
 
 # The offset from the TOC to the .branch_lt section  is (-1 << 16) - 32768.
 #                Name             Type            Address          Off    Size
 # BRANCHLT:     .branch_lt        PROGBITS        0000000010020000 020000 000010
 # BRANCHLT:     .got              PROGBITS        0000000010030000 030000 000008
 # BRANCHLT-NOT: .plt
-

Modified: lld/branches/release_80/test/ELF/ppc64-ifunc.s
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_80/test/ELF/ppc64-ifunc.s?rev=362273&r1=362272&r2=362273&view=diff
==============================================================================
--- lld/branches/release_80/test/ELF/ppc64-ifunc.s (original)
+++ lld/branches/release_80/test/ELF/ppc64-ifunc.s Fri May 31 15:44:16 2019
@@ -1,79 +1,67 @@
 # REQUIRES: ppc
 
 # RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
-# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
-# RUN: ld.lld -shared %t2.o -o %t2.so
-# RUN: ld.lld %t.o %t2.so -o %t
-# RUN: llvm-objdump -D %t | FileCheck %s
-# RUN: llvm-readelf -dynamic-table %t | FileCheck --check-prefix=DT %s
-# RUN: llvm-readelf -dyn-relocations %t | FileCheck --check-prefix=DYNREL %s
+# RUN: ld.lld %t.o -o %t
+# RUN: llvm-nm %t | FileCheck --check-prefix=NM %s
+# RUN: llvm-readelf -S %t | FileCheck --check-prefix=SECTIONS %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
+# RUN: llvm-readelf -r %t | FileCheck --check-prefix=DYNREL %s
 
 # RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
-# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
-# RUN: ld.lld -shared %t2.o -o %t2.so
-# RUN: ld.lld %t.o %t2.so -o %t
-# RUN: llvm-objdump -D %t | FileCheck %s
-# RUN: llvm-readelf -dynamic-table %t | FileCheck --check-prefix=DT %s
-# RUN: llvm-readelf -dyn-relocations %t | FileCheck --check-prefix=DYNREL %s
-
-# CHECK: Disassembly of section .text:
-
-# Tocbase    + (0 << 16) + 32560
-# 0x100280e0 +  0        + 32560 = 0x10030010 (.plt[2])
-# CHECK: __plt_foo:
+# RUN: ld.lld %t.o -o %t
+# RUN: llvm-nm %t | FileCheck --check-prefix=NM %s
+# RUN: llvm-readelf -S %t | FileCheck --check-prefix=SECTIONS %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
+# RUN: llvm-readelf -r %t | FileCheck --check-prefix=DYNREL %s
+
+# NM-DAG: 0000000010028000 d .TOC.
+# NM-DAG: 0000000010010028 T ifunc
+# NM-DAG: 000000001001002c T ifunc2
+
+# SECTIONS: .plt NOBITS 0000000010030000
+
+# .plt[0] - .TOC. = 0x10030000 - 0x10028000 = (1<<16) - 32768
+# CHECK: __plt_ifunc:
 # CHECK-NEXT:     std 2, 24(1)
-# CHECK-NEXT:     addis 12, 2, 0
-# CHECK-NEXT:     ld 12, 32560(12)
+# CHECK-NEXT:     addis 12, 2, 1
+# CHECK-NEXT:     ld 12, -32768(12)
 # CHECK-NEXT:     mtctr 12
 # CHECK-NEXT:     bctr
 
-# Tocbase    + (0 << 16)  +  32568
-# 0x100280e0 +  0          + 32568 = 0x1003018 (.plt[3])
-# CHECK: __plt_ifunc:
+# .plt[1] - .TOC. = 0x10030000+8 - 0x10028000 = (1<<16) - 32760
+# CHECK: __plt_ifunc2:
 # CHECK-NEXT:     std 2, 24(1)
-# CHECK-NEXT:     addis 12, 2, 0
-# CHECK-NEXT:     ld 12, 32568(12)
+# CHECK-NEXT:     addis 12, 2, 1
+# CHECK-NEXT:     ld 12, -32760(12)
 # CHECK-NEXT:     mtctr 12
 # CHECK-NEXT:     bctr
 
-# CHECK: ifunc:
-# CHECK-NEXT: 10010028:  {{.*}} nop
-
+# __plt_ifunc - . = 0x10010000 - 0x10010038 = -56
+# __plt_ifunc2 - . = 0x10010014 - 0x10010040 = -44
 # CHECK: _start:
-# CHECK-NEXT:     addis 2, 12, 2
-# CHECK-NEXT:     addi 2, 2, -32588
-# CHECK-NEXT:     bl .-52
-# CHECK-NEXT:     ld 2, 24(1)
-# CHECK-NEXT:     bl .-40
-# CHECK-NEXT:     ld 2, 24(1)
-
-# Check tocbase
-# CHECK:       Disassembly of section .got:
-# CHECK-NEXT:    .got:
-# CHECK-NEXT:    100200e0
-
-# Check .plt address
-# DT_PLTGOT should point to the start of the .plt section.
-# DT: 0x0000000000000003 PLTGOT 0x10030000
-
-# Check that we emit the correct dynamic relocation type for an ifunc
-# DYNREL: 'PLT' relocation section at offset 0x{{[0-9a-f]+}} contains 48 bytes:
-# 48 bytes --> 2 Elf64_Rela relocations
-# DYNREL-NEXT: Offset        Info           Type               Symbol's Value  Symbol's Name + Addend
-# DYNREL-NEXT: {{[0-9a-f]+}} {{[0-9a-f]+}}  R_PPC64_JMP_SLOT      {{0+}}            foo + 0
-# DYNREL-NEXT: {{[0-9a-f]+}} {{[0-9a-f]+}}  R_PPC64_IRELATIVE     10010028
-
-
-    .text
-    .abiversion 2
+# CHECK-NEXT:                 addis 2, 12, 1
+# CHECK-NEXT:                 addi 2, 2, 32720
+# CHECK-NEXT: 10010038:       bl .-56
+# CHECK-NEXT:                 ld 2, 24(1)
+# CHECK-NEXT: 10010040:       bl .-44
+# CHECK-NEXT:                 ld 2, 24(1)
+
+# Check that we emit 2 R_PPC64_IRELATIVE.
+# DYNREL: R_PPC64_IRELATIVE       10010028
+# DYNREL: R_PPC64_IRELATIVE       1001002c
 
 .type ifunc STT_GNU_IFUNC
 .globl ifunc
 ifunc:
- nop
+  nop
+
+.type ifunc2 STT_GNU_IFUNC
+.globl ifunc2
+ifunc2:
+  nop
 
-    .global _start
-    .type   _start, at function
+.global _start
+.type   _start, at function
 
 _start:
 .Lfunc_gep0:
@@ -81,7 +69,7 @@ _start:
   addi 2, 2, .TOC.-.Lfunc_gep0 at l
 .Lfunc_lep0:
   .localentry     _start, .Lfunc_lep0-.Lfunc_gep0
-  bl foo
-  nop
   bl ifunc
   nop
+  bl ifunc2
+  nop

Modified: lld/branches/release_80/test/ELF/ppc64-toc-restore-recursive-call.s
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_80/test/ELF/ppc64-toc-restore-recursive-call.s?rev=362273&r1=362272&r2=362273&view=diff
==============================================================================
--- lld/branches/release_80/test/ELF/ppc64-toc-restore-recursive-call.s (original)
+++ lld/branches/release_80/test/ELF/ppc64-toc-restore-recursive-call.s Fri May 31 15:44:16 2019
@@ -1,8 +1,8 @@
 # REQUIRES: ppc
 
-# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t1.o
-# RUN: ld.lld -shared %t1.o -o %t
-# RUN: llvm-objdump -d -r %t | FileCheck %s
+# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
+# RUN: ld.lld -shared %t.o -o %t.so
+# RUN: llvm-objdump -d --no-show-raw-insn -r %t.so | FileCheck %s
 
 # For a recursive call that is interposable the linker calls the plt-stub rather
 # then calling the function directly. Since the call is through a plt stub and
@@ -18,8 +18,8 @@
 # CHECK-NEXT: 10000:
 # CHECK-LABEL: recursive_func
 # CHECK-NEXT:  10014:
-# CHECK:       1003c: {{.*}}  bl .-60
-# CHECK-NEXT:  ld 2, 24(1)
+# CHECK:       1003c:       bl .-60
+# CHECK-NEXT:  10040:       ld 2, 24(1)
 
         .abiversion 2
         .section ".text"

Modified: lld/branches/release_80/test/ELF/ppc64-toc-restore.s
URL: http://llvm.org/viewvc/llvm-project/lld/branches/release_80/test/ELF/ppc64-toc-restore.s?rev=362273&r1=362272&r2=362273&view=diff
==============================================================================
--- lld/branches/release_80/test/ELF/ppc64-toc-restore.s (original)
+++ lld/branches/release_80/test/ELF/ppc64-toc-restore.s Fri May 31 15:44:16 2019
@@ -5,14 +5,14 @@
 // RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/ppc64-func.s -o %t3.o
 // RUN: ld.lld -shared %t2.o -o %t2.so
 // RUN: ld.lld %t.o %t2.so %t3.o -o %t
-// RUN: llvm-objdump -d %t | FileCheck %s
+// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
 
 // RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
 // RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
 // RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/ppc64-func.s -o %t3.o
 // RUN: ld.lld -shared %t2.o -o %t2.so
 // RUN: ld.lld %t.o %t2.so %t3.o -o %t
-// RUN: llvm-objdump -d %t | FileCheck %s
+// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
 
     .text
     .abiversion 2
@@ -32,12 +32,12 @@ _start:
 
 // CHECK: Disassembly of section .text:
 // CHECK: _start:
-// CHECK:     1001001c: {{.*}}  bl .-28
-// CHECK-NOT: 10010020: {{.*}}  nop
-// CHECK:     10010020: {{.*}}  ld 2, 24(1)
-// CHECK:     10010024: {{.*}}  bl .-16
-// CHECK-NOT: 10010028: {{.*}}  nop
-// CHECK-NOT: 10010028: {{.*}}  ld 2, 24(1)
+// CHECK:     1001001c:       bl .-28
+// CHECK-NOT: 10010020:       nop
+// CHECK:     10010020:       ld 2, 24(1)
+// CHECK:     10010024:       bl .-16
+// CHECK-NOT: 10010028:       nop
+// CHECK-NOT: 10010028:       ld 2, 24(1)
 
 # Calling a function in another object file which will have same
 # TOC base does not need a nop. If nop present, do not rewrite to
@@ -49,18 +49,18 @@ _diff_object:
   nop
 
 // CHECK: _diff_object:
-// CHECK-NEXT: 10010028: {{.*}}  bl .+24
-// CHECK-NEXT: 1001002c: {{.*}}  bl .+20
-// CHECK-NEXT: 10010030: {{.*}}  nop
+// CHECK-NEXT: 10010028:       bl .+24
+// CHECK-NEXT: 1001002c:       bl .+20
+// CHECK-NEXT: 10010030:       nop
 
 # Branching to a local function does not need a nop
 .global noretbranch
 noretbranch:
   b bar_local
 // CHECK: noretbranch:
-// CHECK:     10010034:  {{.*}}  b .+67108832
-// CHECK-NOT: 10010038:  {{.*}}  nop
-// CHECK-NOT: 1001003c:  {{.*}}  ld 2, 24(1)
+// CHECK:     10010034:        b .+67108832
+// CHECK-NOT: 10010038:        nop
+// CHECK-NOT: 1001003c:        ld 2, 24(1)
 
 // This should come last to check the end-of-buffer condition.
 .global last
@@ -68,5 +68,5 @@ last:
   bl foo
   nop
 // CHECK: last:
-// CHECK:      10010038: {{.*}}   bl .-56
-// CHECK-NEXT: 1001003c: {{.*}}   ld 2, 24(1)
+// CHECK:      10010038:       bl .-56
+// CHECK-NEXT: 1001003c:       ld 2, 24(1)




More information about the llvm-branch-commits mailing list