mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-12-23 03:53:43 +01:00
Implement _Unwind_GetIPInfo() as required by the C++ ABI
Provide a special implementation for ia64, because the unwind information is such that an IP adjustment is not necessary before looking up unwind info. Bad things happen if libunwind only provides parts of the ABI and the rest come from libgcc. Signed-off-by: Jan Kratochvil <jan.kratochvil@redhat.com>
This commit is contained in:
parent
18a0a81ffc
commit
2fce54102c
6 changed files with 96 additions and 12 deletions
|
@ -123,6 +123,8 @@ AC_ARG_ENABLE(cxx_exceptions,
|
|||
# C++ exception handling doesn't work too well on x86
|
||||
case $target_arch in
|
||||
x86*) enable_cxx_exceptions=no;;
|
||||
arm*) enable_cxx_exceptions=no;;
|
||||
mips*) enable_cxx_exceptions=no;;
|
||||
*) enable_cxx_exceptions=yes;;
|
||||
esac
|
||||
])
|
||||
|
|
|
@ -88,6 +88,7 @@ extern void _Unwind_DeleteException (struct _Unwind_Exception *);
|
|||
extern unsigned long _Unwind_GetGR (struct _Unwind_Context *, int);
|
||||
extern void _Unwind_SetGR (struct _Unwind_Context *, int, unsigned long);
|
||||
extern unsigned long _Unwind_GetIP (struct _Unwind_Context *);
|
||||
extern unsigned long _Unwind_GetIPInfo (struct _Unwind_Context *, int *);
|
||||
extern void _Unwind_SetIP (struct _Unwind_Context *, unsigned long);
|
||||
extern unsigned long _Unwind_GetLanguageSpecificData (struct _Unwind_Context*);
|
||||
extern unsigned long _Unwind_GetRegionStart (struct _Unwind_Context *);
|
||||
|
|
|
@ -71,6 +71,12 @@ libunwind_la_SOURCES_local_unwind = \
|
|||
unwind/RaiseException.c unwind/Resume.c \
|
||||
unwind/Resume_or_Rethrow.c unwind/SetGR.c unwind/SetIP.c
|
||||
|
||||
if ARCH_IA64
|
||||
libunwind_la_SOURCES_local_unwind += ia64/unwind_GetIPInfo.c
|
||||
else
|
||||
libunwind_la_SOURCES_local_unwind += unwind/GetIPInfo.c
|
||||
endif # ARCH_IA64
|
||||
|
||||
# _ReadULEB()/_ReadSLEB() are needed for Intel C++ 8.0 compatibility
|
||||
libunwind_la_SOURCES_os_linux_local = mi/_ReadULEB.c mi/_ReadSLEB.c
|
||||
endif
|
||||
|
@ -88,21 +94,9 @@ libunwind_la_SOURCES_local_nounwind = \
|
|||
mi/Lget_fpreg.c mi/Lset_fpreg.c \
|
||||
mi/Lset_caching_policy.c
|
||||
|
||||
# On some platforms, defining _Unwind replacements really upsets
|
||||
# exception-handling. Turn off those functions for those platforms.
|
||||
if ARCH_ARM
|
||||
libunwind_la_SOURCES_local = \
|
||||
$(libunwind_la_SOURCES_local_nounwind)
|
||||
else
|
||||
if ARCH_MIPS
|
||||
libunwind_la_SOURCES_local = \
|
||||
$(libunwind_la_SOURCES_local_nounwind)
|
||||
else
|
||||
libunwind_la_SOURCES_local = \
|
||||
$(libunwind_la_SOURCES_local_nounwind) \
|
||||
$(libunwind_la_SOURCES_local_unwind)
|
||||
endif # ARCH_MIPS
|
||||
endif # ARCH_ARM
|
||||
|
||||
libunwind_la_SOURCES_os_linux = os-linux.h os-linux.c
|
||||
|
||||
|
|
43
src/ia64/unwind_GetIPInfo.c
Normal file
43
src/ia64/unwind_GetIPInfo.c
Normal file
|
@ -0,0 +1,43 @@
|
|||
/* libunwind - a platform-independent unwind library
|
||||
Copyright (C) 2009 Red Hat
|
||||
Contributed by Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
This file is part of libunwind.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#include "../unwind/unwind-internal.h"
|
||||
|
||||
/* gcc/unwind-dw2.c: Retrieve the return address and flag whether that IP is
|
||||
before or after first not yet fully executed instruction.
|
||||
IP_BEFORE_INSN ensures leaving IP intact as was designed for ia64. */
|
||||
|
||||
PROTECTED unsigned long
|
||||
_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
|
||||
{
|
||||
unw_word_t val;
|
||||
|
||||
unw_get_reg (&context->cursor, UNW_REG_IP, &val);
|
||||
*ip_before_insn = 1;
|
||||
return val;
|
||||
}
|
||||
|
||||
unsigned long __libunwind_Unwind_GetIPInfo (struct _Unwind_Context *, int *)
|
||||
ALIAS (_Unwind_GetIPInfo);
|
42
src/unwind/GetIPInfo.c
Normal file
42
src/unwind/GetIPInfo.c
Normal file
|
@ -0,0 +1,42 @@
|
|||
/* libunwind - a platform-independent unwind library
|
||||
Copyright (C) 2009 Red Hat
|
||||
Contributed by Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||
|
||||
This file is part of libunwind.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#include "../unwind/unwind-internal.h"
|
||||
|
||||
/* gcc/unwind-dw2.c: Retrieve the return address and flag whether that IP is
|
||||
before or after first not yet fully executed instruction. */
|
||||
|
||||
PROTECTED unsigned long
|
||||
_Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
|
||||
{
|
||||
unw_word_t val;
|
||||
|
||||
unw_get_reg (&context->cursor, UNW_REG_IP, &val);
|
||||
*ip_before_insn = unw_is_signal_frame (&context->cursor);
|
||||
return val;
|
||||
}
|
||||
|
||||
unsigned long __libunwind_Unwind_GetIPInfo (struct _Unwind_Context *, int *)
|
||||
ALIAS (_Unwind_GetIPInfo);
|
|
@ -197,6 +197,7 @@ check_cxx_abi () {
|
|||
match _Unwind_GetDataRelBase
|
||||
match _Unwind_GetGR
|
||||
match _Unwind_GetIP
|
||||
match _Unwind_GetIPInfo
|
||||
match _Unwind_GetLanguageSpecificData
|
||||
match _Unwind_GetRegionStart
|
||||
match _Unwind_GetTextRelBase
|
||||
|
@ -214,6 +215,7 @@ check_cxx_abi () {
|
|||
match __libunwind_Unwind_GetDataRelBase
|
||||
match __libunwind_Unwind_GetGR
|
||||
match __libunwind_Unwind_GetIP
|
||||
match __libunwind_Unwind_GetIPInfo
|
||||
match __libunwind_Unwind_GetLanguageSpecificData
|
||||
match __libunwind_Unwind_GetRegionStart
|
||||
match __libunwind_Unwind_GetTextRelBase
|
||||
|
|
Loading…
Reference in a new issue