openbsd-ports/lang/gcc/4.6/patches/patch-gcc_ada_s-osprim-posix_adb
tobiasu fa5f89b880 Repair time/delay/duration time_t issues in gnat. All direct imports of
C functions have been modified to use same-size types on both sides.
There are no checks in gcc to make sure the types match, and it happily
trashes the stack or reads bogus data without this fix.

The C shim in gnatlib is still casting down to long (by design), thus
gnat is not 2038-proof on 32 bit architectures. Fixing this is an
ongoing project, but I'm running out of time for this release.

Getting the timezone offset is now supported; the unused usleep
procedure that snuck in from FreeBSD support got removed.

Tested on all supported architectures, plus new bootstraps due to the
stack trashing, just in case...

Conceptually fine with brad@
deraadt@ is unhappy with the partial solution, fixing this remains a
high priority todo
2014-02-07 01:27:21 +00:00

26 lines
860 B
Plaintext

$OpenBSD: patch-gcc_ada_s-osprim-posix_adb,v 1.1 2014/02/07 01:27:21 tobiasu Exp $
--- gcc/ada/s-osprim-posix.adb.orig Sun Jan 19 03:46:06 2014
+++ gcc/ada/s-osprim-posix.adb Sun Jan 19 06:31:26 2014
@@ -38,7 +38,7 @@ package body System.OS_Primitives is
-- these declarations in System.OS_Interface and move these ones in
-- the spec.
- type time_t is new Long_Integer;
+ type time_t is new Long_Long_Integer;
type timespec is record
tv_sec : time_t;
@@ -54,7 +54,11 @@ package body System.OS_Primitives is
-----------
function Clock return Duration is
- type timeval is array (1 .. 2) of Long_Integer;
+ type timeval is
+ record
+ tv_sec : time_t;
+ tv_usec : Long_Integer;
+ end record;
procedure timeval_to_duration
(T : not null access timeval;