[llvm] [BOLT][RISCV] Handle CIE's produced by GNU as (PR #69578)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 19 11:41:01 PDT 2023


================
@@ -2462,6 +2462,13 @@ struct CFISnapshot {
     case MCCFIInstruction::OpDefCfaRegister:
       CFAReg = Instr.getRegister();
       CFARule = UNKNOWN;
+
+      // This shouldn't happen according to the spec but GNU binutils on RISC-V
+      // emits a DW_CFA_def_cfa_register in CIE's which leaves the offset
+      // unspecified. Both readelf and llvm-dwarfdump interpret the offset as 0
+      // in this case so let's do the same.
----------------
maksfb wrote:

Did you check how runtimes (such as libgcc and libunwind) treat uninitialized CFA offset? If both set it to zero (I assume they are), we can definitely follow suit.

https://github.com/llvm/llvm-project/pull/69578


More information about the llvm-commits mailing list