Makefile.in (GNATLIBCFLAGS_FOR_C): New variable.

libada/
	* Makefile.in (GNATLIBCFLAGS_FOR_C): New variable.
	(LIBADA_FLAGS_TO_PASS): Add GNATLIBCFLAGS_FOR_C.
	* configure.ac: Include config/unwind_ipinfo.m4.
	Check for _Unwind_GetIPInfo.
	* configure: Regenerate.

gcc/ada/
	* init.c (__gnat_adjust_context_for_raise): Mention _Unwind_GetIPInfo.
	* gcc-interface/Makefile.in (GNATLIBCFLAGS_FOR_C): Add HAVE_GETIPINFO.
	Pass GNATLIBCFLAGS_FOR_C to recursive invocations.

gcc/testsuite/
	* gnat.dg/null_pointer_deref1.adb: New test.
	* gnat.dg/null_pointer_deref2.adb: Likewise.

From-SVN: r153525
This commit is contained in:
Eric Botcazou 2009-10-24 10:58:31 +00:00 committed by Eric Botcazou
parent c0f81f78ae
commit 2f18d9afae
10 changed files with 145 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2009-10-24 Eric Botcazou <ebotcazou@adacore.com>
* init.c (__gnat_adjust_context_for_raise): Mention _Unwind_GetIPInfo.
* gcc-interface/Makefile.in (GNATLIBCFLAGS_FOR_C): Add HAVE_GETIPINFO.
Pass GNATLIBCFLAGS_FOR_C to recursive invocations.
2009-10-21 Eric Botcazou <ebotcazou@adacore.com>
* gcc-interfaces/decl.c (build_subst_list): Convert the expression of

View File

@ -109,8 +109,11 @@ SOME_ADAFLAGS =-gnata
FORCE_DEBUG_ADAFLAGS = -g
GNATLIBFLAGS = -gnatpg -nostdinc
GNATLIBCFLAGS = -g -O2
# Pretend that _Unwind_GetIPInfo is available for the target by default. This
# should be autodetected during the configuration of libada and passed down to
# here, but we need something for --disable-libada and hope for the best.
GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) -fexceptions \
-DIN_RTS
-DIN_RTS -DHAVE_GETIPINFO
ALL_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS)
MOST_ADAFLAGS = $(CFLAGS) $(ADA_CFLAGS) $(SOME_ADAFLAGS)
THREAD_KIND = native
@ -2422,6 +2425,7 @@ gnatlib-shared-default:
$(MAKE) $(FLAGS_TO_PASS) \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \
GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
MULTISUBDIR="$(MULTISUBDIR)" \
THREAD_KIND="$(THREAD_KIND)" \
gnatlib
@ -2447,6 +2451,7 @@ gnatlib-shared-dual:
$(MAKE) $(FLAGS_TO_PASS) \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
MULTISUBDIR="$(MULTISUBDIR)" \
THREAD_KIND="$(THREAD_KIND)" \
gnatlib-shared-default
@ -2455,6 +2460,7 @@ gnatlib-shared-dual:
$(MAKE) $(FLAGS_TO_PASS) \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
MULTISUBDIR="$(MULTISUBDIR)" \
THREAD_KIND="$(THREAD_KIND)" \
gnatlib
@ -2464,6 +2470,7 @@ gnatlib-shared-dual-win32:
$(MAKE) $(FLAGS_TO_PASS) \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \
GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
MULTISUBDIR="$(MULTISUBDIR)" \
THREAD_KIND="$(THREAD_KIND)" \
gnatlib-shared-win32
@ -2472,6 +2479,7 @@ gnatlib-shared-dual-win32:
$(MAKE) $(FLAGS_TO_PASS) \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
MULTISUBDIR="$(MULTISUBDIR)" \
THREAD_KIND="$(THREAD_KIND)" \
gnatlib
@ -2485,6 +2493,7 @@ gnatlib-shared-win32:
$(MAKE) $(FLAGS_TO_PASS) \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS)" \
GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
MULTISUBDIR="$(MULTISUBDIR)" \
THREAD_KIND="$(THREAD_KIND)" \
gnatlib
@ -2503,7 +2512,7 @@ gnatlib-shared-darwin:
$(MAKE) $(FLAGS_TO_PASS) \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
GNATLIBCFLAGS="$(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) \
-fno-common" \
GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C) -fno-common" \
MULTISUBDIR="$(MULTISUBDIR)" \
THREAD_KIND="$(THREAD_KIND)" \
gnatlib
@ -2531,6 +2540,7 @@ gnatlib-shared-vms:
$(MAKE) $(FLAGS_TO_PASS) \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
MULTISUBDIR="$(MULTISUBDIR)" \
THREAD_KIND="$(THREAD_KIND)" \
gnatlib
@ -2559,6 +2569,7 @@ gnatlib-shared:
$(MAKE) $(FLAGS_TO_PASS) \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
MULTISUBDIR="$(MULTISUBDIR)" \
THREAD_KIND="$(THREAD_KIND)" \
TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" \
@ -2572,6 +2583,7 @@ gnatlib-sjlj:
EH_MECHANISM="" \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
MULTISUBDIR="$(MULTISUBDIR)" \
THREAD_KIND="$(THREAD_KIND)" \
TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" gnatlib
@ -2584,6 +2596,7 @@ gnatlib-zcx:
EH_MECHANISM="-gcc" \
GNATLIBFLAGS="$(GNATLIBFLAGS)" \
GNATLIBCFLAGS="$(GNATLIBCFLAGS)" \
GNATLIBCFLAGS_FOR_C="$(GNATLIBCFLAGS_FOR_C)" \
MULTISUBDIR="$(MULTISUBDIR)" \
THREAD_KIND="$(THREAD_KIND)" \
TARGET_LIBGCC2_CFLAGS="$(TARGET_LIBGCC2_CFLAGS)" gnatlib

