[PATCH] ARM + Thumb Segmented Stacks (v2)

Oliver Stannard Oliver.Stannard at arm.com
Wed Mar 26 02:16:17 PDT 2014

Hi Alex,

I have some high-level comments, but I haven't looked at the patch in any great detail yet. It seems to me that this is just one part of the work that needs to be done before segmented stacks are fully usable. [1] gives a comprehensive-looking list of all the things that need to be done (for GCC), though segmented stacks will be usable to a limited extent with only a small subset of that.

1) Has the calling convention of __morestack for ARM been defined/documented anywhere? Since rust has now abandoned segmented stacks, I don't want us to get into the situation where GCC (or anyone else) defines an incompatible calling convention.

2) Is there currently an ARM implementation of __morestack? Rust's is dead, and libgcc doesn't seem to have an ARM one (yet?). Compiler support will not be useful to anyone if there is no library support.

3) You have not made any changes to the emission of DWARF info, so it seems unlikely that the DWARF stack frame info will accurately describe the stack layout. The emission of DWARF stack frame info may have been added to LLVM after rust forked it, but we cannot emit incorrect debug info.

4) Your patch looks like it can handle calls from non-split-stack to split-stack functions, assuming that the stack limit has been set up in TLS. However, it will not handle calls from split-stack to non-split stack functions, which GCC can do. This is a difficult problem, requiring linker support, so I think it should be out of the scope of this patch.

5) GCC can handle variadic functions for x86 and x86_64, and I can see no reason why we cannot do this on ARM. We should at least make sure that our definition of the interface to __morestack will not prevent adding this at a later date.

[1] http://gcc.gnu.org/wiki/SplitStacks

From: llvm-commits-bounces at cs.uiuc.edu [llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Alex Crichton [alex at crichton.co]
Sent: 25 March 2014 01:01
To: llvm-commits at cs.uiuc.edu
Subject: [PATCH] ARM + Thumb Segmented Stacks (v2)

I sent in a patch a month ago [1] for an ARM and Thumb segmented stack
implementation, but the last thread seems to have died out a bit, so I
was going to try to send this to the mailing list again. Sorry if this
is a little spammy!

The attached patch is the most recent version. If you need any more
info, just let me know!

[1] - http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20140224/205968.html

-- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.

ARM Limited, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No:  2557590
ARM Holdings plc, Registered office 110 Fulbourn Road, Cambridge CB1 9NJ, Registered in England & Wales, Company No:  2548782

More information about the llvm-commits mailing list