diff options
author | Indu Bhagat <indu.bhagat@oracle.com> | 2023-06-29 16:28:56 -0700 |
---|---|---|
committer | Indu Bhagat <indu.bhagat@oracle.com> | 2023-06-29 16:28:56 -0700 |
commit | 9f71b60bd45a93e25ea8dd3d8dc47f9ebd7d00d1 (patch) | |
tree | 6da12653beecf02ac177d829765dc0563ad86af3 /libsframe | |
parent | 3169b734cf07ec8800436b2c5298897aa993d2be (diff) | |
download | binutils-9f71b60bd45a93e25ea8dd3d8dc47f9ebd7d00d1.zip binutils-9f71b60bd45a93e25ea8dd3d8dc47f9ebd7d00d1.tar.gz binutils-9f71b60bd45a93e25ea8dd3d8dc47f9ebd7d00d1.tar.bz2 |
libsframe: add new APIs to get SFrame version
While the SFrame preamble is guaranteed to not change between versions,
providing these access APIs from the SFrame decoder and encoder APIs is
for convenience only. The linker may want to use these APIs as the
format evolves.
include/
* sframe-api.h (sframe_decoder_get_version): New declaration.
(sframe_encoder_get_version): Likewise.
libsframe/
* libsframe/libsframe.ver: Add new APIs.
* libsframe/sframe.c (sframe_decoder_get_version): New
definition.
(sframe_encoder_get_version): Likewise.
Diffstat (limited to 'libsframe')
-rw-r--r-- | libsframe/libsframe.ver | 2 | ||||
-rw-r--r-- | libsframe/sframe.c | 20 |
2 files changed, 22 insertions, 0 deletions
diff --git a/libsframe/libsframe.ver b/libsframe/libsframe.ver index 2c2081f..3e2a569 100644 --- a/libsframe/libsframe.ver +++ b/libsframe/libsframe.ver @@ -13,6 +13,7 @@ LIBSFRAME_1.0 { sframe_decode; sframe_decoder_get_hdr_size; sframe_decoder_get_abi_arch; + sframe_decoder_get_version; sframe_decoder_get_fixed_fp_offset; sframe_decoder_get_fixed_ra_offset; sframe_get_funcdesc_with_addr; @@ -24,6 +25,7 @@ LIBSFRAME_1.0 { sframe_encoder_free; sframe_encoder_get_hdr_size; sframe_encoder_get_abi_arch; + sframe_encoder_get_version; sframe_encoder_get_num_fidx; sframe_encoder_add_fre; sframe_encoder_add_funcdesc; diff --git a/libsframe/sframe.c b/libsframe/sframe.c index fd966cf..cb73a0c 100644 --- a/libsframe/sframe.c +++ b/libsframe/sframe.c @@ -988,6 +988,16 @@ sframe_decoder_get_abi_arch (sframe_decoder_ctx *dctx) return sframe_header->sfh_abi_arch; } +/* Get the format version from the SFrame decoder context DCTX. */ + +uint8_t +sframe_decoder_get_version (sframe_decoder_ctx *dctx) +{ + sframe_header *dhp; + dhp = sframe_decoder_get_header (dctx); + return dhp->sfh_preamble.sfp_version; +} + /* Get the SFrame's fixed FP offset given the decoder context CTX. */ int8_t sframe_decoder_get_fixed_fp_offset (sframe_decoder_ctx *ctx) @@ -1368,6 +1378,16 @@ sframe_encoder_get_abi_arch (sframe_encoder_ctx *encoder) return abi_arch; } +/* Get the format version from the SFrame encoder context ENCODER. */ + +uint8_t +sframe_encoder_get_version (sframe_encoder_ctx *encoder) +{ + sframe_header *ehp; + ehp = sframe_encoder_get_header (encoder); + return ehp->sfh_preamble.sfp_version; +} + /* Return the number of function descriptor entries in the SFrame encoder ENCODER. */ |