[llvm] 9753ea8 - MC,test: Migrate away from the .reloc constant hack

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 16 22:53:23 PDT 2025


Author: Fangrui Song
Date: 2025-07-16T22:53:18-07:00
New Revision: 9753ea83dd34bfb169fbed3995cc79e621ca6963

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

LOG: MC,test: Migrate away from the .reloc constant hack

The initial .reloc support for MIPS incorrectly interpreted .reloc 0 as .reloc .+0 .
I was misled when porting .reloc to other targets in 2019 and 2020.

Many PRINT: prefixes are unnecessary. The MCAsmStreamer implementation
is generic, and it is unnecessary to test too many variants.

Added: 
    

Modified: 
    llvm/test/MC/AArch64/directives-case_insensitive.s
    llvm/test/MC/AArch64/reloc-directive-err.s
    llvm/test/MC/AArch64/reloc-directive.s
    llvm/test/MC/AMDGPU/reloc-directive.s
    llvm/test/MC/ARM/reloc-directive-err.s
    llvm/test/MC/ARM/reloc-directive.s
    llvm/test/MC/AVR/reloc-directive-err.s
    llvm/test/MC/AVR/reloc-directive.s
    llvm/test/MC/LoongArch/Relocations/reloc-directive-err.s
    llvm/test/MC/LoongArch/Relocations/reloc-directive.s
    llvm/test/MC/Mips/reloc-directive-bad.s
    llvm/test/MC/Mips/reloc-directive.s
    llvm/test/MC/PowerPC/ppc32-reloc-directive.s
    llvm/test/MC/PowerPC/ppc64-reloc-directive.s
    llvm/test/MC/RISCV/reloc-directive-err.s
    llvm/test/MC/RISCV/reloc-directive.s
    llvm/test/MC/Sparc/Relocations/reloc-directive.s
    llvm/test/MC/SystemZ/reloc-directive.s
    llvm/test/MC/X86/reloc-directive-elf-32.s
    llvm/test/MC/X86/reloc-directive-elf-64.s
    llvm/test/MC/X86/reloc-directive.s

Removed: 
    


################################################################################
diff  --git a/llvm/test/MC/AArch64/directives-case_insensitive.s b/llvm/test/MC/AArch64/directives-case_insensitive.s
index 35a90a1bffea8..c2bdec73e349e 100644
--- a/llvm/test/MC/AArch64/directives-case_insensitive.s
+++ b/llvm/test/MC/AArch64/directives-case_insensitive.s
@@ -15,8 +15,8 @@ tlbi vmalle1os
 .INST 0x5e104020
 // CHECK: .inst 0x5e104020
 
-.RELOC 0, R_AARCH64_NONE, 8
-// CHECK: .reloc 0, R_AARCH64_NONE, 8
+.RELOC ., R_AARCH64_NONE, 8
+// CHECK: .reloc {{.*}}, R_AARCH64_NONE, 8
 
 .HWORD 0x1234
 // CHECK: .hword  4660

diff  --git a/llvm/test/MC/AArch64/reloc-directive-err.s b/llvm/test/MC/AArch64/reloc-directive-err.s
index 6eec2ae10c0a6..883dd2a06f28e 100644
--- a/llvm/test/MC/AArch64/reloc-directive-err.s
+++ b/llvm/test/MC/AArch64/reloc-directive-err.s
@@ -1,6 +1,6 @@
 # RUN: llvm-mc -triple=aarch64 %s 2>&1 | FileCheck --check-prefix=PRINT %s
 # RUN: not llvm-mc -filetype=obj -triple=aarch64 %s -o /dev/null 2>&1 | FileCheck %s
 
-# PRINT: .reloc 0, R_INVALID, 0
+# PRINT: .reloc {{.*}}, R_INVALID, 0
 # CHECK: {{.*}}.s:[[# @LINE+1]]:11: error: unknown relocation name
-.reloc 0, R_INVALID, 0
+.reloc ., R_INVALID, 0

diff  --git a/llvm/test/MC/AArch64/reloc-directive.s b/llvm/test/MC/AArch64/reloc-directive.s
index 09b0f0d3cb9d3..a502201fb9291 100644
--- a/llvm/test/MC/AArch64/reloc-directive.s
+++ b/llvm/test/MC/AArch64/reloc-directive.s
@@ -2,32 +2,32 @@
 
 # RUN: llvm-mc -filetype=obj -triple=aarch64-linux-musl %s | llvm-readobj -r - | FileCheck %s
 
-# PRINT: .reloc 8, R_AARCH64_NONE, .data
-# PRINT: .reloc 4, R_AARCH64_NONE, foo+4
-# PRINT: .reloc 0, R_AARCH64_NONE, 8
-# PRINT: .reloc 0, R_AARCH64_ABS64, .data+2
-# PRINT: .reloc 0, R_AARCH64_TLSDESC, foo+3
-# PRINT: .reloc 0, R_AARCH64_IRELATIVE, 5
-# PRINT: .reloc 0, BFD_RELOC_NONE, 9
-# PRINT: .reloc 0, BFD_RELOC_16, 9
-# PRINT: .reloc 0, BFD_RELOC_32, 9
-# PRINT: .reloc 0, BFD_RELOC_64, 9
+# PRINT: .reloc {{.*}}+8, R_AARCH64_NONE, .data
+# PRINT: .reloc {{.*}}+4, R_AARCH64_NONE, foo+4
+# PRINT: .reloc {{.*}}+0, R_AARCH64_NONE, 8
+# PRINT: .reloc {{.*}}+0, R_AARCH64_ABS64, .data+2
+# PRINT: .reloc {{.*}}+0, R_AARCH64_TLSDESC, foo+3
+# PRINT: .reloc {{.*}}+0, R_AARCH64_IRELATIVE, 5
+# PRINT: .reloc {{.*}}+0, BFD_RELOC_NONE, 9
+# PRINT: .reloc {{.*}}+0, BFD_RELOC_16, 9
+# PRINT: .reloc {{.*}}+0, BFD_RELOC_32, 9
+# PRINT: .reloc {{.*}}+0, BFD_RELOC_64, 9
 .text
+  .reloc .+8, R_AARCH64_NONE, .data
+  .reloc .+4, R_AARCH64_NONE, foo+4
+  .reloc .+0, R_AARCH64_NONE, 8
+
+  .reloc .+0, R_AARCH64_ABS64, .data+2
+  .reloc .+0, R_AARCH64_TLSDESC, foo+3
+  .reloc .+0, R_AARCH64_IRELATIVE, 5
+
+  .reloc .+0, BFD_RELOC_NONE, 9
+  .reloc .+0, BFD_RELOC_16, 9
+  .reloc .+0, BFD_RELOC_32, 9
+  .reloc .+0, BFD_RELOC_64, 9
   ret
   nop
   nop
-  .reloc 8, R_AARCH64_NONE, .data
-  .reloc 4, R_AARCH64_NONE, foo+4
-  .reloc 0, R_AARCH64_NONE, 8
-
-  .reloc 0, R_AARCH64_ABS64, .data+2
-  .reloc 0, R_AARCH64_TLSDESC, foo+3
-  .reloc 0, R_AARCH64_IRELATIVE, 5
-
-  .reloc 0, BFD_RELOC_NONE, 9
-  .reloc 0, BFD_RELOC_16, 9
-  .reloc 0, BFD_RELOC_32, 9
-  .reloc 0, BFD_RELOC_64, 9
 
 .data
 .globl foo

diff  --git a/llvm/test/MC/AMDGPU/reloc-directive.s b/llvm/test/MC/AMDGPU/reloc-directive.s
index 99e972b3105a2..5d55fde4945ef 100644
--- a/llvm/test/MC/AMDGPU/reloc-directive.s
+++ b/llvm/test/MC/AMDGPU/reloc-directive.s
@@ -3,25 +3,7 @@
 # RUN: llvm-mc -filetype=obj -triple=amdgcn--amdhsa %s -o %t
 # RUN: llvm-readobj -r %t | FileCheck %s
 
