Skip to content

[lld][test] filecheck typo fixes #93471

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

klensy
Copy link
Contributor

@klensy klensy commented May 27, 2024

Few more fixes

Still left ones:

lld\test\ELF\pack-dyn-relocs.s:196:4-20: unknown prefix "ANDROID64-HEADERS"; probably missing `llvm-readobj -S --dynamic-table` for android64
lld\test\ELF\ppc64-reloc-addr.s unknown prefix "HEXBE-NEXT"
lld\test\MachO\export-options.s unknown prefix "REEXPORT-NEXT"
lld\test\MachO\weak-definition-over-dysym.s "PREFER-NONWEAK-OBJECT". looks like some of "PREFER-WEAK-OBJECT" should be "PREFER-NONWEAK-OBJECT"

lld/test/ELF/arm-thumb-blx.s was changed in 2d37bf8 but left CHECK-NEXT-ARM and CHECK-NEXT-THUMB unmerged (they should be CHECK-ARM-NEXT and CHECK-THUMB-NEXT before that)

@llvmbot
Copy link
Member

llvmbot commented May 27, 2024

@llvm/pr-subscribers-lld-wasm
@llvm/pr-subscribers-lld-elf
@llvm/pr-subscribers-lld

@llvm/pr-subscribers-lld-macho

Author: klensy (klensy)

Changes

Few more fixes

Still left ones:

lld\test\ELF\pack-dyn-relocs.s:196:4-20: unknown prefix "ANDROID64-HEADERS"; probably missing `llvm-readobj -S --dynamic-table` for android64
lld\test\ELF\ppc64-reloc-addr.s unknown prefix "HEXBE-NEXT"
lld\test\MachO\export-options.s unknown prefix "REEXPORT-NEXT"
lld\test\MachO\weak-definition-over-dysym.s "PREFER-NONWEAK-OBJECT". looks like some of "PREFER-WEAK-OBJECT" should be "PREFER-NONWEAK-OBJECT"

Full diff: https://github.com/llvm/llvm-project/pull/93471.diff

8 Files Affected:

  • (modified) lld/test/COFF/duplicate.test (+1-1)
  • (modified) lld/test/COFF/pdb-local-constants.test (+1-1)
  • (modified) lld/test/ELF/arm-gotoff.s (+5-5)
  • (modified) lld/test/ELF/lto/sparcv9.ll (+1-1)
  • (modified) lld/test/MachO/compact-unwind-foldings.s (+2-2)
  • (modified) lld/test/MachO/eh-frame.s (+2-2)
  • (modified) lld/test/MachO/invalid/undef-debug.s (+1-1)
  • (modified) lld/test/wasm/tag-section.ll (+1-1)
diff --git a/lld/test/COFF/duplicate.test b/lld/test/COFF/duplicate.test
index 76c88b070ff37..3e97cbe318ea6 100644
--- a/lld/test/COFF/duplicate.test
+++ b/lld/test/COFF/duplicate.test
@@ -6,7 +6,7 @@ RUN: not lld-link /out:beta.dll /dll alpha.obj beta.obj alpha.lib 2>&1 | FileChe
 
 CHECK-ALPHA: error: duplicate symbol: f
 CHECK-ALPHA: defined at {{.*}}alpha.obj
-CHECK-APLHA: defined at alpha.dll
+CHECK-ALPHA: defined at alpha.dll
 
 RUN: llc -mtriple x86_64-windows-msvc -filetype obj -o gamma.obj %S/Inputs/gamma.ll
 RUN: not lld-link /out:gamma.exe /subsystem:console /entry:mainCRTStartup gamma.obj alpha.lib 2>&1 | FileCheck %s -check-prefix CHECK-GAMMA
diff --git a/lld/test/COFF/pdb-local-constants.test b/lld/test/COFF/pdb-local-constants.test
index 3a9538252ed80..4e8e8c0ee865b 100644
--- a/lld/test/COFF/pdb-local-constants.test
+++ b/lld/test/COFF/pdb-local-constants.test
@@ -18,4 +18,4 @@ CHECK-NEXT:           type = 0x1002 (const int), value = 321
 
 CHECK:                          Symbols
 CHECK:           220 | S_CONSTANT [size = 12] `i`
