From a8bf5f4aae5cf8ea651fb541018dbe454f7d01e5 Mon Sep 17 00:00:00 2001 From: danglin Date: Mon, 13 Mar 2006 23:22:57 +0000 Subject: [PATCH] * pa/pa32-linux.h (CRT_CALL_STATIC_FUNCTION): Define when CRTSTUFFS_O is defined. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@112029 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 5 +++++ gcc/config/pa/pa32-linux.h | 24 +++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8325f0fed4a..94aac10fd99 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2006-03-13 John David Anglin + + * pa/pa32-linux.h (CRT_CALL_STATIC_FUNCTION): Define when CRTSTUFFS_O + is defined. + 2006-03-13 Richard Sandiford * config/mips/mips.md (*branch_fp): Use %Z2 for the condition. diff --git a/gcc/config/pa/pa32-linux.h b/gcc/config/pa/pa32-linux.h index 0df6305aa14..69c73fc7bd6 100644 --- a/gcc/config/pa/pa32-linux.h +++ b/gcc/config/pa/pa32-linux.h @@ -1,5 +1,5 @@ /* Definitions for PA_RISC with ELF-32 format - Copyright (C) 2000, 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 2000, 2002, 2004, 2006 Free Software Foundation, Inc. This file is part of GCC. @@ -36,4 +36,26 @@ Boston, MA 02110-1301, USA. */ aligned(sizeof(func_ptr)))) \ = { (func_ptr) (-1) } +/* This is a PIC version of CRT_CALL_STATIC_FUNCTION. The PIC + register has to be saved before the call and restored after + the call. We assume that register %r4 is available for this + purpose. The hack prevents GCC from deleting the restore. */ +#ifdef CRTSTUFFS_O +#define CRT_CALL_STATIC_FUNCTION(SECTION_OP, FUNC) \ +static void __attribute__((__used__)) \ +call_ ## FUNC (void) \ +{ \ + asm (SECTION_OP); \ + asm volatile ("bl " #FUNC ",%%r2\n\t" \ + "copy %%r19,%%r4\n\t" \ + "copy %%r4,%%r19\n" \ + : \ + : \ + : "r1", "r2", "r4", "r20", "r21", \ + "r22", "r24", "r24", "r25", "r26", \ + "r27", "r28", "r29", "r31"); \ + asm (TEXT_SECTION_ASM_OP); \ +} +#endif + #define MD_UNWIND_SUPPORT "config/pa/linux-unwind.h" -- 2.11.0