[PATCH] D150004: [RISCV] .debug_line: emit relocations for assembly input files

Sergei Barannikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 9 23:50:21 PDT 2023


barannikov88 added inline comments.


================
Comment at: llvm/lib/MC/MCObjectStreamer.cpp:545
-  int64_t Res;
-  if (AddrDelta->evaluateAsAbsolute(Res, getAssemblerPtr())) {
-    MCDwarfLineAddr::Emit(this, Assembler->getDWARFLinetableParams(), LineDelta,
----------------
MaskRay wrote:
> reames wrote:
> > The code structure here makes it seem like evaluateAsAbsolute should be returning false in this case.  Removing the fastpath here certainly hides this bug, but do we have others lurking due to incorrect return results from evaluateAsAbsolute?
> > 
> > Not my area, so totally possible I'm off base here.  
> See my main comment.
I share @reames' concern.
There is emitDwarfAdvanceFrameAddr below that has the same issue.
MCPseudoProbe::emit does exactly the same, too.
The solution as-is looks incomplete.

Removing this code fragment does not look totally wrong, but it should be done
consistently in all places and compile time should not be neglected.
Ideally, evaluateAsAbsolute should return false when the expression cannot be
evaluated as absolute.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150004



More information about the llvm-commits mailing list