-# PRINT:      .reloc 2, R_AMDGPU_NONE, .data
-# PRINT-NEXT: .reloc 1, R_AMDGPU_NONE, foo+4
-# PRINT-NEXT: .reloc 0, R_AMDGPU_NONE, 8
-# PRINT-NEXT: .reloc 0, R_AMDGPU_ABS32_LO, .data
-# PRINT-NEXT: .reloc 0, R_AMDGPU_ABS32_HI, .data
-# PRINT-NEXT: .reloc 0, R_AMDGPU_ABS64, .data
-# PRINT-NEXT: .reloc 0, R_AMDGPU_REL32, .data
-# PRINT-NEXT: .reloc 0, R_AMDGPU_REL64, .data
-# PRINT-NEXT: .reloc 0, R_AMDGPU_ABS32, .data
-# PRINT-NEXT: .reloc 0, R_AMDGPU_GOTPCREL, .data
-# PRINT-NEXT: .reloc 0, R_AMDGPU_GOTPCREL32_LO, .data
-# PRINT-NEXT: .reloc 0, R_AMDGPU_GOTPCREL32_HI, .data
-# PRINT-NEXT: .reloc 0, R_AMDGPU_REL32_LO, .data
-# PRINT-NEXT: .reloc 0, R_AMDGPU_REL32_HI, .data
-# PRINT-NEXT: .reloc 0, R_AMDGPU_RELATIVE64, .data
-# PRINT-NEXT: .reloc 0, R_AMDGPU_REL16, .data
-# PRINT-NEXT: .reloc 0, BFD_RELOC_NONE, .data
-# PRINT-NEXT: .reloc 0, BFD_RELOC_32, .data
-# PRINT-NEXT: .reloc 0, BFD_RELOC_64, .data
+# PRINT:      .reloc {{.*}}+2, R_AMDGPU_NONE, .data
 
 # CHECK:      0x2 R_AMDGPU_NONE .data
 # CHECK-NEXT: 0x1 R_AMDGPU_NONE foo 0x4
@@ -44,27 +26,27 @@
 # CHECK-NEXT: 0x0 R_AMDGPU_ABS64 .data
 
 .text
+  .reloc .+2, R_AMDGPU_NONE, .data
+  .reloc .+1, R_AMDGPU_NONE, foo+4
+  .reloc .+0, R_AMDGPU_NONE, 8
+  .reloc .+0, R_AMDGPU_ABS32_LO, .data
+  .reloc .+0, R_AMDGPU_ABS32_HI, .data
+  .reloc .+0, R_AMDGPU_ABS64, .data
+  .reloc .+0, R_AMDGPU_REL32, .data
+  .reloc .+0, R_AMDGPU_REL64, .data
+  .reloc .+0, R_AMDGPU_ABS32, .data
+  .reloc .+0, R_AMDGPU_GOTPCREL, .data
+  .reloc .+0, R_AMDGPU_GOTPCREL32_LO, .data
+  .reloc .+0, R_AMDGPU_GOTPCREL32_HI, .data
+  .reloc .+0, R_AMDGPU_REL32_LO, .data
+  .reloc .+0, R_AMDGPU_REL32_HI, .data
+  .reloc .+0, R_AMDGPU_RELATIVE64, .data
+  .reloc .+0, R_AMDGPU_REL16, .data
+  .reloc .+0, BFD_RELOC_NONE, .data
+  .reloc .+0, BFD_RELOC_32, .data
+  .reloc .+0, BFD_RELOC_64, .data
   s_nop 0
   s_nop 0
-  .reloc 2, R_AMDGPU_NONE, .data
-  .reloc 1, R_AMDGPU_NONE, foo+4
-  .reloc 0, R_AMDGPU_NONE, 8
-  .reloc 0, R_AMDGPU_ABS32_LO, .data
-  .reloc 0, R_AMDGPU_ABS32_HI, .data
-  .reloc 0, R_AMDGPU_ABS64, .data
-  .reloc 0, R_AMDGPU_REL32, .data
-  .reloc 0, R_AMDGPU_REL64, .data
-  .reloc 0, R_AMDGPU_ABS32, .data
-  .reloc 0, R_AMDGPU_GOTPCREL, .data
-  .reloc 0, R_AMDGPU_GOTPCREL32_LO, .data
-  .reloc 0, R_AMDGPU_GOTPCREL32_HI, .data
-  .reloc 0, R_AMDGPU_REL32_LO, .data
-  .reloc 0, R_AMDGPU_REL32_HI, .data
-  .reloc 0, R_AMDGPU_RELATIVE64, .data
-  .reloc 0, R_AMDGPU_REL16, .data
-  .reloc 0, BFD_RELOC_NONE, .data
-  .reloc 0, BFD_RELOC_32, .data
-  .reloc 0, BFD_RELOC_64, .data
 
 .data
 .globl foo

diff  --git a/llvm/test/MC/ARM/reloc-directive-err.s b/llvm/test/MC/ARM/reloc-directive-err.s
index c291fd62d2ba9..113158c51c36b 100644
--- a/llvm/test/MC/ARM/reloc-directive-err.s
+++ b/llvm/test/MC/ARM/reloc-directive-err.s
@@ -1,6 +1,6 @@
 # RUN: llvm-mc -triple=armv7 %s 2>&1 | FileCheck --check-prefix=PRINT %s
 # RUN: not llvm-mc -filetype=obj -triple=armv7 %s -o /dev/null 2>&1 | FileCheck %s
 
-# PRINT: .reloc 0, R_INVALID, 0
+# PRINT: .reloc {{.*}}, R_INVALID, 0
 # CHECK: {{.*}}.s:[[# @LINE+1]]:11: error: unknown relocation name
-.reloc 0, R_INVALID, 0
+.reloc ., R_INVALID, 0

diff  --git a/llvm/test/MC/ARM/reloc-directive.s b/llvm/test/MC/ARM/reloc-directive.s
index 682f0e1185c72..6a3b2496cfc8d 100644
--- a/llvm/test/MC/ARM/reloc-directive.s
+++ b/llvm/test/MC/ARM/reloc-directive.s
@@ -10,21 +10,21 @@
 # RUN: llvm-readelf -x .data %t | FileCheck --check-prefix=HEX %s
 
 .text
+  .reloc .+8, R_ARM_NONE, .data
+  .reloc .+4, R_ARM_NONE, foo+4
+  .reloc .+0, R_ARM_NONE, 8
+
+  .reloc .+0, R_ARM_ALU_PC_G0, .data+2
+  .reloc .+0, R_ARM_LDR_PC_G0, foo+3
+  .reloc .+0, R_ARM_THM_ALU_PREL_11_0, 5
+
+  .reloc .+0, BFD_RELOC_NONE, 9
+  .reloc .+0, BFD_RELOC_8, 9
+  .reloc .+0, BFD_RELOC_16, 9
+  .reloc .+0, BFD_RELOC_32, 9
   bx lr
   nop
   nop
-  .reloc 8, R_ARM_NONE, .data
-  .reloc 4, R_ARM_NONE, foo+4
-  .reloc 0, R_ARM_NONE, 8
-
-  .reloc 0, R_ARM_ALU_PC_G0, .data+2
-  .reloc 0, R_ARM_LDR_PC_G0, foo+3
-  .reloc 0, R_ARM_THM_ALU_PREL_11_0, 5
-
-  .reloc 0, BFD_RELOC_NONE, 9
-  .reloc 0, BFD_RELOC_8, 9
-  .reloc 0, BFD_RELOC_16, 9
-  .reloc 0, BFD_RELOC_32, 9
 
 .data
 .globl foo
