int ret;
if (!state1 || !state2)
- ret = 1;
+ return 1;
/* Skip comparing the scratch[] value of registers. The user visible
unwind information is derived from the regs[] from the SCFI state. */
/* For user functions which perform dynamic stack allocation, after switching
t REG_FP based CFA tracking, it is perfectly possible to have stack usage
- in some control flows. However, double-checking that all control flows
- have the same idea of CFA tracking before this wont hurt. */
- gas_assert (state1->regs[REG_CFA].base == state2->regs[REG_CFA].base);
- if (state1->regs[REG_CFA].base == REG_SP)
+ in some control flows. Further, the different control flows may even not
+ have the same idea of CFA tracking (likely later necessitating generation
+ of .cfi_remember_state / .cfi_restore_state pair). */
+ ret |= state1->regs[REG_CFA].base != state2->regs[REG_CFA].base;
+
+ if (!ret && state1->regs[REG_CFA].base == REG_SP)
ret |= state1->stack_size != state2->stack_size;
ret |= state1->traceable_p != state2->traceable_p;
return ret;
}
-/* Recursively perform forward flow of the (unwind information) SCFI state
+/* Recursively perform forward flow of the (unwind information) SCFI STATE
starting at basic block GBB.
- The forward flow process propagates the SCFI state at exit of a basic block
- to the successor basic block.
+ The core of forward flow process takes the SCFI state at the entry of a bb
+ and updates it incrementally as per the semantics of each ginsn in the bb.
Returns error code, if any. */
bb_for_each_edge(gbb, gedge)
{
gbb = gedge->dst_bb;
+ /* Ensure that the state is the one from the exit of the prev bb. */
+ memcpy (state, prev_bb->exit_state, sizeof (scfi_stateS));
if (gbb->visited)
{
ret = cmp_scfi_state (gbb->entry_state, state);
--- /dev/null
+#as: --scfi=experimental -W
+#as:
+#objdump: -Wf
+#name: Synthesize CFI in presence of control flow 5
+#...
+Contents of the .eh_frame section:
+
+00000000 0+0014 0+0000 CIE
+ Version: 1
+ Augmentation: "zR"
+ Code alignment factor: 1
+ Data alignment factor: -8
+ Return address column: 16
+ Augmentation data: 1b
+ DW_CFA_def_cfa: r7 \(rsp\) ofs 8
+ DW_CFA_offset: r16 \(rip\) at cfa-8
+ DW_CFA_nop
+ DW_CFA_nop
+
+0+0018 0+002c 0000001c FDE cie=00000000 pc=0+0000..0+0017
+ DW_CFA_advance_loc: 1 to 0+0001
+ DW_CFA_def_cfa_offset: 16
+ DW_CFA_offset: r6 \(rbp\) at cfa-16
+ DW_CFA_advance_loc: 3 to 0+0004
+ DW_CFA_def_cfa_register: r6 \(rbp\)
+ DW_CFA_advance_loc: 5 to 0+0009
+ DW_CFA_remember_state
+ DW_CFA_advance_loc: 6 to 0+000f
+ DW_CFA_def_cfa_register: r7 \(rsp\)
+ DW_CFA_restore: r6 \(rbp\)
+ DW_CFA_def_cfa_offset: 8
+ DW_CFA_advance_loc: 1 to 0+0010
+ DW_CFA_restore_state
+ DW_CFA_advance_loc: 6 to 0+0016
+ DW_CFA_def_cfa_register: r7 \(rsp\)
+ DW_CFA_restore: r6 \(rbp\)
+ DW_CFA_def_cfa_offset: 8
+
+#pass
run_list_test "scfi-cfg-3" "--scfi=experimental --warn"
run_dump_test "scfi-cfg-4"
run_list_test "scfi-cfg-4" "--scfi=experimental --warn"
+ run_dump_test "scfi-cfg-5"
+ run_list_test "scfi-cfg-5" "--scfi=experimental --warn"
run_dump_test "scfi-asm-marker-1"
run_list_test "scfi-asm-marker-1" "--scfi=experimental --warn"
run_dump_test "scfi-asm-marker-2"