aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/generic
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-07-22 23:56:53 +0000
committerUlrich Drepper <drepper@redhat.com>2003-07-22 23:56:53 +0000
commit9d79e0377b08773ec4f7ec38479b1563606f7ef7 (patch)
tree31dbc1c0fdb8abb00c75da24a048028225b32c21 /sysdeps/generic
parent0e9d624072fd24ee7d113bcf9325e8fb21d2cf60 (diff)
downloadglibc-9d79e0377b08773ec4f7ec38479b1563606f7ef7.tar
glibc-9d79e0377b08773ec4f7ec38479b1563606f7ef7.tar.gz
glibc-9d79e0377b08773ec4f7ec38479b1563606f7ef7.tar.bz2
glibc-9d79e0377b08773ec4f7ec38479b1563606f7ef7.zip
Update.
* include/stdio.h (__libc_fatal): Add libc_hidden_proto. * include/dlfcn.h (__libc_dlopen_mode, __libc_dlsym, __libc_dlclose): Likewise. * elf/dl-libc.c (__libc_dlopen_mode, __libc_dlsym, __libc_dlclose): Add libc_hidden_def. * sysdeps/generic/libc_fatal.c (__libc_fatal): Likewise. * sysdeps/posix/libc_fatal.c (__libc_fatal): Likewise. * sysdeps/unix/sysv/linux/libc_fatal.c (__libc_fatal): Likewise. * elf/Versions (libc): Export __libc_dlopen_mode@@GLIBC_PRIVATE, __libc_dlsym@@GLIBC_PRIVATE and __libc_dlclose@@GLIBC_PRIVATE. * libio/Versions (libc): Export __libc_fatal@@GLIBC_PRIVATE. * sysdeps/generic/unwind-dw2.c: Readd #ifs removed during last change. * sysdeps/generic/unwind.inc: Removed.
Diffstat (limited to 'sysdeps/generic')
-rw-r--r--sysdeps/generic/libc_fatal.c3
-rw-r--r--sysdeps/generic/unwind-dw2.c9
-rw-r--r--sysdeps/generic/unwind.inc309
3 files changed, 9 insertions, 312 deletions
diff --git a/sysdeps/generic/libc_fatal.c b/sysdeps/generic/libc_fatal.c
index a6632391e5..be23849829 100644
--- a/sysdeps/generic/libc_fatal.c
+++ b/sysdeps/generic/libc_fatal.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1993, 1995, 1997, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -28,3 +28,4 @@ __libc_fatal (message)
abort ();
}
+libc_hidden_def (__libc_fatal)
diff --git a/sysdeps/generic/unwind-dw2.c b/sysdeps/generic/unwind-dw2.c
index 89f9d59f23..2e013cb2e1 100644
--- a/sysdeps/generic/unwind-dw2.c
+++ b/sysdeps/generic/unwind-dw2.c
@@ -72,8 +72,10 @@ struct _Unwind_Context
_Unwind_Word args_size;
};
+#ifndef _LIBC
/* Byte size of every register managed by these routines. */
static unsigned char dwarf_reg_size_table[DWARF_FRAME_REGISTERS];
+#endif
/* The result of interpreting the frame unwind info for a frame.
@@ -321,7 +323,7 @@ extract_cie_info (struct dwarf_cie *cie, struct _Unwind_Context *context,
return ret ? ret : p;
}
-
+#ifndef _LIBC
/* Decode a DW_OP stack program. Return the top of stack. Push INITIAL
onto the stack to start. */
@@ -721,7 +723,7 @@ execute_stack_op (const unsigned char *op_ptr, const unsigned char *op_end,
abort ();
return stack[stack_elt];
}
-
+#endif
/* Decode DWARF 2 call frame information. Takes pointers the
instruction sequence to decode, current register information and
@@ -1059,6 +1061,8 @@ __frame_state_for (void *pc_target, struct frame_state *state_in)
return state_in;
}
+#ifndef _LIBC
+
static void
uw_update_context_1 (struct _Unwind_Context *context, _Unwind_FrameState *fs)
{
@@ -1282,4 +1286,5 @@ uw_identify_context (struct _Unwind_Context *context)
#include "unwind.inc"
+#endif /* _LIBC */
#endif /* !USING_SJLJ_EXCEPTIONS */
diff --git a/sysdeps/generic/unwind.inc b/sysdeps/generic/unwind.inc
deleted file mode 100644
index 7ec65e903b..0000000000
--- a/sysdeps/generic/unwind.inc
+++ /dev/null
@@ -1,309 +0,0 @@
-/* Exception handling and frame unwind runtime interface routines. -*- C -*-
- Copyright (C) 2001 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 2, 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 COPYING. If not, write to the Free
- Software Foundation, 59 Temple Place - Suite 330, Boston, MA
- 02111-1307, USA. */
-
-/* This is derived from the C++ ABI for IA-64. Where we diverge
- for cross-architecture compatibility are noted with "@@@".
- This file is included from unwind-dw2.c or unwind-ia64.c. */
-
-/* Subroutine of _Unwind_RaiseException also invoked from _Unwind_Resume.
-
- Unwind the stack calling the personality routine to find both the
- exception handler and intermediary cleanup code. We'll only locate
- the first such frame here. Cleanup code will call back into
- _Unwind_Resume and we'll continue Phase 2 there. */
-
-static _Unwind_Reason_Code
-_Unwind_RaiseException_Phase2(struct _Unwind_Exception *exc,
- struct _Unwind_Context *context)
-{
- _Unwind_Reason_Code code;
-
- while (1)
- {
- _Unwind_FrameState fs;
- int match_handler;
-
- code = uw_frame_state_for (context, &fs);
-
- /* Identify when we've reached the designated handler context. */
- match_handler = (uw_identify_context (context) == exc->private_2
- ? _UA_HANDLER_FRAME : 0);
-
- if (code != _URC_NO_REASON)
- /* Some error encountered. Usually the unwinder doesn't
- diagnose these and merely crashes. */
- return _URC_FATAL_PHASE2_ERROR;
-
- /* Unwind successful. Run the personality routine, if any. */
- if (fs.personality)
- {
- code = (*fs.personality) (1, _UA_CLEANUP_PHASE | match_handler,
- exc->exception_class, exc, context);
- if (code == _URC_INSTALL_CONTEXT)
- break;
- if (code != _URC_CONTINUE_UNWIND)
- return _URC_FATAL_PHASE2_ERROR;
- }
-
- /* Don't let us unwind past the handler context. */
- if (match_handler)
- abort ();
-
- uw_update_context (context, &fs);
- }
-
- return code;
-}
-
-/* Raise an exception, passing along the given exception object. */
-#ifndef _LIBC
-_Unwind_Reason_Code
-_Unwind_RaiseException(struct _Unwind_Exception *exc)
-{
- struct _Unwind_Context this_context, cur_context;
- _Unwind_Reason_Code code;
-
- /* Set up this_context to describe the current stack frame. */
- uw_init_context (&this_context);
- cur_context = this_context;
-
- /* Phase 1: Search. Unwind the stack, calling the personality routine
- with the _UA_SEARCH_PHASE flag set. Do not modify the stack yet. */
- while (1)
- {
- _Unwind_FrameState fs;
-
- /* Set up fs to describe the FDE for the caller of cur_context. The
- first time through the loop, that means __cxa_throw. */
- code = uw_frame_state_for (&cur_context, &fs);
-
- if (code == _URC_END_OF_STACK)
- /* Hit end of stack with no handler found. */
- return _URC_END_OF_STACK;
-
- if (code != _URC_NO_REASON)
- /* Some error encountered. Ususally the unwinder doesn't
- diagnose these and merely crashes. */
- return _URC_FATAL_PHASE1_ERROR;
-
- /* Unwind successful. Run the personality routine, if any. */
- if (fs.personality)
- {
- code = (*fs.personality) (1, _UA_SEARCH_PHASE, exc->exception_class,
- exc, &cur_context);
- if (code == _URC_HANDLER_FOUND)
- break;
- else if (code != _URC_CONTINUE_UNWIND)
- return _URC_FATAL_PHASE1_ERROR;
- }
-
- /* Update cur_context to describe the same frame as fs. */
- uw_update_context (&cur_context, &fs);
- }
-
- /* Indicate to _Unwind_Resume and associated subroutines that this
- is not a forced unwind. Further, note where we found a handler. */
- exc->private_1 = 0;
- exc->private_2 = uw_identify_context (&cur_context);
-
- cur_context = this_context;
- code = _Unwind_RaiseException_Phase2 (exc, &cur_context);
- if (code != _URC_INSTALL_CONTEXT)
- return code;
-
- uw_install_context (&this_context, &cur_context);
-}
-#endif
-
-
-/* Subroutine of _Unwind_ForcedUnwind also invoked from _Unwind_Resume. */
-
-static _Unwind_Reason_Code
-_Unwind_ForcedUnwind_Phase2(struct _Unwind_Exception *exc,
- struct _Unwind_Context *context)
-{
- _Unwind_Stop_Fn stop = (_Unwind_Stop_Fn) (_Unwind_Ptr) exc->private_1;
- void *stop_argument = (void *) (_Unwind_Ptr) exc->private_2;
- _Unwind_Reason_Code code, stop_code;
-
- while (1)
- {
- _Unwind_FrameState fs;
- int action;
-
- /* Set up fs to describe the FDE for the caller of cur_context. */
- code = uw_frame_state_for (context, &fs);
- if (code != _URC_NO_REASON && code != _URC_END_OF_STACK)
- return _URC_FATAL_PHASE2_ERROR;
-
- /* Unwind successful. */
- action = _UA_FORCE_UNWIND | _UA_CLEANUP_PHASE;
- if (code == _URC_END_OF_STACK)
- action |= _UA_END_OF_STACK;
- stop_code = (*stop) (1, action, exc->exception_class, exc,
- context, stop_argument);
- if (stop_code != _URC_NO_REASON)
- return _URC_FATAL_PHASE2_ERROR;
-
- /* Stop didn't want to do anything. Invoke the personality
- handler, if applicable, to run cleanups. */
- if (code == _URC_END_OF_STACK)
- break;
-
- if (fs.personality)
- {
- code = (*fs.personality) (1, _UA_FORCE_UNWIND | _UA_CLEANUP_PHASE,
- exc->exception_class, exc, context);
- if (code == _URC_INSTALL_CONTEXT)
- break;
- if (code != _URC_CONTINUE_UNWIND)
- return _URC_FATAL_PHASE2_ERROR;
- }
-
- /* Update cur_context to describe the same frame as fs. */
- uw_update_context (context, &fs);
- }
-
- return code;
-}
-
-
-/* Raise an exception for forced unwinding. */
-#ifndef _LIBC
-_Unwind_Reason_Code
-_Unwind_ForcedUnwind (struct _Unwind_Exception *exc,
- _Unwind_Stop_Fn stop, void * stop_argument)
-{
- struct _Unwind_Context this_context, cur_context;
- _Unwind_Reason_Code code;
-
- uw_init_context (&this_context);
- cur_context = this_context;
-
- exc->private_1 = (_Unwind_Ptr) stop;
- exc->private_2 = (_Unwind_Ptr) stop_argument;
-
- code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context);
- if (code != _URC_INSTALL_CONTEXT)
- return code;
-
- uw_install_context (&this_context, &cur_context);
-}
-#endif
-
-
-/* Resume propagation of an existing exception. This is used after
- e.g. executing cleanup code, and not to implement rethrowing. */
-
-void
-_Unwind_Resume (struct _Unwind_Exception *exc)
-{
- struct _Unwind_Context this_context, cur_context;
- _Unwind_Reason_Code code;
-
- uw_init_context (&this_context);
- cur_context = this_context;
-
- /* Choose between continuing to process _Unwind_RaiseException
- or _Unwind_ForcedUnwind. */
- if (exc->private_1 == 0)
- code = _Unwind_RaiseException_Phase2 (exc, &cur_context);
- else
- code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context);
-
- if (code != _URC_INSTALL_CONTEXT)
- abort ();
-
- uw_install_context (&this_context, &cur_context);
-}
-
-
-/* Resume propagation of an FORCE_UNWIND exception, or to rethrow
- a normal exception that was handled. */
-#ifndef _LIBC
-_Unwind_Reason_Code
-_Unwind_Resume_or_Rethrow (struct _Unwind_Exception *exc)
-{
- struct _Unwind_Context this_context, cur_context;
- _Unwind_Reason_Code code;
-
- /* Choose between continuing to process _Unwind_RaiseException
- or _Unwind_ForcedUnwind. */
- if (exc->private_1 == 0)
- return _Unwind_RaiseException (exc);
-
- uw_init_context (&this_context);
- cur_context = this_context;
-
- code = _Unwind_ForcedUnwind_Phase2 (exc, &cur_context);
-
- if (code != _URC_INSTALL_CONTEXT)
- abort ();
-
- uw_install_context (&this_context, &cur_context);
-}
-#endif
-
-
-/* A convenience function that calls the exception_cleanup field. */
-#ifndef _LIBC
-void
-_Unwind_DeleteException (struct _Unwind_Exception *exc)
-{
- if (exc->exception_cleanup)
- (*exc->exception_cleanup) (_URC_FOREIGN_EXCEPTION_CAUGHT, exc);
-}
-#endif
-
-
-/* Perform stack backtrace through unwind data. */
-#ifndef _LIBC
-_Unwind_Reason_Code
-_Unwind_Backtrace(_Unwind_Trace_Fn trace, void * trace_argument)
-{
- struct _Unwind_Context context;
- _Unwind_Reason_Code code;
-
- uw_init_context (&context);
-
- while (1)
- {
- _Unwind_FrameState fs;
-
- /* Set up fs to describe the FDE for the caller of context. */
- code = uw_frame_state_for (&context, &fs);
- if (code != _URC_NO_REASON && code != _URC_END_OF_STACK)
- return _URC_FATAL_PHASE1_ERROR;
-
- /* Call trace function. */
- if ((*trace) (&context, trace_argument) != _URC_NO_REASON)
- return _URC_FATAL_PHASE1_ERROR;
-
- /* We're done at end of stack. */
- if (code == _URC_END_OF_STACK)
- break;
-
- /* Update context to describe the same frame as fs. */
- uw_update_context (&context, &fs);
- }
-
- return code;
-}
-#endif