public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Indu Bhagat <indu.bhagat@oracle.com>
To: binutils@sourceware.org
Cc: Indu Bhagat <indu.bhagat@oracle.com>
Subject: [COMMITTED] libsframe: use uint32_t for fre_type and fde_type function args
Date: Tue, 27 Jun 2023 12:51:20 -0700	[thread overview]
Message-ID: <20230627195126.1955051-6-indu.bhagat@oracle.com> (raw)
In-Reply-To: <20230627195126.1955051-1-indu.bhagat@oracle.com>

The API sframe_fde_create_func_info is provided by libsframe.  Current
users are the bfd linker.  Adjust the argument type for the variables
carrying the SFrame FRE type and SFrame FDE type to consistenly use
uint32_t type alias.

include/
	* sframe-api.h (sframe_fde_create_func_info): Use uint32_t
	instead of unsigned int.
libsframe/
	* sframe.c (sframe_get_fre_type): Likewise.
	(sframe_get_fde_type): Likewise.
	(flip_fre_start_address): Likewise.
	(sframe_fre_start_addr_size): Likewise.
	(sframe_fre_entry_size): Likewise.
	(flip_fre): Likewise.
	(flip_sframe): Likewise.
	(sframe_fde_create_func_info): Likewise.
	(sframe_calc_fre_type): Likewise.
	(sframe_decode_fre_start_address): Likewise.
	(sframe_decode_fre): Likewise.
	(sframe_find_fre): Likewise.
	(sframe_decoder_get_fre): Likewise.
	(sframe_encoder_add_fre): Likewise.
	(sframe_encoder_write_fre_start_addr): Likewise.
	(sframe_encoder_write_fre): Likewise.
	(sframe_encoder_write_sframe): Likewise.
---
 include/sframe-api.h |  2 +-
 libsframe/sframe.c   | 42 +++++++++++++++++++++---------------------
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/include/sframe-api.h b/include/sframe-api.h
index a00303a3598..d04ebe85d11 100644
--- a/include/sframe-api.h
+++ b/include/sframe-api.h
@@ -94,7 +94,7 @@ sframe_errmsg (int error);
 /* Create an FDE function info bye given an FRE_TYPE and an FDE_TYPE.  */
 
 extern unsigned char
-sframe_fde_create_func_info (unsigned int fre_type, unsigned int fde_type);
+sframe_fde_create_func_info (uint32_t fre_type, uint32_t fde_type);
 
 /* Gather the FRE type given the function size.  */
 
diff --git a/libsframe/sframe.c b/libsframe/sframe.c
index 912d34352a1..7391df0d3b5 100644
--- a/libsframe/sframe.c
+++ b/libsframe/sframe.c
@@ -132,19 +132,19 @@ sframe_get_fre_ra_mangled_p (uint8_t fre_info)
 
 /* Access functions for info from function descriptor entry.  */
 
-static unsigned int
+static uint32_t
 sframe_get_fre_type (sframe_func_desc_entry *fdep)
 {
-  unsigned int fre_type = 0;
+  uint32_t fre_type = 0;
   if (fdep)
     fre_type = SFRAME_V1_FUNC_FRE_TYPE (fdep->sfde_func_info);
   return fre_type;
 }
 