@@ -33,16 +33,7 @@ foo:
   .word 0
   .word 0
 
-# PRINT: .reloc 8, R_ARM_NONE, .data
-# PRINT: .reloc 4, R_ARM_NONE, foo+4
-# PRINT: .reloc 0, R_ARM_NONE, 8
-# PRINT: .reloc 0, R_ARM_ALU_PC_G0, .data+2
-# PRINT: .reloc 0, R_ARM_LDR_PC_G0, foo+3
-# PRINT: .reloc 0, R_ARM_THM_ALU_PREL_11_0, 5
-# PRINT:      .reloc 0, BFD_RELOC_NONE, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_8, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_16, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_32, 9
+# PRINT: .reloc {{.*}}+8, R_ARM_NONE, .data
 
 # ARM relocations use the Elf32_Rel format. Addends are neither stored in the
 # relocation entries nor applied in the referenced locations.

diff  --git a/llvm/test/MC/AVR/reloc-directive-err.s b/llvm/test/MC/AVR/reloc-directive-err.s
index d660bde487e3a..8494a66c6b727 100644
--- a/llvm/test/MC/AVR/reloc-directive-err.s
+++ b/llvm/test/MC/AVR/reloc-directive-err.s
@@ -1,10 +1,10 @@
 # RUN: llvm-mc -triple=avr %s 2>&1 | FileCheck --check-prefix=PRINT %s
 # RUN: not llvm-mc -filetype=obj -triple=avr %s -o /dev/null 2>&1 | FileCheck %s
 
-# PRINT: .reloc 0, R_INVALID, 0
+# PRINT: .reloc {{.*}}, R_INVALID, 0
 # CHECK: {{.*}}.s:[[#@LINE+1]]:11: error: unknown relocation name
-.reloc 0, R_INVALID, 0
+.reloc ., R_INVALID, 0
 
-# PRINT: .reloc 0, BFD_RELOC_64, 0
+# PRINT: .reloc {{.*}}, BFD_RELOC_64, 0
 # CHECK: {{.*}}.s:[[#@LINE+1]]:11: error: unknown relocation name
-.reloc 0, BFD_RELOC_64, 0
+.reloc ., BFD_RELOC_64, 0

diff  --git a/llvm/test/MC/AVR/reloc-directive.s b/llvm/test/MC/AVR/reloc-directive.s
index 60913172502cf..9940842171eef 100644
--- a/llvm/test/MC/AVR/reloc-directive.s
+++ b/llvm/test/MC/AVR/reloc-directive.s
@@ -1,14 +1,7 @@
 # RUN: llvm-mc -triple=avr %s | FileCheck --check-prefix=PRINT %s
 # RUN: llvm-mc -filetype=obj -triple=avr %s | llvm-readobj -r - | FileCheck %s
 
-# PRINT:      .reloc 4, R_AVR_NONE, .data
-# PRINT-NEXT: .reloc 2, R_AVR_NONE, foo+4
-# PRINT-NEXT: .reloc 0, R_AVR_NONE, 8
-# PRINT:      .reloc 0, R_AVR_32, .data+2
-# PRINT-NEXT: .reloc 0, R_AVR_16, foo+3
-# PRINT:      .reloc 0, BFD_RELOC_NONE, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_16, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_32, 9
+# PRINT:      .reloc {{.*}}+4, R_AVR_NONE, .data
 
 # CHECK:      Section ({{.*}}) .rela.text {
 # CHECK-NEXT:   0x4 R_AVR_NONE .data 0x0
@@ -22,19 +15,19 @@
 # CHECK-NEXT: }
 
 .text
+  .reloc .+4, R_AVR_NONE, .data
+  .reloc .+2, R_AVR_NONE, foo+4
+  .reloc .+0, R_AVR_NONE, 8
+
+  .reloc .+0, R_AVR_32, .data+2
+  .reloc .+0, R_AVR_16, foo+3
+
+  .reloc .+0, BFD_RELOC_NONE, 9
+  .reloc .+0, BFD_RELOC_16, 9
+  .reloc .+0, BFD_RELOC_32, 9
   ret
   nop
   nop
-  .reloc 4, R_AVR_NONE, .data
-  .reloc 2, R_AVR_NONE, foo+4
-  .reloc 0, R_AVR_NONE, 8
-
-  .reloc 0, R_AVR_32, .data+2
-  .reloc 0, R_AVR_16, foo+3
-
-  .reloc 0, BFD_RELOC_NONE, 9
-  .reloc 0, BFD_RELOC_16, 9
-  .reloc 0, BFD_RELOC_32, 9
 
 .data
 .globl foo

diff  --git a/llvm/test/MC/LoongArch/Relocations/reloc-directive-err.s b/llvm/test/MC/LoongArch/Relocations/reloc-directive-err.s
index 60fd145564ae5..7658865b0f083 100644
--- a/llvm/test/MC/LoongArch/Relocations/reloc-directive-err.s
+++ b/llvm/test/MC/LoongArch/Relocations/reloc-directive-err.s
@@ -2,6 +2,6 @@
 # RUN: not llvm-mc --filetype=obj --triple=loongarch64 %s -o /dev/null 2>&1 \
 # RUN:			| FileCheck %s
 
-# PRINT: .reloc 0, R_INVALID, 0
+# PRINT: .reloc {{.*}}, R_INVALID, 0
 # CHECK: {{.*}}.s:[[# @LINE+1]]:11: error: unknown relocation name
-.reloc 0, R_INVALID, 0
+.reloc ., R_INVALID, 0

diff  --git a/llvm/test/MC/LoongArch/Relocations/reloc-directive.s b/llvm/test/MC/LoongArch/Relocations/reloc-directive.s
index f900f17c06c39..2fc0c816d7057 100644
--- a/llvm/test/MC/LoongArch/Relocations/reloc-directive.s
+++ b/llvm/test/MC/LoongArch/Relocations/reloc-directive.s
@@ -2,31 +2,23 @@
 # RUN: llvm-mc --filetype=obj --triple=loongarch64 %s \
 # RUN:     | llvm-readobj -r - | FileCheck %s
 
-# PRINT: .reloc 8, R_LARCH_NONE, .data
-# PRINT: .reloc 4, R_LARCH_NONE, foo+4
-# PRINT: .reloc 0, R_LARCH_NONE, 8
-# PRINT: .reloc 0, R_LARCH_32, .data+2
-# PRINT: .reloc 0, R_LARCH_TLS_DTPMOD32, foo+3
-# PRINT: .reloc 0, R_LARCH_IRELATIVE, 5
-# PRINT:      .reloc 0, BFD_RELOC_NONE, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_32, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_64, 9
+# PRINT: .reloc {{.*}}+8, R_LARCH_NONE, .data
 
 .text
+  .reloc .+8, R_LARCH_NONE, .data
+  .reloc .+4, R_LARCH_NONE, foo+4
+  .reloc .+0, R_LARCH_NONE, 8
+
+  .reloc .+0, R_LARCH_32, .data+2
+  .reloc .+0, R_LARCH_TLS_DTPMOD32, foo+3
+  .reloc .+0, R_LARCH_IRELATIVE, 5
+
+  .reloc .+0, BFD_RELOC_NONE, 9
+  .reloc .+0, BFD_RELOC_32, 9
+  .reloc .+0, BFD_RELOC_64, 9
   ret
   nop
   nop
-  .reloc 8, R_LARCH_NONE, .data
-  .reloc 4, R_LARCH_NONE, foo+4
-  .reloc 0, R_LARCH_NONE, 8
-
-  .reloc 0, R_LARCH_32, .data+2
-  .reloc 0, R_LARCH_TLS_DTPMOD32, foo+3
-  .reloc 0, R_LARCH_IRELATIVE, 5
-
-  .reloc 0, BFD_RELOC_NONE, 9
-  .reloc 0, BFD_RELOC_32, 9
-  .reloc 0, BFD_RELOC_64, 9
 
 .data
 .globl foo

