diff options
author | Ben Cheng <bccheng@google.com> | 2014-04-22 13:33:12 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2014-04-22 13:33:12 -0700 |
commit | e3cc64dec20832769406aa38cde83c7dd4194bf4 (patch) | |
tree | ef8e39be37cfe0cb69d850043b7924389ff17164 /gcc-4.9/gcc/ada | |
parent | f33c7b3122b1d7950efa88067c9a156229ba647b (diff) | |
download | toolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.tar.gz toolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.tar.bz2 toolchain_gcc-e3cc64dec20832769406aa38cde83c7dd4194bf4.zip |
[4.9] GCC 4.9.0 official release refresh
Change-Id: Ic99a7da8b44b789a48aeec93b33e93944d6e6767
Diffstat (limited to 'gcc-4.9/gcc/ada')
31 files changed, 1017 insertions, 115 deletions
diff --git a/gcc-4.9/gcc/ada/ChangeLog b/gcc-4.9/gcc/ada/ChangeLog index 6a2726ef6..b4d3e7769 100644 --- a/gcc-4.9/gcc/ada/ChangeLog +++ b/gcc-4.9/gcc/ada/ChangeLog @@ -1,3 +1,60 @@ +2014-04-22 Release Manager + + * GCC 4.9.0 released. + +2014-04-09 Eric Botcazou <ebotcazou@adacore.com> + Svante Signell <svante.signell@gmail.com> + + PR ada/54040 + PR ada/59346 + * s-osinte-x32.adb: New file. + * s-linux.ads (Time): New section. + * s-linux-alpha.ads (Time): Likewise. + * s-linux-android.ads (Time: Likewise. + * s-linux-hppa.ads (Time): Likewise. + * s-linux-mipsel.ads (Time): Likewise. + * s-linux-sparc.ads (Time): Likewise. + * s-linux-x32.ads (Time): Likewise. + * s-osprim-x32.ads (timespec): Adjust. + (Clock): Likewise. + (To_Timespec): Likewise. + * s-osinte-linux.ads (Time): Define local subtypes for those defined + in System.Linux. + * s-taprop-linux.adb (Monotonic_Clock): Do not define timeval. + * s-osinte-hpux.ads (timespec): Revert POSIX breakage. + * s-osinte-kfreebsd-gnu.ads (timespec): Likewise. + * s-osinte-solaris-posix.ads (timespec): Likewise. + * s-osinte-posix.adb (To_Timespec): Likewise. + * gcc-interface/Makefile.in (x32/Linux): Use s-osinte-x32.adb. + +2014-04-08 Eric Botcazou <ebotcazou@adacore.com> + + PR ada/60411 + * gcc-interface/Makefile.in (arm% linux-android): Switch to EHABI. + * s-linux-android.ads: New file. + * s-intman-android.adb: Likewise. + * s-osinte-android.ads: Adjust. + * sigtramp-armdroid.c: Likewise. + * sigtramp.h: Add Android support. + +2014-04-07 Eric Botcazou <ebotcazou@adacore.com> + + * gcc-interface/Makefile.in (alpha-vms): Add missing line. + +2014-03-30 Eric Botcazou <ebotcazou@adacore.com> + + PR ada/60703 + * system-linux-alpha.ads: Adjust for Ada 2005. + * system-linux-mips.ads: Likewise. + * system-linux-mips64el.ads: Likewise. + * system-linux-mipsel.ads: Likewise. + * system-linux-s390.ads: Likewise. + * system-linux-s390x.ads: Likewise. + * system-linux-sparc.ads: Likewise. + * system-linux-sparcv9.ads: Likewise. + * system-rtems.ads: Likewise. + * system-vxworks-arm.ads: Likewise. + 2014-03-16 Andreas Schwab <schwab@linux-m68k.org> PR ada/39172 diff --git a/gcc-4.9/gcc/ada/gcc-interface/Makefile.in b/gcc-4.9/gcc/ada/gcc-interface/Makefile.in index 352d6550c..9af1967ce 100644 --- a/gcc-4.9/gcc/ada/gcc-interface/Makefile.in +++ b/gcc-4.9/gcc/ada/gcc-interface/Makefile.in @@ -536,7 +536,7 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks,$(target_cpu) $(target_vendor) $ # System.Stack_Checking.Operations is not needed on VxWorks 6 as it leads to # an undefined symbol when building a dynamic shared library. To alleviate # this problem and distinguish this case, we use the THREAD_KIND and include - # the package only in kernel mode. + # the package only in default mode. ifeq ($(strip $(filter-out default,$(THREAD_KIND))),) LIBGNAT_TARGET_PAIRS += \ @@ -1045,15 +1045,17 @@ ifeq ($(strip $(filter-out arm% linux-androideabi,$(target_cpu) $(target_os))),) LIBGNAT_TARGET_PAIRS = \ a-intnam.ads<a-intnam-linux.ads \ s-inmaop.adb<s-inmaop-posix.adb \ - s-intman.adb<s-intman-posix.adb \ - s-linux.ads<s-linux.ads \ + s-intman.adb<s-intman-android.adb \ + s-linux.ads<s-linux-android.ads \ s-osinte.adb<s-osinte-android.adb \ s-osinte.ads<s-osinte-android.ads \ s-osprim.adb<s-osprim-posix.adb \ s-taprop.adb<s-taprop-posix.adb \ - s-taspri.ads<s-taspri-posix-noaltstack.ads \ + s-taspri.ads<s-taspri-posix.ads \ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \ system.ads<system-linux-armel.ads \ + a-exexpr.adb<a-exexpr-gcc.adb \ + s-excmac.ads<s-excmac-arm.ads \ $(DUMMY_SOCKETS_TARGET_PAIRS) TOOLS_TARGET_PAIRS = \ @@ -1062,7 +1064,9 @@ ifeq ($(strip $(filter-out arm% linux-androideabi,$(target_cpu) $(target_os))),) GNATRTL_SOCKETS_OBJS = EXTRA_GNATRTL_TASKING_OBJS=s-linux.o - EH_MECHANISM= + EXTRA_LIBGNAT_OBJS+=raise-gcc.o sigtramp-armdroid.o + EXTRA_GNATRTL_NONTASKING_OBJS+=g-cppexc.o s-excmac.o + EH_MECHANISM=-arm THREADSLIB = GNATLIB_SHARED = gnatlib-shared-dual LIBRARY_VERSION := $(LIB_VERSION) @@ -1615,6 +1619,7 @@ ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(target_ $(ATOMICS_BUILTINS_TARGET_PAIRS) EXTRA_LIBGNAT_SRCS+=tb-alvms.c + override GNATRTL_ALTIVEC_OBJS= TOOLS_TARGET_PAIRS= \ mlib-tgt-specific.adb<mlib-tgt-specific-vms-alpha.adb \ @@ -2234,7 +2239,7 @@ ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) $(target_os))),) s-linux.ads<s-linux-x32.ads \ s-mudido.adb<s-mudido-affinity.adb \ s-osinte.ads<s-osinte-linux.ads \ - s-osinte.adb<s-osinte-posix.adb \ + s-osinte.adb<s-osinte-x32.adb \ s-osprim.adb<s-osprim-x32.adb \ s-taprop.adb<s-taprop-linux.adb \ s-tasinf.ads<s-tasinf-linux.ads \ @@ -3063,6 +3068,7 @@ mkdir.o : mkdir.c socket.o : socket.c gsocket.h sysdep.o : sysdep.c raise.o : raise.c raise.h +sigtramp-armdroid.o : sigtramp-armdroid.c sigtramp.h sigtramp-armvxw.o : sigtramp-armvxw.c sigtramp.h sigtramp-ppcvxw.o : sigtramp-ppcvxw.c sigtramp.h terminals.o : terminals.c diff --git a/gcc-4.9/gcc/ada/s-intman-android.adb b/gcc-4.9/gcc/ada/s-intman-android.adb new file mode 100644 index 000000000..30a980e3e --- /dev/null +++ b/gcc-4.9/gcc/ada/s-intman-android.adb @@ -0,0 +1,331 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- +-- -- +-- S Y S T E M . I N T E R R U P T _ M A N A G E M E N T -- +-- -- +-- B o d y -- +-- -- +-- Copyright (C) 2014, Free Software Foundation, Inc. -- +-- -- +-- GNARL is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 3, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- +-- or FITNESS FOR A PARTICULAR PURPOSE. -- +-- -- +-- As a special exception 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. -- +-- -- +-- In particular, you can freely distribute your programs built with the -- +-- GNAT Pro compiler, including any required library run-time units, using -- +-- any licensing terms of your choosing. See the AdaCore Software License -- +-- for full details. -- +-- -- +-- GNARL was developed by the GNARL team at Florida State University. -- +-- Extensive contributions were provided by Ada Core Technologies, Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- This is the Android version of this package + +-- Make a careful study of all signals available under the OS, to see which +-- need to be reserved, kept always unmasked, or kept always unmasked. Be on +-- the lookout for special signals that may be used by the thread library. + +-- Since this is a multi target file, the signal <-> exception mapping +-- is simple minded. If you need a more precise and target specific +-- signal handling, create a new s-intman.adb that will fit your needs. + +-- This file assumes that: + +-- SIGFPE, SIGILL, SIGSEGV and SIGBUS exist. They are mapped as follows: +-- SIGPFE => Constraint_Error +-- SIGILL => Program_Error +-- SIGSEGV => Storage_Error +-- SIGBUS => Storage_Error + +-- SIGINT exists and will be kept unmasked unless the pragma +-- Unreserve_All_Interrupts is specified anywhere in the application. + +-- System.OS_Interface contains the following: +-- SIGADAABORT: the signal that will be used to abort tasks. +-- Unmasked: the OS specific set of signals that should be unmasked in +-- all the threads. SIGADAABORT is unmasked by +-- default +-- Reserved: the OS specific set of signals that are reserved. + +with System.Task_Primitives; + +package body System.Interrupt_Management is + + use Interfaces.C; + use System.OS_Interface; + + type Interrupt_List is array (Interrupt_ID range <>) of Interrupt_ID; + Exception_Interrupts : constant Interrupt_List := + (SIGFPE, SIGILL, SIGSEGV, SIGBUS); + + Unreserve_All_Interrupts : Interfaces.C.int; + pragma Import + (C, Unreserve_All_Interrupts, "__gl_unreserve_all_interrupts"); + + ----------------------- + -- Local Subprograms -- + ----------------------- + + procedure Signal_Trampoline + (signo : Signal; + siginfo : System.Address; + ucontext : System.Address; + handler : System.Address); + pragma Import (C, Signal_Trampoline, "__gnat_sigtramp"); + -- Pass the real handler to a speical function that handles unwinding by + -- skipping over the kernel signal frame (which doesn't contain any unwind + -- information). + + function State (Int : Interrupt_ID) return Character; + pragma Import (C, State, "__gnat_get_interrupt_state"); + -- Get interrupt state. Defined in init.c The input argument is the + -- interrupt number, and the result is one of the following: + + procedure Map_Signal + (signo : Signal; + siginfo : System.Address; + ucontext : System.Address); + -- This function identifies the Ada exception to be raised using the + -- information when the system received a synchronous signal. + +---------------- +-- Map_Signal -- +---------------- + + procedure Map_Signal + (signo : Signal; + siginfo : System.Address; + ucontext : System.Address) + is + pragma Unreferenced (siginfo); + pragma Unreferenced (ucontext); + + begin + + -- Check that treatment of exception propagation here is consistent with + -- treatment of the abort signal in System.Task_Primitives.Operations. + + case signo is + when SIGFPE => + raise Constraint_Error; + when SIGILL => + raise Program_Error; + when SIGSEGV => + raise Storage_Error; + when SIGBUS => + raise Storage_Error; + when others => + null; + end case; + end Map_Signal; + +---------------------- +-- Notify_Exception -- +---------------------- + + User : constant Character := 'u'; + Runtime : constant Character := 'r'; + Default : constant Character := 's'; + -- 'n' this interrupt not set by any Interrupt_State pragma + -- 'u' Interrupt_State pragma set state to User + -- 'r' Interrupt_State pragma set state to Runtime + -- 's' Interrupt_State pragma set state to System (use "default" + -- system handler) + + procedure Notify_Exception + (signo : Signal; + siginfo : System.Address; + ucontext : System.Address); + -- This function is the signal handler and calls a trampoline subprogram + -- that adjusts the unwind information so the ARM unwinder can find it's + -- way back to the context of the originating subprogram. Compare with + -- __gnat_error_handler for non-tasking programs. + + ---------------------- + -- Notify_Exception -- + ---------------------- + + Signal_Mask : aliased sigset_t; + -- The set of signals handled by Notify_Exception + + procedure Notify_Exception + (signo : Signal; + siginfo : System.Address; + ucontext : System.Address) + is + Result : Interfaces.C.int; + + begin + -- With the __builtin_longjmp, the signal mask is not restored, so we + -- need to restore it explicitly. ??? We don't use __builtin_longjmp + -- anymore, so do we still need this? */ + + Result := pthread_sigmask (SIG_UNBLOCK, Signal_Mask'Access, null); + pragma Assert (Result = 0); + + -- Perform the necessary context adjustments prior to calling the + -- trampoline subprogram with the "real" signal handler. + + Adjust_Context_For_Raise (signo, ucontext); + + Signal_Trampoline (signo, siginfo, ucontext, Map_Signal'Address); + end Notify_Exception; + + ---------------- + -- Initialize -- + ---------------- + + Initialized : Boolean := False; + + procedure Initialize is + act : aliased struct_sigaction; + old_act : aliased struct_sigaction; + Result : System.OS_Interface.int; + + Use_Alternate_Stack : constant Boolean := + System.Task_Primitives.Alternate_Stack_Size /= 0; + -- Whether to use an alternate signal stack for stack overflows + + begin + if Initialized then + return; + end if; + + Initialized := True; + + -- Need to call pthread_init very early because it is doing signal + -- initializations. + + pthread_init; + + Abort_Task_Interrupt := SIGADAABORT; + + act.sa_handler := Notify_Exception'Address; + + -- Setting SA_SIGINFO asks the kernel to pass more than just the signal + -- number argument to the handler when it is called. The set of extra + -- parameters includes a pointer to the interrupted context, which the + -- ZCX propagation scheme needs. + + -- Most man pages for sigaction mention that sa_sigaction should be set + -- instead of sa_handler when SA_SIGINFO is on. In practice, the two + -- fields are actually union'ed and located at the same offset. + + -- On some targets, we set sa_flags to SA_NODEFER so that during the + -- handler execution we do not change the Signal_Mask to be masked for + -- the Signal. + + -- This is a temporary fix to the problem that the Signal_Mask is not + -- restored after the exception (longjmp) from the handler. The right + -- fix should be made in sigsetjmp so that we save the Signal_Set and + -- restore it after a longjmp. + + -- We set SA_NODEFER to be compatible with what is done in + -- __gnat_error_handler. + + Result := sigemptyset (Signal_Mask'Access); + pragma Assert (Result = 0); + + -- Add signals that map to Ada exceptions to the mask + + for J in Exception_Interrupts'Range loop + if State (Exception_Interrupts (J)) /= Default then + Result := + sigaddset + (Signal_Mask'Access, Signal (Exception_Interrupts (J))); + pragma Assert (Result = 0); + end if; + end loop; + + act.sa_mask := Signal_Mask; + + pragma Assert (Keep_Unmasked = (Interrupt_ID'Range => False)); + pragma Assert (Reserve = (Interrupt_ID'Range => False)); + + -- Process state of exception signals + + for J in Exception_Interrupts'Range loop + if State (Exception_Interrupts (J)) /= User then + Keep_Unmasked (Exception_Interrupts (J)) := True; + Reserve (Exception_Interrupts (J)) := True; + + if State (Exception_Interrupts (J)) /= Default then + act.sa_flags := SA_NODEFER + SA_RESTART + SA_SIGINFO; + + if Use_Alternate_Stack + and then Exception_Interrupts (J) = SIGSEGV + then + act.sa_flags := act.sa_flags + SA_ONSTACK; + end if; + + Result := + sigaction + (Signal (Exception_Interrupts (J)), act'Unchecked_Access, + old_act'Unchecked_Access); + pragma Assert (Result = 0); + end if; + end if; + end loop; + + if State (Abort_Task_Interrupt) /= User then + Keep_Unmasked (Abort_Task_Interrupt) := True; + Reserve (Abort_Task_Interrupt) := True; + end if; + + -- Set SIGINT to unmasked state as long as it is not in "User" state. + -- Check for Unreserve_All_Interrupts last. + + if State (SIGINT) /= User then + Keep_Unmasked (SIGINT) := True; + Reserve (SIGINT) := True; + end if; + + -- Check all signals for state that requires keeping them unmasked and + -- reserved. + + for J in Interrupt_ID'Range loop + if State (J) = Default or else State (J) = Runtime then + Keep_Unmasked (J) := True; + Reserve (J) := True; + end if; + end loop; + + -- Add the set of signals that must always be unmasked for this target + + for J in Unmasked'Range loop + Keep_Unmasked (Interrupt_ID (Unmasked (J))) := True; + Reserve (Interrupt_ID (Unmasked (J))) := True; + end loop; + + -- Add target-specific reserved signals + + for J in Reserved'Range loop + Reserve (Interrupt_ID (Reserved (J))) := True; + end loop; + + -- Process pragma Unreserve_All_Interrupts. This overrides any settings + -- due to pragma Interrupt_State: + + if Unreserve_All_Interrupts /= 0 then + Keep_Unmasked (SIGINT) := False; + Reserve (SIGINT) := False; + end if; + + -- We do not really have Signal 0. We just use this value to identify + -- non-existent signals (see s-intnam.ads). Therefore, Signal should not + -- be used in all signal related operations hence mark it as reserved. + + Reserve (0) := True; + end Initialize; + +end System.Interrupt_Management; diff --git a/gcc-4.9/gcc/ada/s-linux-alpha.ads b/gcc-4.9/gcc/ada/s-linux-alpha.ads index 1a9f37acd..e1c97ad9a 100644 --- a/gcc-4.9/gcc/ada/s-linux-alpha.ads +++ b/gcc-4.9/gcc/ada/s-linux-alpha.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2009-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 2009-2014, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -35,14 +35,30 @@ -- PLEASE DO NOT add any with-clauses to this package or remove the pragma -- Preelaborate. This package is designed to be a bottom-level (leaf) package. +with Interfaces.C; + package System.Linux is pragma Preelaborate; - ------------ - -- time_t -- - ------------ - - type time_t is new Long_Integer; + ---------- + -- Time -- + ---------- + + subtype long is Interfaces.C.long; + subtype suseconds_t is Interfaces.C.long; + subtype time_t is Interfaces.C.long; + + type timespec is record + tv_sec : time_t; + tv_nsec : long; + end record; + pragma Convention (C, timespec); + + type timeval is record + tv_sec : time_t; + tv_usec : suseconds_t; + end record; + pragma Convention (C, timeval); ----------- -- Errno -- diff --git a/gcc-4.9/gcc/ada/s-linux-android.ads b/gcc-4.9/gcc/ada/s-linux-android.ads new file mode 100644 index 000000000..85c421039 --- /dev/null +++ b/gcc-4.9/gcc/ada/s-linux-android.ads @@ -0,0 +1,128 @@ +------------------------------------------------------------------------------ +-- -- +-- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS -- +-- -- +-- S Y S T E M . L I N U X -- +-- -- +-- S p e c -- +-- -- +-- Copyright (C) 2014, Free Software Foundation, Inc. -- +-- -- +-- GNARL is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 3, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- +-- or FITNESS FOR A PARTICULAR PURPOSE. -- +-- -- +-- As a special exception 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. -- +-- -- +-- In particular, you can freely distribute your programs built with the -- +-- GNAT Pro compiler, including any required library run-time units, using -- +-- any licensing terms of your choosing. See the AdaCore Software License -- +-- for full details. -- +-- -- +-- -- +------------------------------------------------------------------------------ + +-- This is the Android version of this package + +-- This package encapsulates cpu specific differences between implementations +-- of GNU/Linux, in order to share s-osinte-linux.ads. + +-- PLEASE DO NOT add any with-clauses to this package or remove the pragma +-- Preelaborate. This package is designed to be a bottom-level (leaf) package + +with Interfaces.C; + +package System.Linux is + pragma Preelaborate; + + ---------- + -- Time -- + ---------- + + subtype long is Interfaces.C.long; + subtype suseconds_t is Interfaces.C.long; + subtype time_t is Interfaces.C.long; + + type timespec is record + tv_sec : time_t; + tv_nsec : long; + end record; + pragma Convention (C, timespec); + + type timeval is record + tv_sec : time_t; + tv_usec : suseconds_t; + end record; + pragma Convention (C, timeval); + + ----------- + -- Errno -- + ----------- + + EAGAIN : constant := 11; + EINTR : constant := 4; + EINVAL : constant := 22; + ENOMEM : constant := 12; + EPERM : constant := 1; + ETIMEDOUT : constant := 110; + + ------------- + -- Signals -- + ------------- + + SIGHUP : constant := 1; -- hangup + SIGINT : constant := 2; -- interrupt (rubout) + SIGQUIT : constant := 3; -- quit (ASCD FS) + SIGILL : constant := 4; -- illegal instruction (not reset) + SIGTRAP : constant := 5; -- trace trap (not reset) + SIGIOT : constant := 6; -- IOT instruction + SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future + SIGFPE : constant := 8; -- floating point exception + SIGKILL : constant := 9; -- kill (cannot be caught or ignored) + SIGBUS : constant := 7; -- bus error + SIGSEGV : constant := 11; -- segmentation violation + SIGPIPE : constant := 13; -- write on a pipe with no one to read it + SIGALRM : constant := 14; -- alarm clock + SIGTERM : constant := 15; -- software termination signal from kill + SIGUSR1 : constant := 10; -- user defined signal 1 + SIGUSR2 : constant := 12; -- user defined signal 2 + SIGCLD : constant := 17; -- alias for SIGCHLD + SIGCHLD : constant := 17; -- child status change + SIGPWR : constant := 30; -- power-fail restart + SIGWINCH : constant := 28; -- window size change + SIGURG : constant := 23; -- urgent condition on IO channel + SIGPOLL : constant := 29; -- pollable event occurred + SIGIO : constant := 29; -- I/O now possible (4.2 BSD) + SIGLOST : constant := 29; -- File lock lost + SIGSTOP : constant := 19; -- stop (cannot be caught or ignored) + SIGTSTP : constant := 20; -- user stop requested from tty + SIGCONT : constant := 18; -- stopped process has been continued + SIGTTIN : constant := 21; -- background tty read attempted + SIGTTOU : constant := 22; -- background tty write attempted + SIGVTALRM : constant := 26; -- virtual timer expired + SIGPROF : constant := 27; -- profiling timer expired + SIGXCPU : constant := 24; -- CPU time limit exceeded + SIGXFSZ : constant := 25; -- filesize limit exceeded + SIGUNUSED : constant := 31; -- unused signal (GNU/Linux) + SIGSTKFLT : constant := 16; -- coprocessor stack fault (Linux) + SIGLTHRRES : constant := 32; -- GNU/LinuxThreads restart signal + SIGLTHRCAN : constant := 33; -- GNU/LinuxThreads cancel signal + SIGLTHRDBG : constant := 34; -- GNU/LinuxThreads debugger signal + + -- struct_sigaction offsets + + sa_handler_pos : constant := 0; + sa_mask_pos : constant := Standard'Address_Size / 8; + sa_flags_pos : constant := 4 + sa_mask_pos; + + SA_SIGINFO : constant := 16#00000004#; + SA_ONSTACK : constant := 16#08000000#; + SA_RESTART : constant := 16#10000000#; + SA_NODEFER : constant := 16#40000000#; + +end System.Linux; diff --git a/gcc-4.9/gcc/ada/s-linux-hppa.ads b/gcc-4.9/gcc/ada/s-linux-hppa.ads index 904615049..8f7d81175 100644 --- a/gcc-4.9/gcc/ada/s-linux-hppa.ads +++ b/gcc-4.9/gcc/ada/s-linux-hppa.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2008-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 2008-2014, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -35,14 +35,30 @@ -- PLEASE DO NOT add any with-clauses to this package or remove the pragma -- Preelaborate. This package is designed to be a bottom-level (leaf) package. +with Interfaces.C; + package System.Linux is pragma Preelaborate; - ------------ - -- time_t -- - ------------ + ---------- + -- Time -- + ---------- + + subtype long is Interfaces.C.long; + subtype suseconds_t is Interfaces.C.long; + subtype time_t is Interfaces.C.long; + + type timespec is record + tv_sec : time_t; + tv_nsec : long; + end record; + pragma Convention (C, timespec); - type time_t is new Long_Integer; + type timeval is record + tv_sec : time_t; + tv_usec : suseconds_t; + end record; + pragma Convention (C, timeval); ----------- -- Errno -- diff --git a/gcc-4.9/gcc/ada/s-linux-mipsel.ads b/gcc-4.9/gcc/ada/s-linux-mipsel.ads index 028ea7c0b..1799a557a 100644 --- a/gcc-4.9/gcc/ada/s-linux-mipsel.ads +++ b/gcc-4.9/gcc/ada/s-linux-mipsel.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2009-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 2009-2014, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -34,14 +34,30 @@ -- PLEASE DO NOT add any with-clauses to this package or remove the pragma -- Preelaborate. This package is designed to be a bottom-level (leaf) package +with Interfaces.C; + package System.Linux is pragma Preelaborate; - ------------ - -- time_t -- - ------------ + ---------- + -- Time -- + ---------- + + subtype long is Interfaces.C.long; + subtype suseconds_t is Interfaces.C.long; + subtype time_t is Interfaces.C.long; + + type timespec is record + tv_sec : time_t; + tv_nsec : long; + end record; + pragma Convention (C, timespec); - type time_t is new Long_Integer; + type timeval is record + tv_sec : time_t; + tv_usec : suseconds_t; + end record; + pragma Convention (C, timeval); ----------- -- Errno -- diff --git a/gcc-4.9/gcc/ada/s-linux-sparc.ads b/gcc-4.9/gcc/ada/s-linux-sparc.ads index db3b4ea79..ae813e6b3 100644 --- a/gcc-4.9/gcc/ada/s-linux-sparc.ads +++ b/gcc-4.9/gcc/ada/s-linux-sparc.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2009-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 2009-2014, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -35,14 +35,30 @@ -- PLEASE DO NOT add any with-clauses to this package or remove the pragma -- Preelaborate. This package is designed to be a bottom-level (leaf) package +with Interfaces.C; + package System.Linux is pragma Preelaborate; - ------------ - -- time_t -- - ------------ - - type time_t is new Long_Integer; + ---------- + -- Time -- + ---------- + + subtype long is Interfaces.C.long; + subtype suseconds_t is Interfaces.C.long; + subtype time_t is Interfaces.C.long; + + type timespec is record + tv_sec : time_t; + tv_nsec : long; + end record; + pragma Convention (C, timespec); + + type timeval is record + tv_sec : time_t; + tv_usec : suseconds_t; + end record; + pragma Convention (C, timeval); ----------- -- Errno -- diff --git a/gcc-4.9/gcc/ada/s-linux-x32.ads b/gcc-4.9/gcc/ada/s-linux-x32.ads index 9dc0e830d..1b2d46edd 100644 --- a/gcc-4.9/gcc/ada/s-linux-x32.ads +++ b/gcc-4.9/gcc/ada/s-linux-x32.ads @@ -6,7 +6,8 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2013, Free Software Foundation, Inc. -- +-- Copyright (C) 2013-2014, Free Software Foundation, Inc. -- +-- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -38,12 +39,24 @@ package System.Linux is pragma Preelaborate; - ------------ - -- time_t -- - ------------ + ---------- + -- Time -- + ---------- type time_t is new Long_Long_Integer; + type timespec is record + tv_sec : time_t; + tv_nsec : Long_Long_Integer; + end record; + pragma Convention (C, timespec); + + type timeval is record + tv_sec : time_t; + tv_usec : Long_Long_Integer; + end record; + pragma Convention (C, timeval); + ----------- -- Errno -- ----------- diff --git a/gcc-4.9/gcc/ada/s-linux.ads b/gcc-4.9/gcc/ada/s-linux.ads index 2339e29e0..8a49e8c89 100644 --- a/gcc-4.9/gcc/ada/s-linux.ads +++ b/gcc-4.9/gcc/ada/s-linux.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2008-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 2008-2014, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -35,14 +35,30 @@ -- PLEASE DO NOT add any with-clauses to this package or remove the pragma -- Preelaborate. This package is designed to be a bottom-level (leaf) package +with Interfaces.C; + package System.Linux is pragma Preelaborate; - ------------ - -- time_t -- - ------------ + ---------- + -- Time -- + ---------- + + subtype long is Interfaces.C.long; + subtype suseconds_t is Interfaces.C.long; + subtype time_t is Interfaces.C.long; + + type timespec is record + tv_sec : time_t; + tv_nsec : long; + end record; + pragma Convention (C, timespec); - type time_t is new Long_Integer; + type timeval is record + tv_sec : time_t; + tv_usec : suseconds_t; + end record; + pragma Convention (C, timeval); ----------- -- Errno -- diff --git a/gcc-4.9/gcc/ada/s-osinte-android.ads b/gcc-4.9/gcc/ada/s-osinte-android.ads index 2b94f3f05..310c598d7 100644 --- a/gcc-4.9/gcc/ada/s-osinte-android.ads +++ b/gcc-4.9/gcc/ada/s-osinte-android.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1995-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 1995-2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -75,7 +75,7 @@ package System.OS_Interface is -- Signals -- ------------- - Max_Interrupt : constant := 63; + Max_Interrupt : constant := 31; type Signal is new int range 0 .. Max_Interrupt; for Signal'Size use int'Size; @@ -114,9 +114,6 @@ package System.OS_Interface is SIGXFSZ : constant := System.Linux.SIGXFSZ; SIGUNUSED : constant := System.Linux.SIGUNUSED; SIGSTKFLT : constant := System.Linux.SIGSTKFLT; - SIGLTHRRES : constant := System.Linux.SIGLTHRRES; - SIGLTHRCAN : constant := System.Linux.SIGLTHRCAN; - SIGLTHRDBG : constant := System.Linux.SIGLTHRDBG; SIGADAABORT : constant := SIGABRT; -- Change this to use another signal for task abort. SIGTERM might be a @@ -138,13 +135,9 @@ package System.OS_Interface is SIGPROF, -- To avoid confusing the profiler - SIGKILL, SIGSTOP, + SIGKILL, SIGSTOP); -- These two signals actually can't be masked (POSIX won't allow it) - SIGLTHRRES, SIGLTHRCAN, SIGLTHRDBG); - -- These three signals are used by GNU/LinuxThreads starting from glibc - -- 2.1 (future 2.2). - Reserved : constant Signal_Set := (SIGVTALRM, SIGUNUSED); -- Not clear why these two signals are reserved. Perhaps they are not -- supported by this version of GNU/Linux ??? @@ -187,6 +180,8 @@ package System.OS_Interface is SA_SIGINFO : constant := System.Linux.SA_SIGINFO; SA_ONSTACK : constant := System.Linux.SA_ONSTACK; + SA_NODEFER : constant := System.Linux.SA_NODEFER; + SA_RESTART : constant := System.Linux.SA_RESTART; SIG_BLOCK : constant := 0; SIG_UNBLOCK : constant := 1; @@ -580,17 +575,16 @@ package System.OS_Interface is private - type sigset_t is - -- array (0 .. OS_Constants.SIZEOF_sigset - 1) of unsigned_char; - array (1 .. 127) of unsigned_char; + type sigset_t is new Interfaces.C.unsigned_long; pragma Convention (C, sigset_t); for sigset_t'Alignment use Interfaces.C.unsigned_long'Alignment; pragma Warnings (Off); for struct_sigaction use record sa_handler at Linux.sa_handler_pos range 0 .. Standard'Address_Size - 1; - sa_mask at Linux.sa_mask_pos range 0 .. 1023; - sa_flags at Linux.sa_flags_pos range 0 .. Standard'Address_Size - 1; + sa_mask at Linux.sa_mask_pos range 0 .. sigset_t'Size - 1; + sa_flags at Linux.sa_flags_pos + range 0 .. Interfaces.C.unsigned_long'Size - 1; end record; -- We intentionally leave sa_restorer unspecified and let the compiler -- append it after the last field, so disable corresponding warning. diff --git a/gcc-4.9/gcc/ada/s-osinte-hpux.ads b/gcc-4.9/gcc/ada/s-osinte-hpux.ads index 396844c68..6beb05018 100644 --- a/gcc-4.9/gcc/ada/s-osinte-hpux.ads +++ b/gcc-4.9/gcc/ada/s-osinte-hpux.ads @@ -7,7 +7,7 @@ -- S p e c -- -- -- -- Copyright (C) 1991-1994, Florida State University -- --- Copyright (C) 1995-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 1995-2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -522,7 +522,7 @@ private type timespec is record tv_sec : time_t; - tv_nsec : time_t; + tv_nsec : long; end record; pragma Convention (C, timespec); diff --git a/gcc-4.9/gcc/ada/s-osinte-kfreebsd-gnu.ads b/gcc-4.9/gcc/ada/s-osinte-kfreebsd-gnu.ads index f57fe9fea..be46c2e53 100644 --- a/gcc-4.9/gcc/ada/s-osinte-kfreebsd-gnu.ads +++ b/gcc-4.9/gcc/ada/s-osinte-kfreebsd-gnu.ads @@ -7,7 +7,7 @@ -- S p e c -- -- -- -- Copyright (C) 1991-1994, Florida State University -- --- Copyright (C) 1995-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 1995-2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -492,7 +492,7 @@ private type timespec is record tv_sec : time_t; - tv_nsec : time_t; + tv_nsec : long; end record; pragma Convention (C, timespec); diff --git a/gcc-4.9/gcc/ada/s-osinte-linux.ads b/gcc-4.9/gcc/ada/s-osinte-linux.ads index 3f8df80c0..15a351ac1 100644 --- a/gcc-4.9/gcc/ada/s-osinte-linux.ads +++ b/gcc-4.9/gcc/ada/s-osinte-linux.ads @@ -7,7 +7,7 @@ -- S p e c -- -- -- -- Copyright (C) 1991-1994, Florida State University -- --- Copyright (C) 1995-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 1995-2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -217,8 +217,9 @@ package System.OS_Interface is -- Time -- ---------- - type timespec is private; - type time_t is private; + subtype time_t is System.Linux.time_t; + subtype timespec is System.Linux.timespec; + subtype timeval is System.Linux.timeval; function To_Duration (TS : timespec) return Duration; pragma Inline (To_Duration); @@ -598,14 +599,6 @@ private type pid_t is new int; - type time_t is new System.Linux.time_t; - - type timespec is record - tv_sec : time_t; - tv_nsec : time_t; - end record; - pragma Convention (C, timespec); - type unsigned_long_long_t is mod 2 ** 64; -- Local type only used to get the alignment of this type below diff --git a/gcc-4.9/gcc/ada/s-osinte-posix.adb b/gcc-4.9/gcc/ada/s-osinte-posix.adb index 402ddcb61..6bcc72235 100644 --- a/gcc-4.9/gcc/ada/s-osinte-posix.adb +++ b/gcc-4.9/gcc/ada/s-osinte-posix.adb @@ -7,7 +7,7 @@ -- B o d y -- -- -- -- Copyright (C) 1991-1994, Florida State University -- --- Copyright (C) 1995-2010, AdaCore -- +-- Copyright (C) 1995-2014, AdaCore -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -30,8 +30,7 @@ -- -- ------------------------------------------------------------------------------ --- This is a GNU/LinuxThreads, Solaris pthread and HP-UX pthread version --- of this package. +-- This version is for POSIX-like operating systems pragma Polling (Off); -- Turn off polling, we do not want ATC polling to take place during @@ -104,7 +103,7 @@ package body System.OS_Interface is end if; return timespec'(tv_sec => S, - tv_nsec => time_t (Long_Long_Integer (F * 10#1#E9))); + tv_nsec => long (Long_Long_Integer (F * 10#1#E9))); end To_Timespec; end System.OS_Interface; diff --git a/gcc-4.9/gcc/ada/s-osinte-solaris-posix.ads b/gcc-4.9/gcc/ada/s-osinte-solaris-posix.ads index 7aa20f115..0859b8d7b 100644 --- a/gcc-4.9/gcc/ada/s-osinte-solaris-posix.ads +++ b/gcc-4.9/gcc/ada/s-osinte-solaris-posix.ads @@ -7,7 +7,7 @@ -- S p e c -- -- -- -- Copyright (C) 1991-1994, Florida State University -- --- Copyright (C) 1995-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 1995-2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -513,7 +513,7 @@ private type timespec is record tv_sec : time_t; - tv_nsec : time_t; + tv_nsec : long; end record; pragma Convention (C, timespec); diff --git a/gcc-4.9/gcc/ada/s-osinte-x32.adb b/gcc-4.9/gcc/ada/s-osinte-x32.adb new file mode 100644 index 000000000..467970b96 --- /dev/null +++ b/gcc-4.9/gcc/ada/s-osinte-x32.adb @@ -0,0 +1,110 @@ +------------------------------------------------------------------------------ +-- -- +-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- +-- -- +-- S Y S T E M . O S _ I N T E R F A C E -- +-- -- +-- B o d y -- +-- -- +-- Copyright (C) 1991-1994, Florida State University -- +-- Copyright (C) 1995-2014, AdaCore -- +-- -- +-- GNAT is free software; you can redistribute it and/or modify it under -- +-- terms of the GNU General Public License as published by the Free Soft- -- +-- ware Foundation; either version 3, or (at your option) any later ver- -- +-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- +-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- +-- or FITNESS FOR A PARTICULAR PURPOSE. -- +-- -- +-- As a special exception 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/>. -- +-- -- +-- GNARL was developed by the GNARL team at Florida State University. -- +-- Extensive contributions were provided by Ada Core Technologies, Inc. -- +-- -- +------------------------------------------------------------------------------ + +-- This version is for Linux/x32 + +pragma Polling (Off); +-- Turn off polling, we do not want ATC polling to take place during +-- tasking operations. It causes infinite loops and other problems. + +-- This package encapsulates all direct interfaces to OS services +-- that are needed by children of System. + +with Interfaces.C; use Interfaces.C; +package body System.OS_Interface is + + -------------------- + -- Get_Stack_Base -- + -------------------- + + function Get_Stack_Base (thread : pthread_t) return Address is + pragma Warnings (Off, thread); + + begin + return Null_Address; + end Get_Stack_Base; + + ------------------ + -- pthread_init -- + ------------------ + + procedure pthread_init is + begin + null; + end pthread_init; + + ----------------- + -- To_Duration -- + ----------------- + + function To_Duration (TS : timespec) return Duration is + begin + return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9; + end To_Duration; + + ------------------------ + -- To_Target_Priority -- + ------------------------ + + function To_Target_Priority + (Prio : System.Any_Priority) return Interfaces.C.int + is + begin + return Interfaces.C.int (Prio); + end To_Target_Priority; + + ----------------- + -- To_Timespec -- + ----------------- + + function To_Timespec (D : Duration) return timespec is + S : time_t; + F : Duration; + + use type System.Linux.time_t; + begin + S := time_t (Long_Long_Integer (D)); + F := D - Duration (S); + + -- If F has negative value due to a round-up, adjust for positive F + -- value. + + if F < 0.0 then + S := S - 1; + F := F + 1.0; + end if; + + return timespec'(tv_sec => S, + tv_nsec => Long_Long_Integer (F * 10#1#E9)); + end To_Timespec; + +end System.OS_Interface; diff --git a/gcc-4.9/gcc/ada/s-osprim-x32.adb b/gcc-4.9/gcc/ada/s-osprim-x32.adb index 5d4964a27..e0c020c78 100644 --- a/gcc-4.9/gcc/ada/s-osprim-x32.adb +++ b/gcc-4.9/gcc/ada/s-osprim-x32.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2013, Free Software Foundation, Inc. -- +-- Copyright (C) 2013-2014, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -42,7 +42,7 @@ package body System.OS_Primitives is type timespec is record tv_sec : time_t; - tv_nsec : time_t; + tv_nsec : Long_Long_Integer; end record; pragma Convention (C, timespec); @@ -54,7 +54,7 @@ package body System.OS_Primitives is ----------- function Clock return Duration is - type timeval is array (1 .. 2) of time_t; + type timeval is array (1 .. 2) of Long_Long_Integer; procedure timeval_to_duration (T : not null access timeval; @@ -118,7 +118,7 @@ package body System.OS_Primitives is return timespec'(tv_sec => S, - tv_nsec => time_t (Long_Long_Integer (F * 10#1#E9))); + tv_nsec => Long_Long_Integer (F * 10#1#E9)); end To_Timespec; ----------------- diff --git a/gcc-4.9/gcc/ada/s-taprop-linux.adb b/gcc-4.9/gcc/ada/s-taprop-linux.adb index 515850a68..5aa384ba1 100644 --- a/gcc-4.9/gcc/ada/s-taprop-linux.adb +++ b/gcc-4.9/gcc/ada/s-taprop-linux.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -627,8 +627,6 @@ package body System.Task_Primitives.Operations is function Monotonic_Clock return Duration is use Interfaces; - type timeval is array (1 .. 2) of System.OS_Interface.time_t; - procedure timeval_to_duration (T : not null access timeval; sec : not null access C.long; diff --git a/gcc-4.9/gcc/ada/sigtramp-armdroid.c b/gcc-4.9/gcc/ada/sigtramp-armdroid.c new file mode 100644 index 000000000..fb522dfcd --- /dev/null +++ b/gcc-4.9/gcc/ada/sigtramp-armdroid.c @@ -0,0 +1,161 @@ +/**************************************************************************** + * * + * GNAT COMPILER COMPONENTS * + * * + * S I G T R A M P * + * * + * Asm Implementation File * + * * + * Copyright (C) 2014, Free Software Foundation, Inc. * + * * + * GNAT is free software; you can redistribute it and/or modify it under * + * terms of the GNU General Public License as published by the Free Soft- * + * ware Foundation; either version 3, or (at your option) any later ver- * + * sion. GNAT is distributed in the hope that it will be useful, but WITH- * + * OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * + * or FITNESS FOR A PARTICULAR PURPOSE. * + * * + * As a special exception 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. * + * * + * In particular, you can freely distribute your programs built with the * + * GNAT Pro compiler, including any required library run-time units, using * + * any licensing terms of your choosing. See the AdaCore Software License * + * for full details. * + * * + * GNAT was originally developed by the GNAT team at New York University. * + * Extensive contributions were provided by Ada Core Technologies Inc. * + * * + ****************************************************************************/ + +/****************************************************** + * ARM-Android version of the __gnat_sigtramp service * + ******************************************************/ + +#include "sigtramp.h" +/* See sigtramp.h for a general explanation of functionality. */ + +/* ---------------------- + -- General comments -- + ---------------------- + + Stubs are generated from toplevel asms, + The general idea is to establish CFA as the sigcontext + and state where to find the registers as offsets from there. + + We support stubs for VxWorks and Android, providing unwind info for + common registers. We might need variants with support for floating + point or altivec registers as well at some point. + + For Android it would be simpler to write this in Asm since there's only + one variant, but to keep it looking like the VxWorks stubs, + C is the choice for our toplevel interface. + + Note that the registers we "restore" here are those to which we have + direct access through the system sigcontext structure, which includes + only a partial set of the non-volatiles ABI-wise. */ + +/* ----------------------------------------- + -- Protypes for our internal asm stubs -- + ----------------------------------------- + + The registers are expected to be at SIGCONTEXT + 12 (reference the + sicontext structure in asm/sigcontext.h which describes the first + 3 * 4byte fields.) Even though our symbols will remain local, the + prototype claims "extern" and not "static" to prevent compiler complaints + about a symbol used but never defined. */ + +/* sigtramp stub providing unwind info for common registers. */ + +extern void __gnat_sigtramp_common + (int signo, void *siginfo, void *sigcontext, + __sigtramphandler_t * handler); + +void __gnat_sigtramp (int signo, void *si, void *sc, + __sigtramphandler_t * handler) + __attribute__((optimize(2))); + +void __gnat_sigtramp (int signo, void *si, void *ucontext, + __sigtramphandler_t * handler) +{ + struct sigcontext *mcontext = &((ucontext_t *) ucontext)->uc_mcontext; + + __gnat_sigtramp_common (signo, si, mcontext, handler); +} + +/* asm string construction helpers. */ + +#define STR(TEXT) #TEXT +/* stringify expanded TEXT, surrounding it with double quotes. */ + +#define S(E) STR(E) +/* stringify E, which will resolve as text but may contain macros + still to be expanded. */ + +/* asm (TEXT) outputs <tab>TEXT. These facilitate the output of + multiline contents: */ +#define TAB(S) "\t" S +#define CR(S) S "\n" + +#undef TCR +#define TCR(S) TAB(CR(S)) + +/* Trampoline body block + --------------------- */ + +#define SIGTRAMP_BODY \ +CR("") \ +TCR("# Allocate frame and also save r2 which is the argument register") \ +TCR("# containing the sigcontext, so that we can restore it during") \ +TCR("# unwinding and thereby load the rest of the desired context.") \ +TCR("stmfd sp!, {r2, r3, lr}") \ +TCR("# The unwinder undo's these operations in reverse order so starting") \ +TCR("# from bottom, restore r2 from the current vsp location, move r2 into") \ +TCR("# the vsp, add 12 bytes to get the start of the register save area") \ +TCR("# then restore the 15 general purpose registers of the frame which") \ +TCR("# raised the signal.") \ +TCR(".save {r0, r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13, r14, r15}") \ +TCR(".pad #12") \ +TCR(".movsp r2") \ +TCR(".save {r2}") \ +TCR("# Call the real handler. The signo, siginfo and sigcontext") \ +TCR("# arguments are the same as those we received in r0, r1 and r2.") \ +TCR("blx r3") \ +TCR("# Restore our callee-saved items, release our frame and return") \ +TCR("# (should never get here!).") \ +TCR("ldmfd sp, {r2, r3, pc}") + +/* Symbol definition block + ----------------------- */ + +#define SIGTRAMP_START(SYM) \ +CR("# " S(SYM) " unwind trampoline") \ +TCR(".type " S(SYM) ", %function") \ +CR("") \ +CR(S(SYM) ":") \ +TCR(".fnstart") + +/* Symbol termination block + ------------------------ */ + +#define SIGTRAMP_END(SYM) \ +CR(".fnend") \ +TCR(".size " S(SYM) ", .-" S(SYM)) + +/*---------------------------- + -- And now, the real code -- + ---------------------------- */ + +/* Text section start. The compiler isn't aware of that switch. */ + +asm (".text\n" + TCR(".align 2")); + +/* sigtramp stub for common registers. */ + +#define TRAMP_COMMON __gnat_sigtramp_common + +asm (SIGTRAMP_START(TRAMP_COMMON)); +asm (SIGTRAMP_BODY); +asm (SIGTRAMP_END(TRAMP_COMMON)); diff --git a/gcc-4.9/gcc/ada/sigtramp.h b/gcc-4.9/gcc/ada/sigtramp.h index cf5f4707e..7419e1725 100644 --- a/gcc-4.9/gcc/ada/sigtramp.h +++ b/gcc-4.9/gcc/ada/sigtramp.h @@ -6,7 +6,7 @@ * * * C Header File * * * - * Copyright (C) 2011-2013, Free Software Foundation, Inc. * + * Copyright (C) 2011-2014, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -41,10 +41,29 @@ extern "C" { #endif - typedef void sighandler_t (int signo, void *siginfo, void *sigcontext); +#ifdef __ANDROID__ +#include <stdlib.h> +#include <asm/signal.h> +#include <asm/sigcontext.h> + +/* Android SDK doesn't define these structs */ +typedef struct sigcontext mcontext_t; + +typedef struct ucontext + { + unsigned long uc_flags; + struct ucontext *uc_link; + stack_t uc_stack; + mcontext_t uc_mcontext; +} ucontext_t; +#endif + + /* This typedef signature sometimes conflicts with the sighandler_t from + system headers so call it something unique. */ + typedef void __sigtramphandler_t (int signo, void *siginfo, void *sigcontext); void __gnat_sigtramp (int signo, void *siginfo, void *sigcontext, - sighandler_t * handler); + __sigtramphandler_t * handler); /* To be called from an established signal handler. Setup the DWARF CFI bits letting unwinders walk through the signal frame up into the diff --git a/gcc-4.9/gcc/ada/system-linux-alpha.ads b/gcc-4.9/gcc/ada/system-linux-alpha.ads index 5d8450204..044ab3e1c 100644 --- a/gcc-4.9/gcc/ada/system-linux-alpha.ads +++ b/gcc-4.9/gcc/ada/system-linux-alpha.ads @@ -7,7 +7,7 @@ -- S p e c -- -- (GNU-Linux/alpha Version) -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -35,9 +35,10 @@ ------------------------------------------------------------------------------ package System is -pragma Pure (System); --- Note that we take advantage of the implementation permission to --- make this unit Pure instead of Preelaborable, see RM 13.7(36) + pragma Pure; + -- Note that we take advantage of the implementation permission to make + -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada + -- 2005, this is Pure in any case (AI-362). type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; @@ -61,6 +62,7 @@ pragma Pure (System); -- Storage-related Declarations type Address is private; + pragma Preelaborable_Initialization (Address); Null_Address : constant Address; Storage_Unit : constant := 8; diff --git a/gcc-4.9/gcc/ada/system-linux-mips.ads b/gcc-4.9/gcc/ada/system-linux-mips.ads index 18f449563..08724650d 100644 --- a/gcc-4.9/gcc/ada/system-linux-mips.ads +++ b/gcc-4.9/gcc/ada/system-linux-mips.ads @@ -7,7 +7,7 @@ -- S p e c -- -- (GNU-Linux/MIPS Version) -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -62,6 +62,7 @@ package System is -- Storage-related Declarations type Address is private; + pragma Preelaborable_Initialization (Address); Null_Address : constant Address; Storage_Unit : constant := 8; diff --git a/gcc-4.9/gcc/ada/system-linux-mips64el.ads b/gcc-4.9/gcc/ada/system-linux-mips64el.ads index 85a0f41c3..5c8cad177 100644 --- a/gcc-4.9/gcc/ada/system-linux-mips64el.ads +++ b/gcc-4.9/gcc/ada/system-linux-mips64el.ads @@ -7,7 +7,7 @@ -- S p e c -- -- (GNU-Linux/MIPS64EL Version) -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -62,6 +62,7 @@ package System is -- Storage-related Declarations type Address is private; + pragma Preelaborable_Initialization (Address); Null_Address : constant Address; Storage_Unit : constant := 8; diff --git a/gcc-4.9/gcc/ada/system-linux-mipsel.ads b/gcc-4.9/gcc/ada/system-linux-mipsel.ads index c700048b8..e6d56fb82 100644 --- a/gcc-4.9/gcc/ada/system-linux-mipsel.ads +++ b/gcc-4.9/gcc/ada/system-linux-mipsel.ads @@ -7,7 +7,7 @@ -- S p e c -- -- (GNU-Linux/MIPSEL Version) -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -62,6 +62,7 @@ package System is -- Storage-related Declarations type Address is private; + pragma Preelaborable_Initialization (Address); Null_Address : constant Address; Storage_Unit : constant := 8; diff --git a/gcc-4.9/gcc/ada/system-linux-s390.ads b/gcc-4.9/gcc/ada/system-linux-s390.ads index 28107a0b4..e240d2e48 100644 --- a/gcc-4.9/gcc/ada/system-linux-s390.ads +++ b/gcc-4.9/gcc/ada/system-linux-s390.ads @@ -7,7 +7,7 @@ -- S p e c -- -- (GNU-Linux/s390 Version) -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -35,9 +35,10 @@ ------------------------------------------------------------------------------ package System is -pragma Pure (System); --- Note that we take advantage of the implementation permission to --- make this unit Pure instead of Preelaborable, see RM 13.7(36) + pragma Pure; + -- Note that we take advantage of the implementation permission to make + -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada + -- 2005, this is Pure in any case (AI-362). type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; @@ -61,6 +62,7 @@ pragma Pure (System); -- Storage-related Declarations type Address is private; + pragma Preelaborable_Initialization (Address); Null_Address : constant Address; Storage_Unit : constant := 8; diff --git a/gcc-4.9/gcc/ada/system-linux-s390x.ads b/gcc-4.9/gcc/ada/system-linux-s390x.ads index 135b5a3b1..19d2180ff 100644 --- a/gcc-4.9/gcc/ada/system-linux-s390x.ads +++ b/gcc-4.9/gcc/ada/system-linux-s390x.ads @@ -7,7 +7,7 @@ -- S p e c -- -- (GNU-Linux/s390x Version) -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -35,9 +35,10 @@ ------------------------------------------------------------------------------ package System is -pragma Pure (System); --- Note that we take advantage of the implementation permission to --- make this unit Pure instead of Preelaborable, see RM 13.7(36) + pragma Pure; + -- Note that we take advantage of the implementation permission to make + -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada + -- 2005, this is Pure in any case (AI-362). type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; @@ -61,6 +62,7 @@ pragma Pure (System); -- Storage-related Declarations type Address is private; + pragma Preelaborable_Initialization (Address); Null_Address : constant Address; Storage_Unit : constant := 8; diff --git a/gcc-4.9/gcc/ada/system-linux-sparc.ads b/gcc-4.9/gcc/ada/system-linux-sparc.ads index ff93463cf..6fde138ea 100644 --- a/gcc-4.9/gcc/ada/system-linux-sparc.ads +++ b/gcc-4.9/gcc/ada/system-linux-sparc.ads @@ -7,7 +7,7 @@ -- S p e c -- -- (GNU/Linux-SPARC Version) -- -- -- --- Copyright (C) 1992-2012, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -35,9 +35,10 @@ ------------------------------------------------------------------------------ package System is -pragma Pure (System); --- Note that we take advantage of the implementation permission to --- make this unit Pure instead of Preelaborable, see RM 13.7(36) + pragma Pure; + -- Note that we take advantage of the implementation permission to make + -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada + -- 2005, this is Pure in any case (AI-362). type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; @@ -61,6 +62,7 @@ pragma Pure (System); -- Storage-related Declarations type Address is private; + pragma Preelaborable_Initialization (Address); Null_Address : constant Address; Storage_Unit : constant := 8; diff --git a/gcc-4.9/gcc/ada/system-linux-sparcv9.ads b/gcc-4.9/gcc/ada/system-linux-sparcv9.ads index 14d89f929..5b7598f3e 100644 --- a/gcc-4.9/gcc/ada/system-linux-sparcv9.ads +++ b/gcc-4.9/gcc/ada/system-linux-sparcv9.ads @@ -7,7 +7,7 @@ -- S p e c -- -- (GNU/Linux-SPARCV9 Version) -- -- -- --- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -35,9 +35,10 @@ ------------------------------------------------------------------------------ package System is -pragma Pure (System); --- Note that we take advantage of the implementation permission to --- make this unit Pure instead of Preelaborable, see RM 13.7(36) + pragma Pure; + -- Note that we take advantage of the implementation permission to make + -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada + -- 2005, this is Pure in any case (AI-362). type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; @@ -61,6 +62,7 @@ pragma Pure (System); -- Storage-related Declarations type Address is private; + pragma Preelaborable_Initialization (Address); Null_Address : constant Address; Storage_Unit : constant := 8; diff --git a/gcc-4.9/gcc/ada/system-rtems.ads b/gcc-4.9/gcc/ada/system-rtems.ads index 3cab22abf..50bf7ac64 100644 --- a/gcc-4.9/gcc/ada/system-rtems.ads +++ b/gcc-4.9/gcc/ada/system-rtems.ads @@ -7,7 +7,7 @@ -- S p e c -- -- (Compiler Version) -- -- -- --- Copyright (C) 1992-2011 Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2014 Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -34,9 +34,8 @@ -- -- ------------------------------------------------------------------------------ --- This version of System is a RTEMS version that is used in building --- the compiler. This is based as closely as possible on the generic --- version with the following exceptions: +-- This version is for RTEMS. It is based as closely as possible on the +-- generic version with the following exceptions: -- + priority definitions package System is @@ -67,6 +66,7 @@ package System is -- Storage-related Declarations type Address is private; + pragma Preelaborable_Initialization (Address); Null_Address : constant Address; Storage_Unit : constant := Standard'Storage_Unit; diff --git a/gcc-4.9/gcc/ada/system-vxworks-arm.ads b/gcc-4.9/gcc/ada/system-vxworks-arm.ads index 60a41e1b2..e7418a8a5 100644 --- a/gcc-4.9/gcc/ada/system-vxworks-arm.ads +++ b/gcc-4.9/gcc/ada/system-vxworks-arm.ads @@ -7,7 +7,7 @@ -- S p e c -- -- (VxWorks Version ARM) -- -- -- --- Copyright (C) 1992-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2014, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -35,10 +35,10 @@ ------------------------------------------------------------------------------ package System is -pragma Pure (System); --- Note that we take advantage of the implementation permission to make this --- unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada 2005, this is --- Pure in any case (AI-362). + pragma Pure; + -- Note that we take advantage of the implementation permission to make + -- this unit Pure instead of Preelaborable; see RM 13.7.1(15). In Ada + -- 2005, this is Pure in any case (AI-362). type Name is (SYSTEM_NAME_GNAT); System_Name : constant Name := SYSTEM_NAME_GNAT; |