[PATCH] D142879: [RISCV] Emit relocation for uleb128

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 13 20:26:10 PDT 2023


MaskRay added inline comments.


================
Comment at: llvm/lib/Target/RISCV/MCTargetDesc/RISCVELFStreamer.cpp:210
+  const MCExpr *A, *B;
+  if (!EnableULEB128Reloc || !requiresFixups(getContext(), Value, A, B))
+    return MCELFStreamer::emitULEB128Value(Value);
----------------
evaluateAsAbsolute has now been correct (D153097). I am now mainly concerned with our inaccurate `requiresFixups` and whether there will be users rely on a possibly buggy behavior...


================
Comment at: llvm/test/MC/RISCV/fixups-expr-uleb128.s:60
+# EMIT-RELOC-32: 0x0 R_RISCV_SET_ULEB128 G3 0x0
+# EMIT-RELOC-32: 0x0 R_RISCV_SUB_ULEB128 G1 0x0
+# EMIT-RELOC-32: 0x5 R_RISCV_SET_ULEB128 .L2 0x0
----------------
Add -NEXT whenever applicable. Check the preceding line `.rela.xxx {` and the the pairing `}` to assert that there is no other relocations.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142879



More information about the llvm-commits mailing list