diff  --git a/llvm/test/MC/Mips/reloc-directive-bad.s b/llvm/test/MC/Mips/reloc-directive-bad.s
index bb056b752fb9f..f09a73b962b01 100644
--- a/llvm/test/MC/Mips/reloc-directive-bad.s
+++ b/llvm/test/MC/Mips/reloc-directive-bad.s
@@ -2,6 +2,6 @@
 # RUN:     -target-abi=o32 2>&1 | FileCheck %s
 	.text
 foo:
-	.reloc 0, R_MIPS_32, .text+.text  # CHECK: :[[@LINE]]:23: error: expression must be relocatable
-	.reloc 0, 0, R_MIPS_32, .text     # CHECK: :[[@LINE]]:12: error: expected relocation name
+	.reloc ., R_MIPS_32, .text+.text  # CHECK: :[[@LINE]]:23: error: expression must be relocatable
+	.reloc ., 0, R_MIPS_32, .text     # CHECK: :[[@LINE]]:12: error: expected relocation name
 	nop

diff  --git a/llvm/test/MC/Mips/reloc-directive.s b/llvm/test/MC/Mips/reloc-directive.s
index 2f699ec98a609..4f875687f33b7 100644
--- a/llvm/test/MC/Mips/reloc-directive.s
+++ b/llvm/test/MC/Mips/reloc-directive.s
@@ -15,78 +15,79 @@
 # RUN:     FileCheck -check-prefix=OBJ-N64 %s
 	.text
 foo:
-	.reloc 4, R_MIPS_NONE, foo   # ASM: .reloc 4, R_MIPS_NONE, foo
-	.reloc 0, R_MIPS_NONE, foo+4 # ASM: .reloc 0, R_MIPS_NONE, foo+4
-	.reloc 8, R_MIPS_32, foo+8   # ASM: .reloc 8, R_MIPS_32, foo+8
+# ASM: .reloc {{.*}}+4, R_MIPS_NONE, foo
+	.reloc .+4, R_MIPS_NONE, foo
+	.reloc .+0, R_MIPS_NONE, foo+4
+	.reloc .+8, R_MIPS_32, foo+8
 	nop
 	nop
 	nop
-	.reloc 12, R_MIPS_NONE       # ASM: .reloc 12, R_MIPS_NONE{{$}}
+	.reloc ., R_MIPS_NONE
         nop
-  .reloc 16, R_MIPS_CALL_HI16, 4        # ASM: .reloc 16, R_MIPS_CALL_HI16, 4
+  .reloc ., R_MIPS_CALL_HI16, 4
   nop
-  .reloc 20, R_MIPS_CALL_LO16, 4        # ASM: .reloc 20, R_MIPS_CALL_LO16, 4
+  .reloc ., R_MIPS_CALL_LO16, 4
   nop
-  .reloc 24, R_MIPS_CALL16, 4           # ASM: .reloc 24, R_MIPS_CALL16, 4
+  .reloc ., R_MIPS_CALL16, 4
   nop
-  .reloc 28, R_MIPS_GOT16, 4            # ASM: .reloc 28, R_MIPS_GOT16, 4
+  .reloc ., R_MIPS_GOT16, 4
   nop
-  .reloc 32, R_MIPS_GOT_PAGE, 4         # ASM: .reloc 32, R_MIPS_GOT_PAGE, 4
+  .reloc ., R_MIPS_GOT_PAGE, 4
   nop
-  .reloc 36, R_MIPS_GOT_OFST, 4         # ASM: .reloc 36, R_MIPS_GOT_OFST, 4
+  .reloc ., R_MIPS_GOT_OFST, 4
   nop
-  .reloc 40, R_MIPS_GOT_DISP, 4         # ASM: .reloc 40, R_MIPS_GOT_DISP, 4
+  .reloc ., R_MIPS_GOT_DISP, 4
   nop
-  .reloc 44, R_MIPS_GOT_HI16, 4         # ASM: .reloc 44, R_MIPS_GOT_HI16, 4
+  .reloc ., R_MIPS_GOT_HI16, 4
   nop
-  .reloc 48, R_MIPS_GOT_LO16, 4         # ASM: .reloc 48, R_MIPS_GOT_LO16, 4
+  .reloc ., R_MIPS_GOT_LO16, 4
   nop
-  .reloc 52, R_MIPS_TLS_GOTTPREL, 4     # ASM: .reloc 52, R_MIPS_TLS_GOTTPREL, 4
+  .reloc ., R_MIPS_TLS_GOTTPREL, 4
   nop
-  .reloc 56, R_MIPS_TLS_DTPREL_HI16, 4  # ASM: .reloc 56, R_MIPS_TLS_DTPREL_HI16, 4
+  .reloc ., R_MIPS_TLS_DTPREL_HI16, 4
   nop
-  .reloc 60, R_MIPS_TLS_DTPREL_LO16, 4  # ASM: .reloc 60, R_MIPS_TLS_DTPREL_LO16, 4
+  .reloc ., R_MIPS_TLS_DTPREL_LO16, 4
   nop
-  .reloc 64, R_MIPS_TLS_GD, 4           # ASM: .reloc 64, R_MIPS_TLS_GD, 4
+  .reloc ., R_MIPS_TLS_GD, 4
   nop
-  .reloc 68, R_MIPS_TLS_LDM, 4          # ASM: .reloc 68, R_MIPS_TLS_LDM, 4
+  .reloc ., R_MIPS_TLS_LDM, 4
   nop
-  .reloc 72, R_MIPS_TLS_TPREL_HI16, 4   # ASM: .reloc 72, R_MIPS_TLS_TPREL_HI16, 4
+  .reloc ., R_MIPS_TLS_TPREL_HI16, 4
   nop
-  .reloc 76, R_MIPS_TLS_TPREL_LO16, 4   # ASM: .reloc 76, R_MIPS_TLS_TPREL_LO16, 4
+  .reloc ., R_MIPS_TLS_TPREL_LO16, 4
   nop
-  .reloc 80, R_MICROMIPS_CALL16, 4      # ASM: .reloc 80, R_MICROMIPS_CALL16, 4
+  .reloc ., R_MICROMIPS_CALL16, 4
   nop
-  .reloc 84, R_MICROMIPS_GOT_DISP, 4    # ASM: .reloc 84, R_MICROMIPS_GOT_DISP, 4
+  .reloc ., R_MICROMIPS_GOT_DISP, 4
   nop
-  .reloc 88, R_MICROMIPS_GOT_PAGE, 4    # ASM: .reloc 88, R_MICROMIPS_GOT_PAGE, 4
+  .reloc ., R_MICROMIPS_GOT_PAGE, 4
   nop
-  .reloc 92, R_MICROMIPS_GOT_OFST, 4    # ASM: .reloc 92, R_MICROMIPS_GOT_OFST, 4
+  .reloc ., R_MICROMIPS_GOT_OFST, 4
   nop
-  .reloc 96, R_MICROMIPS_GOT16, 4       # ASM: .reloc 96, R_MICROMIPS_GOT16, 4
+  .reloc ., R_MICROMIPS_GOT16, 4
   nop
-  .reloc 100, R_MICROMIPS_TLS_GOTTPREL, 4       # ASM: .reloc 100, R_MICROMIPS_TLS_GOTTPREL, 4
+  .reloc ., R_MICROMIPS_TLS_GOTTPREL, 4
   nop
-  .reloc 104, R_MICROMIPS_TLS_DTPREL_HI16, 4    # ASM: .reloc 104, R_MICROMIPS_TLS_DTPREL_HI16, 4
+  .reloc ., R_MICROMIPS_TLS_DTPREL_HI16, 4
   nop
