[PATCH 05/12] include: libsframe: define new flag SFRAME_F_FDE_FUNC_START_ADDR_PCREL
Jens Remus
jremus@linux.ibm.com
Wed May 28 09:25:24 GMT 2025
On 28.05.2025 07:40, Indu Bhagat via Binutils wrote:
> Add a new flag SFRAME_F_FDE_FUNC_START_ADDR_PCREL to SFrame stack trace
> format. If set, this flag indicates that the function start address
> field (sfde_func_start_address) is the offset to the function start
> address from the SFrame FDE function start address field itself.
>
> Such an encoding is friendlier to the exisitng PC-REL relocations
> available in the ABIs supported in SFrame: AMD64 (R_X86_64_PC32) and
> AArch64 (R_AARCH64_PREL32). In subsequent patches, we will make the
> implementation in gas and ld to both:
> - emit the values in the same (above-mentioned) encoding uniformly.
> - set the flag SFRAME_F_FDE_FUNC_START_ADDR_PCREL in the SFrame header
> for consumers to be able to distinguish.
> diff --git a/include/sframe.h b/include/sframe.h
> @@ -82,9 +82,15 @@ extern "C"
> /* Various flags for SFrame. */
>
> /* Function Descriptor Entries are sorted on PC. */
> -#define SFRAME_F_FDE_SORTED 0x1
> +#define SFRAME_F_FDE_SORTED 0x1
> /* Functions preserve frame pointer. */
> -#define SFRAME_F_FRAME_POINTER 0x2
> +#define SFRAME_F_FRAME_POINTER (0x1 << 1)
> +/* Function start address in SFrame FDE is encoded as the distance from the
> + location of the sfde_func_start_address to the start PC of the function.
> + If absent, the function start address in SFrame FDE is encoded as the
> + distance from the start of the SFrame FDE section to the start PC of the
> + function. */
> +#define SFRAME_F_FDE_FUNC_START_ADDR_PCREL (0x1 << 2)
1.......10........20........30........40........50........60........70..
I would prefer to use hexadecimal values for the flags (and perhaps use
two digits, as the flags field is uint8_t):
#define SFRAME_F_FDE_SORTED 0x01
#define SFRAME_F_FRAME_POINTER 0x02
#define SFRAME_F_FDE_FUNC_START_ADDR_PCREL 0x04
This would also match with how you document them in your subsequent patch
(which I would merge into this one).
Regards,
Jens
--
Jens Remus
Linux on Z Development (D3303)
+49-7031-16-1128 Office
jremus@de.ibm.com
IBM
IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Böblingen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/
More information about the Binutils
mailing list