diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d7e51d71bd2..ff855b7439e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2002-12-20 John David Anglin + + * pa-linux.h (TARGET_HAS_STUBS_AND_ELF_SECTIONS): Delete define. + * pa32-linux.h (FUNCTION_OK_FOR_SIBCALL): Delete define. + * pa.c (pa_function_ok_for_sibcall): Allow non indirect sibcalls on + TARGET_ELF32. Add comment on sibcall issues for TARGET_64BIT. + 2002-12-20 Kazu Hirata * config/h8300/h8300-protos.h: Add prototypes for diff --git a/gcc/config/pa/pa-linux.h b/gcc/config/pa/pa-linux.h index a39ef318a00..b2c09981689 100644 --- a/gcc/config/pa/pa-linux.h +++ b/gcc/config/pa/pa-linux.h @@ -167,11 +167,6 @@ Boston, MA 02111-1307, USA. */ /* Globalizing directive for a label. */ #define GLOBAL_ASM_OP ".globl " -/* This definition is used inside pa.c to disable all - sibcall optimization, because sibcalls, stubs and - elf sections don't play well. */ -#define TARGET_HAS_STUBS_AND_ELF_SECTIONS 1 - /* FIXME: Hacked from the one so that we avoid multiple labels in a function declaration (since pa.c seems determined to do it differently) */ diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c index cd52977abb6..651fc96eb37 100644 --- a/gcc/config/pa/pa.c +++ b/gcc/config/pa/pa.c @@ -6878,14 +6878,26 @@ pa_function_ok_for_sibcall (decl, exp) tree decl; tree exp ATTRIBUTE_UNUSED; { -#ifdef TARGET_HAS_STUBS_AND_ELF_SECTIONS - /* Sibcalls, stubs, and elf sections don't play well. */ - return false; -#endif + /* Sibcalls are ok for TARGET_ELF32 as along as the linker is used in + single subspace mode and the call is not indirect. As far as I know, + there is no operating system support for the multiple subspace mode. + It might be possible to support indirect calls if we didn't use + $$dyncall (see the indirect sequence generated in output_call). */ + if (TARGET_ELF32) + return (decl != NULL_TREE); + + /* Sibcalls are not ok because the arg pointer register is not a fixed + register. This prevents the sibcall optimization from occuring. In + addition, there are problems with stub placement using GNU ld. This + is because a normal sibcall branch uses a 17-bit relocation while + a regular call branch uses a 22-bit relocation. As a result, more + care needs to be taken in the placement of long-branch stubs. */ + if (TARGET_64BIT) + return false; + return (decl - && ! TARGET_PORTABLE_RUNTIME - && ! TARGET_64BIT - && ! TREE_PUBLIC (decl)); + && !TARGET_PORTABLE_RUNTIME + && !TREE_PUBLIC (decl)); } /* Returns 1 if the 6 operands specified in OPERANDS are suitable for diff --git a/gcc/config/pa/pa32-linux.h b/gcc/config/pa/pa32-linux.h index e8bc78322ee..c8e7b37012b 100644 --- a/gcc/config/pa/pa32-linux.h +++ b/gcc/config/pa/pa32-linux.h @@ -22,14 +22,6 @@ Boston, MA 02111-1307, USA. */ #undef TARGET_ELF32 #define TARGET_ELF32 1 -/* Sibcalls are ok when ld is used in single subspace mode. The - multiple subspace mode is not compatible with sibcalls to external - functions because the linker generated stubs store the return - pointer into the frame. This target does not need multiple - subspace stubs, so we allow sibcalls to all functions. */ -#undef FUNCTION_OK_FOR_SIBCALL -#define FUNCTION_OK_FOR_SIBCALL(DECL) 1 - /* The libcall __canonicalize_funcptr_for_compare is referenced in crtend.o and the reference isn't resolved in objects that don't compare function pointers. Thus, we need to play games to provide