-CHECK-NEXT            type = 0x0074 (int), value = 123
\ No newline at end of file
+CHECK-NEXT:           type = 0x0074 (int), value = 123
\ No newline at end of file
diff --git a/lld/test/ELF/arm-gotoff.s b/lld/test/ELF/arm-gotoff.s
index 0a6ea3ab0dad9..989f9d5c4714e 100644
--- a/lld/test/ELF/arm-gotoff.s
+++ b/lld/test/ELF/arm-gotoff.s
@@ -54,14 +54,14 @@
 
 // DISASM:      Disassembly of section .text:
 // DISASM-EMPTY:
-// DISASM-NEXT :_start:
-// DISASM-NEXT   11114:       1e ff 2f e1     bx      lr
+// DISASM-NEXT: _start:
+// DISASM-NEXT:   11114:       1e ff 2f e1     bx      lr
 // Offset 0 from .got = bar
-// DISASM        11118:       00 10 00 00
+// DISASM:        11118:       00 10 00 00
 // Offset 10 from .got = obj
-// DISASM-NEXT   1111c:       0a 10 00 00
+// DISASM-NEXT:   1111c:       0a 10 00 00
 // Offset 15 from .got = obj +5
-// DISASM-NEXT   11120:       0f 10 00 00
+// DISASM-NEXT:   11120:       0f 10 00 00
  .syntax unified
  .globl _start
 _start:
diff --git a/lld/test/ELF/lto/sparcv9.ll b/lld/test/ELF/lto/sparcv9.ll
index a4cdc6eafa403..9ffdd988b6964 100644
--- a/lld/test/ELF/lto/sparcv9.ll
+++ b/lld/test/ELF/lto/sparcv9.ll
@@ -5,7 +5,7 @@
 ; RUN: ld.lld %t.bc -o %t
 ; RUN: llvm-readobj -h %t | FileCheck %s
 
-; CHECK    Class: 64-bit
+; CHECK:   Class: 64-bit
 ; CHECK:   DataEncoding: BigEndian
 ; CHECK: Machine: EM_SPARCV9
 
diff --git a/lld/test/MachO/compact-unwind-foldings.s b/lld/test/MachO/compact-unwind-foldings.s
index 18511da772144..0e97e708cf139 100644
--- a/lld/test/MachO/compact-unwind-foldings.s
+++ b/lld/test/MachO/compact-unwind-foldings.s
@@ -23,8 +23,8 @@
 ## Check that [1] offset starts at c's address + 3 (its length).
 # CHECK-LABEL: Contents of __unwind_info section:
 # CHECK:  Top level indices: (count = 2)
-# CHECK-NEXT : [0]: function offset=[[#%#.7x,MAIN_ADDR]]
-# CHECK-NEXT : [1]: function offset=[[#%#.7x,C_ADDR + 3]]
+# CHECK-NEXT: [0]: function offset=[[#%#.7x,MAIN_ADDR]]
+# CHECK-NEXT: [1]: function offset=[[#%#.7x,C_ADDR + 3]]
 
 #--- fold-tail.s
         .text
diff --git a/lld/test/MachO/eh-frame.s b/lld/test/MachO/eh-frame.s
index 64fd364c87a59..70c04d2cec2d4 100644
--- a/lld/test/MachO/eh-frame.s
+++ b/lld/test/MachO/eh-frame.s
@@ -66,8 +66,8 @@
 # CHECK:     [2]: function offset=0x[[#%.8x,H - BASE]], LSDA offset=0x[[#%.8x,EXCEPT2 - BASE]]
 # CHECK:   Second level indices:
 # CHECK:     Second level index[0]:
-# CHECK       [0]: function offset=0x[[#%.8x,F - BASE]],              encoding[{{.*}}]=0x52{{.*}}
-# CHECK       [1]: function offset=0x[[#%.8x,NO_UNWIND - BASE]],      encoding[{{.*}}]=0x00000000
+# CHECK:      [0]: function offset=0x[[#%.8x,F - BASE]],              encoding[{{.*}}]=0x52{{.*}}
+# CHECK:      [1]: function offset=0x[[#%.8x,NO_UNWIND - BASE]],      encoding[{{.*}}]=0x00000000
 # CHECK:      [2]: function offset=0x[[#%.8x,G - BASE]],              encoding[{{.*}}]=0x0[[#%x,DWARF_ENC]][[#%.6x, G_DWARF_OFF:]]
 # CHECK:      [3]: function offset=0x[[#%.8x,H - BASE]],              encoding[{{.*}}]=0x0[[#%x,DWARF_ENC]][[#%.6x, H_DWARF_OFF:]]
 # CHECK:      [4]: function offset=0x[[#%.8x,MY_PERSONALITY - BASE]], encoding[{{.*}}]=0x00000000