-  .reloc 108, R_MICROMIPS_TLS_DTPREL_LO16, 4    # ASM: .reloc 108, R_MICROMIPS_TLS_DTPREL_LO16, 4
+  .reloc ., R_MICROMIPS_TLS_DTPREL_LO16, 4
   nop
-  .reloc 112, R_MICROMIPS_TLS_GD, 4             # ASM: .reloc 112, R_MICROMIPS_TLS_GD, 4
+  .reloc ., R_MICROMIPS_TLS_GD, 4
   nop
-  .reloc 116, R_MICROMIPS_TLS_LDM, 4            # ASM: .reloc 116, R_MICROMIPS_TLS_LDM, 4
+  .reloc ., R_MICROMIPS_TLS_LDM, 4
   nop
-  .reloc 120, R_MICROMIPS_TLS_TPREL_HI16, 4     # ASM: .reloc 120, R_MICROMIPS_TLS_TPREL_HI16, 4
+  .reloc ., R_MICROMIPS_TLS_TPREL_HI16, 4
   nop
-  .reloc 124, R_MICROMIPS_TLS_TPREL_LO16, 4     # ASM: .reloc 124, R_MICROMIPS_TLS_TPREL_LO16, 4
+  .reloc ., R_MICROMIPS_TLS_TPREL_LO16, 4
   nop
-  .reloc 128, R_MIPS_JALR, 4            # ASM: .reloc 128, R_MIPS_JALR, 4
+  .reloc ., R_MIPS_JALR, 4
   nop
-  .reloc 132, R_MICROMIPS_JALR, 4       # ASM: .reloc 132, R_MICROMIPS_JALR, 4
+  .reloc ., R_MICROMIPS_JALR, 4
   nop
-  .reloc 136, BFD_RELOC_NONE, 9         # ASM: .reloc 136, BFD_RELOC_NONE, 9
-  .reloc 137, BFD_RELOC_16, 9           # ASM: .reloc 137, BFD_RELOC_16, 9
-  .reloc 138, BFD_RELOC_32, 9           # ASM: .reloc 138, BFD_RELOC_32, 9
-  .reloc 139, BFD_RELOC_64, 9           # ASM: .reloc 139, BFD_RELOC_64, 9
+  .reloc ., BFD_RELOC_NONE, 9
+  .reloc ., BFD_RELOC_16, 9
+  .reloc ., BFD_RELOC_32, 9
+  .reloc ., BFD_RELOC_64, 9
   nop
 
 # OBJ-O32-LABEL: Name: .text
@@ -134,9 +135,9 @@ foo:
 # OBJ-O32-NEXT:  0x80 R_MIPS_JALR -
 # OBJ-O32-NEXT:  0x84 R_MICROMIPS_JALR -
 # OBJ-O32-NEXT:  0x88 R_MIPS_NONE -
-# OBJ-O32-NEXT:  0x89 R_MIPS_16 -
-# OBJ-O32-NEXT:  0x8A R_MIPS_32 -
-# OBJ-O32-NEXT:  0x8B R_MIPS_64 -
+# OBJ-O32-NEXT:  0x88 R_MIPS_16 -
+# OBJ-O32-NEXT:  0x88 R_MIPS_32 -
+# OBJ-O32-NEXT:  0x88 R_MIPS_64 -
 # OBJ-O32-NEXT:  0x1C R_MIPS_GOT16 -
 # OBJ-O32-NEXT:  0x60 R_MICROMIPS_GOT16 -
 
@@ -188,9 +189,9 @@ foo:
 # OBJ-N32-NEXT:  0x80 R_MIPS_JALR - 0x4
 # OBJ-N32-NEXT:  0x84 R_MICROMIPS_JALR - 0x4
 # OBJ-N32-NEXT:  0x88 R_MIPS_NONE - 0x9
-# OBJ-N32-NEXT:  0x89 R_MIPS_16 - 0x9
-# OBJ-N32-NEXT:  0x8A R_MIPS_32 - 0x9
-# OBJ-N32-NEXT:  0x8B R_MIPS_64 - 0x9
+# OBJ-N32-NEXT:  0x88 R_MIPS_16 - 0x9
+# OBJ-N32-NEXT:  0x88 R_MIPS_32 - 0x9
+# OBJ-N32-NEXT:  0x88 R_MIPS_64 - 0x9
 
 # OBJ-N64-LABEL: Name: .text
 # OBJ-N64:       0000: 00000000 00000000 00000000 00000000
@@ -239,6 +240,6 @@ foo:
 # OBJ-N64-NEXT:  0x80 R_MIPS_JALR/R_MIPS_NONE/R_MIPS_NONE - 0x4
 # OBJ-N64-NEXT:  0x84 R_MICROMIPS_JALR/R_MIPS_NONE/R_MIPS_NONE - 0x4
 # OBJ-N64-NEXT:  0x88 R_MIPS_NONE/R_MIPS_NONE/R_MIPS_NONE - 0x9
-# OBJ-N64-NEXT:  0x89 R_MIPS_16/R_MIPS_NONE/R_MIPS_NONE - 0x9
-# OBJ-N64-NEXT:  0x8A R_MIPS_32/R_MIPS_NONE/R_MIPS_NONE - 0x9
-# OBJ-N64-NEXT:  0x8B R_MIPS_64/R_MIPS_NONE/R_MIPS_NONE - 0x9
+# OBJ-N64-NEXT:  0x88 R_MIPS_16/R_MIPS_NONE/R_MIPS_NONE - 0x9
+# OBJ-N64-NEXT:  0x88 R_MIPS_32/R_MIPS_NONE/R_MIPS_NONE - 0x9
+# OBJ-N64-NEXT:  0x88 R_MIPS_64/R_MIPS_NONE/R_MIPS_NONE - 0x9

diff  --git a/llvm/test/MC/PowerPC/ppc32-reloc-directive.s b/llvm/test/MC/PowerPC/ppc32-reloc-directive.s
index 3eb6c2964c85c..ca809a750a373 100644
--- a/llvm/test/MC/PowerPC/ppc32-reloc-directive.s
+++ b/llvm/test/MC/PowerPC/ppc32-reloc-directive.s
@@ -2,15 +2,15 @@
 
 # RUN: llvm-mc -filetype=obj -triple=powerpc-linux-musl %s | llvm-readobj -r - | FileCheck %s
 
-# PRINT: .reloc 8, R_PPC_NONE, .data
-# PRINT: .reloc 4, R_PPC_NONE, foo+4
-# PRINT: .reloc 0, R_PPC_NONE, 8
-# PRINT: .reloc 0, R_PPC_ADDR32, .data+2
-# PRINT: .reloc 0, R_PPC_REL16_HI, foo+3
-# PRINT: .reloc 0, R_PPC_REL16_HA, 5
-# PRINT: .reloc 0, BFD_RELOC_NONE, 9
-# PRINT: .reloc 0, BFD_RELOC_16, 9
-# PRINT: .reloc 0, BFD_RELOC_32, 9
+# PRINT: .reloc {{.*}}+8, R_PPC_NONE, .data
+# PRINT: .reloc {{.*}}+4, R_PPC_NONE, foo+4
+# PRINT: .reloc {{.*}}+0, R_PPC_NONE, 8
+# PRINT: .reloc {{.*}}+0, R_PPC_ADDR32, .data+2
+# PRINT: .reloc {{.*}}+0, R_PPC_REL16_HI, foo+3
+# PRINT: .reloc {{.*}}+0, R_PPC_REL16_HA, 5
+# PRINT: .reloc {{.*}}+0, BFD_RELOC_NONE, 9
+# PRINT: .reloc {{.*}}+0, BFD_RELOC_16, 9
+# PRINT: .reloc {{.*}}+0, BFD_RELOC_32, 9
 
 # CHECK:      0x8 R_PPC_NONE .data 0x0
 # CHECK-NEXT: 0x4 R_PPC_NONE foo 0x4
