Removing nested function from elfxx-aarch64.c
Richard Earnshaw (lists)
Richard.Earnshaw@arm.com
Wed Mar 19 14:04:43 GMT 2025
On 19/03/2025 13:58, Eric Botcazou wrote:
>> It very much depends on the platform. From the gcc internals manual:
>>
>> {Target Hook} int TARGET_CUSTOM_FUNCTION_DESCRIPTORS
>> If the target can use GCC's generic descriptor mechanism for nested
>> functions, define this hook to a power of 2 representing an unused bit
>> in function pointers which can be used to differentiate descriptors at
>> run time. This value gives the number of bytes by which descriptor
>> pointers are misaligned compared to function pointers. For example, on
>> targets that require functions to be aligned to a 4-byte boundary, a
>> value of either 1 or 2 is appropriate unless the architecture already
>> reserves the bit for another purpose, such as on ARM.
>
> The discussion was more about requiring an executable stack in the mere
> presence of nested functions though, as opposed to in the presence of pointers
> to them (for which TARGET_CUSTOM_FUNCTION_DESCRIPTORS is indeed designed).
>
I don't think we've ever needed an executable stack for nested functions if pointers to them aren't used. It's only the trampolines that those use that need it. The compiler knows when the address of a nested function is needed because it has local binding (for C at any rate).
R.
More information about the Binutils
mailing list