[PATCH] D107515: [DWARF] Expose raw bytes in DWARFExpression

Rafael Auler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 5 13:04:58 PDT 2021


rafauler added a comment.

@aprantl interesting point, thanks for the heads up on this corner case. I read about it in the DWARF manual and here are my 2c. BOLT is currently forced to deal with DWARF expressions because they appear in the CFI (unwind metadata). They rarely appear, but they do appear. For unwinding purposes, I've checked the DWARF manual and it says that these operations are forbidden in an expression (probably because we don't want unwind info depending on debug info). [1]

So BOLT does rewrite all unwind info related to CFIs because their encoding is very dependent on the code layout (something BOLT is completely changing). But BOLT does not rewrite stuff that doesn't depend on layout because that's usually very expensive at post-link phase. So most of debug_info is just copied, and we definitely preserve original DIE offsets (but, for this case, I wouldn't worry about it, since this operation is not permitted to exist in CFIs anyway).

Regarding the unit test, I think it makes sense, let me write one.

[1] DWARF 5 manual sec 6.4.2 Call Frame Instructions:

  Some call frame instructions have operands that are encoded as DWARF
  expressions (see Section 2.5.1 on page 26). The following DWARF operators
  cannot be used in such operands:
  DW_OP_addrx, DW_OP_call2, DW_OP_call4, DW_OP_call_ref, DW_OP_const_type, DW_OP_constx, DW_OP_convert, DW_OP_deref_type, DW_OP_regval_type and DW_OP_reinterpret operators are not allowed in an operand of these instructions because the call frame information must not depend on other debug sections.
  DW_OP_push_object_address is not meaningful in an operand of these instructions because there is no object context to provide a value to push.
  DW_OP_call_frame_cfa is not meaningful in an operand of these instructions because its use would be circular.
  Call frame instructions to which these restrictions apply include DW_CFA_def_cfa_expression, DW_CFA_expression and DW_CFA_val_expression.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107515



More information about the llvm-commits mailing list