* [COMMITTED 1/6] gas: sframe: use ATTRIBUTE_UNUSED consistently
2023-04-19 22:11 [COMMITTED 0/6] Minor sframe related patches Indu Bhagat
@ 2023-04-19 22:11 ` Indu Bhagat
2023-04-19 22:11 ` [COMMITTED 2/6] gas: sframe: fix comment Indu Bhagat
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Indu Bhagat @ 2023-04-19 22:11 UTC (permalink / raw)
To: binutils; +Cc: Indu Bhagat
gas/
* gen-sframe.c (sframe_set_version): Use ATTRIBUTE_UNUSED
consistently.
(output_sframe): Likewise.
(sframe_set_fre_info): Remove the usage of ATTRIBUTE_UNUSED.
---
gas/gen-sframe.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
index c5470596d14..9e6a9d16a64 100644
--- a/gas/gen-sframe.c
+++ b/gas/gen-sframe.c
@@ -276,7 +276,7 @@ sframe_v1_set_func_info (unsigned int fde_type, unsigned int fre_type,
/* SFrame version specific operations setup. */
static void
-sframe_set_version (uint32_t sframe_version __attribute__((unused)))
+sframe_set_version (uint32_t sframe_version ATTRIBUTE_UNUSED)
{
sframe_ver_ops.format_version = SFRAME_VERSION_1;
@@ -297,7 +297,7 @@ sframe_set_fre_info (unsigned int base_reg, unsigned int num_offsets,
/* SFrame set func info. */
-ATTRIBUTE_UNUSED static unsigned char
+static unsigned char
sframe_set_func_info (unsigned int fde_type, unsigned int fre_type,
unsigned int pauth_key)
{
@@ -1366,7 +1366,7 @@ output_sframe (segT sframe_seg)
#else /* support_sframe_p */
void
-output_sframe (segT sframe_seg __attribute__((unused)))
+output_sframe (segT sframe_seg ATTRIBUTE_UNUSED)
{
}
--
2.39.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [COMMITTED 2/6] gas: sframe: fix comment
2023-04-19 22:11 [COMMITTED 0/6] Minor sframe related patches Indu Bhagat
2023-04-19 22:11 ` [COMMITTED 1/6] gas: sframe: use ATTRIBUTE_UNUSED consistently Indu Bhagat
@ 2023-04-19 22:11 ` Indu Bhagat
2023-04-19 22:11 ` [COMMITTED 3/6] libsframe: use return type of bool for predicate functions Indu Bhagat
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Indu Bhagat @ 2023-04-19 22:11 UTC (permalink / raw)
To: binutils; +Cc: Indu Bhagat
---
gas/gen-sframe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gas/gen-sframe.c b/gas/gen-sframe.c
index 9e6a9d16a64..b0bf514be75 100644
--- a/gas/gen-sframe.c
+++ b/gas/gen-sframe.c
@@ -661,7 +661,7 @@ output_sframe_internal (void)
out_one (fixed_bp_offset);
/* Offset for the return address from CFA is fixed for some ABIs
- (e.g., AMD64), output a zero otherwise. */
+ (e.g., AMD64), output a SFRAME_CFA_FIXED_RA_INVALID otherwise. */
#ifdef sframe_ra_tracking_p
if (!sframe_ra_tracking_p ())
fixed_ra_offset = sframe_cfa_ra_offset ();
--
2.39.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [COMMITTED 3/6] libsframe: use return type of bool for predicate functions
2023-04-19 22:11 [COMMITTED 0/6] Minor sframe related patches Indu Bhagat
2023-04-19 22:11 ` [COMMITTED 1/6] gas: sframe: use ATTRIBUTE_UNUSED consistently Indu Bhagat
2023-04-19 22:11 ` [COMMITTED 2/6] gas: sframe: fix comment Indu Bhagat
@ 2023-04-19 22:11 ` Indu Bhagat
2023-04-19 22:11 ` [COMMITTED 4/6] sframe: correct some typos Indu Bhagat
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Indu Bhagat @ 2023-04-19 22:11 UTC (permalink / raw)
To: binutils; +Cc: Indu Bhagat
libsframe/
* sframe.c (sframe_header_sanity_check_p): Change return type to
bool.
(sframe_fre_sanity_check_p): Likewise.
---
libsframe/sframe.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/libsframe/sframe.c b/libsframe/sframe.c
index ea3169ba7aa..907214a8a89 100644
--- a/libsframe/sframe.c
+++ b/libsframe/sframe.c
@@ -201,7 +201,7 @@ flip_fde (sframe_func_desc_entry *fdep)
/* Check if SFrame header has valid data. */
-static int
+static bool
sframe_header_sanity_check_p (sframe_header *hp)
{
unsigned char all_flags = SFRAME_F_FDE_SORTED | SFRAME_F_FRAME_POINTER;
@@ -209,13 +209,13 @@ sframe_header_sanity_check_p (sframe_header *hp)
if ((hp->sfh_preamble.sfp_magic != SFRAME_MAGIC)
|| (hp->sfh_preamble.sfp_version != SFRAME_VERSION)
|| ((hp->sfh_preamble.sfp_flags | all_flags) != all_flags))
- return 0;
+ return false;
/* Check offsets are valid. */
if (hp->sfh_fdeoff > hp->sfh_freoff)
- return 0;
+ return false;
- return 1;
+ return true;
}
/* Flip the start address pointed to by FP. */
@@ -284,14 +284,14 @@ sframe_fre_start_addr_size (unsigned int fre_type)
/* Check if the FREP has valid data. */
-static int
+static bool
sframe_fre_sanity_check_p (sframe_frame_row_entry *frep)
{
unsigned int offset_size, offset_cnt;
unsigned int fre_info;
if (frep == NULL)
- return 0;
+ return false;
fre_info = frep->fre_info;
offset_size = sframe_fre_get_offset_size (fre_info);
@@ -299,13 +299,13 @@ sframe_fre_sanity_check_p (sframe_frame_row_entry *frep)
if (offset_size != SFRAME_FRE_OFFSET_1B
&& offset_size != SFRAME_FRE_OFFSET_2B
&& offset_size != SFRAME_FRE_OFFSET_4B)
- return 0;
+ return false;
offset_cnt = sframe_fre_get_offset_count (fre_info);
if (offset_cnt > 3)
- return 0;
+ return false;
- return 1;
+ return true;
}
/* Get FRE_INFO's offset size in bytes. */
--
2.39.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [COMMITTED 4/6] sframe: correct some typos
2023-04-19 22:11 [COMMITTED 0/6] Minor sframe related patches Indu Bhagat
` (2 preceding siblings ...)
2023-04-19 22:11 ` [COMMITTED 3/6] libsframe: use return type of bool for predicate functions Indu Bhagat
@ 2023-04-19 22:11 ` Indu Bhagat
2023-04-19 22:11 ` [COMMITTED 5/6] libsframe: use consistent function argument names Indu Bhagat
2023-04-19 22:11 ` [COMMITTED 6/6] libsframe: minor formatting fixes in sframe_encoder_write_fre Indu Bhagat
5 siblings, 0 replies; 7+ messages in thread
From: Indu Bhagat @ 2023-04-19 22:11 UTC (permalink / raw)
To: binutils; +Cc: Indu Bhagat
include/
* sframe.h: Correct a typo.
libsframe/
* sframe.c: Likewise.
---
include/sframe.h | 4 ++--
libsframe/sframe.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/sframe.h b/include/sframe.h
index 58907d73413..c3dbb3a4097 100644
--- a/include/sframe.h
+++ b/include/sframe.h
@@ -146,9 +146,9 @@ typedef struct sframe_header
not fixed, it is set to SFRAME_CFA_FIXED_RA_INVALID, and individual
FREs provide the applicable stack frame offset, if any. */
int8_t sfh_cfa_fixed_ra_offset;
- /* Number of bytes making up the auxilliary header, if any.
+ /* Number of bytes making up the auxiliary header, if any.
Some ABI/arch, in the future, may use this space for extending the
- information in SFrame header. Auxilliary header is contained in
+ information in SFrame header. Auxiliary header is contained in
bytes sequentially following the sframe_header. */
uint8_t sfh_auxhdr_len;
/* Number of SFrame FDEs in this SFrame section. */
diff --git a/libsframe/sframe.c b/libsframe/sframe.c
index 907214a8a89..b2c8eacae14 100644
--- a/libsframe/sframe.c
+++ b/libsframe/sframe.c
@@ -970,7 +970,7 @@ sframe_get_funcdesc_with_addr (sframe_decoder_ctx *ctx,
if (fdp[mid].sfde_func_start_address < addr)
{
if (mid == (cnt - 1)) /* Check if it's the last one. */
- return fdp + (cnt - 1) ;
+ return fdp + (cnt - 1);
else if (fdp[mid+1].sfde_func_start_address > addr)
return fdp + mid;
low = mid + 1;
--
2.39.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [COMMITTED 5/6] libsframe: use consistent function argument names
2023-04-19 22:11 [COMMITTED 0/6] Minor sframe related patches Indu Bhagat
` (3 preceding siblings ...)
2023-04-19 22:11 ` [COMMITTED 4/6] sframe: correct some typos Indu Bhagat
@ 2023-04-19 22:11 ` Indu Bhagat
2023-04-19 22:11 ` [COMMITTED 6/6] libsframe: minor formatting fixes in sframe_encoder_write_fre Indu Bhagat
5 siblings, 0 replies; 7+ messages in thread
From: Indu Bhagat @ 2023-04-19 22:11 UTC (permalink / raw)
To: binutils; +Cc: Indu Bhagat
libsframe/
* sframe.c (sframe_decoder_get_header): Use consistent function
arg names.
(sframe_decoder_free): Likewise.
(sframe_encode): Use more appropriate var name.
---
libsframe/sframe.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/libsframe/sframe.c b/libsframe/sframe.c
index b2c8eacae14..0b47e264ab1 100644
--- a/libsframe/sframe.c
+++ b/libsframe/sframe.c
@@ -469,14 +469,14 @@ bad:
/* The SFrame Decoder. */
-/* Get DECODER's SFrame header. */
+/* Get SFrame header from the given decoder context DCTX. */
static sframe_header *
-sframe_decoder_get_header (sframe_decoder_ctx *decoder)
+sframe_decoder_get_header (sframe_decoder_ctx *dctx)
{
sframe_header *hp = NULL;
- if (decoder != NULL)
- hp = &decoder->sfd_header;
+ if (dctx != NULL)
+ hp = &dctx->sfd_header;
return hp;
}
@@ -534,11 +534,11 @@ sframe_get_fre_offset (sframe_frame_row_entry *fre, int idx, int *errp)
/* Free the decoder context. */
void
-sframe_decoder_free (sframe_decoder_ctx **decoder)
+sframe_decoder_free (sframe_decoder_ctx **dctxp)
{
- if (decoder != NULL)
+ if (dctxp != NULL)
{
- sframe_decoder_ctx *dctx = *decoder;
+ sframe_decoder_ctx *dctx = *dctxp;
if (dctx == NULL)
return;
@@ -558,8 +558,8 @@ sframe_decoder_free (sframe_decoder_ctx **decoder)
dctx->sfd_buf = NULL;
}
- free (*decoder);
- *decoder = NULL;
+ free (*dctxp);
+ *dctxp = NULL;
}
}
@@ -1221,18 +1221,18 @@ sframe_encode (unsigned char ver, unsigned char flags, int abi_arch,
int8_t fixed_fp_offset, int8_t fixed_ra_offset, int *errp)
{
sframe_header *hp;
- sframe_encoder_ctx *fp;
+ sframe_encoder_ctx *encoder;
if (ver != SFRAME_VERSION)
return sframe_ret_set_errno (errp, SFRAME_ERR_VERSION_INVAL);
- if ((fp = malloc (sizeof (sframe_encoder_ctx))) == NULL)
+ if ((encoder = malloc (sizeof (sframe_encoder_ctx))) == NULL)
return sframe_ret_set_errno (errp, SFRAME_ERR_NOMEM);
- memset (fp, 0, sizeof (sframe_encoder_ctx));
+ memset (encoder, 0, sizeof (sframe_encoder_ctx));
/* Get the SFrame header and update it. */
- hp = sframe_encoder_get_header (fp);
+ hp = sframe_encoder_get_header (encoder);
hp->sfh_preamble.sfp_version = ver;
hp->sfh_preamble.sfp_magic = SFRAME_MAGIC;
hp->sfh_preamble.sfp_flags = flags;
@@ -1241,7 +1241,7 @@ sframe_encode (unsigned char ver, unsigned char flags, int abi_arch,
hp->sfh_cfa_fixed_fp_offset = fixed_fp_offset;
hp->sfh_cfa_fixed_ra_offset = fixed_ra_offset;
- return fp;
+ return encoder;
}
/* Free the encoder context. */
--
2.39.2
^ permalink raw reply [flat|nested] 7+ messages in thread
* [COMMITTED 6/6] libsframe: minor formatting fixes in sframe_encoder_write_fre
2023-04-19 22:11 [COMMITTED 0/6] Minor sframe related patches Indu Bhagat
` (4 preceding siblings ...)
2023-04-19 22:11 ` [COMMITTED 5/6] libsframe: use consistent function argument names Indu Bhagat
@ 2023-04-19 22:11 ` Indu Bhagat
5 siblings, 0 replies; 7+ messages in thread
From: Indu Bhagat @ 2023-04-19 22:11 UTC (permalink / raw)
To: binutils; +Cc: Indu Bhagat
libsframe/
* sframe.c (sframe_encoder_write_fre): Formatting fixes for
readability.
---
libsframe/sframe.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/libsframe/sframe.c b/libsframe/sframe.c
index 0b47e264ab1..d65662484cb 100644
--- a/libsframe/sframe.c
+++ b/libsframe/sframe.c
@@ -1552,7 +1552,7 @@ static int
sframe_encoder_write_fre (char *contents, sframe_frame_row_entry *frep,
unsigned int fre_type, size_t *esz)
{
- size_t fre_size;
+ size_t fre_sz;
size_t fre_start_addr_sz;
size_t fre_stack_offsets_sz;
int err = 0;
@@ -1572,23 +1572,19 @@ sframe_encoder_write_fre (char *contents, sframe_frame_row_entry *frep,
fre_type, fre_start_addr_sz);
contents += fre_start_addr_sz;
- memcpy (contents,
- &frep->fre_info,
- sizeof (frep->fre_info));
+ memcpy (contents, &frep->fre_info, sizeof (frep->fre_info));
contents += sizeof (frep->fre_info);
- memcpy (contents,
- frep->fre_offsets,
- fre_stack_offsets_sz);
+ memcpy (contents, frep->fre_offsets, fre_stack_offsets_sz);
contents+= fre_stack_offsets_sz;
- fre_size = sframe_fre_entry_size (frep, fre_type);
+ fre_sz = sframe_fre_entry_size (frep, fre_type);
/* Sanity checking. */
sframe_assert ((fre_start_addr_sz
- + sizeof (frep->fre_info)
- + fre_stack_offsets_sz) == fre_size);
+ + sizeof (frep->fre_info)
+ + fre_stack_offsets_sz) == fre_sz);
- *esz = fre_size;
+ *esz = fre_sz;
return 0;
}
--
2.39.2
^ permalink raw reply [flat|nested] 7+ messages in thread