sframe: fix the defined SFRAME_FRE_TYPE_*_LIMIT constants
authorIndu Bhagat <indu.bhagat@oracle.com>
Fri, 6 Jan 2023 17:30:20 +0000 (09:30 -0800)
committerIndu Bhagat <indu.bhagat@oracle.com>
Mon, 9 Jan 2023 17:47:42 +0000 (09:47 -0800)
commitb6250e0b724231e8456293c364b344aa6ffeea95
treed2477630e9f52d5d3ad9e7eeb680ae522c28fa5c
parent2ffa66fc9f2a23119e799455f6f94ade8d710d3f
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.

(cherry picked from commit 725a19bfd142c845bf76ae28f6289972fd1cf5db)
gas/sframe-opt.c
include/sframe-api.h
include/sframe.h
libsframe/sframe.c