)]}'
{
  "commit": "b52c4ee46657eb5a70095d48cbc2938d024cc3b6",
  "tree": "10fb1afba608156a25ebe9732cfe5e3fe1d85833",
  "parents": [
    "b07a29781610756a9b75a931c7c13735b7555d9f"
  ],
  "author": {
    "name": "Indu Bhagat",
    "email": "indu.bhagat@oracle.com",
    "time": "Tue Nov 15 15:06:46 2022 -0800"
  },
  "committer": {
    "name": "Indu Bhagat",
    "email": "indu.bhagat@oracle.com",
    "time": "Tue Nov 15 15:24:06 2022 -0800"
  },
  "message": "gas: generate .sframe from CFI directives\n\nCurrently supported for x86_64 and aarch64 only.\n\n[PS: Currently, the compiler has not been adapted to generate\n\".cfi_sections\" with \".sframe\" in it.  The newly added command line\noption of --gsframe provides an easy way to try out .sframe support\nin the toolchain.]\n\ngas interprets the CFI directives to generate DWARF-based .eh_frame\ninfo.  These internal DWARF structures are now consumed by\ngen-sframe.[ch] sub-system to, in turn, create the SFrame unwind\ninformation.  These internal DWARF structures are read-only for the\npurpose of SFrame unwind info generation.\n\nSFrame unwind info generation does not impact .eh_frame unwind info\ngeneration.  Both .eh_frame and .sframe can co-exist in an ELF file,\nif so desired by the user.\n\nRecall that SFrame unwind information only contains the minimal\nnecessary information to generate backtraces and does not provide\ninformation to recover all callee-saved registers.  The reason being\nthat callee-saved registers other than FP are not needed for stack\nunwinding, and hence are not included in the .sframe section.\n\nConsequently, gen-sframe.[ch] only needs to interpret a subset of\nDWARF opcodes in gas.  More details follow.\n\n[Set 1, Interpreted] The following opcodes are interpreted:\n- DW_CFA_advance_loc\n- DW_CFA_def_cfa\n- DW_CFA_def_cfa_register\n- DW_CFA_def_cfa_offset\n- DW_CFA_offset\n- DW_CFA_remember_state\n- DW_CFA_restore_state\n- DW_CFA_restore\n\n[Set 2, Bypassed] The following opcodes are acknowledged but are not\nnecessary for generating SFrame unwind info:\n- DW_CFA_undefined\n- DW_CFA_same_value\n\nAnything else apart from the two above-mentioned sets is skipped\naltogether.  This means that any function containing a CFI directive not\nin Set 1 or Set 2 above, will not have any SFrame unwind information\ngenerated for them.  Holes in instructions covered by FREs of a single\nFDE are not representable in the SFrame unwind format.\n\nAs few examples, following opcodes are not processed for .sframe\ngeneration, and are skipped:\n- .cfi_personality*\n- .cfi_*lsda\n- .cfi_escape\n- .cfi_negate_ra_state\n- ...\n\nNot processing .cfi_escape, .cfi_negate_ra_state will cause SFrame\nunwind information to be absent for SFrame FDEs that contain these CFI\ndirectives, hence affecting the asynchronicity.\n\nx86-64 and aarch64 backends need to have a few new definitions and\nfunctions for .sframe generation.  These provide gas with architecture\nspecific information like the SP/FP/RA register numbers and an\nSFrame-specific ABI marker.\n\nLastly, the patch also implements an optimization for size, where\nspecific fragments containing SFrame FRE start address and SFrame FDE\nfunction are fixed up.  This is similar to other similar optimizations\nin gas, where fragments are sized and fixed up when the associated\nsymbols can be resolved.  This optimization is controlled by a #define\nSFRAME_FRE_TYPE_SELECTION_OPT and should be easy to turn off if needed.\nThe optimization is on by default for both x86_64 and aarch64.\n\nChangeLog:\n\n\t* gas/Makefile.am: Include gen-sframe.c and sframe-opt.c.\n\t* gas/Makefile.in: Regenerated.\n\t* gas/as.h (enum _relax_state): Add new state rs_sframe.\n\t(sframe_estimate_size_before_relax): New function.\n\t(sframe_relax_frag): Likewise.\n\t(sframe_convert_frag): Likewise.\n\t* gas/config/tc-aarch64.c (aarch64_support_sframe_p): New\n\tdefinition.\n\t(aarch64_sframe_ra_tracking_p): Likewise.\n\t(aarch64_sframe_cfa_ra_offset): Likewise.\n\t(aarch64_sframe_get_abi_arch): Likewise.\n\t(md_begin): Set values of sp/fp/ra registers.\n\t* gas/config/tc-aarch64.h (aarch64_support_sframe_p): New\n\tdeclaration.\n\t(support_sframe_p): Likewise.\n\t(SFRAME_CFA_SP_REG): Likewise.\n\t(SFRAME_CFA_FP_REG): Likewise.\n\t(SFRAME_CFA_RA_REG): Likewise.\n\t(aarch64_sframe_ra_tracking_p): Likewise.\n\t(sframe_ra_tracking_p): Likewise.\n\t(aarch64_sframe_cfa_ra_offset): Likewise.\n\t(sframe_cfa_ra_offset): Likewise.\n\t(aarch64_sframe_get_abi_arch): Likewise.\n\t(sframe_get_abi_arch): Likewise.\n\t* gas/config/tc-i386.c (x86_support_sframe_p): New definition.\n\t(x86_sframe_ra_tracking_p): Likewise.\n\t(x86_sframe_cfa_ra_offset): Likewise.\n\t(x86_sframe_get_abi_arch): Likewise.\n\t* gas/config/tc-i386.h (x86_support_sframe_p): New declaration.\n\t(support_sframe_p): Likewise.\n\t(SFRAME_CFA_SP_REG): Likewise.\n\t(SFRAME_CFA_FP_REG): Likewise.\n\t(x86_sframe_ra_tracking_p): Likewise.\n\t(sframe_ra_tracking_p): Likewise.\n\t(x86_sframe_cfa_ra_offset): Likewise.\n\t(sframe_cfa_ra_offset): Likewise.\n\t(x86_sframe_get_abi_arch): Likewise.\n\t(sframe_get_abi_arch): Likewise.\n\t* gas/config/tc-xtensa.c (unrelaxed_frag_max_size): Add case for\n\trs_sframe.\n\t* gas/doc/as.texi: Add .sframe to the documentation for\n\t.cfi_sections.\n\t* gas/dw2gencfi.c (cfi_finish): Create a .sframe section.\n\t* gas/dw2gencfi.h (CFI_EMIT_sframe): New definition.\n\t* gas/write.c (cvt_frag_to_fill): Handle rs_sframe.\n\t(relax_segment): Likewise.\n\t* gas/gen-sframe.c: New file.\n\t* gas/gen-sframe.h: New file.\n\t* gas/sframe-opt.c: New file.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "5f0f24abf8de0757e8591eae317e2c29c7243336",
      "old_mode": 33188,
      "old_path": "gas/Makefile.am",
      "new_id": "4661a7182148c20a18eedeab2c622ff0cdd4818b",
      "new_mode": 33188,
      "new_path": "gas/Makefile.am"
    },
    {
      "type": "modify",
      "old_id": "5a4dd7022528c9a0cbae23867b14d3db3c451729",
      "old_mode": 33188,
      "old_path": "gas/Makefile.in",
      "new_id": "1e01f343f32b89095b58450d768afb311063d330",
      "new_mode": 33188,
      "new_path": "gas/Makefile.in"
    },
    {
      "type": "modify",
      "old_id": "1b924071938859db4ac18e299997853ca8651cd2",
      "old_mode": 33188,
      "old_path": "gas/as.h",
      "new_id": "23542e452b6533db6698a195ed48e48b2e281e96",
      "new_mode": 33188,
      "new_path": "gas/as.h"
    },
    {
      "type": "modify",
      "old_id": "165d9278ce78fae3cc7357c0ad88378a9f494470",
      "old_mode": 33188,
      "old_path": "gas/config/tc-aarch64.c",
      "new_id": "c679d930e881e34df8e33e44f0306e54a008c5a7",
      "new_mode": 33188,
      "new_path": "gas/config/tc-aarch64.c"
    },
    {
      "type": "modify",
      "old_id": "2d514ff610a8a63a7dcaabfc9eea35296e40da45",
      "old_mode": 33188,
      "old_path": "gas/config/tc-aarch64.h",
      "new_id": "91412ce82923af2989cc3c7075eb41cb3ebf8657",
      "new_mode": 33188,
      "new_path": "gas/config/tc-aarch64.h"
    },
    {
      "type": "modify",
      "old_id": "a5ea9b16c9e984c223bd6daf1e681a8e6deab2c7",
      "old_mode": 33188,
      "old_path": "gas/config/tc-i386.c",
      "new_id": "5bc3a56e4b2f8352f0014a554069e17675fafc9a",
      "new_mode": 33188,
      "new_path": "gas/config/tc-i386.c"
    },
    {
      "type": "modify",
      "old_id": "a6e096ee110575885e543de9c41ccecdfb6d0e70",
      "old_mode": 33188,
      "old_path": "gas/config/tc-i386.h",
      "new_id": "90037269eea5773aeef1297ebc461b2abfddddcb",
      "new_mode": 33188,
      "new_path": "gas/config/tc-i386.h"
    },
    {
      "type": "modify",
      "old_id": "b7403ac45d47f34b30b5d385dabab42dea222e43",
      "old_mode": 33188,
      "old_path": "gas/config/tc-xtensa.c",
      "new_id": "f7a28d32d0cafc494ac4e78d5a6c48a4afac61b3",
      "new_mode": 33188,
      "new_path": "gas/config/tc-xtensa.c"
    },
    {
      "type": "modify",
      "old_id": "83f49c518d7c50c2a488c4d27ef96673a41ac249",
      "old_mode": 33188,
      "old_path": "gas/doc/as.texi",
      "new_id": "32300d73dcb2f8c18b7f95f5c36d57ae49e0cd46",
      "new_mode": 33188,
      "new_path": "gas/doc/as.texi"
    },
    {
      "type": "modify",
      "old_id": "80b2628928967a7624ae22038aeefe9ec689a643",
      "old_mode": 33188,
      "old_path": "gas/dw2gencfi.c",
      "new_id": "d18cd267f54cf4711b2072b4c30a6ab0ecca2cba",
      "new_mode": 33188,
      "new_path": "gas/dw2gencfi.c"
    },
    {
      "type": "modify",
      "old_id": "0f5ae77d8004e369baff5de1577c8856ec1814cb",
      "old_mode": 33188,
      "old_path": "gas/dw2gencfi.h",
      "new_id": "4ac70d0d1e511e173dae4c781966c9d54673cc82",
      "new_mode": 33188,
      "new_path": "gas/dw2gencfi.h"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "13f5bda7f9ebbfac8dfdf18c97b0e07164f86844",
      "new_mode": 33188,
      "new_path": "gas/gen-sframe.c"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "93af499278c1ac380fb50af1708e3b5f6d7a439c",
      "new_mode": 33188,
      "new_path": "gas/gen-sframe.h"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "c17fd6b83324db787af2ae0a0fe2ce5e1c7d0fd8",
      "new_mode": 33188,
      "new_path": "gas/sframe-opt.c"
    },
    {
      "type": "modify",
      "old_id": "3014f687949aa6fec3b6ea23431fb207a6245514",
      "old_mode": 33188,
      "old_path": "gas/write.c",
      "new_id": "fa748eb7c795faa07481203cda179bd4c946c92f",
      "new_mode": 33188,
      "new_path": "gas/write.c"
    }
  ]
}
