diff options
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index d02b1c3..9975b75 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -485,7 +485,22 @@ expand_builtin_return_addr (enum built_in_function fndecl_code, int count) #ifdef INITIAL_FRAME_ADDRESS_RTX rtx tem = INITIAL_FRAME_ADDRESS_RTX; #else - rtx tem = hard_frame_pointer_rtx; + rtx tem; + + /* For a zero count, we don't care what frame address we return, so frame + pointer elimination is OK, and using the soft frame pointer is OK. + For a non-zero count, we require a stable offset from the current frame + pointer to the previous one, so we must use the hard frame pointer, and + we must disable frame pointer elimination. */ + if (count == 0) + tem = frame_pointer_rtx; + else + { + tem = hard_frame_pointer_rtx; + + /* Tell reload not to eliminate the frame pointer. */ + current_function_accesses_prior_frames = 1; + } #endif /* Some machines need special handling before we can access |