[PATCH] D61584: [DebugInfo] Some fields do not need relocations even relax is enabled.

Hsiangkai Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 29 17:37:03 PDT 2019


HsiangKai updated this revision to Diff 202082.
HsiangKai edited the summary of this revision.
HsiangKai added a comment.

Fix the bug according to @jrtc27's suggestions.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61584/new/

https://reviews.llvm.org/D61584

Files:
  lib/MC/MCExpr.cpp
  test/DebugInfo/RISCV/relax-debug-frame.ll


Index: test/DebugInfo/RISCV/relax-debug-frame.ll
===================================================================
--- test/DebugInfo/RISCV/relax-debug-frame.ll
+++ test/DebugInfo/RISCV/relax-debug-frame.ll
@@ -2,10 +2,12 @@
 ; RUN:     | llvm-readobj -r | FileCheck -check-prefix=RELAX %s
 ;
 ; RELAX: .rela.{{eh|debug}}_frame {
-; RELAX: R_RISCV_ADD32
-; RELAX: R_RISCV_SUB32
-; RELAX: R_RISCV_SET6
-; RELAX: R_RISCV_SUB6
+; RELAX-NOT: 0x0 R_RISCV_ADD32
+; RELAX-NOT: 0x0 R_RISCV_SUB32
+; RELAX: 0x20 R_RISCV_ADD32
+; RELAX: 0x20 R_RISCV_SUB32
+; RELAX: 0x25 R_RISCV_SET6
+; RELAX: 0x25 R_RISCV_SUB6
 source_filename = "frame.c"
 
 ; Function Attrs: noinline nounwind optnone
Index: lib/MC/MCExpr.cpp
===================================================================
--- lib/MC/MCExpr.cpp
+++ lib/MC/MCExpr.cpp
@@ -607,7 +607,9 @@
   // the InSet flag is set to get the current difference anyway (used for
   // example to calculate symbol sizes).
   if (Asm &&
-      (InSet || !Asm->getBackend().requiresDiffExpressionRelocations())) {
+      (InSet || (LHS_A && !LHS_A->getSymbol().getSection().hasInstructions()) ||
+       (LHS_B && !LHS_B->getSymbol().getSection().hasInstructions()) ||
+       !Asm->getBackend().requiresDiffExpressionRelocations())) {
     // First, fold out any differences which are fully resolved. By
     // reassociating terms in
     //   Result = (LHS_A - LHS_B + LHS_Cst) + (RHS_A - RHS_B + RHS_Cst).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61584.202082.patch
Type: text/x-patch
Size: 1440 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190530/2358d916/attachment.bin>


More information about the llvm-commits mailing list