diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-15 09:35:56 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-15 09:35:56 +0000 |
commit | e8844fc36936140eb1c9f659a16b401980733b49 (patch) | |
tree | 604287ecd222a7298e95b6799dafc8e1b6467250 /libgcc | |
parent | 5ce2a6ec8443c9fcf3c4f96383246efa8f5b3d6a (diff) | |
download | gcc-e8844fc36936140eb1c9f659a16b401980733b49.tar.gz |
2012-03-15 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 185416 using svnmerge
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@185423 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgcc')
-rw-r--r-- | libgcc/ChangeLog | 78 | ||||
-rw-r--r-- | libgcc/config.host | 20 | ||||
-rw-r--r-- | libgcc/config/alpha/gthr-posix.c | 266 | ||||
-rw-r--r-- | libgcc/config/alpha/libgcc-osf5.ver | 58 | ||||
-rw-r--r-- | libgcc/config/alpha/osf5-unwind.h | 329 | ||||
-rw-r--r-- | libgcc/config/alpha/t-osf-pthread | 5 | ||||
-rw-r--r-- | libgcc/config/alpha/t-slibgcc-osf | 29 | ||||
-rw-r--r-- | libgcc/config/alpha/t-vms | 2 | ||||
-rw-r--r-- | libgcc/config/arm/crtn.S | 4 | ||||
-rw-r--r-- | libgcc/config/i386/sol2-unwind.h | 66 | ||||
-rw-r--r-- | libgcc/config/ia64/t-vms | 2 | ||||
-rw-r--r-- | libgcc/config/mips/irix-crti.S | 71 | ||||
-rw-r--r-- | libgcc/config/mips/irix-crtn.S | 38 | ||||
-rw-r--r-- | libgcc/config/mips/irix6-unwind.h | 180 | ||||
-rw-r--r-- | libgcc/config/mips/t-irix6 | 24 | ||||
-rw-r--r-- | libgcc/config/mips/t-slibgcc-irix | 7 | ||||
-rw-r--r-- | libgcc/config/sparc/sol2-unwind.h | 112 | ||||
-rw-r--r-- | libgcc/config/t-crtfm | 5 | ||||
-rw-r--r-- | libgcc/gthr-posix.h | 49 | ||||
-rw-r--r-- | libgcc/gthr-single.h | 1 | ||||
-rw-r--r-- | libgcc/gthr.h | 9 | ||||
-rw-r--r-- | libgcc/libgcov.c | 34 | ||||
-rw-r--r-- | libgcc/longlong.h | 3 | ||||
-rw-r--r-- | libgcc/mkmap-flat.awk | 13 | ||||
-rw-r--r-- | libgcc/unwind-dw2-fde.c | 8 | ||||
-rw-r--r-- | libgcc/unwind-dw2.c | 3 |
26 files changed, 175 insertions, 1241 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog index 4d8294b44f6..5184a85b033 100644 --- a/libgcc/ChangeLog +++ b/libgcc/ChangeLog @@ -1,3 +1,81 @@ +2012-03-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * config/i386/sol2-unwind.h (x86_fallback_frame_state): Remove + Solaris 8 handling. + * config/sparc/sol2-unwind.h (sparc64_is_sighandler): Remove + Solaris 8 handling. + (sparc_is_sighandler): Likewise. + +2012-03-13 H.J. Lu <hongjiu.lu@intel.com> + + * unwind-dw2.c (_Unwind_SetGRValue): Assert DWARF register size + <= saved reg size. + +2012-03-13 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * config/arm/crtn.S: Fix typo. + +2012-03-13 Richard Guenther <rguenther@suse.de> + + * libgcov.c: Remove stdio.h include and NULL un-define. + +2012-03-13 Richard Guenther <rguenther@suse.de> + + PR target/52569 + * unwind-dw2-fde.c: Make avoid-include-gthr.h hacks work again. + +2012-03-13 Richard Guenther <rguenther@suse.de> + + * gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Fix definition. + +2012-03-13 Richard Guenther <rguenther@suse.de> + + * gthr-posix.h: Remove duplicate __GTHREAD_MUTEX_INIT_FUNCTION + and __gthread_mutex_init_function definitions. + +2012-03-12 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * config.host (mips*-*-openbsd*): Remove. + +2012-03-12 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> + + * config.host: Remove alpha*-dec-osf5.1* handling. + * config/alpha/gthr-posix.c: Remove. + * config/alpha/libgcc-osf5.ver: Remove. + * config/alpha/osf5-unwind.h: Remove. + * config/alpha/t-osf-pthread: Remove. + * config/alpha/t-slibgcc-osf: Remove. + * config/t-crtfm (crtfastmath.o): Remove -frandom-seed. + * gthr-posix.h [!_REENTRANT && __osf__] (_REENTRANT): Don't define. + [__osf__ && _PTHREAD_USE_MANGLED_NAMES_]: Remove. + * mkmap-flat.awk: Remove osf_export handling. + +2012-03-12 Richard Guenther <rguenther@suse.de> + + * gthr.h (__GTHREAD_MUTEX_INIT_FUNCTION): Adjust specification. + * gthr-posix.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define. + (__gthread_mutex_init_function): New function. + * gthr-single.h (__GTHREAD_MUTEX_INIT_FUNCTION): Define. + + PR gcov/49484 + * libgcov.c: Include gthr.h. + (__gcov_flush_mx): New global variable. + (init_mx, init_mx_once): New functions. + (__gcov_flush): Protect self with a mutex. + (__gcov_fork): Re-initialize mutex after forking. + * unwind-dw2-fde.c: Change condition under which to use + __GTHREAD_MUTEX_INIT_FUNCTION. + +2012-03-12 Tristan Gingold <gingold@adacore.com> + + * config/alpha/t-vms: Define HOST_LIBGCC2_CFLAGS. + * config/ia64/t-vms: Likewise. + +2012-03-11 Michael Hope <michael.hope@linaro.org> + + * longlong.h [ARM] (add_ssaaaa, sub_ddmmss, umul_ppmm): Enable + for Thumb-2. + 2012-03-07 Walter Lee <walt@tilera.com> * config/tilepro/atomic.c: Rename "atomic_" prefix to diff --git a/libgcc/config.host b/libgcc/config.host index 257622a09ff..4a0897c2515 100644 --- a/libgcc/config.host +++ b/libgcc/config.host @@ -266,8 +266,7 @@ case ${host} in esac case ${host} in -*-*-darwin* | *-*-freebsd* | *-*-netbsd* | *-*-openbsd* | *-*-solaris2* | \ - alpha*-dec-osf5.1*) +*-*-darwin* | *-*-freebsd* | *-*-netbsd* | *-*-openbsd* | *-*-solaris2*) enable_execute_stack=enable-execute-stack-mprotect.c ;; i[34567]86-*-mingw* | x86_64-*-mingw*) @@ -294,16 +293,6 @@ alpha*-*-netbsd*) alpha*-*-openbsd*) tmake_file="${tmake_file} alpha/t-alpha alpha/t-ieee" ;; -alpha*-dec-osf5.1*) - tmake_file="${tmake_file} alpha/t-alpha alpha/t-ieee t-crtfm t-slibgcc alpha/t-slibgcc-osf" - case ${target_thread_file} in - posix) - tmake_file="${tmake_file} alpha/t-osf-pthread" - ;; - esac - extra_parts="${extra_parts} crtfastmath.o" - md_unwind_header=alpha/osf5-unwind.h - ;; alpha64-dec-*vms*) tmake_file="$tmake_file alpha/t-alpha alpha/t-ieee alpha/t-vms t-slibgcc-vms" extra_parts="$extra_parts vms-dwarf2.o vms-dwarf2eh.o" @@ -737,11 +726,6 @@ microblaze*-*-*) tmake_file="microblaze/t-microblaze t-fdpbit" extra_parts="crtbegin.o crtend.o crti.o crtn.o" ;; -mips-sgi-irix6.5*) - tmake_file="$tmake_file mips/t-irix6 t-crtfm mips/t-tpbit t-slibgcc mips/t-slibgcc-irix" - extra_parts="crtbegin.o crtend.o crtfastmath.o irix-crti.o irix-crtn.o" - md_unwind_header=mips/irix6-unwind.h - ;; mips*-*-netbsd*) # NetBSD/mips, either endian. ;; mips64*-*-linux* | mipsisa64*-*-linux*) @@ -754,8 +738,6 @@ mips*-*-linux*) # Linux MIPS, either endian. tmake_file="${tmake_file} t-crtfm mips/t-mips16" md_unwind_header=mips/linux-unwind.h ;; -mips*-*-openbsd*) - ;; mips*-sde-elf*) tmake_file="$tmake_file mips/t-crtstuff mips/t-mips16" case "${with_newlib}" in diff --git a/libgcc/config/alpha/gthr-posix.c b/libgcc/config/alpha/gthr-posix.c deleted file mode 100644 index 02681a4371e..00000000000 --- a/libgcc/config/alpha/gthr-posix.c +++ /dev/null @@ -1,266 +0,0 @@ -/* POSIX threads dummy routines for systems without weak definitions. */ -/* Compile this one with gcc. */ -/* Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2011 - Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 3, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -Under Section 7 of GPL version 3, you are granted additional -permissions described in the GCC Runtime Library Exception, version -3.1, as published by the Free Software Foundation. - -You should have received a copy of the GNU General Public License and -a copy of the GCC Runtime Library Exception along with this program; -see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -<http://www.gnu.org/licenses/>. */ - -#include "tconfig.h" -#include "tm.h" -#include "libgcc_tm.h" -# define __gthrw_pragma(pragma) _Pragma (#pragma) -/* Define so we provide weak definitions of functions used by libobjc only. */ -#define _LIBOBJC_WEAK -#include "gthr.h" - -int -pthread_once (pthread_once_t *once ATTRIBUTE_UNUSED, - void (*func) (void) ATTRIBUTE_UNUSED) -{ - return -1; -} - -int -pthread_key_create (pthread_key_t *key ATTRIBUTE_UNUSED, - void (*dtor) (void *) ATTRIBUTE_UNUSED) -{ - return -1; -} - -int -pthread_key_delete (pthread_key_t key ATTRIBUTE_UNUSED) -{ - return 0; -} - -void * -pthread_getspecific (pthread_key_t key ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -pthread_setspecific (pthread_key_t key ATTRIBUTE_UNUSED, - const void *ptr ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -pthread_create (pthread_t *thread ATTRIBUTE_UNUSED, - const pthread_attr_t *attr ATTRIBUTE_UNUSED, - void *(*start_routine) (void *) ATTRIBUTE_UNUSED, - void *arg ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -pthread_join (pthread_t thread ATTRIBUTE_UNUSED, - void **value_ptr ATTRIBUTE_UNUSED) -{ - return 0; -} - -void -pthread_exit (void *value_ptr ATTRIBUTE_UNUSED) -{ -} - -int -pthread_detach (pthread_t thread ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -pthread_cancel (pthread_t thread ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -pthread_mutex_lock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -pthread_mutex_trylock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED) -{ - return 0; -} - -#ifdef _POSIX_TIMEOUTS -#if _POSIX_TIMEOUTS >= 0 -int -pthread_mutex_timedlock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED, - const struct timespec *abs_timeout ATTRIBUTE_UNUSED) -{ - return 0; -} -#endif -#endif /* _POSIX_TIMEOUTS */ - -int -pthread_mutex_unlock (pthread_mutex_t *mutex ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -pthread_mutexattr_init (pthread_mutexattr_t *attr ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -pthread_mutexattr_settype (pthread_mutexattr_t *attr ATTRIBUTE_UNUSED, - int type ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -pthread_mutexattr_destroy (pthread_mutexattr_t *attr ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -pthread_cond_broadcast (pthread_cond_t *cond ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -pthread_cond_destroy (pthread_cond_t *cond ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -pthread_cond_init (pthread_cond_t *cond ATTRIBUTE_UNUSED, - const pthread_condattr_t *attr ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -pthread_cond_signal (pthread_cond_t *cond ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -pthread_cond_wait (pthread_cond_t *cond ATTRIBUTE_UNUSED, - pthread_mutex_t *mutex ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -pthread_cond_timedwait (pthread_cond_t *cond ATTRIBUTE_UNUSED, - pthread_mutex_t *mutex ATTRIBUTE_UNUSED, - const struct timespec *abstime ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -pthread_mutex_init (pthread_mutex_t *mutex ATTRIBUTE_UNUSED, - const pthread_mutexattr_t *attr ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -pthread_mutex_destroy (pthread_mutex_t *mutex ATTRIBUTE_UNUSED) -{ - return 0; -} - -pthread_t -pthread_self (void) -{ - return (pthread_t) 0; -} - -#ifdef _POSIX_PRIORITY_SCHEDULING -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING -int -sched_get_priority_max (int policy ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -sched_get_priority_min (int policy ATTRIBUTE_UNUSED) -{ - return 0; -} -#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ -#endif /* _POSIX_PRIORITY_SCHEDULING */ - -int -sched_yield (void) -{ - return 0; -} - -int -pthread_attr_destroy (pthread_attr_t *attr ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -pthread_attr_init (pthread_attr_t *attr ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -pthread_attr_setdetachstate (pthread_attr_t *attr ATTRIBUTE_UNUSED, - int detachstate ATTRIBUTE_UNUSED) -{ - return 0; -} - -#ifdef _POSIX_THREAD_PRIORITY_SCHEDULING -int -pthread_getschedparam (pthread_t thread ATTRIBUTE_UNUSED, - int *policy ATTRIBUTE_UNUSED, - struct sched_param *param ATTRIBUTE_UNUSED) -{ - return 0; -} - -int -pthread_setschedparam (pthread_t thread ATTRIBUTE_UNUSED, - int policy ATTRIBUTE_UNUSED, - const struct sched_param *param ATTRIBUTE_UNUSED) -{ - return 0; -} -#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING */ - diff --git a/libgcc/config/alpha/libgcc-osf5.ver b/libgcc/config/alpha/libgcc-osf5.ver deleted file mode 100644 index 4266928d1cf..00000000000 --- a/libgcc/config/alpha/libgcc-osf5.ver +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (C) 2011 Free Software Foundation, Inc. -# -# This file is part of GCC. -# -# GCC is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GCC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GCC; see the file COPYING3. If not see -# <http://www.gnu.org/licenses/>. - -# Tru64 UNIX specific additions to libgcc-std.ver. - -GCC_4.7.0 { - __udiv_qrnnd - # Beware *not* to hide the POSIX threads related symbols provided by - # gthr-posix.c, as this would prevent their preemption by real symbols. - __pthread_cancel - __pthread_cond_broadcast - __pthread_cond_destroy - __pthread_cond_init - __pthread_cond_signal - __pthread_cond_timedwait - __pthread_cond_wait - __pthread_create - __pthread_detach - __pthread_exit - __pthread_getspecific - __pthread_join - __pthread_mutex_destroy - __pthread_mutex_init - __pthread_mutex_lock - __pthread_mutex_trylock - __pthread_mutex_unlock - __pthread_once - __pthread_self - __pthread_setspecific - pthread_attr_destroy - pthread_attr_init - pthread_attr_setdetachstate - pthread_getschedparam - pthread_key_create - pthread_key_delete - pthread_mutexattr_destroy - pthread_mutexattr_init - pthread_mutexattr_settype - pthread_setschedparam - sched_get_priority_max - sched_get_priority_min - sched_yield -} diff --git a/libgcc/config/alpha/osf5-unwind.h b/libgcc/config/alpha/osf5-unwind.h deleted file mode 100644 index c649099349e..00000000000 --- a/libgcc/config/alpha/osf5-unwind.h +++ /dev/null @@ -1,329 +0,0 @@ -/* DWARF2 EH unwinding support for Alpha Tru64. - Copyright (C) 2010 Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 3, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -You should have received a copy of the GNU General Public License -along with GCC; see the file COPYING3. If not see -<http://www.gnu.org/licenses/>. */ - -/* This file implements the MD_FALLBACK_FRAME_STATE_FOR macro, triggered when - the GCC table based unwinding process hits a frame for which no unwind info - has been registered. This typically occurs when raising an exception from a - signal handler, because the handler is actually called from the OS kernel. - - The basic idea is to detect that we are indeed trying to unwind past a - signal handler and to fill out the GCC internal unwinding structures for - the OS kernel frame as if it had been directly called from the interrupted - context. - - This is all assuming that the code to set the handler asked the kernel to - pass a pointer to such context information. */ - -/* -------------------------------------------------------------------------- - -- Basic principles of operation: - -------------------------------------------------------------------------- - - 1/ We first need a way to detect if we are trying to unwind past a signal - handler. - - The typical method that is used on most platforms is to look at the code - around the return address we have and check if it matches the OS code - calling a handler. To determine what this code is expected to be, get a - breakpoint into a real signal handler and look at the code around the - return address. Depending on the library versions the pattern of the - signal handler is different; this is the reason why we check against more - than one pattern. - - On this target, the return address is right after the call and every - instruction is 4 bytes long. For the simple case of a null dereference in - a single-threaded app, it went like: - - # Check that we indeed have something we expect: the instruction right - # before the return address is within a __sigtramp function and is a call. - - [... run gdb and break at the signal handler entry ...] - - (gdb) x /i $ra-4 - <__sigtramp+160>: jsr ra,(a3),0x3ff800d0ed4 <_fpdata+36468> - - # Look at the code around that return address, and eventually observe a - # significantly large chunk of *constant* code right before the call: - - (gdb) x /10i $ra-44 - <__sigtramp+120>: lda gp,-27988(gp) - <__sigtramp+124>: ldq at,-18968(gp) - <__sigtramp+128>: lda t0,-1 - <__sigtramp+132>: stq t0,0(at) - <__sigtramp+136>: ldq at,-18960(gp) - <__sigtramp+140>: ldl t1,8(at) - <__sigtramp+144>: ldq at,-18960(gp) - <__sigtramp+148>: stl t1,12(at) - <__sigtramp+152>: ldq at,-18960(gp) - <__sigtramp+156>: stl t0,8(at) - - # The hexadecimal equivalent that we will have to match is: - - (gdb) x /10x $ra-44 - <__sigtramp+120>: 0x23bd92ac 0xa79db5e8 0x203fffff 0xb43c0000 - <__sigtramp+136>: 0xa79db5f0 0xa05c0008 0xa79db5f0 0xb05c000c - <__sigtramp+152>: 0xa79db5f0 0xb03c0008 - - The problem observed on this target with this approach is that although - we found a constant set of instruction patterns there were some - gp-related offsets that made the machine code to differ from one - installation to another. This problem could have been overcome by masking - these offsets, but we found that it would be simpler and more efficient to - check whether the return address was part of a signal handler, by comparing - it against some expected code offset from __sigtramp. - - # Check that we indeed have something we expect: the instruction - # right before the return address is within a __sigtramp - # function and is a call. We also need to obtain the offset - # between the return address and the start address of __sigtramp. - - [... run gdb and break at the signal handler entry ...] - - (gdb) x /2i $ra-4 - <__sigtramp+160>: jsr ra,(a3),0x3ff800d0ed4 <_fpdata+36468> - <__sigtramp+164>: ldah gp,16381(ra) - - (gdb) p (long)$ra - (long)&__sigtramp - $2 = 164 - - -------------------------------------------------------------------------- - - 2/ Once we know we are going through a signal handler, we need a way to - retrieve information about the interrupted run-time context. - - On this platform, the third handler's argument is a pointer to a structure - describing this context (struct sigcontext *). We unfortunately have no - direct way to transfer this value here, so a couple of tricks are required - to compute it. - - As documented at least in some header files (e.g. sys/machine/context.h), - the structure the handler gets a pointer to is located on the stack. As of - today, while writing this macro, we have unfortunately not been able to - find a detailed description of the full stack layout at handler entry time, - so we'll have to resort to empirism :) - - When unwinding here, we have the handler's CFA at hand, as part of the - current unwinding context which is one of our arguments. We presume that - for each call to a signal handler by the same kernel routine, the context's - structure location on the stack is always at the same offset from the - handler's CFA, and we compute that offset from bare observation: - - For the simple case of a bare null dereference in a single-threaded app, - computing the offset was done using GNAT like this: - - # Break on the first handler's instruction, before the prologue to have the - # CFA in $sp, and get there: - - (gdb) b *&__gnat_error_handler - Breakpoint 1 at 0x120016090: file init.c, line 378. - - (gdb) r - Program received signal SIGSEGV, Segmentation fault. - - (gdb) c - Breakpoint 1, __gnat_error_handler (sig=..., sip=..., context=...) - - # The displayed argument value are meaningless because we stopped before - # their final "homing". We know they are passed through $a0, $a1 and $a2 - # from the ABI, though, so ... - - # Observe that $sp and the context pointer are in the same (stack) area, - # and compute the offset: - - (gdb) p /x $sp - $2 = 0x11fffbc80 - - (gdb) p /x $a2 - $3 = 0x11fffbcf8 - - (gdb) p /x (long)$a2 - (long)$sp - $4 = 0x78 - - -------------------------------------------------------------------------- - - 3/ Once we know we are unwinding through a signal handler and have the - address of the structure describing the interrupted context at hand, we - have to fill the internal frame-state/unwind-context structures properly - to allow the unwinding process to proceed. - - Roughly, we are provided with an *unwinding* CONTEXT, describing the state - of some point P in the call chain we are unwinding through. The macro we - implement has to fill a "frame state" structure FS that describe the P's - caller state, by way of *rules* to compute its CFA, return address, and - **saved** registers *locations*. - - For the case we are going to deal with, the caller is some kernel code - calling a signal handler, and: - - o The saved registers are all in the interrupted run-time context, - - o The CFA is the stack pointer value when the kernel code is entered, that - is, the stack pointer value at the interruption point, also part of the - interrupted run-time context. - - o We want the return address to appear as the address of the active - instruction at the interruption point, so that the unwinder proceeds as - if the interruption had been a regular call. This address is also part - of the interrupted run-time context. - - -- - - Also, note that there is an important difference between the return address - we need to claim for the kernel frame and the value of the return address - register at the interruption point. - - The latter might be required to be able to unwind past the interrupted - routine, for instance if it is interrupted before saving the incoming - register value in its own frame, which may typically happen during stack - probes for stack-checking purposes. - - It is then essential that the rules stated to locate the kernel frame - return address don't clobber the rules describing where is saved the return - address register at the interruption point, so some scratch register state - entry should be used for the former. We have DWARF_ALT_FRAME_RETURN_COLUMN - at hand exactly for that purpose. - - -------------------------------------------------------------------------- - - 4/ Depending on the context (single-threaded or multi-threaded app, ...), - the code calling the handler and the handler-cfa to interrupted-context - offset might change, so we use a simple generic data structure to track - the possible variants. */ - -/* This is the structure to wrap information about each possible sighandler - caller we may have to identify. */ - -typedef struct { - /* Expected return address when being called from a sighandler. */ - void *ra_value; - - /* Offset to get to the sigcontext structure from the handler's CFA - when the pattern matches. */ - int cfa_to_context_offset; - -} sighandler_call_t; - -/* Helper macro for MD_FALLBACK_FRAME_STATE_FOR below. - - Look at RA to see if it matches within a sighandler caller. - Set SIGCTX to the corresponding sigcontext structure (computed from - CFA) if it does, or to 0 otherwise. */ - -#define COMPUTE_SIGCONTEXT_FOR(RA,CFA,SIGCTX) \ -do { \ - /* Define and register the applicable patterns. */ \ - extern void __sigtramp (void); \ - \ - sighandler_call_t sighandler_calls [] = { \ - {__sigtramp + 164, 0x78} \ - }; \ - \ - int n_patterns_to_match \ - = sizeof (sighandler_calls) / sizeof (sighandler_call_t); \ - \ - int pn; /* pattern number */ \ - \ - int match = 0; /* Did last pattern match ? */ \ - \ - /* Try to match each pattern in turn. */ \ - for (pn = 0; !match && pn < n_patterns_to_match; pn ++) \ - match = ((RA) == sighandler_calls[pn].ra_value); \ - \ - (SIGCTX) = (struct sigcontext *) \ - (match ? ((CFA) + sighandler_calls[pn - 1].cfa_to_context_offset) : 0); \ -} while (0); - -#include <sys/context_t.h> - -#define REG_SP 30 /* hard reg for stack pointer */ -#define REG_RA 26 /* hard reg for return address */ - -#define MD_FALLBACK_FRAME_STATE_FOR alpha_fallback_frame_state - -static _Unwind_Reason_Code -alpha_fallback_frame_state (struct _Unwind_Context *context, - _Unwind_FrameState *fs) -{ - /* Return address and CFA of the frame we're attempting to unwind through, - possibly a signal handler. */ - void *ctx_ra = (void *)context->ra; - void *ctx_cfa = (void *)context->cfa; - - /* CFA of the intermediate abstract kernel frame between the interrupted - code and the signal handler, if we're indeed unwinding through a signal - handler. */ - void *k_cfa; - - /* Pointer to the sigcontext structure pushed by the kernel when we're - unwinding through a signal handler. */ - struct sigcontext *sigctx; - int i; - - COMPUTE_SIGCONTEXT_FOR (ctx_ra, ctx_cfa, sigctx); - - if (sigctx == 0) - return _URC_END_OF_STACK; - - /* The kernel frame's CFA is exactly the stack pointer value at the - interruption point. */ - k_cfa = (void *) sigctx->sc_regs [REG_SP]; - - /* State the rules to compute the CFA we have the value of: use the - previous CFA and offset by the difference between the two. See - uw_update_context_1 for the supporting details. */ - fs->regs.cfa_how = CFA_REG_OFFSET; - fs->regs.cfa_reg = __builtin_dwarf_sp_column (); - fs->regs.cfa_offset = k_cfa - ctx_cfa; - - /* Fill the internal frame_state structure with information stating - where each register of interest in the saved context can be found - from the CFA. */ - - /* The general registers are in sigctx->sc_regs. Leave out r31, which - is read-as-zero. It makes no sense restoring it, and we are going to - use the state entry for the kernel return address rule below. - - This loop must cover at least all the callee-saved registers, and - we just don't bother specializing the set here. */ - for (i = 0; i <= 30; i ++) - { - fs->regs.reg[i].how = REG_SAVED_OFFSET; - fs->regs.reg[i].loc.offset - = (void *) &sigctx->sc_regs[i] - (void *) k_cfa; - } - - /* Ditto for the floating point registers in sigctx->sc_fpregs. */ - for (i = 0; i <= 31; i ++) - { - fs->regs.reg[32+i].how = REG_SAVED_OFFSET; - fs->regs.reg[32+i].loc.offset - = (void *) &sigctx->sc_fpregs[i] - (void *) k_cfa; - } - - /* State the rules to find the kernel's code "return address", which - is the address of the active instruction when the signal was caught, - in sigctx->sc_pc. Use DWARF_ALT_FRAME_RETURN_COLUMN since the return - address register is a general register and should be left alone. */ - fs->retaddr_column = DWARF_ALT_FRAME_RETURN_COLUMN; - fs->regs.reg[DWARF_ALT_FRAME_RETURN_COLUMN].how = REG_SAVED_OFFSET; - fs->regs.reg[DWARF_ALT_FRAME_RETURN_COLUMN].loc.offset - = (void *) &sigctx->sc_pc - (void *) k_cfa; - fs->signal_frame = 1; - - return _URC_NO_REASON; -} diff --git a/libgcc/config/alpha/t-osf-pthread b/libgcc/config/alpha/t-osf-pthread deleted file mode 100644 index 9a175dbeb9e..00000000000 --- a/libgcc/config/alpha/t-osf-pthread +++ /dev/null @@ -1,5 +0,0 @@ -# Compile libgcc2 with POSIX threads supports -HOST_LIBGCC2_CFLAGS += -pthread - -# Provide dummy POSIX threads functions -LIB2ADD += $(srcdir)/config/alpha/gthr-posix.c diff --git a/libgcc/config/alpha/t-slibgcc-osf b/libgcc/config/alpha/t-slibgcc-osf deleted file mode 100644 index 66e5cf12aa1..00000000000 --- a/libgcc/config/alpha/t-slibgcc-osf +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2011 -# Free Software Foundation, Inc. -# -# This file is part of GCC. -# -# GCC is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GCC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GCC; see the file COPYING3. If not see -# <http://www.gnu.org/licenses/>. - -# Build a shared libgcc library with the Tru64 UNIX linker. - -SHLIB_LDFLAGS = -Wl,-msym -Wl,-set_version,gcc.1 -Wl,-soname,$(SHLIB_SONAME) \ - -Wl,-hidden -Wl,-input,$(SHLIB_MAP) - -SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk -SHLIB_MKMAP_OPTS = -v osf_export=1 -# Needed so mkmap-flat.awk can parse the nm output. -SHLIB_NM_FLAGS = -Bg -SHLIB_MAPFILES = libgcc-std.ver $(srcdir)/config/alpha/libgcc-osf5.ver diff --git a/libgcc/config/alpha/t-vms b/libgcc/config/alpha/t-vms index dd5760d9747..870e44c8dd1 100644 --- a/libgcc/config/alpha/t-vms +++ b/libgcc/config/alpha/t-vms @@ -7,3 +7,5 @@ vms-dwarf2eh.o: $(srcdir)/config/alpha/vms-dwarf2eh.S $(gcc_compile) -c -x assembler-with-cpp $< LIB2ADD += $(srcdir)/config/alpha/vms-gcc_shell_handler.c + +HOST_LIBGCC2_CFLAGS=-mpointer-size=64 diff --git a/libgcc/config/arm/crtn.S b/libgcc/config/arm/crtn.S index 8c5f22572f7..7b2b0a0a679 100644 --- a/libgcc/config/arm/crtn.S +++ b/libgcc/config/arm/crtn.S @@ -1,4 +1,4 @@ -# Copyright (C) 2001, 2004, 2008, 2009, 2010, 2011 +# Copyright (C) 2001, 2004, 2008, 2009, 2010, 2011, 2012 # Free Software Foundation, Inc. # Written By Nick Clifton # @@ -47,7 +47,7 @@ # # Note - we do not try any fancy optimizations of the return # sequences here, it is just not worth it. Instead keep things - # simple. Restore all the save resgisters, including the link + # simple. Restore all the save registers, including the link # register and then perform the correct function return instruction. # We also save/restore r3 to ensure stack alignment. .macro FUNC_END diff --git a/libgcc/config/i386/sol2-unwind.h b/libgcc/config/i386/sol2-unwind.h index d93b60c781c..176fa69a091 100644 --- a/libgcc/config/i386/sol2-unwind.h +++ b/libgcc/config/i386/sol2-unwind.h @@ -1,5 +1,5 @@ /* DWARF2 EH unwinding support for AMD x86-64 and x86. - Copyright (C) 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2009, 2010, 2012 Free Software Foundation, Inc. This file is part of GCC. @@ -144,55 +144,23 @@ x86_fallback_frame_state (struct _Unwind_Context *context, mcontext_t *mctx; long new_cfa; - if (/* Solaris 8 - single-threaded + if (/* Solaris 9 - single-threaded ---------------------------- - <sigacthandler+17>: mov 0x10(%ebp),%esi - <sigacthandler+20>: push %esi - <sigacthandler+21>: pushl 0xc(%ebp) - <sigacthandler+24>: mov 0x8(%ebp),%ecx - <sigacthandler+27>: push %ecx - <sigacthandler+28>: mov offset(%ebx),%eax - <sigacthandler+34>: call *(%eax,%ecx,4) - <sigacthandler+37>: add $0xc,%esp <--- PC - <sigacthandler+40>: push %esi ... */ - (*(unsigned long *)(pc - 20) == 0x5610758b - && *(unsigned long *)(pc - 16) == 0x8b0c75ff - && *(unsigned long *)(pc - 12) == 0x8b51084d - && *(unsigned char *)(pc - 8) == 0x83 - && *(unsigned long *)(pc - 4) == 0x8814ff00 - && *(unsigned long *)(pc - 0) == 0x560cc483) - - || /* Solaris 8 - multi-threaded - --------------------------- - <__sighndlr+0>: push %ebp - <__sighndlr+1>: mov %esp,%ebp - <__sighndlr+3>: pushl 0x10(%ebp) - <__sighndlr+6>: pushl 0xc(%ebp) - <__sighndlr+9>: pushl 0x8(%ebp) - <__sighndlr+12>: call *0x14(%ebp) - <__sighndlr+15>: leave <--- PC */ - (*(unsigned long *)(pc - 15) == 0xffec8b55 - && *(unsigned long *)(pc - 11) == 0x75ff1075 - && *(unsigned long *)(pc - 7) == 0x0875ff0c - && *(unsigned long *)(pc - 3) == 0xc91455ff) - - || /* Solaris 9 - single-threaded - ---------------------------- - <sigacthandler+16>: mov 0x244(%ebx),%ecx - <sigacthandler+22>: mov 0x8(%ebp),%eax - <sigacthandler+25>: mov (%ecx,%eax,4),%ecx - <sigacthandler+28>: pushl 0x10(%ebp) - <sigacthandler+31>: pushl 0xc(%ebp) - <sigacthandler+34>: push %eax - <sigacthandler+35>: call *%ecx - <sigacthandler+37>: add $0xc,%esp <--- PC - <sigacthandler+40>: pushl 0x10(%ebp) */ - (*(unsigned long *)(pc - 21) == 0x2448b8b - && *(unsigned long *)(pc - 17) == 0x458b0000 - && *(unsigned long *)(pc - 13) == 0x810c8b08 - && *(unsigned long *)(pc - 9) == 0xff1075ff - && *(unsigned long *)(pc - 5) == 0xff500c75 - && *(unsigned long *)(pc - 1) == 0xcc483d1) + <sigacthandler+16>: mov 0x244(%ebx),%ecx + <sigacthandler+22>: mov 0x8(%ebp),%eax + <sigacthandler+25>: mov (%ecx,%eax,4),%ecx + <sigacthandler+28>: pushl 0x10(%ebp) + <sigacthandler+31>: pushl 0xc(%ebp) + <sigacthandler+34>: push %eax + <sigacthandler+35>: call *%ecx + <sigacthandler+37>: add $0xc,%esp <--- PC + <sigacthandler+40>: pushl 0x10(%ebp) */ + (*(unsigned long *)(pc - 21) == 0x2448b8b + && *(unsigned long *)(pc - 17) == 0x458b0000 + && *(unsigned long *)(pc - 13) == 0x810c8b08 + && *(unsigned long *)(pc - 9) == 0xff1075ff + && *(unsigned long *)(pc - 5) == 0xff500c75 + && *(unsigned long *)(pc - 1) == 0xcc483d1) || /* Solaris 9 - multi-threaded, Solaris 10 --------------------------------------- diff --git a/libgcc/config/ia64/t-vms b/libgcc/config/ia64/t-vms index 140c748b771..e95c58d8b50 100644 --- a/libgcc/config/ia64/t-vms +++ b/libgcc/config/ia64/t-vms @@ -5,3 +5,5 @@ crtinitS.o: $(srcdir)/config/ia64/vms-crtinit.S $(gcc_compile) -c -x assembler-with-cpp $< LIB2ADDEH += $(srcdir)/config/ia64/fde-vms.c + +HOST_LIBGCC2_CFLAGS=-mpointer-size=64 diff --git a/libgcc/config/mips/irix-crti.S b/libgcc/config/mips/irix-crti.S deleted file mode 100644 index b9fc1918f74..00000000000 --- a/libgcc/config/mips/irix-crti.S +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright (C) 2004, 2008, 2011 Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 3, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -Under Section 7 of GPL version 3, you are granted additional -permissions described in the GCC Runtime Library Exception, version -3.1, as published by the Free Software Foundation. - -You should have received a copy of the GNU General Public License and -a copy of the GCC Runtime Library Exception along with this program; -see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -<http://www.gnu.org/licenses/>. */ - - .abicalls - .set noreorder - .set nomacro - -/* The GNU and SGI linkers differ in their implementation of -init and -fini. - With the GNU linker, there can only be a single -init option, and the - linker simply sets DT_INIT to that value. gcc's initialization and - finalization code can go directly in .init, with the prologue and - epilogue of the main initialization routine being provided by external - object files (*crti.o and *crtn.o in this case). - - The SGI linker instead accepts several -init options. It will set DT_INIT - to a linker-created function (placed in .init) that calls each of the -init - functions in turn. If there is any user code in .init, this linker-created - function will be placed after it. Note that such user code is not treated - specially; it will only be called if the -init options arrange for it to - be called. - - In theory, the SGI model should allow the crti, crtn and intermediate code - to go in .init, just like it can with the GNU linker. However, doing this - seems to confuse the linker and triggers an internal error: - - ld32: FATAL 2 : Internal: at ../../ld/mips_code.c mips_code_fixup() - text section overflow! - - (seen with MIPSpro 7.30). We therefore put everything in a special - .gcc_init section instead. */ - - .section .gcc_init,"ax",@progbits - .globl __gcc_init -__gcc_init: - daddiu $sp,$sp,-16 - sd $31,0($sp) - sd $28,8($sp) - - .section .gcc_fini,"ax",@progbits - .globl __gcc_fini -__gcc_fini: - daddiu $sp,$sp,-16 - sd $31,0($sp) - sd $28,8($sp) - -/* This object will typically be included in the final link for both - shared libraries and executable, and we need to hide the symbols to - prevent possible symbol preemption warnings from the SGI linker. */ -.hidden __gcc_init -.hidden __gcc_fini - diff --git a/libgcc/config/mips/irix-crtn.S b/libgcc/config/mips/irix-crtn.S deleted file mode 100644 index 8194cacf5d7..00000000000 --- a/libgcc/config/mips/irix-crtn.S +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright (C) 2004, 2011 Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free -Software Foundation; either version 3, or (at your option) any later -version. - -GCC is distributed in the hope that it will be useful, but WITHOUT ANY -WARRANTY; without even the implied warranty of MERCHANTABILITY or -FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -for more details. - -Under Section 7 of GPL version 3, you are granted additional -permissions described in the GCC Runtime Library Exception, version -3.1, as published by the Free Software Foundation. - -You should have received a copy of the GNU General Public License and -a copy of the GCC Runtime Library Exception along with this program; -see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -<http://www.gnu.org/licenses/>. */ - - .abicalls - .set noreorder - .set nomacro - - .section .gcc_init,"ax",@progbits - ld $31,0($sp) - ld $28,8($sp) - jr $31 - daddiu $sp,$sp,16 - - .section .gcc_fini,"ax",@progbits - ld $31,0($sp) - ld $28,8($sp) - jr $31 - daddiu $sp,$sp,16 diff --git a/libgcc/config/mips/irix6-unwind.h b/libgcc/config/mips/irix6-unwind.h deleted file mode 100644 index e862560fe34..00000000000 --- a/libgcc/config/mips/irix6-unwind.h +++ /dev/null @@ -1,180 +0,0 @@ -/* DWARF2 EH unwinding support for MIPS IRIX 6. - Copyright (C) 2011 Free Software Foundation, Inc. - -This file is part of GCC. - -GCC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 3, or (at your option) -any later version. - -GCC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -Under Section 7 of GPL version 3, you are granted additional -permissions described in the GCC Runtime Library Exception, version -3.1, as published by the Free Software Foundation. - -You should have received a copy of the GNU General Public License and -a copy of the GCC Runtime Library Exception along with this program; -see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -<http://www.gnu.org/licenses/>. */ - -/* Do code reading to identify a signal frame, and set the frame - state data appropriately. See unwind-dw2.c for the structs. */ - -/* This code was developed-for and only tested-in limited ABI - configurations. Characterize that. */ - -#if defined (_ABIN32) || defined (_ABI64) -#define SUPPORTED_ABI 1 -#else -#define SUPPORTED_ABI 0 -#endif - -#include <signal.h> - -#define MD_FALLBACK_FRAME_STATE_FOR mips_fallback_frame_state - -/* Look at the code around RA to see if it matches a sighandler caller with a - sigcontext_t * argument (SA_SIGINFO cleared). Return that pointer argument - if it does match, or 0 otherwise. */ - -static sigcontext_t * -sigcontext_for (unsigned int *ra, void *cfa) -{ - /* IRIX 6.5, mono-threaded application. We're lucky enough to be able - to expect a short very sighandler specific sequence around. - - <_sigtramp+124>: li v0,1088 (SYS_sigreturn) - <_sigtramp+128>: syscall */ - - if ( ra[6] == 0x24020440 - && ra[7] == 0x0000000c) - return (sigcontext_t *)(cfa + 0x30); - - /* IRIX 6.5 variants, multi-threaded application, pthreads. Nothing really - sighandler specific handy, so match a fairly long constant sequence. */ - -#if _MIPS_SIM == _ABIN32 - /* - <sig_fixup_mask+40>: sd s0,0(sp) - <sig_fixup_mask+44>: sll ra,a0,0x2 - <sig_fixup_mask+48>: addiu t9,t9,-28584/-28456/-28448 - <sig_fixup_mask+52>: lw s0,3804(at) - <sig_fixup_mask+56>: addu t9,t9,ra - <sig_fixup_mask+60>: lw t9,0(t9) - <sig_fixup_mask+64>: ld at,3696(at) - <sig_fixup_mask+68>: ld s2,88(s0) - <sig_fixup_mask+72>: jalr t9 - <sig_fixup_mask+76>: sd at,88(s0) */ - if ( ra[-10] == 0xffb00000 - && ra[ -9] == 0x0004f880 - && (ra[-8] == 0x27399058 - || ra[-8] == 0x273990d8 - || ra[-8] == 0x273990e0) - && ra[ -7] == 0x8c300edc - && ra[ -6] == 0x033fc821 - && ra[ -5] == 0x8f390000 - && ra[ -4] == 0xdc210e70 - && ra[ -3] == 0xde120058 - && ra[ -2] == 0x0320f809 - && ra[ -1] == 0xfe010058) - -#elif _MIPS_SIM == _ABI64 - /* - <sig_fixup_mask+44>: sd s0,0(sp) - <sig_fixup_mask+48>: daddu t9,t9,ra - <sig_fixup_mask+52>: dsll ra,a0,0x3 - <sig_fixup_mask+56>: ld s0,3880(at) - <sig_fixup_mask+60>: daddu t9,t9,ra - <sig_fixup_mask+64>: ld t9,0(t9) - <sig_fixup_mask+68>: ld at,3696(at) - <sig_fixup_mask+72>: ld s2,152(s0) - <sig_fixup_mask+76>: jalr t9 - <sig_fixup_mask+80>: sd at,152(s0) */ - if ( ra[-10] == 0xffb00000 - && ra[ -9] == 0x033fc82d - && ra[ -8] == 0x0004f8f8 - && ra[ -7] == 0xdc300f28 - && ra[ -6] == 0x033fc82d - && ra[ -5] == 0xdf390000 - && ra[ -4] == 0xdc210e70 - && ra[ -3] == 0xde120098 - && ra[ -2] == 0x0320f809 - && ra[ -1] == 0xfe010098) -#endif - return (sigcontext_t *)(cfa + 0x60); - - return 0; -} - -#define SIGCTX_GREG_ADDR(REGNO,SIGCTX) \ - ((void *) &(SIGCTX)->sc_regs[REGNO]) - -#define SIGCTX_FPREG_ADDR(REGNO,SIGCTX) \ - ((void *) &(SIGCTX)->sc_fpregs[REGNO]) - -static _Unwind_Reason_Code -mips_fallback_frame_state (struct _Unwind_Context *context, - _Unwind_FrameState *fs) -{ - /* Return address and CFA of the frame we're attempting to unwind through, - possibly a signal handler. */ - void *ctx_ra = (void *)context->ra; - void *ctx_cfa = (void *)context->cfa; - - /* CFA of the intermediate abstract kernel frame between the interrupted - code and the signal handler, if we're indeed unwinding through a signal - handler. */ - void *k_cfa; - - /* Pointer to the sigcontext_t structure pushed by the kernel when we're - unwinding through a signal handler setup with SA_SIGINFO cleared. */ - sigcontext_t *sigctx; - int i; - - if (! SUPPORTED_ABI) - return _URC_END_OF_STACK; - - sigctx = sigcontext_for (ctx_ra, ctx_cfa); - - if (sigctx == 0) - return _URC_END_OF_STACK; - - /* The abstract kernel frame's CFA is extactly the stack pointer - value at the interruption point. */ - k_cfa = *(void **)SIGCTX_GREG_ADDR (CTX_SP, sigctx); - - /* State the rules to compute the CFA we have the value of: use the - previous CFA and offset by the difference between the two. See - uw_update_context_1 for the supporting details. */ - fs->regs.cfa_how = CFA_REG_OFFSET; - fs->regs.cfa_reg = __builtin_dwarf_sp_column (); - fs->regs.cfa_offset = k_cfa - ctx_cfa; - - /* Fill the internal frame_state structure with information stating where - each register of interest can be found from the CFA. */ - for (i = 0; i <= 31; i ++) - { - fs->regs.reg[i].how = REG_SAVED_OFFSET; - fs->regs.reg[i].loc.offset = SIGCTX_GREG_ADDR (i, sigctx) - k_cfa; - } - - for (i = 0; i <= 31; i ++) - { - fs->regs.reg[32+i].how = REG_SAVED_OFFSET; - fs->regs.reg[32+i].loc.offset = SIGCTX_FPREG_ADDR (i, sigctx) - k_cfa; - } - - /* State the rules to find the kernel's code "return address", which is the - address of the active instruction when the signal was caught. */ - fs->retaddr_column = DWARF_FRAME_RETURN_COLUMN; - fs->regs.reg[fs->retaddr_column].how = REG_SAVED_OFFSET; - fs->regs.reg[fs->retaddr_column].loc.offset = (void *)&sigctx->sc_pc - k_cfa; - fs->signal_frame = 1; - - return _URC_NO_REASON; -} diff --git a/libgcc/config/mips/t-irix6 b/libgcc/config/mips/t-irix6 deleted file mode 100644 index c9bd3cdcb0a..00000000000 --- a/libgcc/config/mips/t-irix6 +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright (C) 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, -# 2006, 2010, 2011 Free Software Foundation, Inc. -# -# This file is part of GCC. -# -# GCC is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GCC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GCC; see the file COPYING3. If not see -# <http://www.gnu.org/licenses/>. - -irix-crti.o: $(srcdir)/config/mips/irix-crti.S - $(crt_compile) -c $< - -irix-crtn.o: $(srcdir)/config/mips/irix-crtn.S - $(crt_compile) -c $< diff --git a/libgcc/config/mips/t-slibgcc-irix b/libgcc/config/mips/t-slibgcc-irix deleted file mode 100644 index 47b2e0eec21..00000000000 --- a/libgcc/config/mips/t-slibgcc-irix +++ /dev/null @@ -1,7 +0,0 @@ -# Build a shared libgcc library with the SGI linker. - -SHLIB_LDFLAGS = -Wl,-soname,$(SHLIB_SONAME) \ - -Wl,-exports_file,$(SHLIB_MAP) - -SHLIB_MKMAP = $(srcdir)/mkmap-flat.awk -SHLIB_MAPFILES = libgcc-std.ver diff --git a/libgcc/config/sparc/sol2-unwind.h b/libgcc/config/sparc/sol2-unwind.h index 1458950063a..6458ae25838 100644 --- a/libgcc/config/sparc/sol2-unwind.h +++ b/libgcc/config/sparc/sol2-unwind.h @@ -36,44 +36,25 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see static int sparc64_is_sighandler (unsigned int *pc, void *cfa, int *nframes) { - if (/* Solaris 8 - single-threaded + if (/* Solaris 9 - single-threaded ---------------------------- - <sigacthandler+24>: add %g5, %o7, %o2 - <sigacthandler+28>: ldx [ %o2 + 0xfa0 ], %g5 - <sigacthandler+32>: sra %i0, 0, %o0 - <sigacthandler+36>: sllx %o0, 3, %g4 + The pattern changes slightly in different versions of the + operating system, so we skip the comparison against pc[-6] for + Solaris 9. + + <sigacthandler+24>: sra %i0, 0, %l1 + + Solaris 9 5/02: + <sigacthandler+28>: ldx [ %o2 + 0xf68 ], %g5 + Solaris 9 9/05: + <sigacthandler+28>: ldx [ %o2 + 0xe50 ], %g5 + + <sigacthandler+32>: sllx %l1, 3, %g4 + <sigacthandler+36>: mov %l1, %o0 <sigacthandler+40>: ldx [ %g4 + %g5 ], %l0 <sigacthandler+44>: call %l0 <sigacthandler+48>: mov %i2, %o2 - <sigacthandler+52>: cmp %i3, 8 <--- PC */ - ( pc[-7] == 0x9401400f - && pc[-6] == 0xca5aafa0 - && pc[-5] == 0x913e2000 - && pc[-4] == 0x892a3003 - && pc[-3] == 0xe0590005 - && pc[-2] == 0x9fc40000 - && pc[-1] == 0x9410001a - && pc[ 0] == 0x80a6e008) - - || /* Solaris 9 - single-threaded - ---------------------------- - The pattern changes slightly in different versions of the - operating system, so we skip the comparison against pc[-6] for - Solaris 9. - - <sigacthandler+24>: sra %i0, 0, %l1 - - Solaris 9 5/02: - <sigacthandler+28>: ldx [ %o2 + 0xf68 ], %g5 - Solaris 9 9/05: - <sigacthandler+28>: ldx [ %o2 + 0xe50 ], %g5 - - <sigacthandler+32>: sllx %l1, 3, %g4 - <sigacthandler+36>: mov %l1, %o0 - <sigacthandler+40>: ldx [ %g4 + %g5 ], %l0 - <sigacthandler+44>: call %l0 - <sigacthandler+48>: mov %i2, %o2 - <sigacthandler+52>: cmp %l1, 8 <--- PC */ + <sigacthandler+52>: cmp %l1, 8 <--- PC */ ( pc[-7] == 0xa33e2000 /* skip pc[-6] */ && pc[-5] == 0x892c7003 @@ -147,8 +128,7 @@ sparc64_is_sighandler (unsigned int *pc, void *cfa, int *nframes) } else if (cuh_pattern == 0x9410001a || cuh_pattern == 0x94100013) - /* This matches the call_user_handler pattern for Solaris 9 and - for Solaris 8 running inside Solaris Containers respectively + /* This matches the call_user_handler pattern for Solaris 9. We need to move up three frames: <signal handler> <-- context->cfa @@ -159,17 +139,6 @@ sparc64_is_sighandler (unsigned int *pc, void *cfa, int *nframes) */ *nframes = 3; - else /* cuh_pattern == 0xe0272010 */ - /* This is the default Solaris 8 case. - We need to move up two frames: - - <signal handler> <-- context->cfa - __sighndlr - sigacthandler - <kernel> - */ - *nframes = 2; - return 1; } @@ -211,8 +180,8 @@ sparc64_frob_update_context (struct _Unwind_Context *context, static int sparc_is_sighandler (unsigned int *pc, void *cfa, int *nframes) { - if (/* Solaris 8, 9 - single-threaded - ------------------------------- + if (/* Solaris 9 - single-threaded + ---------------------------- The pattern changes slightly in different versions of the operating system, so we skip the comparison against pc[-6]. @@ -247,37 +216,6 @@ sparc_is_sighandler (unsigned int *pc, void *cfa, int *nframes) return 1; } - if (/* Solaris 8 - multi-threaded - --------------------------- - <__libthread_segvhdlr+212>: clr %o2 - <__libthread_segvhdlr+216>: ld [ %fp + -28 ], %l0 - <__libthread_segvhdlr+220>: mov %i4, %o0 - <__libthread_segvhdlr+224>: mov %i1, %o1 - <__libthread_segvhdlr+228>: call %l0 - <__libthread_segvhdlr+232>: mov %i2, %o2 - <__libthread_segvhdlr+236>: ret <--- PC - <__libthread_segvhdlr+240>: restore - <__libthread_segvhdlr+244>: cmp %o1, 0 */ - pc[-6] == 0x94102000 - && pc[-5] == 0xe007bfe4 - && pc[-4] == 0x9010001c - && pc[-3] == 0x92100019 - && pc[-2] == 0x9fc40000 - && pc[-1] == 0x9410001a - && pc[ 0] == 0x81c7e008 - && pc[ 1] == 0x81e80000 - && pc[ 2] == 0x80a26000) - { - /* We need to move up one frame: - - <signal handler> <-- context->cfa - __libthread_segvhdlr - <kernel> - */ - *nframes = 1; - return 1; - } - if(/* Solaris 8+ - multi-threaded ---------------------------- <__sighndlr>: save %sp, -96, %sp @@ -332,8 +270,7 @@ sparc_is_sighandler (unsigned int *pc, void *cfa, int *nframes) } else if (cuh_pattern == 0x9410001a || cuh_pattern == 0x9410001b) - /* This matches the call_user_handler pattern for Solaris 9 and - for Solaris 8 running inside Solaris Containers respectively. + /* This matches the call_user_handler pattern for Solaris 9. We need to move up three frames: <signal handler> <-- context->cfa @@ -344,17 +281,6 @@ sparc_is_sighandler (unsigned int *pc, void *cfa, int *nframes) */ *nframes = 3; - else /* cuh_pattern == 0x90100018 */ - /* This is the default Solaris 8 case. - We need to move up two frames: - - <signal handler> <-- context->cfa - __sighndlr - sigacthandler - <kernel> - */ - *nframes = 2; - return 1; } diff --git a/libgcc/config/t-crtfm b/libgcc/config/t-crtfm index 1d3b8ecfc35..61e62696bfd 100644 --- a/libgcc/config/t-crtfm +++ b/libgcc/config/t-crtfm @@ -1,5 +1,2 @@ -# -frandom-seed is necessary to avoid bootstrap comparison failures due to -# changing mangled names of the constructor on Tru64 Unix, but harmless -# otherwise. crtfastmath.o: $(srcdir)/config/$(cpu_type)/crtfastmath.c - $(gcc_compile) -frandom-seed=gcc-crtfastmath -c $< + $(gcc_compile) -c $< diff --git a/libgcc/gthr-posix.h b/libgcc/gthr-posix.h index a935e929184..b5b161184f4 100644 --- a/libgcc/gthr-posix.h +++ b/libgcc/gthr-posix.h @@ -1,7 +1,7 @@ /* Threads compatibility routines for libgcc2 and libobjc. */ /* Compile this one with gcc. */ /* Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. This file is part of GCC. @@ -33,11 +33,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define __GTHREADS 1 #define __GTHREADS_CXX0X 1 -/* Some implementations of <pthread.h> require this to be defined. */ -#if !defined(_REENTRANT) && defined(__osf__) -#define _REENTRANT 1 -#endif - #include <pthread.h> #if ((defined(_LIBOBJC) || defined(_LIBOBJC_WEAK)) \ @@ -63,6 +58,7 @@ typedef struct timespec __gthread_time_t; #define __GTHREAD_HAS_COND 1 #define __GTHREAD_MUTEX_INIT PTHREAD_MUTEX_INITIALIZER +#define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function #define __GTHREAD_ONCE_INIT PTHREAD_ONCE_INIT #if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER) #define __GTHREAD_RECURSIVE_MUTEX_INIT PTHREAD_RECURSIVE_MUTEX_INITIALIZER @@ -76,7 +72,6 @@ typedef struct timespec __gthread_time_t; #ifdef _GTHREAD_USE_MUTEX_INIT_FUNC # undef __GTHREAD_MUTEX_INIT -# define __GTHREAD_MUTEX_INIT_FUNCTION __gthread_mutex_init_function #endif #ifdef _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC # undef __GTHREAD_RECURSIVE_MUTEX_INIT @@ -104,39 +99,6 @@ typedef struct timespec __gthread_time_t; /* Typically, __gthrw_foo is a weak reference to symbol foo. */ #define __gthrw(name) __gthrw2(__gthrw_ ## name,name,name) -/* On Tru64, /usr/include/pthread.h uses #pragma extern_prefix "__" to - map a subset of the POSIX pthread API to mangled versions of their - names. */ -#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_) -#define __gthrw3(name) __gthrw2(__gthrw_ ## name, __ ## name, name) -__gthrw3(pthread_once) -__gthrw3(pthread_getspecific) -__gthrw3(pthread_setspecific) - -__gthrw3(pthread_create) -__gthrw3(pthread_join) -__gthrw3(pthread_detach) -__gthrw3(pthread_equal) -__gthrw3(pthread_self) -__gthrw3(pthread_cancel) -__gthrw3(sched_yield) - -__gthrw3(pthread_mutex_lock) -__gthrw3(pthread_mutex_trylock) -#if _GTHREAD_USE_MUTEX_TIMEDLOCK -__gthrw3(pthread_mutex_timedlock) -#endif -__gthrw3(pthread_mutex_unlock) -__gthrw3(pthread_mutex_init) -__gthrw3(pthread_mutex_destroy) - -__gthrw3(pthread_cond_init) -__gthrw3(pthread_cond_broadcast) -__gthrw3(pthread_cond_signal) -__gthrw3(pthread_cond_wait) -__gthrw3(pthread_cond_timedwait) -__gthrw3(pthread_cond_destroy) -#else __gthrw(pthread_once) __gthrw(pthread_getspecific) __gthrw(pthread_setspecific) @@ -166,7 +128,6 @@ __gthrw(pthread_cond_signal) __gthrw(pthread_cond_wait) __gthrw(pthread_cond_timedwait) __gthrw(pthread_cond_destroy) -#endif __gthrw(pthread_key_create) __gthrw(pthread_key_delete) @@ -177,11 +138,7 @@ __gthrw(pthread_mutexattr_destroy) #if defined(_LIBOBJC) || defined(_LIBOBJC_WEAK) /* Objective-C. */ -#if defined(__osf__) && defined(_PTHREAD_USE_MANGLED_NAMES_) -__gthrw3(pthread_exit) -#else __gthrw(pthread_exit) -#endif /* __osf__ && _PTHREAD_USE_MANGLED_NAMES_ */ #ifdef _POSIX_PRIORITY_SCHEDULING #ifdef _POSIX_THREAD_PRIORITY_SCHEDULING __gthrw(sched_get_priority_max) @@ -744,14 +701,12 @@ __gthread_setspecific (__gthread_key_t __key, const void *__ptr) return __gthrw_(pthread_setspecific) (__key, __ptr); } -#ifdef _GTHREAD_USE_MUTEX_INIT_FUNC static inline void __gthread_mutex_init_function (__gthread_mutex_t *__mutex) { if (__gthread_active_p ()) __gthrw_(pthread_mutex_init) (__mutex, NULL); } -#endif static inline int __gthread_mutex_destroy (__gthread_mutex_t *__mutex) diff --git a/libgcc/gthr-single.h b/libgcc/gthr-single.h index 357528ad1f1..4e396797785 100644 --- a/libgcc/gthr-single.h +++ b/libgcc/gthr-single.h @@ -36,6 +36,7 @@ typedef int __gthread_recursive_mutex_t; #define __GTHREAD_ONCE_INIT 0 #define __GTHREAD_MUTEX_INIT 0 +#define __GTHREAD_MUTEX_INIT_FUNCTION(mx) #define __GTHREAD_RECURSIVE_MUTEX_INIT 0 #define UNUSED __attribute__((unused)) diff --git a/libgcc/gthr.h b/libgcc/gthr.h index 03a3ee1d84f..813abe1e57e 100644 --- a/libgcc/gthr.h +++ b/libgcc/gthr.h @@ -52,11 +52,12 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see to initialize __gthread_mutex_t to get a fast non-recursive mutex. __GTHREAD_MUTEX_INIT_FUNCTION - some systems can't initialize a mutex without a - function call. On such systems, define this to a - function which looks like this: + to initialize __gthread_mutex_t to get a fast + non-recursive mutex. + Define this to a function which looks like this: void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *) - Don't define __GTHREAD_MUTEX_INIT in this case + Some systems can't initialize a mutex without a + function call. Don't define __GTHREAD_MUTEX_INIT in this case. __GTHREAD_RECURSIVE_MUTEX_INIT __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION as above, but for a recursive mutex. diff --git a/libgcc/libgcov.c b/libgcc/libgcov.c index d75ae6955ed..1603912de2f 100644 --- a/libgcc/libgcov.c +++ b/libgcc/libgcov.c @@ -30,12 +30,11 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #include "coretypes.h" #include "tm.h" #include "libgcc_tm.h" +#include "gthr.h" #if defined(inhibit_libc) #define IN_LIBGCOV (-1) #else -#undef NULL /* Avoid errors if stdio.h and our stddef.h mismatch. */ -#include <stdio.h> #define IN_LIBGCOV 1 #if defined(L_gcov) #define GCOV_LINKAGE /* nothing */ @@ -705,6 +704,25 @@ __gcov_init (struct gcov_info *info) info->version = 0; } +#ifdef __GTHREAD_MUTEX_INIT +ATTRIBUTE_HIDDEN __gthread_mutex_t __gcov_flush_mx = __GTHREAD_MUTEX_INIT; +#define init_mx_once() +#else +__gthread_mutex_t __gcov_flush_mx ATTRIBUTE_HIDDEN; + +static void +init_mx (void) +{ + __GTHREAD_MUTEX_INIT_FUNCTION (&mx); +} +static void +init_mx_once (void) +{ + static __gthread_once_t once = __GTHREAD_ONCE_INIT; + __gthread_once (&once, init_mx); +} +#endif + /* Called before fork or exec - write out profile information gathered so far and reset it to zero. This avoids duplication or loss of the profile information gathered so far. */ @@ -714,6 +732,9 @@ __gcov_flush (void) { const struct gcov_info *gi_ptr; + init_mx_once (); + __gthread_mutex_lock (&__gcov_flush_mx); + gcov_exit (); for (gi_ptr = gcov_list; gi_ptr; gi_ptr = gi_ptr->next) { @@ -737,6 +758,8 @@ __gcov_flush (void) } } } + + __gthread_mutex_unlock (&__gcov_flush_mx); } #endif /* L_gcov */ @@ -975,8 +998,13 @@ __gcov_ior_profiler (gcov_type *counters, gcov_type value) pid_t __gcov_fork (void) { + pid_t pid; + extern __gthread_mutex_t __gcov_flush_mx; __gcov_flush (); - return fork (); + pid = fork (); + if (pid == 0) + __GTHREAD_MUTEX_INIT_FUNCTION (&__gcov_flush_mx); + return pid; } #endif diff --git a/libgcc/longlong.h b/libgcc/longlong.h index 1a839dd0d30..202637714af 100644 --- a/libgcc/longlong.h +++ b/libgcc/longlong.h @@ -203,7 +203,8 @@ do { \ UDItype __umulsidi3 (USItype, USItype); #endif -#if defined (__arm__) && !defined (__thumb__) && W_TYPE_SIZE == 32 +#if defined (__arm__) && (defined (__thumb2__) || !defined (__thumb__)) \ + && W_TYPE_SIZE == 32 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \ __asm__ ("adds %1, %4, %5\n\tadc %0, %2, %3" \ : "=r" ((USItype) (sh)), \ diff --git a/libgcc/mkmap-flat.awk b/libgcc/mkmap-flat.awk index ec5e1fdf513..234de223c64 100644 --- a/libgcc/mkmap-flat.awk +++ b/libgcc/mkmap-flat.awk @@ -1,5 +1,6 @@ # Generate a flat list of symbols to export. -# Copyright (C) 2007, 2008, 2009, 2011 Free Software Foundation, Inc. +# Copyright (C) 2007, 2008, 2009, 2011, 2012 +# Free Software Foundation, Inc. # Contributed by Richard Henderson <rth@cygnus.com> # # This file is part of GCC. @@ -20,8 +21,6 @@ # Options: # "-v leading_underscore=1" : Symbols in map need leading underscore. -# "-v osf_export=1" : Create -input file for Tru64 UNIX linker -# instead of map file. # "-v pe_dll=1" : Create .DEF file for Windows PECOFF # DLL link instead of map file. @@ -100,10 +99,6 @@ END { } for (sym in export) - if (def[sym] || (pe_dll && def["_" sym])) { - if (!osf_export) - print sym; - else - print "-exported_symbol " sym; - } + if (def[sym] || (pe_dll && def["_" sym])) + print sym; } diff --git a/libgcc/unwind-dw2-fde.c b/libgcc/unwind-dw2-fde.c index 7a783329f7c..b99a432edb9 100644 --- a/libgcc/unwind-dw2-fde.c +++ b/libgcc/unwind-dw2-fde.c @@ -47,11 +47,11 @@ static struct object *seen_objects; #ifdef __GTHREAD_MUTEX_INIT static __gthread_mutex_t object_mutex = __GTHREAD_MUTEX_INIT; +#define init_object_mutex_once() #else +#ifdef __GTHREAD_MUTEX_INIT_FUNCTION static __gthread_mutex_t object_mutex; -#endif -#ifdef __GTHREAD_MUTEX_INIT_FUNCTION static void init_object_mutex (void) { @@ -65,7 +65,11 @@ init_object_mutex_once (void) __gthread_once (&once, init_object_mutex); } #else +/* ??? Several targets include this file with stubbing parts of gthr.h + and expect no locking to be done. */ #define init_object_mutex_once() +static __gthread_mutex_t object_mutex; +#endif #endif /* Called from crtbegin.o to register the unwind info for an object. */ diff --git a/libgcc/unwind-dw2.c b/libgcc/unwind-dw2.c index 475ad00bf52..d1c62eef153 100644 --- a/libgcc/unwind-dw2.c +++ b/libgcc/unwind-dw2.c @@ -294,7 +294,8 @@ _Unwind_SetGRValue (struct _Unwind_Context *context, int index, { index = DWARF_REG_TO_UNWIND_COLUMN (index); gcc_assert (index < (int) sizeof(dwarf_reg_size_table)); - gcc_assert (dwarf_reg_size_table[index] == sizeof (_Unwind_Context_Reg_Val)); + /* Return column size may be smaller than _Unwind_Context_Reg_Val. */ + gcc_assert (dwarf_reg_size_table[index] <= sizeof (_Unwind_Context_Reg_Val)); context->by_value[index] = 1; context->reg[index] = _Unwind_Get_Unwind_Context_Reg_Val (val); |