diff --git a/lld/test/MachO/invalid/undef-debug.s b/lld/test/MachO/invalid/undef-debug.s
index 7cf75fa898274..0990687d19750 100644
--- a/lld/test/MachO/invalid/undef-debug.s
+++ b/lld/test/MachO/invalid/undef-debug.s
@@ -6,7 +6,7 @@
 # CHECK-NEXT: >>> referenced by test.c:3
 # CHECK-NEXT: >>>               {{.*}}.o:(symbol _main+0x0)
 # CHECK-NEXT: >>> referenced by test.c:2
-# CHECK-NEXT  >>>               {{.*}}.o:(symbol _ptr+0x0)
+# CHECK-NEXT: >>>               {{.*}}.o:(symbol _ptr+0x0)
 
 ## This is the output of `clang -g2 -O2 -fdebug-compilation-dir=. -fno-ident` called on the following file, with the
 ## Apple DWARF tables removed:
diff --git a/lld/test/wasm/tag-section.ll b/lld/test/wasm/tag-section.ll
index 4decdb58f952a..c85c798ff5e53 100644
--- a/lld/test/wasm/tag-section.ll
+++ b/lld/test/wasm/tag-section.ll
@@ -44,7 +44,7 @@ define void @_start() {
 ; NOPIC:        - Type:            GLOBAL
 
 ; NOPIC-EXPORT-ALL:   - Type:            EXPORT
-; NOPIC-EXPORT-ALL-NEXT Exports:
+; NOPIC-EXPORT-ALL-NEXT: Exports:
 ; NOPIC-EXPORT-ALL:       - Name:            __cpp_exception
 ; NOPIC-EXPORT-ALL:         Kind:            TAG
 ; NOPIC-EXPORT-ALL:         Index:           0

@klensy
Copy link
Contributor Author

klensy commented May 27, 2024

tests with filecheck directives, but without RUN: with FileCheck
lld\test\COFF\pdb_char8_t.ll
lld\test\ELF\aarch64-cortex-a53-843419-thunk-align.s
lld\test\ELF\arm-thumb-branch-rangethunk.s

lld\test\ELF\comdat-discarded-gdb-index.s
lld\test\ELF\dso-undef-size.s
lld\test\ELF\lto\ctor-dtor-alias2.ll

@@ -23,8 +23,8 @@
## Check that [1] offset starts at c's address + 3 (its length).
# CHECK-LABEL: Contents of __unwind_info section:
# CHECK: Top level indices: (count = 2)
# CHECK-NEXT : [0]: function offset=[[#%#.7x,MAIN_ADDR]]
# CHECK-NEXT : [1]: function offset=[[#%#.7x,C_ADDR + 3]]
# CHECK-NEXT: [0]: function offset=[[#%#.7x,MAIN_ADDR]]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oontvoo @int3 This needs a fix

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I'm not sure I understand this change. Why is line 27 being deleted? From the PR's description seems to say it's only fixing typo ....

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, i see - feel free to revert this file (or temporarily disable the test), I'll have a look and fix it later this week. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Output is:

SYMBOL TABLE:
0000000100000380 l     F __TEXT,__text _a
0000000100000390 l     F __TEXT,__text _b
00000001000003a0 l     F __TEXT,__text _c
00000001000003a1 l     F __TEXT,__text _d
0000000100000370 g     F __TEXT,__text _main
0000000100000000 g     F __TEXT,__text __mh_execute_header
0000000000000000         *UND* dyld_stub_binder
Contents of __unwind_info section:
  Version:                                   0x1
  Common encodings array section offset:     0x1c
  Number of common encodings in array:       0x5
  Personality function array section offset: 0x30
  Number of personality functions in array:  0x0
  Index array section offset:                0x30
  Number of indices in array:                0x2
  Common encodings: (count = 5)
    encoding[0]: 0x04000078
    encoding[1]: 0x04000058
    encoding[2]: 0x04000038
    encoding[3]: 0x04000018
    encoding[4]: 0x00000000
  Personality functions: (count = 0)
  Top level indices: (count = 2)
    [0]: function offset=0x00000370, 2nd level page offset=0x00000048, LSDA offset=0x00000048
    [1]: function offset=0x000003a1, 2nd level page offset=0x00000000, LSDA offset=0x00000048
  LSDA descriptors:
  Second level indices:
    Second level index[0]: offset in section=0x00000048, base function offset=0x00000370
      [0]: function offset=0x00000370, encoding[3]=0x04000018
      [1]: function offset=0x00000380, encoding[2]=0x04000038
      [2]: function offset=0x00000390, encoding[1]=0x04000058
      [3]: function offset=0x000003a0, encoding[0]=0x04000078
      [4]: function offset=0x000003a1, encoding[4]=0x00000000

So filecheck fails to match 0x100000370 with 0x00000370 (and next line will fail too)

@klensy klensy force-pushed the filecheck-lld2 branch 2 times, most recently from 22dbaf5 to d6f25c7 Compare June 7, 2024 12:36
@klensy
Copy link
Contributor Author

klensy commented Feb 3, 2025

Current:

Failed Tests (4):
--
  | lld :: ELF/aarch64-cortex-a53-843419-thunk-align.s
  | lld :: ELF/arm-thumb-branch-rangethunk.s
  | lld :: ELF/dso-undef-size.s
  | lld :: MachO/compact-unwind-foldings.s

compact-unwind-foldings.s still stuck from last try, and for rebased ones need help too.

@smithp35
Copy link
Collaborator

smithp35 commented Feb 3, 2025

Current:

Failed Tests (4):
--
  | lld :: ELF/aarch64-cortex-a53-843419-thunk-align.s
  | lld :: ELF/arm-thumb-branch-rangethunk.s
  | lld :: ELF/dso-undef-size.s
  | lld :: MachO/compact-unwind-foldings.s

compact-unwind-foldings.s still stuck from last try, and for rebased ones need help too.

I can help with ELF/aarch64* and ELF/arm* if you need it?

Depending on how big the update is, it may be better for me to submit a separate PR rather than post what needs to change.

@klensy
Copy link
Contributor Author

klensy commented Feb 3, 2025

Depending on how big the update is, it may be better for me to submit a separate PR rather than post what needs to change.

Ok, this will be faster, i guess.

@smithp35
Copy link
Collaborator

smithp35 commented Feb 3, 2025

The arm-thumb-branch-rangethunk.s needs a couple of updates:

  • The test is calibrated to .text starting at 0x20000 which due to page size changes no longer holds. I've added -Ttext=0x20000 to force this.
  • I've updated the disassembly as short thunks are now used.

Feel free to add this to your patch.

It should be:

// REQUIRES: arm
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv7a-none-linux-gnueabi %s -o %t
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=thumbv7a-none-linux-gnueabi %S/Inputs/far-arm-thumb-abs.s -o %tfar
// RUN: ld.lld -Ttext=0x20000 %t %tfar -o %t2
// RUN: llvm-objdump --no-show-raw-insn -d %t2 | FileCheck %s
 .syntax unified
 .thumb
 .section .text, "ax",%progbits
 .globl _start
 .balign 0x10000
 .type _start,%function
_start:
 // address of too_far symbols are just out of range of ARM branch with
 // 26-bit immediate field and an addend of -8
 bl  too_far1
 b   too_far2
 beq.w too_far3

// CHECK-LABEL: 00020000 <_start>:
// CHECK-NEXT: 20000: bl      0x2000c <__Thumbv7ABSLongThunk_too_far1>
// CHECK-NEXT:        b.w     0x20010 <__Thumbv7ABSLongThunk_too_far2>
// CHECK-NEXT:        beq.w   0x20014 <__Thumbv7ABSLongThunk_too_far3>
// CHECK-EMPTY:
// CHECK-NEXT: 0002000c <__Thumbv7ABSLongThunk_too_far1>:
// CHECK-NEXT: 2000c: b.w     0x1020004
// CHECK-EMPTY:
// CHECK-NEXT: 00020010 <__Thumbv7ABSLongThunk_too_far2>:
// CHECK-NEXT: 20010: b.w     0x1020008
// CHECK-EMPTY:
// CHECK-NEXT: 00020014 <__Thumbv7ABSLongThunk_too_far3>:
// CHECK-NEXT: 20014: b.w     0x12000c

@smithp35
Copy link
Collaborator

smithp35 commented Feb 3, 2025

A diff (apologies can't upload as a file) for aarch64-cortex-a53-843419-thunk-align.s . No functional changes, just needed to update for more recent llvm-objdump output syntax.

Are you OK to incorporate these into your patch?

diff --git a/lld/test/ELF/aarch64-cortex-a53-843419-thunk-align.s b/lld/test/ELF/aarch64-cortex-a53-843419-thunk-align.s
index 5226d6733acb..5d09ca62dc66 100644
--- a/lld/test/ELF/aarch64-cortex-a53-843419-thunk-align.s
+++ b/lld/test/ELF/aarch64-cortex-a53-843419-thunk-align.s
@@ -7,7 +7,7 @@
 // RUN:                  *(.text.02) } \
 // RUN:                  .foo : { *(.foo_sec) } } " > %t.script
 // RUN: ld.lld -pie --fix-cortex-a53-843419 --script=%t.script %t.o -o %t2
-// RUN: llvm-objdump --no-show-raw-insn --triple=aarch64-linux-gnu -d %t2
+// RUN: llvm-objdump --no-show-raw-insn --triple=aarch64-linux-gnu -d %t2 | FileCheck %s


 /// %t2 is > 128 Megabytes, so delete it early.
@@ -36,13 +36,13 @@ t3_ff8_ldr:
  ret

 /// Expect thunk and patch to be inserted here
-// CHECK: 0000000000011008 __AArch64ADRPThunk_far_away:
-// CHECK-NEXT: 11008: adrp    x16, #134221824
-// CHECK-NEXT:        add     x16, x16, #16
-// CHECK-NEXT:        br      x16
-// CHECK: 0000000000012008 __CortexA53843419_11000:
-// CHECK-NEXT: 12008: ldr     x0, [x0, #168]
-// CHECK-NEXT:        b       #-4104 <t3_ff8_ldr+0xc>
+// CHECK-LABEL: 0000000000011008 <__AArch64ADRPThunk_far_away>:
+// CHECK-NEXT: 11008: adrp      x16, 0x8012000
+// CHECK-NEXT:        add     x16, x16, #0x10
+// CHECK-NEXT::       br      x16
+// CHECK-LABEL: 0000000000012008 <__CortexA53843419_11000>:
+// CHECK-NEXT: 12008: ldr     x0, [x0, #0xb8]
+// CHECK-NEXT: 1200c: b       0x11004 <t3_ff8_ldr+0xc>

  .section .text.02, "ax", %progbits
  .globl far_away
@@ -52,15 +52,13 @@ far_away:
  ret
 /// Expect thunk for _start not to have size rounded up to 4KiB as it is at
 /// the end of the OutputSection
-// CHECK: 0000000008012010 far_away:
-// CHECK-NEXT:  8012010: bl      #8
-// CHECK-NEXT:           ret
-// CHECK: 0000000008012018 __AArch64ADRPThunk__start:
-// CHECK-NEXT:  8012018: adrp    x16, #-134225920
-// CHECK-NEXT:           add     x16, x16, #0
-// CHECK-NEXT:           br      x16
-// CHECK: 0000000008012024 foo:
-// CHECK-NEXT:  8012024: ret
+// CHECK-LABEL: 0000000008012010 <far_away>:
+// CHECK-NEXT: 8012010: bl      0x8012018 <__AArch64ADRPThunk__start>
+// CHECK-NEXT: 8012014: ret
+// CHECK-LABEL: 0000000008012018 <__AArch64ADRPThunk__start>:
+// CHECK-NEXT: 8012018: adrp    x16, 0x10000
+// CHECK-NEXT: 801201c: add     x16, x16, #0x0
+// CHECK-NEXT: 8012020: br      x16
  .section .foo_sec, "ax", %progbits
  .globl foo
  .type foo, function

@klensy
Copy link
Contributor Author

klensy commented Feb 3, 2025

Applied fixes, thanks.

Failed Tests (2):
  lld :: ELF/dso-undef-size.s
  lld :: MachO/compact-unwind-foldings.s

CHECK-NEXT: type = 0x0074 (int), value = 123
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensure the file ends with \n while updating this line

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

Copy link
Member

@MaskRay MaskRay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if premerge checks passed

@klensy
Copy link
Contributor Author

klensy commented Feb 8, 2025

Rebased, added newline for lld/test/COFF/pdb-local-constants.test and commented out broken lines in MachO/compact-unwind-foldings.s, as i don't know what to do with it.

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

Successfully merging this pull request may close these issues.

5 participants