@@ -23,19 +23,19 @@
 # CHECK-NEXT: 0x0 R_PPC_ADDR32 - 0x9
 
 .text
+  .reloc .+8, R_PPC_NONE, .data
+  .reloc .+4, R_PPC_NONE, foo+4
+  .reloc .+0, R_PPC_NONE, 8
+  .reloc .+0, R_PPC_ADDR32, .data+2
+  .reloc .+0, R_PPC_REL16_HI, foo+3
+  .reloc .+0, R_PPC_REL16_HA, 5
+
+  .reloc .+0, BFD_RELOC_NONE, 9
+  .reloc .+0, BFD_RELOC_16, 9
+  .reloc .+0, BFD_RELOC_32, 9
   blr
   nop
   nop
-  .reloc 8, R_PPC_NONE, .data
-  .reloc 4, R_PPC_NONE, foo+4
-  .reloc 0, R_PPC_NONE, 8
-  .reloc 0, R_PPC_ADDR32, .data+2
-  .reloc 0, R_PPC_REL16_HI, foo+3
-  .reloc 0, R_PPC_REL16_HA, 5
-
-  .reloc 0, BFD_RELOC_NONE, 9
-  .reloc 0, BFD_RELOC_16, 9
-  .reloc 0, BFD_RELOC_32, 9
 
 .data
 .globl foo

diff  --git a/llvm/test/MC/PowerPC/ppc64-reloc-directive.s b/llvm/test/MC/PowerPC/ppc64-reloc-directive.s
index 5f54ac73bcf16..2268a3c18bf97 100644
--- a/llvm/test/MC/PowerPC/ppc64-reloc-directive.s
+++ b/llvm/test/MC/PowerPC/ppc64-reloc-directive.s
@@ -4,16 +4,16 @@
 # RUN: llvm-mc -filetype=obj -triple=powerpc64-linux-musl %s | llvm-readobj -r - | FileCheck %s
 # RUN: llvm-mc -filetype=obj -triple=powerpc64le-linux-musl %s | llvm-readobj -r - | FileCheck %s
 
-# PRINT: .reloc 8, R_PPC64_NONE, .data
-# PRINT: .reloc 4, R_PPC64_NONE, foo+4
-# PRINT: .reloc 0, R_PPC64_NONE, 8
-# PRINT: .reloc 0, R_PPC64_ADDR32, .data+2
-# PRINT: .reloc 0, R_PPC64_REL16_HI, foo+3
-# PRINT: .reloc 0, R_PPC64_REL16_HA, 5
-# PRINT: .reloc 0, BFD_RELOC_NONE, 9
-# PRINT: .reloc 0, BFD_RELOC_16, 9
-# PRINT: .reloc 0, BFD_RELOC_32, 9
-# PRINT: .reloc 0, BFD_RELOC_64, 9
+# PRINT: .reloc {{.*}}+8, R_PPC64_NONE, .data
+# PRINT: .reloc {{.*}}+4, R_PPC64_NONE, foo+4
+# PRINT: .reloc {{.*}}+0, R_PPC64_NONE, 8
+# PRINT: .reloc {{.*}}+0, R_PPC64_ADDR32, .data+2
+# PRINT: .reloc {{.*}}+0, R_PPC64_REL16_HI, foo+3
+# PRINT: .reloc {{.*}}+0, R_PPC64_REL16_HA, 5
+# PRINT: .reloc {{.*}}+0, BFD_RELOC_NONE, 9
+# PRINT: .reloc {{.*}}+0, BFD_RELOC_16, 9
+# PRINT: .reloc {{.*}}+0, BFD_RELOC_32, 9
+# PRINT: .reloc {{.*}}+0, BFD_RELOC_64, 9
 
 # CHECK:      0x8 R_PPC64_NONE .data 0x0
 # CHECK-NEXT: 0x4 R_PPC64_NONE foo 0x4
@@ -27,20 +27,20 @@
 # CHECK-NEXT: 0x0 R_PPC64_ADDR64 - 0x9
 
 .text
+  .reloc .+8, R_PPC64_NONE, .data
+  .reloc .+4, R_PPC64_NONE, foo+4
+  .reloc .+0, R_PPC64_NONE, 8
+  .reloc .+0, R_PPC64_ADDR32, .data+2
+  .reloc .+0, R_PPC64_REL16_HI, foo+3
+  .reloc .+0, R_PPC64_REL16_HA, 5
+
+  .reloc .+0, BFD_RELOC_NONE, 9
+  .reloc .+0, BFD_RELOC_16, 9
+  .reloc .+0, BFD_RELOC_32, 9
+  .reloc .+0, BFD_RELOC_64, 9
   blr
   nop
   nop
-  .reloc 8, R_PPC64_NONE, .data
-  .reloc 4, R_PPC64_NONE, foo+4
-  .reloc 0, R_PPC64_NONE, 8
-  .reloc 0, R_PPC64_ADDR32, .data+2
-  .reloc 0, R_PPC64_REL16_HI, foo+3
-  .reloc 0, R_PPC64_REL16_HA, 5
-
-  .reloc 0, BFD_RELOC_NONE, 9
-  .reloc 0, BFD_RELOC_16, 9
-  .reloc 0, BFD_RELOC_32, 9
-  .reloc 0, BFD_RELOC_64, 9
 
 .data
 .globl foo

diff  --git a/llvm/test/MC/RISCV/reloc-directive-err.s b/llvm/test/MC/RISCV/reloc-directive-err.s
index 2b00019fcb8ea..370e4ceb95734 100644
--- a/llvm/test/MC/RISCV/reloc-directive-err.s
+++ b/llvm/test/MC/RISCV/reloc-directive-err.s
@@ -1,6 +1,6 @@
 # RUN: llvm-mc -triple=riscv64 %s 2>&1 | FileCheck --check-prefix=PRINT %s
 # RUN: not llvm-mc -filetype=obj -triple=riscv64 %s -o /dev/null 2>&1 | FileCheck %s
 
-# PRINT: .reloc 0, R_INVALID, 0
+# PRINT: .reloc {{.*}}, R_INVALID, 0
 # CHECK: {{.*}}.s:[[# @LINE+1]]:11: error: unknown relocation name
-.reloc 0, R_INVALID, 0
+.reloc ., R_INVALID, 0

diff  --git a/llvm/test/MC/RISCV/reloc-directive.s b/llvm/test/MC/RISCV/reloc-directive.s
index 0e217fa798482..4ab2889a17ac9 100644
--- a/llvm/test/MC/RISCV/reloc-directive.s
+++ b/llvm/test/MC/RISCV/reloc-directive.s
@@ -3,15 +3,7 @@
 # RUN: llvm-mc -filetype=obj -triple=riscv32 %s | llvm-readobj -r - | FileCheck %s
 # RUN: llvm-mc -filetype=obj -triple=riscv64 %s | llvm-readobj -r - | FileCheck %s
 
-# PRINT: .reloc 8, R_RISCV_NONE, .data
-# PRINT: .reloc 4, R_RISCV_NONE, foo+4
-# PRINT: .reloc 0, R_RISCV_NONE, 8
-# PRINT: .reloc 0, R_RISCV_32, .data+2
-# PRINT: .reloc 0, R_RISCV_SET32, foo+3
-# PRINT: .reloc 0, R_RISCV_32_PCREL, 5
-# PRINT:      .reloc 0, BFD_RELOC_NONE, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_32, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_64, 9
+# PRINT: .reloc {{.*}}+8, R_RISCV_NONE, .data
 
 # CHECK:      0x8 R_RISCV_NONE .data 0x0
 # CHECK-NEXT: 0x4 R_RISCV_NONE foo 0x4
