aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport/gdb_obstack.h
diff options
context:
space:
mode:
authorIndu Bhagat <indu.bhagat@oracle.com>2024-04-10 13:45:59 -0700
committerIndu Bhagat <indu.bhagat@oracle.com>2024-04-10 13:45:59 -0700
commita1c6a60cc55a17b5f3c8e26f1bc68b4ee2470e54 (patch)
treeecc61da961764d4f3935063493ac7e27a60027ae /gdbsupport/gdb_obstack.h
parent96c1bcb38bcb1fd1e861d1536ab4deecaaf2b7de (diff)
downloadbinutils-a1c6a60cc55a17b5f3c8e26f1bc68b4ee2470e54.zip
binutils-a1c6a60cc55a17b5f3c8e26f1bc68b4ee2470e54.tar.gz
binutils-a1c6a60cc55a17b5f3c8e26f1bc68b4ee2470e54.tar.bz2
gas: gcfg: add_bb_at_ginsn must return root_bb
A GCFG (ginsn control flow graph) is created for SCFI purposes in GAS. The existing GCFG creation process was ignoring some paths. add_bb_at_ginsn () is a recursive function which should return the root of the added basic blocks. This property was being violated in some traversals, e.g., where a taken path involving a sequence of a few basic blocks eventually culminated in a GINSN_TYPE_RETURN instruction. This patch fixes the issue by keeping an explicit variable root_bb to memorize the bb to be returned. Next, find_or_make_bb () must either create or find the bb with the first ginsn as the provided ginsn. Add a few assertions to ensure health of the cfg creation process. Note that the testcase, in its current shape, is not fit for catching regressions for the issue at hand. Although the testcase does exercise the updated code path, the testcase passes even without the current fix, because the added edge in this specific testcase does not alter the synthesized CFI. (The missing edge is the fallthrough edge of the conditional branch "jne .L13" in the testcase.) Using a manual gcfg_print (), one can see the missing edge without the fix. Lets keep the testcase for now, until there is a better way to test the GCFG for this issue (e.g., either by dumping the GCFG in textual format, or a case when the missing edge does cause wrong synthesized CFI). gas/ * ginsn.c (bb_add_edge): Fix a code comment. (find_bb): Likewise. (find_or_make_bb): Add new assertions to ensure health of cfg creation process. (add_bb_at_ginsn): Keep reference to the root_bb and return it. gas/testsuite/ * gas/scfi/x86_64/scfi-x86-64.exp: Add new test. * gas/scfi/x86_64/scfi-cfg-4.d: New test. * gas/scfi/x86_64/scfi-cfg-4.l: New test. * gas/scfi/x86_64/scfi-cfg-4.s: New test.
Diffstat (limited to 'gdbsupport/gdb_obstack.h')
0 files changed, 0 insertions, 0 deletions