View File

@ -2301,8 +2301,10 @@ __gnat_adjust_context_for_raise (int signo ATTRIBUTE_UNUSED,
{
/* We used to compensate here for the raised from call vs raised from signal
exception discrepancy with the GCC ZCX scheme, but this now can be dealt
with generically in the unwinder (see GCC PR other/26208). Only the VMS
ports still do the compensation described in the few lines below.
with generically in the unwinder (see GCC PR other/26208). This however
requires the use of the _Unwind_GetIPInfo routine in raise-gcc.c, which
is predicated on the definition of HAVE_GETIPINFO at compile time. Only
the VMS ports still do the compensation described in the few lines below.
*** Call vs signal exception discrepancy with GCC ZCX scheme ***

View File

@ -1,3 +1,8 @@
2009-10-24 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/null_pointer_deref1.adb: New test.
* gnat.dg/null_pointer_deref2.adb: Likewise.
2009-10-24 Paul Thomas <pault@gcc.gnu.org>
PR fortran/41772

View File

@ -0,0 +1,21 @@
-- { dg-do run }
-- { dg-options "-gnatp" }
-- This test requires architecture- and OS-specific support code for unwinding
-- through signal frames (typically located in *-unwind.h) to pass. Feel free
-- to disable it if this code hasn't been implemented yet.
procedure Null_Pointer_Deref1 is
type Int_Ptr is access all Integer;
function Ident return Int_Ptr is
begin
return null;
end;
Data : Int_Ptr := Ident;
begin
Data.all := 1;
exception
when Storage_Error => null;
end;

View File

@ -0,0 +1,28 @@
-- { dg-do run }
-- { dg-options "-gnatp" }
-- This test requires architecture- and OS-specific support code for unwinding
-- through signal frames (typically located in *-unwind.h) to pass. Feel free
-- to disable it if this code hasn't been implemented yet.
procedure Null_Pointer_Deref2 is
task T;
task body T is
type Int_Ptr is access all Integer;
function Ident return Int_Ptr is
begin
return null;
end;
Data : Int_Ptr := Ident;
begin
Data.all := 1;
exception
when Storage_Error => null;
end T;
begin
null;
end;

View File

@ -1,3 +1,11 @@
2009-10-24 Eric Botcazou <ebotcazou@adacore.com>
* Makefile.in (GNATLIBCFLAGS_FOR_C): New variable.
(LIBADA_FLAGS_TO_PASS): Add GNATLIBCFLAGS_FOR_C.
* configure.ac: Include config/unwind_ipinfo.m4.
Check for _Unwind_GetIPInfo.
* configure: Regenerate.
2009-08-30 Paolo Bonzini <bonzini@gnu.org>
PR ada/41122

View File

@ -58,6 +58,8 @@ WARN_CFLAGS = @warn_cflags@
TARGET_LIBGCC2_CFLAGS=
GNATLIBCFLAGS= -g -O2
GNATLIBCFLAGS_FOR_C = $(GNATLIBCFLAGS) $(TARGET_LIBGCC2_CFLAGS) -fexceptions \
-DIN_RTS @have_getipinfo@
# Get target-specific overrides for TARGET_LIBGCC2_CFLAGS.
host_subdir = @host_subdir@
@ -80,6 +82,7 @@ LIBADA_FLAGS_TO_PASS = \
"SHELL=$(SHELL)" \
"GNATLIBFLAGS=$(GNATLIBFLAGS) $(MULTIFLAGS)" \
"GNATLIBCFLAGS=$(GNATLIBCFLAGS) $(MULTIFLAGS)" \
"GNATLIBCFLAGS_FOR_C=$(GNATLIBCFLAGS_FOR_C) $(MULTIFLAGS)" \
"TARGET_LIBGCC2_CFLAGS=$(TARGET_LIBGCC2_CFLAGS)" \
"THREAD_KIND=$(THREAD_KIND)" \
"TRACE=$(TRACE)" \

46
libada/configure vendored
View File

@ -554,6 +554,7 @@ ac_unique_file="Makefile.in"
ac_subst_vars='LTLIBOBJS
LIBOBJS
warn_cflags
have_getipinfo
default_gnatlib_target
LN_S
AWK
@ -631,6 +632,7 @@ with_build_libsubdir
enable_maintainer_mode
enable_multilib
enable_shared
with_system_libunwind
'
ac_precious_vars='build_alias
host_alias
@ -1258,6 +1260,7 @@ Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-build-libsubdir=DIR Directory where to find libraries for build system
--with-system-libunwind use installed libunwind
Some influential environment variables:
CC C compiler command
@ -2879,6 +2882,49 @@ else
fi
# Check for _Unwind_GetIPInfo
# Check whether --with-system-libunwind was given.
if test "${with_system_libunwind+set}" = set; then :
withval=$with_system_libunwind;
fi
# If system-libunwind was not specifically set, pick a default setting.
if test x$with_system_libunwind = x; then
case ${target} in
ia64-*-hpux*) with_system_libunwind=yes ;;
*) with_system_libunwind=no ;;
esac
fi
# Based on system-libunwind and target, do we have ipinfo?
if test x$with_system_libunwind = xyes; then
case ${target} in
ia64-*-*) have_unwind_getipinfo=no ;;
*) have_unwind_getipinfo=yes ;;
esac
else
# Darwin before version 9 does not have _Unwind_GetIPInfo.
case ${target} in
*-*-darwin[3-8]|*-*-darwin[3-8].*) have_unwind_getipinfo=no ;;
*) have_unwind_getipinfo=yes ;;
esac
fi
if test x$have_unwind_getipinfo = xyes; then
$as_echo "#define HAVE_GETIPINFO 1" >>confdefs.h
fi
have_getipinfo=
if test x$have_unwind_getipinfo = xyes; then
have_getipinfo=-DHAVE_GETIPINFO
fi
warn_cflags=
if test "x$GCC" = "xyes"; then
warn_cflags='$(GCC_WARN_CFLAGS)'

View File

@ -18,6 +18,7 @@
sinclude(../config/acx.m4)
sinclude(../config/multi.m4)
sinclude(../config/override.m4)
sinclude(../config/unwind_ipinfo.m4)
AC_INIT
AC_PREREQ([2.64])
@ -131,6 +132,14 @@ else
fi
AC_SUBST([default_gnatlib_target])
# Check for _Unwind_GetIPInfo
GCC_CHECK_UNWIND_GETIPINFO
have_getipinfo=
if test x$have_unwind_getipinfo = xyes; then
have_getipinfo=-DHAVE_GETIPINFO
fi
AC_SUBST(have_getipinfo)
warn_cflags=
if test "x$GCC" = "xyes"; then
warn_cflags='$(GCC_WARN_CFLAGS)'