@@ -37,26 +29,26 @@
 # CHECK-NEXT: }
 
 .text
-  ret
-  nop
-  nop
-  .reloc 8, R_RISCV_NONE, .data
-  .reloc 4, R_RISCV_NONE, foo+4
-  .reloc 0, R_RISCV_NONE, 8
+  .reloc .+8, R_RISCV_NONE, .data
+  .reloc .+4, R_RISCV_NONE, foo+4
+  .reloc .+0, R_RISCV_NONE, 8
 
-  .reloc 0, R_RISCV_32, .data+2
-  .reloc 0, R_RISCV_SET32, foo+3
-  .reloc 0, R_RISCV_32_PCREL, 5
+  .reloc .+0, R_RISCV_32, .data+2
+  .reloc .+0, R_RISCV_SET32, foo+3
+  .reloc .+0, R_RISCV_32_PCREL, 5
 
-  .reloc 0, BFD_RELOC_NONE, 9
-  .reloc 0, BFD_RELOC_32, 9
-  .reloc 0, BFD_RELOC_64, 9
+  .reloc .+0, BFD_RELOC_NONE, 9
+  .reloc .+0, BFD_RELOC_32, 9
+  .reloc .+0, BFD_RELOC_64, 9
 
   .reloc foo, R_RISCV_32, 6
   .reloc line, R_RISCV_32, 6
   .reloc probe, R_RISCV_32, 6
-
   .reloc foo+4, R_RISCV_32, 6
+  ret
+  nop
+  nop
+
 .data
 .globl foo
 foo:

diff  --git a/llvm/test/MC/Sparc/Relocations/reloc-directive.s b/llvm/test/MC/Sparc/Relocations/reloc-directive.s
index 8899408ee428d..26164b3c2eb38 100644
--- a/llvm/test/MC/Sparc/Relocations/reloc-directive.s
+++ b/llvm/test/MC/Sparc/Relocations/reloc-directive.s
@@ -3,15 +3,7 @@
 # RUN: llvm-mc -filetype=obj -triple=sparc %s | llvm-readobj -r - | FileCheck %s
 # RUN: llvm-mc -filetype=obj -triple=sparcv9 %s | llvm-readobj -r - | FileCheck %s
 
-# PRINT: .reloc 8, R_SPARC_NONE, .data
-# PRINT: .reloc 4, R_SPARC_NONE, foo+4
-# PRINT: .reloc 0, R_SPARC_NONE, 8
-# PRINT: .reloc 0, R_SPARC_32, .data+2
-# PRINT: .reloc 0, R_SPARC_UA16, foo+3
-# PRINT: .reloc 0, R_SPARC_DISP32, foo+5
-# PRINT:      .reloc 0, BFD_RELOC_NONE, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_32, foo+2
-# PRINT-NEXT: .reloc 0, BFD_RELOC_64, foo+3
+# PRINT: .reloc {{.*}}+8, R_SPARC_NONE, .data
 
 # CHECK:      0x8 R_SPARC_NONE .data 0x0
 # CHECK-NEXT: 0x4 R_SPARC_NONE foo 0x4
@@ -23,20 +15,20 @@
 # CHECK-NEXT: 0x0 R_SPARC_32 foo 0x2
 # CHECK-NEXT: 0x0 R_SPARC_64 foo 0x3
 .text
+  .reloc .+8, R_SPARC_NONE, .data
+  .reloc .+4, R_SPARC_NONE, foo+4
+  .reloc .+0, R_SPARC_NONE, 8
+
+  .reloc .+0, R_SPARC_32, .data+2
+  .reloc .+0, R_SPARC_UA16, foo+3
+  .reloc .+0, R_SPARC_DISP32, foo+5
+
+  .reloc .+0, BFD_RELOC_NONE, 9
+  .reloc .+0, BFD_RELOC_32, foo+2
+  .reloc .+0, BFD_RELOC_64, foo+3
   ret
   nop
   nop
-  .reloc 8, R_SPARC_NONE, .data
-  .reloc 4, R_SPARC_NONE, foo+4
-  .reloc 0, R_SPARC_NONE, 8
-
-  .reloc 0, R_SPARC_32, .data+2
-  .reloc 0, R_SPARC_UA16, foo+3
-  .reloc 0, R_SPARC_DISP32, foo+5
-
-  .reloc 0, BFD_RELOC_NONE, 9
-  .reloc 0, BFD_RELOC_32, foo+2
-  .reloc 0, BFD_RELOC_64, foo+3
 
 .data
 .globl foo

diff  --git a/llvm/test/MC/SystemZ/reloc-directive.s b/llvm/test/MC/SystemZ/reloc-directive.s
index abc6ca320642d..78c36e1434574 100644
--- a/llvm/test/MC/SystemZ/reloc-directive.s
+++ b/llvm/test/MC/SystemZ/reloc-directive.s
@@ -3,19 +3,7 @@
 # RUN: llvm-mc -filetype=obj -triple=s390x-linux-gnu %s -o %t
 # RUN: llvm-readobj -r %t | FileCheck %s
 
-# PRINT:      .reloc 2, R_390_NONE, .data
-# PRINT-NEXT: .reloc 1, R_390_NONE, foo+4
-# PRINT-NEXT: .reloc 0, R_390_NONE, 8
-# PRINT-NEXT: .reloc 0, R_390_64, .data+2
-# PRINT-NEXT: .reloc 0, R_390_GOTENT, foo+3
-# PRINT-NEXT: .reloc 0, R_390_PC32DBL, 6
-# PRINT-NEXT: .reloc 4, R_390_12, foo
-# PRINT-NEXT: .reloc 2, R_390_20, foo
-# PRINT:      .reloc 0, BFD_RELOC_NONE, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_8, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_16, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_32, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_64, 9
+# PRINT:      .reloc {{.*}}+2, R_390_NONE, .data
 
 # CHECK:      0x2 R_390_NONE .data 0x0
 # CHECK-NEXT: 0x1 R_390_NONE foo 0x4
@@ -32,23 +20,23 @@
 # CHECK-NEXT: 0x0 R_390_64 - 0x9
 
 .text
+  .reloc .+2, R_390_NONE, .data
+  .reloc .+1, R_390_NONE, foo+4
+  .reloc .+0, R_390_NONE, 8
+  .reloc .+0, R_390_64, .data+2
+  .reloc .+0, R_390_GOTENT, foo+3
+  .reloc .+0, R_390_PC32DBL, 6
+  .reloc .+4, R_390_12, foo
+  .reloc .+2, R_390_20, foo
+
+  .reloc .+0, BFD_RELOC_NONE, 9
+  .reloc .+0, BFD_RELOC_8, 9
+  .reloc .+0, BFD_RELOC_16, 9
+  .reloc .+0, BFD_RELOC_32, 9
+  .reloc .+0, BFD_RELOC_64, 9
   br %r14
   nop
   nop
-  .reloc 2, R_390_NONE, .data
-  .reloc 1, R_390_NONE, foo+4
-  .reloc 0, R_390_NONE, 8
-  .reloc 0, R_390_64, .data+2
-  .reloc 0, R_390_GOTENT, foo+3
-  .reloc 0, R_390_PC32DBL, 6
-  .reloc 4, R_390_12, foo
-  .reloc 2, R_390_20, foo
-
-  .reloc 0, BFD_RELOC_NONE, 9
-  .reloc 0, BFD_RELOC_8, 9
-  .reloc 0, BFD_RELOC_16, 9
-  .reloc 0, BFD_RELOC_32, 9
-  .reloc 0, BFD_RELOC_64, 9
 
 .data
 .globl foo

