aboutsummaryrefslogtreecommitdiff
path: root/libsframe
diff options
context:
space:
mode:
authorIndu Bhagat <indu.bhagat@oracle.com>2022-12-09 10:23:07 -0800
committerIndu Bhagat <indu.bhagat@oracle.com>2022-12-09 10:23:07 -0800
commit3f107464e35cf63a529358a1c240821b30c35d2b (patch)
tree5e4a62b1c62e48a1c17b35ed303c26f6f04f512e /libsframe
parent70cfae61f4ed5db02d8daa59dc4432ff2d9302bd (diff)
downloadgdb-3f107464e35cf63a529358a1c240821b30c35d2b.zip
gdb-3f107464e35cf63a529358a1c240821b30c35d2b.tar.gz
gdb-3f107464e35cf63a529358a1c240821b30c35d2b.tar.bz2
sframe: gas: libsframe: define constants and remove magic numbers
Define constants in sframe.h for the various limits associated with the range of offsets that can be encoded in the start address of an SFrame FRE. E.g., sframe_frame_row_entry_addr1 is used when start address offset can be encoded as 1-byte unsigned value. Update the code in gas to use these defined constants as it checks for these limits, and remove the usage of magic numbers. ChangeLog: * gas/sframe-opt.c (sframe_estimate_size_before_relax): (sframe_convert_frag): Do not use magic numbers. * libsframe/sframe.c (sframe_calc_fre_type): Likewise. include/ChangeLog: * sframe.h (SFRAME_FRE_TYPE_ADDR1_LIMIT): New constant. (SFRAME_FRE_TYPE_ADDR2_LIMIT): Likewise. (SFRAME_FRE_TYPE_ADDR4_LIMIT): Likewise.
Diffstat (limited to 'libsframe')
-rw-r--r--libsframe/sframe.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libsframe/sframe.c b/libsframe/sframe.c
index 6e0eb7b..64fa907 100644
--- a/libsframe/sframe.c
+++ b/libsframe/sframe.c
@@ -572,11 +572,11 @@ unsigned int
sframe_calc_fre_type (unsigned int func_size)
{
unsigned int fre_type = 0;
- if (func_size <= 0xff)
+ if (func_size < SFRAME_FRE_TYPE_ADDR1_LIMIT)
fre_type = SFRAME_FRE_TYPE_ADDR1;
- else if (func_size <= 0xffff)
+ else if (func_size < SFRAME_FRE_TYPE_ADDR2_LIMIT)
fre_type = SFRAME_FRE_TYPE_ADDR2;
- else if (func_size <= 0xffffffff)
+ else if (func_size < SFRAME_FRE_TYPE_ADDR4_LIMIT)
fre_type = SFRAME_FRE_TYPE_ADDR4;
return fre_type;
}