[llvm] 8f671a6 - [LoongArch] Always emit symbol-based relocations regardless of relaxation (#153943)

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 18 05:15:52 PDT 2025


Author: ZhaoQi
Date: 2025-08-18T20:15:49+08:00
New Revision: 8f671a675f52a7bbf33df5d4c8545bab31d28689

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

LOG: [LoongArch] Always emit symbol-based relocations regardless of relaxation (#153943)

This commit changes all relocations to be relocated with symbols.

Without this commit, errors may occur in some cases, such as when using
`llc/lto+relax`, or combining relaxed and norelaxed object files using
`ld -r`.

Some tests updated.

Added: 
    

Modified: 
    llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp
    llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp
    llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCTargetDesc.h
    llvm/test/CodeGen/LoongArch/linker-relaxation.ll
    llvm/test/CodeGen/LoongArch/xray-attribute-instrumentation.ll
    llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll
    llvm/test/MC/LoongArch/Misc/cfi-advance.s
    llvm/test/MC/LoongArch/Relocations/fde-reloc.s
    llvm/test/MC/LoongArch/Relocations/relax-addsub.s
    llvm/test/MC/LoongArch/Relocations/relax-attr.s
    llvm/test/MC/LoongArch/Relocations/relocation-specifier.s
    llvm/test/MC/LoongArch/Relocations/sub-expr.s

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp
index 994e8577e496e..338134ffcde61 100644
--- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp
+++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.cpp
@@ -496,8 +496,7 @@ bool LoongArchAsmBackend::addReloc(const MCFragment &F, const MCFixup &Fixup,
 
 std::unique_ptr<MCObjectTargetWriter>
 LoongArchAsmBackend::createObjectTargetWriter() const {
-  return createLoongArchELFObjectWriter(
-      OSABI, Is64Bit, STI.hasFeature(LoongArch::FeatureRelax));
+  return createLoongArchELFObjectWriter(OSABI, Is64Bit);
 }
 
 MCAsmBackend *llvm::createLoongArchAsmBackend(const Target &T,

diff  --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp
index 7e021e486836a..7d5456555045b 100644
--- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp
+++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchELFObjectWriter.cpp
@@ -21,26 +21,23 @@ using namespace llvm;
 namespace {
 class LoongArchELFObjectWriter : public MCELFObjectTargetWriter {
 public:
-  LoongArchELFObjectWriter(uint8_t OSABI, bool Is64Bit, bool EnableRelax);
+  LoongArchELFObjectWriter(uint8_t OSABI, bool Is64Bit);
 
   ~LoongArchELFObjectWriter() override;
 
   bool needsRelocateWithSymbol(const MCValue &, unsigned Type) const override {
-    return EnableRelax;
+    return true;
   }
 
 protected:
   unsigned getRelocType(const MCFixup &, const MCValue &,
                         bool IsPCRel) const override;
-  bool EnableRelax;
 };
 } // end namespace
 
-LoongArchELFObjectWriter::LoongArchELFObjectWriter(uint8_t OSABI, bool Is64Bit,
-                                                   bool EnableRelax)
+LoongArchELFObjectWriter::LoongArchELFObjectWriter(uint8_t OSABI, bool Is64Bit)
     : MCELFObjectTargetWriter(Is64Bit, OSABI, ELF::EM_LOONGARCH,
-                              /*HasRelocationAddend=*/true),
-      EnableRelax(EnableRelax) {}
+                              /*HasRelocationAddend=*/true) {}
 
 LoongArchELFObjectWriter::~LoongArchELFObjectWriter() {}
 
@@ -103,6 +100,6 @@ unsigned LoongArchELFObjectWriter::getRelocType(const MCFixup &Fixup,
 }
 
 std::unique_ptr<MCObjectTargetWriter>
-llvm::createLoongArchELFObjectWriter(uint8_t OSABI, bool Is64Bit, bool Relax) {
-  return std::make_unique<LoongArchELFObjectWriter>(OSABI, Is64Bit, Relax);
+llvm::createLoongArchELFObjectWriter(uint8_t OSABI, bool Is64Bit) {
+  return std::make_unique<LoongArchELFObjectWriter>(OSABI, Is64Bit);
 }

diff  --git a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCTargetDesc.h b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCTargetDesc.h
index bb05baa9b717c..ab35a0096c8a2 100644
--- a/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCTargetDesc.h
+++ b/llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchMCTargetDesc.h
@@ -36,7 +36,7 @@ MCAsmBackend *createLoongArchAsmBackend(const Target &T,
                                         const MCTargetOptions &Options);
 
 std::unique_ptr<MCObjectTargetWriter>
-createLoongArchELFObjectWriter(uint8_t OSABI, bool Is64Bit, bool Relax);
+createLoongArchELFObjectWriter(uint8_t OSABI, bool Is64Bit);
 
 } // end namespace llvm
 

diff  --git a/llvm/test/CodeGen/LoongArch/linker-relaxation.ll b/llvm/test/CodeGen/LoongArch/linker-relaxation.ll
index 3bb83193ce7ac..6b197bc578919 100644
--- a/llvm/test/CodeGen/LoongArch/linker-relaxation.ll
+++ b/llvm/test/CodeGen/LoongArch/linker-relaxation.ll
@@ -1,6 +1,6 @@
 ; RUN: llc --mtriple=loongarch64 --filetype=obj -mattr=-relax \
 ; RUN:     --relocation-model=pic --code-model=medium < %s \
-; RUN:     | llvm-readobj -r - | FileCheck --check-prefixes=CHECK-RELOC,PCALA-RELOC %s
+; RUN:     | llvm-readobj -r - | FileCheck --check-prefix=CHECK-RELOC %s
 ; RUN: llc --mtriple=loongarch64 --filetype=obj -mattr=+relax \
 ; RUN:     --relocation-model=pic --code-model=medium < %s \
 ; RUN:     | llvm-readobj -r - | FileCheck --check-prefixes=CHECK-RELOC,RELAX %s
@@ -33,10 +33,8 @@ declare dso_local void @callee3() nounwind
 ; RELAX:            R_LARCH_RELAX - 0x0
 ; CHECK-RELOC-NEXT: R_LARCH_GOT_PC_LO12 g_e 0x0
 ; RELAX-NEXT:       R_LARCH_RELAX - 0x0
-; PCALA-RELOC:      R_LARCH_PCALA_HI20 .bss 0x0
-; RELAX-NEXT:       R_LARCH_PCALA_HI20 g_i 0x0
-; PCALA-RELOC:      R_LARCH_PCALA_LO12 .bss 0x0
-; RELAX-NEXT:       R_LARCH_PCALA_LO12 g_i 0x0
+; CHECK-RELOC-NEXT: R_LARCH_PCALA_HI20 g_i 0x0
+; CHECK-RELOC-NEXT: R_LARCH_PCALA_LO12 g_i 0x0
 ; CHECK-RELOC:      R_LARCH_TLS_GD_PC_HI20 t_un 0x0
 ; RELAX-NEXT:       R_LARCH_RELAX - 0x0
 ; CHECK-RELOC-NEXT: R_LARCH_GOT_PC_LO12 t_un 0x0
@@ -75,11 +73,9 @@ declare dso_local void @callee3() nounwind
 ; RELAX-NEXT:       R_LARCH_RELAX - 0x0
 ; CHECK-RELOC-NEXT: R_LARCH_TLS_LE_LO12_R t_le 0x0
 ; RELAX-NEXT:       R_LARCH_RELAX - 0x0
-; PCALA-RELOC:      R_LARCH_PCALA_HI20 .data 0x0
-; RELAX-NEXT:       R_LARCH_PCALA_HI20 g_i1 0x0
+; CHECK-RELOC-NEXT: R_LARCH_PCALA_HI20 g_i1 0x0
 ; RELAX-NEXT:       R_LARCH_RELAX - 0x0
-; PCALA-RELOC:      R_LARCH_PCALA_LO12 .data 0x0
-; RELAX-NEXT:       R_LARCH_PCALA_LO12 g_i1 0x0
+; CHECK-RELOC-NEXT: R_LARCH_PCALA_LO12 g_i1 0x0
 ; RELAX-NEXT:       R_LARCH_RELAX - 0x0
 ; RELAX-NEXT:       R_LARCH_ALIGN - 0x1C
 ; CHECK-RELOC-NEXT: R_LARCH_CALL36 callee1 0x0

diff  --git a/llvm/test/CodeGen/LoongArch/xray-attribute-instrumentation.ll b/llvm/test/CodeGen/LoongArch/xray-attribute-instrumentation.ll
index 8999c20387003..7838bcea1025d 100644
--- a/llvm/test/CodeGen/LoongArch/xray-attribute-instrumentation.ll
+++ b/llvm/test/CodeGen/LoongArch/xray-attribute-instrumentation.ll
@@ -43,14 +43,14 @@ define i32 @foo() nounwind noinline uwtable "function-instrument"="xray-always"
 ; CHECK-NEXT: .dword 2
 
 ; RELOC:      Section ([[#]]) .relaxray_instr_map {
-; RELOC-NEXT:   0x0 R_LARCH_64_PCREL .text 0x0
-; RELOC-NEXT:   0x8 R_LARCH_64_PCREL .text 0x0
-; RELOC-NEXT:   0x20 R_LARCH_64_PCREL .text 0x34
-; RELOC-NEXT:   0x28 R_LARCH_64_PCREL .text 0x0
+; RELOC-NEXT:   0x0 R_LARCH_64_PCREL .L{{.*}} 0x0
+; RELOC-NEXT:   0x8 R_LARCH_64_PCREL .L{{.*}} 0x0
+; RELOC-NEXT:   0x20 R_LARCH_64_PCREL .L{{.*}} 0x0
+; RELOC-NEXT:   0x28 R_LARCH_64_PCREL .L{{.*}} 0x0
 ; RELOC-NEXT: }
 ; RELOC-NEXT: Section ([[#]]) .relaxray_fn_idx {
-; RELOC-NEXT:   0x0 R_LARCH_64_PCREL xray_instr_map 0x0
+; RELOC-NEXT:   0x0 R_LARCH_64_PCREL .Lxray_sleds_start0 0x0
 ; RELOC-NEXT: }
 ; RELOC-NEXT: Section ([[#]]) .rela.eh_frame {
-; RELOC-NEXT:   0x1C R_LARCH_32_PCREL .text 0x0
+; RELOC-NEXT:   0x1C R_LARCH_32_PCREL .L{{.*}} 0x0
 ; RELOC-NEXT: }

diff  --git a/llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll b/llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll
index d28836d560377..2f5cc373a68f5 100644
--- a/llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll
+++ b/llvm/test/DebugInfo/LoongArch/dwarf-loongarch-relocs.ll
@@ -1,5 +1,5 @@
 ; RUN: llc --filetype=obj --mtriple=loongarch64 --mattr=-relax %s -o %t.o
-; RUN: llvm-readobj -r %t.o | FileCheck --check-prefixes=RELOCS-BOTH,RELOCS-NORL %s
+; RUN: llvm-readobj -r %t.o | FileCheck --check-prefix=RELOCS-BOTH %s
 ; RUN: llvm-objdump --source %t.o | FileCheck --check-prefix=SOURCE %s
 ; RUN: llvm-dwarfdump --debug-info --debug-line %t.o | FileCheck --check-prefix=DWARF %s
 
@@ -16,10 +16,8 @@
 ; RELOCS-ENRL-NEXT:      0x18 R_LARCH_RELAX - 0x0
 ; RELOCS-BOTH-NEXT:    }
 ; RELOCS-BOTH:         Section ({{.*}}) .rela.debug_frame {
-; RELOCS-NORL-NEXT:      0x1C R_LARCH_32 .debug_frame 0x0
-; RELOCS-NORL-NEXT:      0x20 R_LARCH_64 .text 0x0
-; RELOCS-ENRL-NEXT:      0x1C R_LARCH_32 .L0  0x0
-; RELOCS-ENRL-NEXT:      0x20 R_LARCH_64 .L0  0x0
+; RELOCS-BOTH-NEXT:      0x1C R_LARCH_32 .L0  0x0
+; RELOCS-BOTH-NEXT:      0x20 R_LARCH_64 .L0  0x0
 ; RELOCS-ENRL-NEXT:      0x28 R_LARCH_ADD64 .L0  0x0
 ; RELOCS-ENRL-NEXT:      0x28 R_LARCH_SUB64 .L0  0x0
 ; RELOCS-ENRL-NEXT:      0x3F R_LARCH_ADD6 .L0  0x0
@@ -29,8 +27,7 @@
 ; RELOCS-BOTH-NEXT:      0x22 R_LARCH_32 .debug_line_str 0x0
 ; RELOCS-BOTH-NEXT:      0x31 R_LARCH_32 .debug_line_str 0x2
 ; RELOCS-BOTH-NEXT:      0x46 R_LARCH_32 .debug_line_str 0x1B
-; RELOCS-NORL-NEXT:      0x4F R_LARCH_64 .text 0x0
-; RELOCS-ENRL-NEXT:      0x4F R_LARCH_64 .L0  0x0
+; RELOCS-BOTH-NEXT:      0x4F R_LARCH_64 .L0  0x0
 ; RELOCS-ENRL-NEXT:      0x5F R_LARCH_ADD16 .L0  0x0
 ; RELOCS-ENRL-NEXT:      0x5F R_LARCH_SUB16 .L0  0x0
 ; RELOCS-BOTH-NEXT:    }

diff  --git a/llvm/test/MC/LoongArch/Misc/cfi-advance.s b/llvm/test/MC/LoongArch/Misc/cfi-advance.s
index 494b8af21064b..86b36a38c3f15 100644
--- a/llvm/test/MC/LoongArch/Misc/cfi-advance.s
+++ b/llvm/test/MC/LoongArch/Misc/cfi-advance.s
@@ -6,7 +6,7 @@
 
 # RELOC:       Relocations [
 # RELOC:         .rela.eh_frame {
-# RELOC-NEXT:       0x1C R_LARCH_32_PCREL .text 0x0
+# RELOC-NEXT:       0x1C R_LARCH_32_PCREL .L{{.*}} 0x0
 # RELOC-NEXT:    }
 # RELOC-NEXT:  ]
 # DWARFDUMP:       DW_CFA_advance_loc: 8

diff  --git a/llvm/test/MC/LoongArch/Relocations/fde-reloc.s b/llvm/test/MC/LoongArch/Relocations/fde-reloc.s
index ab911d1853a87..3b9f4003950f8 100644
--- a/llvm/test/MC/LoongArch/Relocations/fde-reloc.s
+++ b/llvm/test/MC/LoongArch/Relocations/fde-reloc.s
@@ -1,7 +1,7 @@
 # RUN: llvm-mc --filetype=obj --triple=loongarch64 --mattr=-relax < %s \
 # RUN:     | llvm-readobj -r - | FileCheck %s
 # RUN: llvm-mc --filetype=obj --triple=loongarch64 --mattr=+relax < %s \
-# RUN:     | llvm-readobj -r - | FileCheck %s --check-prefix=RELAX
+# RUN:     | llvm-readobj -r - | FileCheck %s
 
 ## Ensure that the eh_frame records the symbolic 
diff erence with
 ## the R_LARCH_32_PCREL relocation.
@@ -11,9 +11,6 @@ func:
   ret
  .cfi_endproc
 
-# CHECK:   Section (4) .rela.eh_frame {
-# CHECK-NEXT:   0x1C R_LARCH_32_PCREL .text 0x0
+# CHECK:   Section ({{.*}}) .rela.eh_frame {
+# CHECK-NEXT:   0x1C R_LARCH_32_PCREL .L{{.*}} 0x0
 # CHECK-NEXT: }
-# RELAX:   Section ({{.*}}) .rela.eh_frame {
-# RELAX-NEXT:   0x1C R_LARCH_32_PCREL .L{{.*}} 0x0
-# RELAX-NEXT: }

diff  --git a/llvm/test/MC/LoongArch/Relocations/relax-addsub.s b/llvm/test/MC/LoongArch/Relocations/relax-addsub.s
index da3f655e9a31e..67c643c076895 100644
--- a/llvm/test/MC/LoongArch/Relocations/relax-addsub.s
+++ b/llvm/test/MC/LoongArch/Relocations/relax-addsub.s
@@ -6,18 +6,18 @@
 # NORELAX:       Relocations [
 # NORELAX-NEXT:    Section ({{.*}}) .rela.text {
 # NORELAX-NEXT:      0x0 R_LARCH_CALL36 foo 0x0
-# NORELAX-NEXT:      0x10 R_LARCH_PCALA_HI20 .text 0x8
-# NORELAX-NEXT:      0x14 R_LARCH_PCALA_LO12 .text 0x8
+# NORELAX-NEXT:      0x10 R_LARCH_PCALA_HI20 .L1 0x0
+# NORELAX-NEXT:      0x14 R_LARCH_PCALA_LO12 .L1 0x0
 # NORELAX-NEXT:    }
 # NORELAX-NEXT:    Section ({{.*}}) .rela.data {
 # NORELAX-NEXT:      0x30 R_LARCH_ADD8 foo 0x0
-# NORELAX-NEXT:      0x30 R_LARCH_SUB8 .text 0x10
+# NORELAX-NEXT:      0x30 R_LARCH_SUB8 .L3 0x0
 # NORELAX-NEXT:      0x31 R_LARCH_ADD16 foo 0x0
-# NORELAX-NEXT:      0x31 R_LARCH_SUB16 .text 0x10
+# NORELAX-NEXT:      0x31 R_LARCH_SUB16 .L3 0x0
 # NORELAX-NEXT:      0x33 R_LARCH_ADD32 foo 0x0
-# NORELAX-NEXT:      0x33 R_LARCH_SUB32 .text 0x10
+# NORELAX-NEXT:      0x33 R_LARCH_SUB32 .L3 0x0
 # NORELAX-NEXT:      0x37 R_LARCH_ADD64 foo 0x0
-# NORELAX-NEXT:      0x37 R_LARCH_SUB64 .text 0x10
+# NORELAX-NEXT:      0x37 R_LARCH_SUB64 .L3 0x0
 # NORELAX-NEXT:    }
 # NORELAX-NEXT:  ]
 

diff  --git a/llvm/test/MC/LoongArch/Relocations/relax-attr.s b/llvm/test/MC/LoongArch/Relocations/relax-attr.s
index d94d32ebd7ab0..7cc8dda07e333 100644
--- a/llvm/test/MC/LoongArch/Relocations/relax-attr.s
+++ b/llvm/test/MC/LoongArch/Relocations/relax-attr.s
@@ -8,7 +8,7 @@
 # CHECK-NEXT:     0x4 R_LARCH_CALL36 foo 0x0
 # CHECK-NEXT:   }
 # CHECK-NEXT:   Section ({{.*}}) .rela.data {
-# CHECK-NEXT:     0x0 R_LARCH_64 .text 0xC
+# CHECK-NEXT:     0x0 R_LARCH_64 .L1 0x0
 # CHECK-NEXT:   }
 # CHECK-NEXT: ]
 

diff  --git a/llvm/test/MC/LoongArch/Relocations/relocation-specifier.s b/llvm/test/MC/LoongArch/Relocations/relocation-specifier.s
index d0898aaab92fe..c2526a6ecd701 100644
--- a/llvm/test/MC/LoongArch/Relocations/relocation-specifier.s
+++ b/llvm/test/MC/LoongArch/Relocations/relocation-specifier.s
@@ -6,10 +6,10 @@
 ## This test is similar to test/MC/CSKY/relocation-specifier.s.
 
 # RELOC32: '.rela.data'
-# RELOC32: R_LARCH_32 00000000 .data + 0
+# RELOC32: R_LARCH_32 00000000 local
 
 # RELOC64: '.rela.data'
-# RELOC64: R_LARCH_32 0000000000000000 .data + 0
+# RELOC64: R_LARCH_32 0000000000000000 local
 
 # CHECK: TLS GLOBAL DEFAULT UND gd
 # CHECK: TLS GLOBAL DEFAULT UND ld

diff  --git a/llvm/test/MC/LoongArch/Relocations/sub-expr.s b/llvm/test/MC/LoongArch/Relocations/sub-expr.s
index 2d439194eb932..4554101200818 100644
--- a/llvm/test/MC/LoongArch/Relocations/sub-expr.s
+++ b/llvm/test/MC/LoongArch/Relocations/sub-expr.s
@@ -1,78 +1,57 @@
 # RUN: llvm-mc --filetype=obj --triple=loongarch64 --mattr=-relax %s \
-# RUN:     | llvm-readobj -r - | FileCheck %s
+# RUN:     | llvm-readobj -r - | FileCheck %s --check-prefixes=CHECK,NORELAX
 # RUN: llvm-mc --filetype=obj --triple=loongarch64 --mattr=+relax %s \
-# RUN:     | llvm-readobj -r - | FileCheck %s --check-prefix=RELAX
+# RUN:     | llvm-readobj -r - | FileCheck %s --check-prefixes=CHECK,RELAX
 
 ## Check that subtraction expressions emit R_LARCH_32_PCREL and R_LARCH_64_PCREL relocations.
 
 ## TODO: 1- or 2-byte data relocations are not supported for now.
 
-# CHECK:      Relocations [
-# CHECK-NEXT:     Section ({{.*}}) .rela.sx {
-# CHECK-NEXT:       0x4 R_LARCH_PCALA_HI20 z 0x0
-# CHECK-NEXT:       0x8 R_LARCH_PCALA_LO12 z 0x0
-# CHECK-NEXT:       0xC R_LARCH_32_PCREL .sy 0x10
-# CHECK-NEXT:     }
+# CHECK:        Relocations [
+# NORELAX-NEXT:   Section ({{.*}}) .rela.sx {
+# NORELAX-NEXT:     0x4 R_LARCH_PCALA_HI20 z 0x0
+# NORELAX-NEXT:     0x8 R_LARCH_PCALA_LO12 z 0x0
+# NORELAX-NEXT:     0xC R_LARCH_32_PCREL y 0x8
+# NORELAX-NEXT:   }
+# RELAX-NEXT:     Section ({{.*}}) .rela.sx {
+# RELAX-NEXT:       0x4 R_LARCH_PCALA_HI20 z 0x0
+# RELAX-NEXT:       0x4 R_LARCH_RELAX - 0x0
+# RELAX-NEXT:       0x8 R_LARCH_PCALA_LO12 z 0x0
+# RELAX-NEXT:       0x8 R_LARCH_RELAX - 0x0
+# RELAX-NEXT:       0xC R_LARCH_ADD32 y 0x0
+# RELAX-NEXT:       0xC R_LARCH_SUB32 x 0x0
+# RELAX-NEXT:     }
 # CHECK-NEXT:     Section ({{.*}}) .rela.data {
-# CHECK-NEXT:       0x0 R_LARCH_64_PCREL .sx 0x4
-# CHECK-NEXT:       0x8 R_LARCH_64_PCREL .sy 0x8
-# CHECK-NEXT:       0x10 R_LARCH_32_PCREL .sx 0x4
-# CHECK-NEXT:       0x14 R_LARCH_32_PCREL .sy 0x8
-# CHECK-NEXT:       0x18 R_LARCH_ADD64 .sx 0x4
-# CHECK-NEXT:       0x18 R_LARCH_SUB64 .sy 0x8
-# CHECK-NEXT:       0x20 R_LARCH_ADD64 .sy 0x8
-# CHECK-NEXT:       0x20 R_LARCH_SUB64 .sx 0x4
-# CHECK-NEXT:       0x28 R_LARCH_ADD32 .sx 0x4
-# CHECK-NEXT:       0x28 R_LARCH_SUB32 .sy 0x8
-# CHECK-NEXT:       0x2C R_LARCH_ADD32 .sy 0x8
-# CHECK-NEXT:       0x2C R_LARCH_SUB32 .sx 0x4
-# CHECK-NEXT:       0x30 R_LARCH_ADD64 .data 0x30
-# CHECK-NEXT:       0x30 R_LARCH_SUB64 .sx 0x4
-# CHECK-NEXT:       0x38 R_LARCH_ADD32 .data 0x38
-# CHECK-NEXT:       0x38 R_LARCH_SUB32 .sy 0x8
-# CHECK-NEXT:     }
-# CHECK-NEXT:     Section ({{.*}}) .rela.sy {
-# CHECK-NEXT:       0x0 R_LARCH_CALL36 foo 0x0
-# CHECK-NEXT:       0x10 R_LARCH_32_PCREL .sx 0xC
+# CHECK-NEXT:       0x0 R_LARCH_64_PCREL x 0x0
+# CHECK-NEXT:       0x8 R_LARCH_64_PCREL y 0x0
+# CHECK-NEXT:       0x10 R_LARCH_32_PCREL x 0x0
+# CHECK-NEXT:       0x14 R_LARCH_32_PCREL y 0x0
+# CHECK-NEXT:       0x18 R_LARCH_ADD64 x 0x0
+# CHECK-NEXT:       0x18 R_LARCH_SUB64 y 0x0
+# CHECK-NEXT:       0x20 R_LARCH_ADD64 y 0x0
+# CHECK-NEXT:       0x20 R_LARCH_SUB64 x 0x0
+# CHECK-NEXT:       0x28 R_LARCH_ADD32 x 0x0
+# CHECK-NEXT:       0x28 R_LARCH_SUB32 y 0x0
+# CHECK-NEXT:       0x2C R_LARCH_ADD32 y 0x0
+# CHECK-NEXT:       0x2C R_LARCH_SUB32 x 0x0
+# CHECK-NEXT:       0x30 R_LARCH_ADD64 {{.*}} 0x0
+# CHECK-NEXT:       0x30 R_LARCH_SUB64 x 0x0
+# CHECK-NEXT:       0x38 R_LARCH_ADD32 {{.*}} 0x0
+# CHECK-NEXT:       0x38 R_LARCH_SUB32 y 0x0
 # CHECK-NEXT:     }
+# NORELAX-NEXT:   Section ({{.*}}) .rela.sy {
+# NORELAX-NEXT:     0x0 R_LARCH_CALL36 foo 0x0
+# NORELAX-NEXT:     0x10 R_LARCH_32_PCREL x 0x8
+# NORELAX-NEXT:   }
+# RELAX-NEXT:     Section ({{.*}}) .rela.sy {
+# RELAX-NEXT:       0x0 R_LARCH_CALL36 foo 0x0
+# RELAX-NEXT:       0x0 R_LARCH_RELAX - 0x0
+# RELAX-NEXT:       0x8 R_LARCH_ALIGN - 0xC
+# RELAX-NEXT:       0x14 R_LARCH_ADD32 x 0x0
+# RELAX-NEXT:       0x14 R_LARCH_SUB32 y 0x0
+# RELAX-NEXT:     }
 # CHECK-NEXT:   ]
 
-# RELAX:      Relocations [
-# RELAX-NEXT:   Section ({{.*}}) .rela.sx {
-# RELAX-NEXT:     0x4 R_LARCH_PCALA_HI20 z 0x0
-# RELAX-NEXT:     0x4 R_LARCH_RELAX - 0x0
-# RELAX-NEXT:     0x8 R_LARCH_PCALA_LO12 z 0x0
-# RELAX-NEXT:     0x8 R_LARCH_RELAX - 0x0
-# RELAX-NEXT:     0xC R_LARCH_ADD32 y 0x0
-# RELAX-NEXT:     0xC R_LARCH_SUB32 x 0x0
-# RELAX-NEXT:   }
-# RELAX-NEXT:   Section ({{.*}}) .rela.data {
-# RELAX-NEXT:     0x0 R_LARCH_64_PCREL x 0x0
-# RELAX-NEXT:     0x8 R_LARCH_64_PCREL y 0x0
-# RELAX-NEXT:     0x10 R_LARCH_32_PCREL x 0x0
-# RELAX-NEXT:     0x14 R_LARCH_32_PCREL y 0x0
-# RELAX-NEXT:     0x18 R_LARCH_ADD64 x 0x0
-# RELAX-NEXT:     0x18 R_LARCH_SUB64 y 0x0
-# RELAX-NEXT:     0x20 R_LARCH_ADD64 y 0x0
-# RELAX-NEXT:     0x20 R_LARCH_SUB64 x 0x0
-# RELAX-NEXT:     0x28 R_LARCH_ADD32 x 0x0
-# RELAX-NEXT:     0x28 R_LARCH_SUB32 y 0x0
-# RELAX-NEXT:     0x2C R_LARCH_ADD32 y 0x0
-# RELAX-NEXT:     0x2C R_LARCH_SUB32 x 0x0
-# RELAX-NEXT:     0x30 R_LARCH_ADD64 {{.*}} 0x0
-# RELAX-NEXT:     0x30 R_LARCH_SUB64 x 0x0
-# RELAX-NEXT:     0x38 R_LARCH_ADD32 {{.*}} 0x0
-# RELAX-NEXT:     0x38 R_LARCH_SUB32 y 0x0
-# RELAX-NEXT:   }
-# RELAX-NEXT:   Section ({{.*}}) .rela.sy {
-# RELAX-NEXT:     0x0 R_LARCH_CALL36 foo 0x0
-# RELAX-NEXT:     0x0 R_LARCH_RELAX - 0x0
-# RELAX-NEXT:     0x8 R_LARCH_ALIGN - 0xC
-# RELAX-NEXT:     0x14 R_LARCH_ADD32 x 0x0
-# RELAX-NEXT:     0x14 R_LARCH_SUB32 y 0x0
-# RELAX-NEXT:   }
-# RELAX-NEXT: ]
-
 .section .sx,"ax"
 nop
 x:


        


More information about the llvm-commits mailing list