diff  --git a/llvm/test/MC/X86/reloc-directive-elf-32.s b/llvm/test/MC/X86/reloc-directive-elf-32.s
index d4b612ebfcefc..d3112dd5f7daf 100644
--- a/llvm/test/MC/X86/reloc-directive-elf-32.s
+++ b/llvm/test/MC/X86/reloc-directive-elf-32.s
@@ -4,16 +4,7 @@
 # RUN: llvm-readobj -r %t | FileCheck %s
 # RUN: llvm-readelf -x .data %t | FileCheck --check-prefix=HEX %s
 
-# PRINT:      .reloc 2, R_386_NONE, .data
-# PRINT-NEXT: .reloc 1, R_386_NONE, foo+4
-# PRINT-NEXT: .reloc 0, R_386_NONE, 8
-# PRINT-NEXT: .reloc 0, R_386_32, .data+2
-# PRINT-NEXT: .reloc 0, R_386_IRELATIVE, foo+3
-# PRINT-NEXT: .reloc 0, R_386_GOT32X, 5
-# PRINT:      .reloc 0, BFD_RELOC_NONE, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_8, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_16, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_32, 9
+# PRINT:      .reloc {{.*}}+2, R_386_NONE, .data
 
 # X86 relocations use the Elf32_Rel format. Addends are neither stored in the
 # relocation entries nor applied in the referenced locations.
@@ -31,20 +22,20 @@
 # HEX: 0x00000000 00000000 00000000
 
 .text
+  .reloc .+2, R_386_NONE, .data
+  .reloc .+1, R_386_NONE, foo+4
+  .reloc .+0, R_386_NONE, 8
+  .reloc .+0, R_386_32, .data+2
+  .reloc .+0, R_386_IRELATIVE, foo+3
+  .reloc .+0, R_386_GOT32X, 5
+
+  .reloc .+0, BFD_RELOC_NONE, 9
+  .reloc .+0, BFD_RELOC_8, 9
+  .reloc .+0, BFD_RELOC_16, 9
+  .reloc .+0, BFD_RELOC_32, 9
   ret
   nop
   nop
-  .reloc 2, R_386_NONE, .data
-  .reloc 1, R_386_NONE, foo+4
-  .reloc 0, R_386_NONE, 8
-  .reloc 0, R_386_32, .data+2
-  .reloc 0, R_386_IRELATIVE, foo+3
-  .reloc 0, R_386_GOT32X, 5
-
-  .reloc 0, BFD_RELOC_NONE, 9
-  .reloc 0, BFD_RELOC_8, 9
-  .reloc 0, BFD_RELOC_16, 9
-  .reloc 0, BFD_RELOC_32, 9
 
 .data
 .globl foo

diff  --git a/llvm/test/MC/X86/reloc-directive-elf-64.s b/llvm/test/MC/X86/reloc-directive-elf-64.s
index e0a1a5730597f..d6b8db98d5d08 100644
--- a/llvm/test/MC/X86/reloc-directive-elf-64.s
+++ b/llvm/test/MC/X86/reloc-directive-elf-64.s
@@ -3,18 +3,7 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux-musl %s -o %t
 # RUN: llvm-readobj -r %t | FileCheck %s
 
-# PRINT:      .reloc 2, R_X86_64_NONE, .data
-# PRINT-NEXT: .reloc 1, R_X86_64_NONE, foo+4
-# PRINT-NEXT: .reloc 0, R_X86_64_NONE, 8
-# PRINT-NEXT: .reloc 0, R_X86_64_64, .data+2
-# PRINT-NEXT: .reloc 0, R_X86_64_GOTPCRELX, foo+3
-# PRINT-NEXT: .reloc 0, R_X86_64_REX_GOTPCRELX, 5
-# PRINT-NEXT: .reloc 0, R_X86_64_CODE_4_GOTPCRELX, 7
-# PRINT:      .reloc 0, BFD_RELOC_NONE, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_8, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_16, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_32, 9
-# PRINT-NEXT: .reloc 0, BFD_RELOC_64, 9
+# PRINT:      .reloc {{.*}}+2, R_X86_64_NONE, .data
 
 # CHECK:      0x2 R_X86_64_NONE .data 0x0
 # CHECK-NEXT: 0x1 R_X86_64_NONE foo 0x4
@@ -30,22 +19,22 @@
 # CHECK-NEXT: 0x0 R_X86_64_64 - 0x9
 
 .text
+  .reloc .+2, R_X86_64_NONE, .data
+  .reloc .+1, R_X86_64_NONE, foo+4
+  .reloc .+0, R_X86_64_NONE, 8
+  .reloc .+0, R_X86_64_64, .data+2
+  .reloc .+0, R_X86_64_GOTPCRELX, foo+3
+  .reloc .+0, R_X86_64_REX_GOTPCRELX, 5
+  .reloc .+0, R_X86_64_CODE_4_GOTPCRELX, 7
+
+  .reloc .+0, BFD_RELOC_NONE, 9
+  .reloc .+0, BFD_RELOC_8, 9
+  .reloc .+0, BFD_RELOC_16, 9
+  .reloc .+0, BFD_RELOC_32, 9
+  .reloc .+0, BFD_RELOC_64, 9
   ret
   nop
   nop
-  .reloc 2, R_X86_64_NONE, .data
-  .reloc 1, R_X86_64_NONE, foo+4
-  .reloc 0, R_X86_64_NONE, 8
-  .reloc 0, R_X86_64_64, .data+2
-  .reloc 0, R_X86_64_GOTPCRELX, foo+3
-  .reloc 0, R_X86_64_REX_GOTPCRELX, 5
-  .reloc 0, R_X86_64_CODE_4_GOTPCRELX, 7
-
-  .reloc 0, BFD_RELOC_NONE, 9
-  .reloc 0, BFD_RELOC_8, 9
-  .reloc 0, BFD_RELOC_16, 9
-  .reloc 0, BFD_RELOC_32, 9
-  .reloc 0, BFD_RELOC_64, 9
 
 .data
 .globl foo

diff  --git a/llvm/test/MC/X86/reloc-directive.s b/llvm/test/MC/X86/reloc-directive.s
index 5f4fc2394f5e7..124dc06951122 100644
--- a/llvm/test/MC/X86/reloc-directive.s
+++ b/llvm/test/MC/X86/reloc-directive.s
@@ -8,16 +8,16 @@
 # RUN:     FileCheck -check-prefix=OBJ-64 %s
 	.text
 foo:
+	.reloc .+4, dir32,    foo          # ASM: .reloc {{.*}}+4, dir32, foo
+	.reloc .+0, secrel32, foo+4        # ASM: .reloc {{.*}}+0, secrel32, foo+4
+	.reloc .+8, secidx,   foo+8        # ASM: .reloc {{.*}}+8, secidx, foo+8
+	.reloc .+12, dir32,   foo at secrel32 # ASM: .reloc {{.*}}+12, dir32, foo at SECREL32
+	.reloc .+16, dir32,   foo at imgrel   # ASM: .reloc {{.*}}+16, dir32, foo at IMGREL
 	.long 0
 	.long 0
 	.long 0
 	.long 0
 	.long 0
-	.reloc 4, dir32,    foo          # ASM: .reloc 4, dir32, foo
-	.reloc 0, secrel32, foo+4        # ASM: .reloc 0, secrel32, foo+4
-	.reloc 8, secidx,   foo+8        # ASM: .reloc 8, secidx, foo+8
-	.reloc 12, dir32,   foo at secrel32 # ASM: .reloc 12, dir32, foo at SECREL32
-	.reloc 16, dir32,   foo at imgrel   # ASM: .reloc 16, dir32, foo at IMGREL
 
 # OBJ-32-LABEL: Name: .text
 # OBJ-32:       0000: 04000000 00000000 00000000


        


More information about the llvm-commits mailing list