diff options
author | Paul Brook <paul@codesourcery.com> | 2008-05-23 20:36:57 +0000 |
---|---|---|
committer | Carlos O'Donell <carlos@gcc.gnu.org> | 2008-05-23 20:36:57 +0000 |
commit | 007e61c28bd45792a74a66be4feae5968468befe (patch) | |
tree | fabe76f974542d0458d609ec4222651293549585 /gcc/doc | |
parent | b86c6d94f8ceddd239e1cf26687302de6b88f1ab (diff) | |
download | gcc-007e61c28bd45792a74a66be4feae5968468befe.zip gcc-007e61c28bd45792a74a66be4feae5968468befe.tar.gz gcc-007e61c28bd45792a74a66be4feae5968468befe.tar.bz2 |
extend.texi: Clarify use of __attribute__((naked)).
gcc/
2008-05-23 Paul Brook <paul@codesourcery.com>
Carlos O'Donell <carlos@codesourcery.com>
* doc/extend.texi: Clarify use of __attribute__((naked)).
* doc/tm.texi: Document TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS.
* target.h (gcc_target): Add allocate_stack_slots_for_args.
* function.c (use_register_for_decl): Use
targetm.calls.allocate_stack_slots_for_args.
* target-def.h (TARGET_CALLS): Add
TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS.
* config/arm/arm.c (arm_allocate_stack_slots_for_args):
New function.
(TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS): Define.
gcc/testsuite/
2008-05-23 Paul Brook <paul@codesourcery.com>
Carlos O'Donell <carlos@codesourcery.com>
* gcc.target/arm/naked-1.c: New test.
* gcc.target/arm/naked-2.c: New test.
Co-Authored-By: Carlos O'Donell <carlos@codesourcery.com>
From-SVN: r135831
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/extend.texi | 8 | ||||
-rw-r--r-- | gcc/doc/tm.texi | 11 |
2 files changed, 18 insertions, 1 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 78d581d..f0e8593 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -2512,7 +2512,13 @@ defined by shared libraries. @cindex function without a prologue/epilogue code Use this attribute on the ARM, AVR, IP2K and SPU ports to indicate that the specified function does not need prologue/epilogue sequences generated by -the compiler. It is up to the programmer to provide these sequences. +the compiler. It is up to the programmer to provide these sequences. The +only statements that can be safely included in naked functions are +@code{asm} statements that do not have operands. All other statements, +including declarations of local variables, @code{if} statements, and so +forth, should be avoided. Naked functions should be used to implement the +body of an assembly function, while allowing the compiler to construct +the requisite function declaration for the assembler. @item near @cindex functions which do not handle memory bank switching on 68HC11/68HC12 diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 12a2740..8c0de3b 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -10465,3 +10465,14 @@ to the functions in @file{libgcc} that provide low-level support for call stack unwinding. It is used in declarations in @file{unwind-generic.h} and the associated definitions of those functions. @end defmac + +@deftypefn {Target Hook} {bool} TARGET_ALLOCATE_STACK_SLOTS_FOR_ARGS (void) +When optimization is disabled, this hook indicates whether or not +arguments should be allocated to stack slots. Normally, GCC allocates +stacks slots for arguments when not optimizing in order to make +debugging easier. However, when a function is declared with +@code{__attribute__((naked))}, there is no stack frame, and the compiler +cannot safely move arguments from the registers in which they are passed +to the stack. Therefore, this hook should return true in general, but +false for naked functions. The default implementation always returns true. +@end deftypefn |