[llvm] bf0d76d - [MC,test] Reorganize relax-recompute-align.s & layout-interdependency.s

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 9 21:14:14 PDT 2024


Author: Fangrui Song
Date: 2024-06-09T21:14:11-07:00
New Revision: bf0d76d185a7c0fbedb75633afb467c74e8c0e81

URL: https://github.com/llvm/llvm-project/commit/bf0d76d185a7c0fbedb75633afb467c74e8c0e81
DIFF: https://github.com/llvm/llvm-project/commit/bf0d76d185a7c0fbedb75633afb467c74e8c0e81.diff

LOG: [MC,test] Reorganize relax-recompute-align.s & layout-interdependency.s

relax-recompute-align.s might change when we change the fragment
relaxation approach.

Added: 
    llvm/test/MC/ELF/layout-interdependency.s
    llvm/test/MC/ELF/relax-recompute-align.s

Modified: 
    

Removed: 
    llvm/test/MC/AsmParser/layout-interdependency.s
    llvm/test/MC/MachO/relax-recompute-align.s


################################################################################
diff  --git a/llvm/test/MC/AsmParser/layout-interdependency.s b/llvm/test/MC/ELF/layout-interdependency.s
similarity index 100%
rename from llvm/test/MC/AsmParser/layout-interdependency.s
rename to llvm/test/MC/ELF/layout-interdependency.s

diff  --git a/llvm/test/MC/ELF/relax-recompute-align.s b/llvm/test/MC/ELF/relax-recompute-align.s
new file mode 100644
index 0000000000000..508fb5969b3b5
--- /dev/null
+++ b/llvm/test/MC/ELF/relax-recompute-align.s
@@ -0,0 +1,23 @@
+// RUN: llvm-mc -filetype=obj -triple i386 %s -o - | llvm-objdump -d --no-show-raw-insn - | FileCheck %s
+
+// This is a case where llvm-mc computes a better layout than Darwin 'as'. This
+// issue is that after the first jmp slides, the .align size must be
+// recomputed -- otherwise the second jump will appear to be out-of-range for a
+// 1-byte jump.
+
+// CHECK:            int3
+// CHECK-NEXT:  ce:  int3
+// CHECK:       d0:  pushal
+// CHECK:      130:  jl      0xd0
+
+L0:
+        .space 0x8a, 0x90
+	jmp	L0
+        .space (0xb3 - 0x8f), 0x90
+	jle	L2
+        .space (0xcd - 0xb5), 0x90
+	.p2align 4, 0xcc
+L1:
+        .space (0x130 - 0xd0),0x60
+	jl	L1
+L2:

diff  --git a/llvm/test/MC/MachO/relax-recompute-align.s b/llvm/test/MC/MachO/relax-recompute-align.s
deleted file mode 100644
index bfb17b71274e9..0000000000000
--- a/llvm/test/MC/MachO/relax-recompute-align.s
+++ /dev/null
@@ -1,42 +0,0 @@
-// RUN: llvm-mc -triple i386-apple-darwin9 %s -filetype=obj -o - | llvm-readobj -S - | FileCheck %s
-
-// FIXME: This is a horrible way of checking the output, we need an llvm-mc
-// based 'otool'.
-
-// This is a case where llvm-mc computes a better layout than Darwin 'as'. This
-// issue is that after the first jmp slides, the .align size must be
-// recomputed -- otherwise the second jump will appear to be out-of-range for a
-// 1-byte jump.
-
-L0:
-        .space 0x8a, 0x90
-	jmp	L0
-        .space (0xb3 - 0x8f), 0x90
-	jle	L2
-        .space (0xcd - 0xb5), 0x90
-	.align	4, 0x90
-L1:
-        .space (0x130 - 0xd0),0x90
-	jl	L1
-L2:
-
-.zerofill __DATA,__bss,_sym,4,2
-
-// CHECK: Section {
-// CHECK-NEXT:   Index: 0
-// CHECK-NEXT:   Name: __text (5F 5F 74 65 78 74 00 00 00 00 00 00 00 00 00 00)
-// CHECK-NEXT:   Segment: __TEXT (5F 5F 54 45 58 54 00 00 00 00 00 00 00 00 00 00)
-// CHECK-NEXT:   Address: 0x0
-// CHECK-NEXT:   Size: 0x132
-// CHECK-NEXT:   Offset: 340
-// CHECK-NEXT:   Alignment: 4
-// CHECK-NEXT:   RelocationOffset: 0x0
-// CHECK-NEXT:   RelocationCount: 0
-// CHECK-NEXT:   Type: Regular (0x0)
-// CHECK-NEXT:   Attributes [ (0x800004)
-// CHECK-NEXT:     PureInstructions (0x800000)
-// CHECK-NEXT:     SomeInstructions (0x4)
-// CHECK-NEXT:   ]
-// CHECK-NEXT:   Reserved1: 0x0
-// CHECK-NEXT:   Reserved2: 0x0
-// CHECK-NEXT: }


        


More information about the llvm-commits mailing list