summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorIndu Bhagat <indu.bhagat@oracle.com>2023-01-06 09:30:20 -0800
committerIndu Bhagat <indu.bhagat@oracle.com>2023-01-06 09:30:56 -0800
commit725a19bfd142c845bf76ae28f6289972fd1cf5db (patch)
treed4312aa9fa29f28f4b2be090e87f0def39972629 /include
parentcd9aea32cffd8089f6f63f4eb86d4dccfc0b3850 (diff)
downloadbinutils-gdb-725a19bfd142c845bf76ae28f6289972fd1cf5db.tar.gz
sframe: fix the defined SFRAME_FRE_TYPE_*_LIMIT constants
An earlier commit 3f107464 defined the SFRAME_FRE_TYPE_*_LIMIT constants. These constants are used (by gas and libsframe) to pick an SFrame FRE type based on the function size. Those constants, however, were buggy, causing the generated SFrame sections to be bloated as SFRAME_FRE_TYPE_ADDR2/SFRAME_FRE_TYPE_ADDR4 got chosen more often than necessary. gas/ * sframe-opt.c (sframe_estimate_size_before_relax): Use typecast. (sframe_convert_frag): Likewise. libsframe/ * sframe.c (sframe_calc_fre_type): Use a more appropriate type for argument. Adjust the check for SFRAME_FRE_TYPE_ADDR4_LIMIT to keep it warning-free but meaningful. include/ * sframe-api.h (sframe_calc_fre_type): Use a more appropriate type for the argument. * sframe.h (SFRAME_FRE_TYPE_ADDR1_LIMIT): Correct the constant. (SFRAME_FRE_TYPE_ADDR2_LIMIT): Likewise. (SFRAME_FRE_TYPE_ADDR4_LIMIT): Likewise.
Diffstat (limited to 'include')
-rw-r--r--include/sframe-api.h2
-rw-r--r--include/sframe.h9
2 files changed, 7 insertions, 4 deletions
diff --git a/include/sframe-api.h b/include/sframe-api.h
index cdffc25d2cd..405e30c27e8 100644
--- a/include/sframe-api.h
+++ b/include/sframe-api.h
@@ -96,7 +96,7 @@ sframe_fde_create_func_info (unsigned int fre_type, unsigned int fde_type);
/* Gather the FRE type given the function size. */
extern unsigned int
-sframe_calc_fre_type (unsigned int func_size);
+sframe_calc_fre_type (size_t func_size);
/* The SFrame Decoder. */
diff --git a/include/sframe.h b/include/sframe.h
index 7e7840b605c..58ef07dcc21 100644
--- a/include/sframe.h
+++ b/include/sframe.h
@@ -304,7 +304,8 @@ typedef struct sframe_frame_row_entry_addr1
/* Upper limit of start address in sframe_frame_row_entry_addr1
is 0x100 (not inclusive). */
-#define SFRAME_FRE_TYPE_ADDR1_LIMIT ((SFRAME_FRE_TYPE_ADDR1 + 1) * 8)
+#define SFRAME_FRE_TYPE_ADDR1_LIMIT \
+ (1ULL << ((SFRAME_FRE_TYPE_ADDR1 + 1) * 8))
/* Used when SFRAME_FRE_TYPE_ADDR2 is specified as FRE type. */
typedef struct sframe_frame_row_entry_addr2
@@ -317,7 +318,8 @@ typedef struct sframe_frame_row_entry_addr2
/* Upper limit of start address in sframe_frame_row_entry_addr2
is 0x10000 (not inclusive). */
-#define SFRAME_FRE_TYPE_ADDR2_LIMIT ((SFRAME_FRE_TYPE_ADDR2 * 2) * 8)
+#define SFRAME_FRE_TYPE_ADDR2_LIMIT \
+ (1ULL << ((SFRAME_FRE_TYPE_ADDR2 * 2) * 8))
/* Used when SFRAME_FRE_TYPE_ADDR4 is specified as FRE type. */
typedef struct sframe_frame_row_entry_addr4
@@ -330,7 +332,8 @@ typedef struct sframe_frame_row_entry_addr4
/* Upper limit of start address in sframe_frame_row_entry_addr2
is 0x100000000 (not inclusive). */
-#define SFRAME_FRE_TYPE_ADDR4_LIMIT ((SFRAME_FRE_TYPE_ADDR4 * 2) * 8)
+#define SFRAME_FRE_TYPE_ADDR4_LIMIT \
+ (1ULL << ((SFRAME_FRE_TYPE_ADDR4 * 2) * 8))
#ifdef __cplusplus
}