-static unsigned int
+static uint32_t
 sframe_get_fde_type (sframe_func_desc_entry *fdep)
 {
-  unsigned int fde_type = 0;
+  uint32_t fde_type = 0;
   if (fdep)
     fde_type = SFRAME_V1_FUNC_FDE_TYPE (fdep->sfde_func_info);
   return fde_type;
@@ -221,7 +221,7 @@ sframe_header_sanity_check_p (sframe_header *hp)
 /* Flip the start address pointed to by FP.  */
 
 static void
-flip_fre_start_address (char *addr, unsigned int fre_type)
+flip_fre_start_address (char *addr, uint32_t fre_type)
 {
   if (fre_type == SFRAME_FRE_TYPE_ADDR2)
     {
@@ -257,7 +257,7 @@ flip_fre_stack_offsets (char *offsets, uint8_t offset_size, uint8_t offset_cnt)
 /* Get the FRE start address size, given the FRE_TYPE.  */
 
 static size_t
-sframe_fre_start_addr_size (unsigned int fre_type)
+sframe_fre_start_addr_size (uint32_t fre_type)
 {
   size_t addr_size = 0;
   switch (fre_type)
@@ -329,7 +329,7 @@ sframe_fre_offset_bytes_size (uint8_t fre_info)
    includes the starting address, FRE info, and all the offsets.  */
 
 static size_t
-sframe_fre_entry_size (sframe_frame_row_entry *frep, unsigned int fre_type)
+sframe_fre_entry_size (sframe_frame_row_entry *frep, uint32_t fre_type)
 {
   if (frep == NULL)
     return 0;
@@ -363,7 +363,7 @@ sframe_decoder_get_funcdesc_at_index (sframe_decoder_ctx *ctx,
 }
 
 static int
-flip_fre (char *fp, unsigned int fre_type, size_t *fre_size)
+flip_fre (char *fp, uint32_t fre_type, size_t *fre_size)
 {
   uint8_t fre_info;
   uint8_t offset_size, offset_cnt;
@@ -416,7 +416,7 @@ flip_sframe (char *frame_buf, size_t buf_size, uint32_t to_foreign)
   sframe_func_desc_entry *fdep;
   unsigned int num_fdes = 0;
   unsigned int num_fres = 0;
-  unsigned int fre_type = 0;
+  uint32_t fre_type = 0;
   uint32_t fre_offset = 0;
   size_t esz = 0;
   size_t hdrsz = 0;
@@ -585,8 +585,8 @@ sframe_decoder_free (sframe_decoder_ctx **dctxp)
 /* FIXME API for linker.  Revisit if its better placed somewhere else?  */
 
 unsigned char
-sframe_fde_create_func_info (unsigned int fre_type,
-			     unsigned int fde_type)
+sframe_fde_create_func_info (uint32_t fre_type,
+			     uint32_t fde_type)
 {
   unsigned char func_info;
   sframe_assert (fre_type == SFRAME_FRE_TYPE_ADDR1
@@ -604,7 +604,7 @@ sframe_fde_create_func_info (unsigned int fre_type,
 unsigned int
 sframe_calc_fre_type (size_t func_size)
 {
-  unsigned int fre_type = 0;
+  uint32_t fre_type = 0;
   if (func_size < SFRAME_FRE_TYPE_ADDR1_LIMIT)
     fre_type = SFRAME_FRE_TYPE_ADDR1;
   else if (func_size < SFRAME_FRE_TYPE_ADDR2_LIMIT)
@@ -717,7 +717,7 @@ sframe_frame_row_entry_copy (sframe_frame_row_entry *dst,
 static int
 sframe_decode_fre_start_address (const char *fre_buf,
 				 uint32_t *fre_start_addr,
-				 unsigned int fre_type)
+				 uint32_t fre_type)
 {
   uint32_t saddr = 0;
   int err = 0;
@@ -762,7 +762,7 @@ sframe_decode_fre_start_address (const char *fre_buf,
 
 static int
 sframe_decode_fre (const char *fre_buf, sframe_frame_row_entry *fre,
-		   unsigned int fre_type, size_t *esz)
+		   uint32_t fre_type, size_t *esz)
 {
   int err = 0;
   const char *stack_offsets = NULL;
@@ -1056,7 +1056,7 @@ sframe_find_fre (sframe_decoder_ctx *ctx, int32_t pc,
 {
   sframe_frame_row_entry cur_fre;
   sframe_func_desc_entry *fdep;
-  unsigned int fre_type, fde_type;
+  uint32_t fre_type, fde_type;
   uint32_t end_ip_offset, i;
   int32_t start_ip, end_ip;
   int32_t func_start_addr;
@@ -1178,7 +1178,7 @@ sframe_decoder_get_fre (sframe_decoder_ctx *ctx,
   sframe_frame_row_entry ifre;
   const char *fres;
   uint32_t i;
-  unsigned int fre_type;
+  uint32_t fre_type;
   size_t esz = 0;
   int err = 0;
 
@@ -1359,7 +1359,7 @@ sframe_encoder_add_fre (sframe_encoder_ctx *encoder,
   sframe_func_desc_entry *fdep;
   sframe_frame_row_entry *ectx_frep;
   size_t offsets_sz, esz;
-  unsigned int fre_type;
+  uint32_t fre_type;
   size_t fre_tbl_sz;
   int err = 0;
 
@@ -1505,7 +1505,7 @@ sframe_encoder_add_funcdesc (sframe_encoder_ctx *encoder,
     = encoder->sfe_fre_nbytes;
 #if 0
   // Linker optimization test code cleanup later ibhagat TODO FIXME
-  unsigned int fre_type = sframe_calc_fre_type (func_size);
+  uint32_t fre_type = sframe_calc_fre_type (func_size);
 
   fd_info->entry[fd_info->count].sfde_func_info
     = sframe_fde_func_info (fre_type);
@@ -1549,7 +1549,7 @@ sframe_sort_funcdesc (sframe_encoder_ctx *encoder)
 static int
 sframe_encoder_write_fre_start_addr (char *contents,
 				     uint32_t fre_start_addr,
-				     unsigned int fre_type,
+				     uint32_t fre_type,
 				     size_t fre_start_addr_sz)
 {
   int err = 0;
@@ -1584,7 +1584,7 @@ sframe_encoder_write_fre_start_addr (char *contents,
 
 static int
 sframe_encoder_write_fre (char *contents, sframe_frame_row_entry *frep,
-			  unsigned int fre_type, size_t *esz)
+			  uint32_t fre_type, size_t *esz)
 {
   size_t fre_sz;
   size_t fre_start_addr_sz;
@@ -1644,7 +1644,7 @@ sframe_encoder_write_sframe (sframe_encoder_ctx *encoder)
   sframe_func_desc_entry *fdep;
   sframe_frame_row_entry *frep;
 
-  unsigned int fre_type;
+  uint32_t fre_type;
   int err = 0;
 
   contents = encoder->sfe_data;
-- 
2.39.2


  parent reply	other threads:[~2023-06-27 19:52 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-27 19:51 [COMMITTED] libsframe: add library versioning Indu Bhagat
2023-06-27 19:51 ` [COMMITTED] libsframe: remove sframe_get_funcdesc_with_addr API Indu Bhagat
2023-06-27 19:51 ` [COMMITTED] libsframe: add symbol versioning Indu Bhagat
2023-06-27 19:51 ` [COMMITTED] libsframe: update the semantics of sframe_fre_get_ra_offset Indu Bhagat
2023-06-27 19:51 ` [COMMITTED] libsframe: update the semantics of sframe_fre_get_fp_offset Indu Bhagat
2023-06-27 19:51 ` Indu Bhagat [this message]
2023-06-27 19:51 ` [COMMITTED] libsframe: bfd: use uint32_t for return type of sframe_calc_fre_type Indu Bhagat
2023-06-27 19:51 ` [COMMITTED] libsframe: use uint8_t instead of unsigned char for abi_arch Indu Bhagat
2023-06-27 19:51 ` [COMMITTED] libsframe: use uint8_t for return type of sframe_fre_get_base_reg_id Indu Bhagat
2023-06-27 19:51 ` [COMMITTED] libsframe: use appropriate data types for args of sframe_encode Indu Bhagat
2023-06-27 19:51 ` [COMMITTED] libsframe: bfd: use uint32_t for return type of get_num_fidx APIs Indu Bhagat
2023-06-27 19:51 ` [COMMITTED] binutils/NEWS: add note about upcoming libsframe changes Indu Bhagat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230627195126.1955051-6-indu.bhagat@oracle.com \
    --to=indu.bhagat@oracle.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).