This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Trampolines and descriptors


This came up in a discussion of an or1k patch, but it left me wondering so I'll raise the question again.

Are function descriptors meaningful outside Ada?  The internals manual seems to say yes, if enabled they will be used -- instead of trampolines -- also for C nested functions.

Is that correct?  It seems that this is worth using for any machine where it's desirable to avoid executing stack data.

	paul

> On Aug 31, 2018, at 9:19 AM, Paul Koning <paulkoning@comcast.net> wrote:
> 
> 
> 
>> On Aug 30, 2018, at 9:02 PM, Jeff Law <law@redhat.com> wrote:
>> 
>> On 08/30/2018 10:58 AM, Richard Henderson wrote:
>>> On 08/28/2018 07:13 AM, Jeff Law wrote:
>>>> Please consider using function descriptors rather than trampolines.
>>>> This allows you to make the stack non-executable at all times which is
>>>> good from a security standpoint.  The downside is the indirect calling
>>>> mechanism has to change slightly to distinguish between a simple
>>>> indirect call and one through a function descriptor (usually by having a
>>>> low bit on to indicate the latter).  GIven this is an ABI change, now is
>>>> probably the last opportunity to make this change.
>>> 
>>> Correct me if I'm wrong here:
>>> 
>>> Define TARGET_CUSTOM_FUNCTION_DESCRIPTORS to an appropriate value -- easy for a
>>> RISC target -- and that's it.
>>> 
>>> Further, it pretty much only gets used by the Ada front end.  One should not
>>> expect these to be used by the C front end nested functions.
>> I thought it was used more extensively than that...  Thanks for checking
>> into it though.
>> 
>> Jeff
> 
> My impression from reading the internals manual is that it's an alternative to trampolines -- and in fact it appears to suggest it's a superior alternative.  I've been planning to try turning it on for pdp11 where executable stacks can be problematic.  (For that matter, they are on lots of other machines -- which is why descriptors instead of trampolines sounds like a good thing.)
> 
> 	paul
> 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]