Fri Mar 2 16:00:58 2012 UTC ()
lang/gnat-aux: Sync with gcc 4.6.3

GCC 4.6.3 was released 01 MAR 2012.  It is a bug-fix release for regressions
and serious bugs.  Seventy-four bug reports were addressed.  The link is
available at bottom of http://gcc.gnu.org/gcc-4.6/changes.html

Unlike release 4.6.2, a few Ada issues were among those addressed.


(marino)
diff -r1.11 -r1.12 pkgsrc/lang/gnat-aux/Makefile
diff -r1.8 -r1.9 pkgsrc/lang/gnat-aux/distinfo
diff -r1.1 -r1.2 pkgsrc/lang/gnat-aux/files/diff-ada
diff -r1.1 -r1.2 pkgsrc/lang/gnat-aux/files/diff-core

cvs diff -r1.11 -r1.12 pkgsrc/lang/gnat-aux/Attic/Makefile (switch to unified diff)

--- pkgsrc/lang/gnat-aux/Attic/Makefile 2012/01/12 15:38:45 1.11
+++ pkgsrc/lang/gnat-aux/Attic/Makefile 2012/03/02 16:00:58 1.12
@@ -1,302 +1,302 @@ @@ -1,302 +1,302 @@
1# $NetBSD: Makefile,v 1.11 2012/01/12 15:38:45 hans Exp $ 1# $NetBSD: Makefile,v 1.12 2012/03/02 16:00:58 marino Exp $
2# 2#
3 3
4PKGNAME= gnat-aux-${SNAPSHOT} 4PKGNAME= gnat-aux-${SNAPSHOT}
5DISTNAME= gcc-${GCC_VERSION} 5DISTNAME= gcc-${GCC_VERSION}
6CATEGORIES= lang 6CATEGORIES= lang
7MASTER_SITES= ${MASTER_SITE_GNU:=gcc/gcc-${GCC_VERSION}/} 7MASTER_SITES= ${MASTER_SITE_GNU:=gcc/gcc-${GCC_VERSION}/}
8DISTFILES= gcc-core-${GCC_VERSION}.tar.bz2 8DISTFILES= gcc-core-${GCC_VERSION}.tar.bz2
9 9
10MAINTAINER= draco@marino.st 10MAINTAINER= draco@marino.st
11HOMEPAGE= http://www.dragonlace.net/ 11HOMEPAGE= http://www.dragonlace.net/
12COMMENT= GNAT Ada compiler based on GCC ${GCC_BRANCH} 12COMMENT= GNAT Ada compiler based on GCC ${GCC_BRANCH}
13LICENSE= gnu-gpl-v3 AND gnu-lgpl-v3 13LICENSE= gnu-gpl-v3 AND gnu-lgpl-v3
14 14
15SNAPSHOT= 20111026 15SNAPSHOT= 20120301
16GCC_BRANCH= 4.6 16GCC_BRANCH= 4.6
17GCC_POINT= 2 17GCC_POINT= 3
18GCC_VERSION= ${GCC_BRANCH}.${GCC_POINT} 18GCC_VERSION= ${GCC_BRANCH}.${GCC_POINT}
19LANGS= c 19LANGS= c
20 20
21PKG_DESTDIR_SUPPORT= user-destdir 21PKG_DESTDIR_SUPPORT= user-destdir
22 22
23USE_TOOLS+= gmake sed perl makeinfo bzip2 patch pod2man 23USE_TOOLS+= gmake sed perl makeinfo bzip2 patch pod2man
24USE_BUILTIN.iconv= no 24USE_BUILTIN.iconv= no
25APPLY_DIFFS= core 25APPLY_DIFFS= core
26 26
27.include "../../mk/bsd.prefs.mk" 27.include "../../mk/bsd.prefs.mk"
28.include "options.mk" 28.include "options.mk"
29 29
30# Requires bootstrap compiler, which is only available for NetBSD i386/AMD64 30# Requires bootstrap compiler, which is only available for NetBSD i386/AMD64
31# and DragonFly i386/AMD64. Actually bootstrap compilers for OpenBSD and 31# and DragonFly i386/AMD64. Actually bootstrap compilers for OpenBSD and
32# FreeBSD also exist, but native packages will be available for those ports. 32# FreeBSD also exist, but native packages will be available for those ports.
33 33
34ONLY_FOR_PLATFORM= DragonFly-*-* \ 34ONLY_FOR_PLATFORM= DragonFly-*-* \
35 NetBSD-[5-9]*-i386 \ 35 NetBSD-[5-9]*-i386 \
36 NetBSD-[5-9]*-x86_64 \ 36 NetBSD-[5-9]*-x86_64 \
37 SunOS-5.*-i386 37 SunOS-5.*-i386
38 38
39BLD_TARGET= ${MACHINE_ARCH}-aux-${LOWER_OPSYS}${OS_VERSION} 39BLD_TARGET= ${MACHINE_ARCH}-aux-${LOWER_OPSYS}${OS_VERSION}
40THREAD_MODEL= posix 40THREAD_MODEL= posix
41OS_LABEL4VERS= [pkgsrc] 41OS_LABEL4VERS= [pkgsrc]
42BOOTSTRAP_COMPILER= NOT_REQUIRED 42BOOTSTRAP_COMPILER= NOT_REQUIRED
43INTENDED_COMPILER= NATIVE 43INTENDED_COMPILER= NATIVE
44BOOTSTRAP_TRIPLET= NOT SET 44BOOTSTRAP_TRIPLET= NOT SET
45FULL_GNATGCC= NOT SET 45FULL_GNATGCC= NOT SET
46FULL_PATH= /sbin:/bin:/usr/sbin:/usr/bin:${PREFIX}/sbin:${PREFIX}/bin 46FULL_PATH= /sbin:/bin:/usr/sbin:/usr/bin:${PREFIX}/sbin:${PREFIX}/bin
47OLD_EH= register_frame 47OLD_EH= register_frame
48REBUILD_LIB= Rebuild the following library first: 48REBUILD_LIB= Rebuild the following library first:
49 49
50 50
51.if ${OPSYS} == "DragonFly" 51.if ${OPSYS} == "DragonFly"
52.if ${MACHINE_ARCH} == "i386" 52.if ${MACHINE_ARCH} == "i386"
53 OS_LABEL4VERS= [DragonFly] 53 OS_LABEL4VERS= [DragonFly]
54 BOOTSTRAP_TRIPLET= i386-bootstrap-dragonfly2.8/4.6.0 54 BOOTSTRAP_TRIPLET= i386-bootstrap-dragonfly2.8/4.6.0
55.endif 55.endif
56.if ${MACHINE_ARCH} == "x86_64" 56.if ${MACHINE_ARCH} == "x86_64"
57 OS_LABEL4VERS= [DragonFly64] 57 OS_LABEL4VERS= [DragonFly64]
58 BOOTSTRAP_TRIPLET= x86_64-bootstrap-dragonfly2.8/4.6.0 58 BOOTSTRAP_TRIPLET= x86_64-bootstrap-dragonfly2.8/4.6.0
59.endif 59.endif
60BOOTSTRAP_COMPILER= gnat-bootstrap.${MACHINE_ARCH}.dragonfly.tar.bz2 60BOOTSTRAP_COMPILER= gnat-bootstrap.${MACHINE_ARCH}.dragonfly.tar.bz2
61LINK_HEADER= /usr/include/sys/link_elf.h 61LINK_HEADER= /usr/include/sys/link_elf.h
62.endif 62.endif
63 63
64 64
65.if ${OPSYS} == "NetBSD" 65.if ${OPSYS} == "NetBSD"
66.if empty(OS_VERSION:M5.99.*) 66.if empty(OS_VERSION:M5.99.*)
67 NSUFF= ${OS_VERSION} 67 NSUFF= ${OS_VERSION}
68.else 68.else
69 NSUFF= 6.0_DEV 69 NSUFF= 6.0_DEV
70.endif 70.endif
71.if ${MACHINE_ARCH} == "i386" 71.if ${MACHINE_ARCH} == "i386"
72 OS_LABEL4VERS= [NetBSD] 72 OS_LABEL4VERS= [NetBSD]
73 BOOTSTRAP_TRIPLET= i386-bootstrap-netbsdelf5.1/4.6.0 73 BOOTSTRAP_TRIPLET= i386-bootstrap-netbsdelf5.1/4.6.0
74 BLD_TARGET= ${MACHINE_ARCH}-aux-netbsdelf${NSUFF} 74 BLD_TARGET= ${MACHINE_ARCH}-aux-netbsdelf${NSUFF}
75.endif 75.endif
76.if ${MACHINE_ARCH} == "x86_64" 76.if ${MACHINE_ARCH} == "x86_64"
77 OS_LABEL4VERS= [NetBSD64] 77 OS_LABEL4VERS= [NetBSD64]
78 BOOTSTRAP_TRIPLET= x86_64-bootstrap-netbsd5.1/4.6.0 78 BOOTSTRAP_TRIPLET= x86_64-bootstrap-netbsd5.1/4.6.0
79 BLD_TARGET= ${MACHINE_ARCH}-aux-netbsd${NSUFF} 79 BLD_TARGET= ${MACHINE_ARCH}-aux-netbsd${NSUFF}
80.endif 80.endif
81BOOTSTRAP_COMPILER= gnat-bootstrap.${MACHINE_ARCH}.netbsd.tar.bz2 81BOOTSTRAP_COMPILER= gnat-bootstrap.${MACHINE_ARCH}.netbsd.tar.bz2
82LINK_HEADER= /usr/include/link_elf.h 82LINK_HEADER= /usr/include/link_elf.h
83 83
84SUBST_CLASSES+= net1 84SUBST_CLASSES+= net1
85SUBST_STAGE.net1= post-patch 85SUBST_STAGE.net1= post-patch
86SUBST_FILES.net1= gcc/config/i386/netbsd-elf.h 86SUBST_FILES.net1= gcc/config/i386/netbsd-elf.h
87SUBST_MESSAGE.net1= Fixing libgcc linkage problem on NetBSD 87SUBST_MESSAGE.net1= Fixing libgcc linkage problem on NetBSD
88SUBST_SED.net1= -e "s,@EXEC_PREFIX@,${PREFIX}," 88SUBST_SED.net1= -e "s,@EXEC_PREFIX@,${PREFIX},"
89.endif 89.endif
90 90
91 91
92.if ${OPSYS} == "SunOS" 92.if ${OPSYS} == "SunOS"
93.if ${MACHINE_ARCH} == "i386" 93.if ${MACHINE_ARCH} == "i386"
94 OS_LABEL4VERS= [Solaris] 94 OS_LABEL4VERS= [Solaris]
95 BOOTSTRAP_TRIPLET= i386-bootstrap-solaris5.11/4.6.1 95 BOOTSTRAP_TRIPLET= i386-bootstrap-solaris5.11/4.6.1
96.endif 96.endif
97SOL_OSV= `expr substr ${OS_VERSION} 3 2` 97SOL_OSV= `expr substr ${OS_VERSION} 3 2`
98BLD_TARGET= ${MACHINE_ARCH}-aux-${LOWER_OPSYS}2.${SOL_OSV} 98BLD_TARGET= ${MACHINE_ARCH}-aux-${LOWER_OPSYS}2.${SOL_OSV}
99BOOTSTRAP_COMPILER= gnat-bootstrap.${MACHINE_ARCH}.solaris.tar.bz2 99BOOTSTRAP_COMPILER= gnat-bootstrap.${MACHINE_ARCH}.solaris.tar.bz2
100.endif 100.endif
101 101
102 102
103 103
104# Let's build this without bash 104# Let's build this without bash
105CONFIG_SHELL= ${TOOLS_PATH.sh} 105CONFIG_SHELL= ${TOOLS_PATH.sh}
106 106
107 107
108# define some important directories and files 108# define some important directories and files
109BUILDDIR= ${WRKDIR}/build 109BUILDDIR= ${WRKDIR}/build
110WRKSRC= ${WRKDIR}/gcc-${GCC_VERSION} 110WRKSRC= ${WRKDIR}/gcc-${GCC_VERSION}
111PKG_PREFIX= ${PREFIX} 111PKG_PREFIX= ${PREFIX}
112CFG_SCRIPT= ${WRKSRC}/configure 112CFG_SCRIPT= ${WRKSRC}/configure
113BOOTSTRAP_PREFIX= ${WRKDIR}/bootstrap 113BOOTSTRAP_PREFIX= ${WRKDIR}/bootstrap
114REVFILE= ${WRKSRC}/gcc/REVISION 114REVFILE= ${WRKSRC}/gcc/REVISION
115BASELIB= ${PREFIX}/lib 115BASELIB= ${PREFIX}/lib
116 116
117 117
118 118
119# testing if gnatgcc, gnatlink, gnatbind and gnatmake are in standard location 119# testing if gnatgcc, gnatlink, gnatbind and gnatmake are in standard location
120# exists function will NOT expand any variable, so it has to be hard-coded 120# exists function will NOT expand any variable, so it has to be hard-coded
121.if exists(/usr/pkg/bin/gnatgcc) || exists(/opt/ipp/pkg/bin/gnatgcc) 121.if exists(/usr/pkg/bin/gnatgcc) || exists(/opt/ipp/pkg/bin/gnatgcc)
122.if exists(/usr/pkg/bin/gnatbind) || exists(/opt/ipp/pkg/bin/gnatbind) 122.if exists(/usr/pkg/bin/gnatbind) || exists(/opt/ipp/pkg/bin/gnatbind)
123.if exists(/usr/pkg/bin/gnatlink) || exists(/opt/ipp/pkg/bin/gnatlink) 123.if exists(/usr/pkg/bin/gnatlink) || exists(/opt/ipp/pkg/bin/gnatlink)
124.if exists(/usr/pkg/bin/gnatmake) || exists(/opt/ipp/pkg/bin/gnatmake) 124.if exists(/usr/pkg/bin/gnatmake) || exists(/opt/ipp/pkg/bin/gnatmake)
125FULL_GNATGCC=${PREFIX}/bin/gnatgcc 125FULL_GNATGCC=${PREFIX}/bin/gnatgcc
126.endif #gnatmake 126.endif #gnatmake
127.endif #gnatlink 127.endif #gnatlink
128.endif #gnatbind 128.endif #gnatbind
129.endif #gnatgcc 129.endif #gnatgcc
130 130
131 131
132.if ${FULL_GNATGCC} == "NOT SET" 132.if ${FULL_GNATGCC} == "NOT SET"
133# here we know we need to install the bootstrap compiler 133# here we know we need to install the bootstrap compiler
134INTENDED_COMPILER=BOOTSTRAP 134INTENDED_COMPILER=BOOTSTRAP
135FULL_GNATGCC=${BOOTSTRAP_PREFIX}/bin/gnatgcc 135FULL_GNATGCC=${BOOTSTRAP_PREFIX}/bin/gnatgcc
136DISTFILES+= ${BOOTSTRAP_COMPILER} 136DISTFILES+= ${BOOTSTRAP_COMPILER}
137SITES.${BOOTSTRAP_COMPILER}= http://downloads.dragonlace.net/src/ \ 137SITES.${BOOTSTRAP_COMPILER}= http://downloads.dragonlace.net/src/ \
138 http://dragonlace.mirrors.ada.cx/src/ 138 http://dragonlace.mirrors.ada.cx/src/
139FULL_PATH=${BOOTSTRAP_PREFIX}/bin:/sbin:/bin:/usr/sbin:/usr/bin:${PREFIX}/sbin:${PREFIX}/bin 139FULL_PATH=${BOOTSTRAP_PREFIX}/bin:/sbin:/bin:/usr/sbin:/usr/bin:${PREFIX}/sbin:${PREFIX}/bin
140.endif 140.endif
141 141
142 142
143# For pkg maintenance, uncomment to invoke "bmake mdi" 143# For pkg maintenance, uncomment to invoke "bmake mdi"
144#DISTFILES+= \ 144#DISTFILES+= \
145# gnat-bootstrap.i386.dragonfly.tar.bz2 \ 145# gnat-bootstrap.i386.dragonfly.tar.bz2 \
146# gnat-bootstrap.x86_64.dragonfly.tar.bz2 \ 146# gnat-bootstrap.x86_64.dragonfly.tar.bz2 \
147# gnat-bootstrap.i386.netbsd.tar.bz2 \ 147# gnat-bootstrap.i386.netbsd.tar.bz2 \
148# gnat-bootstrap.x86_64.netbsd.tar.bz2 \ 148# gnat-bootstrap.x86_64.netbsd.tar.bz2 \
149# gnat-bootstrap.i386.solaris.tar.bz2 149# gnat-bootstrap.i386.solaris.tar.bz2
150 150
151 151
152# establish ada-aware compiler for use 152# establish ada-aware compiler for use
153MY_CONFIGURE_ENV= CC=${FULL_GNATGCC} 153MY_CONFIGURE_ENV= CC=${FULL_GNATGCC}
154MY_CONFIGURE_ENV+= PATH=${FULL_PATH} 154MY_CONFIGURE_ENV+= PATH=${FULL_PATH}
155MY_CONFIGURE_ENV+= CONFIG_SHELL=${CONFIG_SHELL} 155MY_CONFIGURE_ENV+= CONFIG_SHELL=${CONFIG_SHELL}
156MY_MAKE_ENV= PATH=${FULL_PATH} 156MY_MAKE_ENV= PATH=${FULL_PATH}
157MY_MAKE_ENV+= LD_LIBRARY_PATH=${BUILDDIR}/gcc 157MY_MAKE_ENV+= LD_LIBRARY_PATH=${BUILDDIR}/gcc
158 158
159 159
160# The standard configuration options 160# The standard configuration options
161CONFIGURE_ARGS= --enable-languages=${LANGS:Q} 161CONFIGURE_ARGS= --enable-languages=${LANGS:Q}
162CONFIGURE_ARGS+= --build=${BLD_TARGET} 162CONFIGURE_ARGS+= --build=${BLD_TARGET}
163CONFIGURE_ARGS+= --program-prefix=gnat 163CONFIGURE_ARGS+= --program-prefix=gnat
164CONFIGURE_ARGS+= --prefix=${PREFIX} 164CONFIGURE_ARGS+= --prefix=${PREFIX}
165CONFIGURE_ARGS+= --with-system-zlib 165CONFIGURE_ARGS+= --with-system-zlib
166CONFIGURE_ARGS+= --with-gmp=${BUILDLINK_PREFIX.gmp} 166CONFIGURE_ARGS+= --with-gmp=${BUILDLINK_PREFIX.gmp}
167CONFIGURE_ARGS+= --with-mpfr=${BUILDLINK_PREFIX.mpfr} 167CONFIGURE_ARGS+= --with-mpfr=${BUILDLINK_PREFIX.mpfr}
168CONFIGURE_ARGS+= --with-mpc=${BUILDLINK_PREFIX.mpcomplex} 168CONFIGURE_ARGS+= --with-mpc=${BUILDLINK_PREFIX.mpcomplex}
169CONFIGURE_ARGS+= --with-libiconv-prefix=${PKG_PREFIX} 169CONFIGURE_ARGS+= --with-libiconv-prefix=${PKG_PREFIX}
170CONFIGURE_ARGS+= --enable-shared 170CONFIGURE_ARGS+= --enable-shared
171CONFIGURE_ARGS+= --enable-threads=${THREAD_MODEL} 171CONFIGURE_ARGS+= --enable-threads=${THREAD_MODEL}
172CONFIGURE_ARGS+= --disable-bootstrap 172CONFIGURE_ARGS+= --disable-bootstrap
173CONFIGURE_ARGS+= ${QUADOPT} 173CONFIGURE_ARGS+= ${QUADOPT}
174CONFIGURE_ARGS+= --disable-libmudflap 174CONFIGURE_ARGS+= --disable-libmudflap
175CONFIGURE_ARGS+= --disable-libgomp 175CONFIGURE_ARGS+= --disable-libgomp
176CONFIGURE_ARGS+= --disable-libssp 176CONFIGURE_ARGS+= --disable-libssp
177CONFIGURE_ARGS+= --disable-nls 177CONFIGURE_ARGS+= --disable-nls
178 178
179# Automatic package list generation 179# Automatic package list generation
180GENERATE_PLIST= cd ${DESTDIR}${PREFIX}; 180GENERATE_PLIST= cd ${DESTDIR}${PREFIX};
181GENERATE_PLIST+= ${FIND} * \( -type f -or -type l \) | ${SORT} -dr; 181GENERATE_PLIST+= ${FIND} * \( -type f -or -type l \) | ${SORT} -dr;
182 182
183 183
184post-extract: 184post-extract:
185 # Personalize GNAT for each different machine 185 # Personalize GNAT for each different machine
186 @${ECHO} "-=> GNAT AUX ${OS_LABEL4VERS}" > ${REVFILE} 186 @${ECHO} "-=> GNAT AUX ${OS_LABEL4VERS}" > ${REVFILE}
187 187
188 # Create new directories in preparation of applying diff files 188 # Create new directories in preparation of applying diff files
189.if !empty(PKG_OPTIONS:Mcxx) 189.if !empty(PKG_OPTIONS:Mcxx)
190 ${MKDIR} ${WRKSRC}/libstdc++-v3/config/locale/dragonfly 190 ${MKDIR} ${WRKSRC}/libstdc++-v3/config/locale/dragonfly
191 ${MKDIR} ${WRKSRC}/libstdc++-v3/config/os/bsd/dragonfly 191 ${MKDIR} ${WRKSRC}/libstdc++-v3/config/os/bsd/dragonfly
192.endif 192.endif
193 193
194 # Apply required composite diff files 194 # Apply required composite diff files
195.for suffix in ${APPLY_DIFFS} 195.for suffix in ${APPLY_DIFFS}
196 @${ECHO} "Applying composite patch diff-${suffix}" 196 @${ECHO} "Applying composite patch diff-${suffix}"
197 @${PATCH} -d ${WRKSRC} -s -E < ${FILESDIR}/diff-${suffix} 197 @${PATCH} -d ${WRKSRC} -s -E < ${FILESDIR}/diff-${suffix}
198.endfor 198.endfor
199 199
200.if ${INTENDED_COMPILER} == "BOOTSTRAP" 200.if ${INTENDED_COMPILER} == "BOOTSTRAP"
201 # Bootstrap compiler has statically linked z, gmp, mpc, mpfr and iconv 201 # Bootstrap compiler has statically linked z, gmp, mpc, mpfr and iconv
202 # The only shared lib is libc.so.7, so it should work for a long time. 202 # The only shared lib is libc.so.7, so it should work for a long time.
203 # It is at least 28MB and doesn't come with shared libraries. 203 # It is at least 28MB and doesn't come with shared libraries.
204 204
205 ${MKDIR} ${BOOTSTRAP_PREFIX} 205 ${MKDIR} ${BOOTSTRAP_PREFIX}
206 mv ${BOOTSTRAP_PREFIX}/../bin ${BOOTSTRAP_PREFIX} 206 mv ${BOOTSTRAP_PREFIX}/../bin ${BOOTSTRAP_PREFIX}
207 mv ${BOOTSTRAP_PREFIX}/../lib ${BOOTSTRAP_PREFIX} 207 mv ${BOOTSTRAP_PREFIX}/../lib ${BOOTSTRAP_PREFIX}
208 mv ${BOOTSTRAP_PREFIX}/../libexec ${BOOTSTRAP_PREFIX} 208 mv ${BOOTSTRAP_PREFIX}/../libexec ${BOOTSTRAP_PREFIX}
209 209
210 # Bootstrap compiler malfunctions in NetBSD 6 unless include-fixed 210 # Bootstrap compiler malfunctions in NetBSD 6 unless include-fixed
211 # directory is removed first. It will eventually cause problems 211 # directory is removed first. It will eventually cause problems
212 # for DragonFly and Solaris as well, so just unconditionally kill it. 212 # for DragonFly and Solaris as well, so just unconditionally kill it.
213 ${RM} -rf ${BOOTSTRAP_PREFIX}/lib/gcc/${BOOTSTRAP_TRIPLET}/include-fixed 213 ${RM} -rf ${BOOTSTRAP_PREFIX}/lib/gcc/${BOOTSTRAP_TRIPLET}/include-fixed
214.endif 214.endif
215 215
216 216
217pre-configure: 217pre-configure:
218# NetBSD's system compiler is not configured to use dl_iterate_phdr which is 218# NetBSD's system compiler is not configured to use dl_iterate_phdr which is
219# required to build shared libraries if gnat-aux handles exceptions via 219# required to build shared libraries if gnat-aux handles exceptions via
220# dl_iterate_phdr. Therefore this functionality is disabled for NetBSD until 220# dl_iterate_phdr. Therefore this functionality is disabled for NetBSD until
221# further notice. DragonFly introduced this functionality with 2.11, but it's 221# further notice. DragonFly introduced this functionality with 2.11, but it's
222# possible the shared libraries were built with an earlier compiler in the 222# possible the shared libraries were built with an earlier compiler in the
223# case of an upgrade. We need to detect this situation and stop the build 223# case of an upgrade. We need to detect this situation and stop the build
224# if the libraries need to be rebuilt. 224# if the libraries need to be rebuilt.
225.if ${OPSYS} == "DragonFly" 225.if ${OPSYS} == "DragonFly"
226 @if ${GREP} dl_iterate_phdr ${LINK_HEADER} > /dev/null; then \ 226 @if ${GREP} dl_iterate_phdr ${LINK_HEADER} > /dev/null; then \
227 if ${GREP} ${OLD_EH} ${BASELIB}/libmpc.so > /dev/null; then \ 227 if ${GREP} ${OLD_EH} ${BASELIB}/libmpc.so > /dev/null; then \
228 ${ERROR_MSG} "${REBUILD_LIB} math/mpcomplex"; \ 228 ${ERROR_MSG} "${REBUILD_LIB} math/mpcomplex"; \
229 exit 101; \ 229 exit 101; \
230 fi; \ 230 fi; \
231 if ${GREP} ${OLD_EH} ${BASELIB}/libmpfr.so > /dev/null; then \ 231 if ${GREP} ${OLD_EH} ${BASELIB}/libmpfr.so > /dev/null; then \
232 ${ERROR_MSG} "${REBUILD_LIB} math/mpfr"; \ 232 ${ERROR_MSG} "${REBUILD_LIB} math/mpfr"; \
233 exit 102; \ 233 exit 102; \
234 fi; \ 234 fi; \
235 if ${GREP} ${OLD_EH} ${BASELIB}/libgmp.so > /dev/null; then \ 235 if ${GREP} ${OLD_EH} ${BASELIB}/libgmp.so > /dev/null; then \
236 ${ERROR_MSG} "${REBUILD_LIB} devel/gmp"; \ 236 ${ERROR_MSG} "${REBUILD_LIB} devel/gmp"; \
237 exit 103; \ 237 exit 103; \
238 fi; \ 238 fi; \
239 if ${GREP} ${OLD_EH} ${BASELIB}/libiconv.so > /dev/null; then \ 239 if ${GREP} ${OLD_EH} ${BASELIB}/libiconv.so > /dev/null; then \
240 ${ERROR_MSG} "${REBUILD_LIB} converters/libiconv"; \ 240 ${ERROR_MSG} "${REBUILD_LIB} converters/libiconv"; \
241 exit 104; \ 241 exit 104; \
242 fi; \ 242 fi; \
243 fi 243 fi
244.endif 244.endif
245 245
246 246
247do-configure: 247do-configure:
248 ${MKDIR} ${BUILDDIR} 248 ${MKDIR} ${BUILDDIR}
249 cd ${BUILDDIR} && ${SETENV} ${MY_CONFIGURE_ENV} \ 249 cd ${BUILDDIR} && ${SETENV} ${MY_CONFIGURE_ENV} \
250 ${CFG_SCRIPT} ${CONFIGURE_ARGS} 250 ${CFG_SCRIPT} ${CONFIGURE_ARGS}
251 251
252 252
253do-build: 253do-build:
254 # The unlimited stacksize is for NetBSD64 254 # The unlimited stacksize is for NetBSD64
255 cd ${BUILDDIR} && \ 255 cd ${BUILDDIR} && \
256 ${ULIMIT_CMD_stacksize} && \ 256 ${ULIMIT_CMD_stacksize} && \
257 ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -j${MAKE_JOBS:U1:Q} all 257 ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -j${MAKE_JOBS:U1:Q} all
258 258
259 259
260do-test: build 260do-test: build
261.if !empty(PKG_OPTIONS:Mtestada) 261.if !empty(PKG_OPTIONS:Mtestada)
262.if (${OPSYS} == "NetBSD") && (${MACHINE_ARCH} == "x86_64") 262.if (${OPSYS} == "NetBSD") && (${MACHINE_ARCH} == "x86_64")
263 # NetBSD has an extremely small default stacksize of 2MB, which is 263 # NetBSD has an extremely small default stacksize of 2MB, which is
264 # insufficient for the gnat.dg testsuite. 264 # insufficient for the gnat.dg testsuite.
265 # specifically: entry_queues test on AMD64 265 # specifically: entry_queues test on AMD64
266 # Unlimiting stack resources on i386-netbsdelf* will result in 266 # Unlimiting stack resources on i386-netbsdelf* will result in
267 # failure of gnat.dg/task_stack_align.adb execution test. 267 # failure of gnat.dg/task_stack_align.adb execution test.
268 cd ${BUILDDIR} && \ 268 cd ${BUILDDIR} && \
269 ${ULIMIT_CMD_stacksize} && \ 269 ${ULIMIT_CMD_stacksize} && \
270 ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk check-ada 270 ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk check-ada
271.else 271.else
272 cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk check-ada 272 cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk check-ada
273.endif 273.endif
274.endif 274.endif
275.if !empty(PKG_OPTIONS:Mfortran) && !empty(PKG_OPTIONS:Mtestfortran) 275.if !empty(PKG_OPTIONS:Mfortran) && !empty(PKG_OPTIONS:Mtestfortran)
276 cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk check-fortran 276 cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk check-fortran
277.endif 277.endif
278.if !empty(PKG_OPTIONS:Mobjc) && !empty(PKG_OPTIONS:Mtestobjc) 278.if !empty(PKG_OPTIONS:Mobjc) && !empty(PKG_OPTIONS:Mtestobjc)
279 cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk check-objc 279 cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk check-objc
280.endif 280.endif
281.if !empty(PKG_OPTIONS:Mcxx) && !empty(PKG_OPTIONS:Mtestcxx) 281.if !empty(PKG_OPTIONS:Mcxx) && !empty(PKG_OPTIONS:Mtestcxx)
282 # libstdc++ always ends with error status, so ignore it 282 # libstdc++ always ends with error status, so ignore it
283 cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk \ 283 cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk \
284 check-c++ || ${TRUE} 284 check-c++ || ${TRUE}
285.endif 285.endif
286.if !empty(PKG_OPTIONS:Mtestgcc) 286.if !empty(PKG_OPTIONS:Mtestgcc)
287 cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk check-c 287 cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} -sk check-c
288.endif 288.endif
289 289
290 290
291do-install: 291do-install:
292 cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} install-strip \ 292 cd ${BUILDDIR} && ${SETENV} ${MY_MAKE_ENV} ${GMAKE} install-strip \
293 DESTDIR=${DESTDIR} 293 DESTDIR=${DESTDIR}
294 294
295 295
296 296
297.include "../../devel/zlib/buildlink3.mk" 297.include "../../devel/zlib/buildlink3.mk"
298.include "../../devel/gmp/buildlink3.mk" 298.include "../../devel/gmp/buildlink3.mk"
299.include "../../math/mpfr/buildlink3.mk" 299.include "../../math/mpfr/buildlink3.mk"
300.include "../../math/mpcomplex/buildlink3.mk" 300.include "../../math/mpcomplex/buildlink3.mk"
301.include "../../converters/libiconv/buildlink3.mk" 301.include "../../converters/libiconv/buildlink3.mk"
302.include "../../mk/bsd.pkg.mk" 302.include "../../mk/bsd.pkg.mk"

cvs diff -r1.8 -r1.9 pkgsrc/lang/gnat-aux/Attic/distinfo (switch to unified diff)

--- pkgsrc/lang/gnat-aux/Attic/distinfo 2012/01/08 11:17:07 1.8
+++ pkgsrc/lang/gnat-aux/Attic/distinfo 2012/03/02 16:00:58 1.9
@@ -1,35 +1,35 @@ @@ -1,35 +1,35 @@
1$NetBSD: distinfo,v 1.8 2012/01/08 11:17:07 marino Exp $ 1$NetBSD: distinfo,v 1.9 2012/03/02 16:00:58 marino Exp $
2 2
3SHA1 (gcc-ada-4.6.2.tar.bz2) = e6eaa9b8111ac8e550844a7cc2d161f8c3c96522 3SHA1 (gcc-ada-4.6.3.tar.bz2) = dad948b980357bab992d0ac9aaa1f9859f1671e7
4RMD160 (gcc-ada-4.6.2.tar.bz2) = 6f5d5af97c374411e13698c32314b43b1afd99cf 4RMD160 (gcc-ada-4.6.3.tar.bz2) = 33d0077a366edc8705d6907ca98ff2c53a434498
5Size (gcc-ada-4.6.2.tar.bz2) = 6064757 bytes 5Size (gcc-ada-4.6.3.tar.bz2) = 6092418 bytes
6SHA1 (gcc-core-4.6.2.tar.bz2) = 23d259e2269a40f6e203cf6f57bc7eb7a207a8b3 6SHA1 (gcc-core-4.6.3.tar.bz2) = eaefb90df5a833c94560a8dda177bd1e165c2a88
7RMD160 (gcc-core-4.6.2.tar.bz2) = 82c25532303759b6195bbd53d7f371f1974ff182 7RMD160 (gcc-core-4.6.3.tar.bz2) = 071371eae1ce10dbb44c077b69256f2ec2ee1b6b
8Size (gcc-core-4.6.2.tar.bz2) = 30258326 bytes 8Size (gcc-core-4.6.3.tar.bz2) = 30305971 bytes
9SHA1 (gcc-fortran-4.6.2.tar.bz2) = aba480c9a42d58eca6c34355b6d2f5f487de051d 9SHA1 (gcc-fortran-4.6.3.tar.bz2) = 4dc62a4b995391584e7f80e05353e9635407e647
10RMD160 (gcc-fortran-4.6.2.tar.bz2) = 6a966d647e9d3fe35996d390fbcd7ff0622edfb8 10RMD160 (gcc-fortran-4.6.3.tar.bz2) = 95b338486d4427f1ba54d3c652fcb628da2c5576
11Size (gcc-fortran-4.6.2.tar.bz2) = 1676539 bytes 11Size (gcc-fortran-4.6.3.tar.bz2) = 1676490 bytes
12SHA1 (gcc-g++-4.6.2.tar.bz2) = f0bc2b4e1c23c5dc1462599efd5df4b9807b23af 12SHA1 (gcc-g++-4.6.3.tar.bz2) = 528d010ee7af50e023bd4d476d65d08df71a7f65
13RMD160 (gcc-g++-4.6.2.tar.bz2) = afb274990e9102b55cb5f5dc11876c96e6b31c96 13RMD160 (gcc-g++-4.6.3.tar.bz2) = 2540b113a2ee983c517b1bed6910d8d60c1292c3
14Size (gcc-g++-4.6.2.tar.bz2) = 6955594 bytes 14Size (gcc-g++-4.6.3.tar.bz2) = 6928430 bytes
15SHA1 (gcc-objc-4.6.2.tar.bz2) = 32e5fbc31f1e8dd5e7c7e7ed9172afaf6136ea4e 15SHA1 (gcc-objc-4.6.3.tar.bz2) = a584c2b3505a7f6411167027cc7fe473182c6e1c
16RMD160 (gcc-objc-4.6.2.tar.bz2) = 3c38c655edb90fadb2805043219296a4af43c56a 16RMD160 (gcc-objc-4.6.3.tar.bz2) = 1a673690aad47472126e518d4f56f3b385751877
17Size (gcc-objc-4.6.2.tar.bz2) = 342544 bytes 17Size (gcc-objc-4.6.3.tar.bz2) = 342441 bytes
18SHA1 (gcc-testsuite-4.6.2.tar.bz2) = 514c0ed8b9e4ed22e55303ae2426dd6f1e8a24f2 18SHA1 (gcc-testsuite-4.6.3.tar.bz2) = 31f428af55332ee45bfae7184139a65d130ac2df
19RMD160 (gcc-testsuite-4.6.2.tar.bz2) = 859486da17497b61e0919f53f13efc04eeaef751 19RMD160 (gcc-testsuite-4.6.3.tar.bz2) = 6b2d96cc4db33bd28c0b98fe43526acdc69ecd0d
20Size (gcc-testsuite-4.6.2.tar.bz2) = 6309400 bytes 20Size (gcc-testsuite-4.6.3.tar.bz2) = 6354781 bytes
21SHA1 (gnat-bootstrap.i386.dragonfly.tar.bz2) = d7a8103243a2df3723d9d3c3ec0da9c3bb725214 21SHA1 (gnat-bootstrap.i386.dragonfly.tar.bz2) = d7a8103243a2df3723d9d3c3ec0da9c3bb725214
22RMD160 (gnat-bootstrap.i386.dragonfly.tar.bz2) = 9e6fde444e0ed76ee404810af6d6b7eb48659c09 22RMD160 (gnat-bootstrap.i386.dragonfly.tar.bz2) = 9e6fde444e0ed76ee404810af6d6b7eb48659c09
23Size (gnat-bootstrap.i386.dragonfly.tar.bz2) = 28205489 bytes 23Size (gnat-bootstrap.i386.dragonfly.tar.bz2) = 28205489 bytes
24SHA1 (gnat-bootstrap.i386.netbsd.tar.bz2) = 19b61f54fae8e237a4e678ff03f20f50b47db1df 24SHA1 (gnat-bootstrap.i386.netbsd.tar.bz2) = 19b61f54fae8e237a4e678ff03f20f50b47db1df
25RMD160 (gnat-bootstrap.i386.netbsd.tar.bz2) = ade03f223b2af229daece20a749915f7da0eb0a6 25RMD160 (gnat-bootstrap.i386.netbsd.tar.bz2) = ade03f223b2af229daece20a749915f7da0eb0a6
26Size (gnat-bootstrap.i386.netbsd.tar.bz2) = 27654956 bytes 26Size (gnat-bootstrap.i386.netbsd.tar.bz2) = 27654956 bytes
27SHA1 (gnat-bootstrap.x86_64.dragonfly.tar.bz2) = 77a637a497c61e4085de31b24a205f24b1776a15 27SHA1 (gnat-bootstrap.x86_64.dragonfly.tar.bz2) = 77a637a497c61e4085de31b24a205f24b1776a15
28RMD160 (gnat-bootstrap.x86_64.dragonfly.tar.bz2) = 4d0eb7b8a5f901333f1ffd190a5bf72072b2b52e 28RMD160 (gnat-bootstrap.x86_64.dragonfly.tar.bz2) = 4d0eb7b8a5f901333f1ffd190a5bf72072b2b52e
29Size (gnat-bootstrap.x86_64.dragonfly.tar.bz2) = 31380342 bytes 29Size (gnat-bootstrap.x86_64.dragonfly.tar.bz2) = 31380342 bytes
30SHA1 (gnat-bootstrap.x86_64.netbsd.tar.bz2) = 84f0e9179998daa643046a5d139321c4130ea84d 30SHA1 (gnat-bootstrap.x86_64.netbsd.tar.bz2) = 84f0e9179998daa643046a5d139321c4130ea84d
31RMD160 (gnat-bootstrap.x86_64.netbsd.tar.bz2) = 0b2943349536c323a62b56dc05ff1fedd6d7e17a 31RMD160 (gnat-bootstrap.x86_64.netbsd.tar.bz2) = 0b2943349536c323a62b56dc05ff1fedd6d7e17a
32Size (gnat-bootstrap.x86_64.netbsd.tar.bz2) = 30572187 bytes 32Size (gnat-bootstrap.x86_64.netbsd.tar.bz2) = 30572187 bytes
33SHA1 (gnat-bootstrap.i386.solaris.tar.bz2) = 4962657bfc894a20ad3102c1f6fe8e566b47cb51 33SHA1 (gnat-bootstrap.i386.solaris.tar.bz2) = 4962657bfc894a20ad3102c1f6fe8e566b47cb51
34RMD160 (gnat-bootstrap.i386.solaris.tar.bz2) = ae72e76d0aba94451d99b9a70a3c049c9258cc82 34RMD160 (gnat-bootstrap.i386.solaris.tar.bz2) = ae72e76d0aba94451d99b9a70a3c049c9258cc82
35Size (gnat-bootstrap.i386.solaris.tar.bz2) = 43247034 bytes 35Size (gnat-bootstrap.i386.solaris.tar.bz2) = 43247034 bytes

cvs diff -r1.1 -r1.2 pkgsrc/lang/gnat-aux/files/Attic/diff-ada (switch to unified diff)

--- pkgsrc/lang/gnat-aux/files/Attic/diff-ada 2012/01/08 11:17:07 1.1
+++ pkgsrc/lang/gnat-aux/files/Attic/diff-ada 2012/03/02 16:00:58 1.2
@@ -1,3441 +1,3441 @@ @@ -1,3441 +1,3441 @@
1--- /dev/null 1--- /dev/null
2+++ gcc/ada/a-intnam-dragonfly.ads 2+++ gcc/ada/a-intnam-dragonfly.ads
3@@ -0,0 +1,133 @@ 3@@ -0,0 +1,133 @@
4+------------------------------------------------------------------------------ 4+------------------------------------------------------------------------------
5+-- -- 5+-- --
6+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- 6+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
7+-- -- 7+-- --
8+-- A D A . I N T E R R U P T S . N A M E S -- 8+-- A D A . I N T E R R U P T S . N A M E S --
9+-- -- 9+-- --
10+-- S p e c -- 10+-- S p e c --
11+-- -- 11+-- --
12+-- Copyright (C) 1991-2009, Free Software Foundation, Inc. -- 12+-- Copyright (C) 1991-2009, Free Software Foundation, Inc. --
13+-- -- 13+-- --
14+-- GNARL is free software; you can redistribute it and/or modify it under -- 14+-- GNARL is free software; you can redistribute it and/or modify it under --
15+-- terms of the GNU General Public License as published by the Free Soft- -- 15+-- terms of the GNU General Public License as published by the Free Soft- --
16+-- ware Foundation; either version 3, or (at your option) any later ver- -- 16+-- ware Foundation; either version 3, or (at your option) any later ver- --
17+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- 17+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
18+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- 18+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
19+-- or FITNESS FOR A PARTICULAR PURPOSE. -- 19+-- or FITNESS FOR A PARTICULAR PURPOSE. --
20+-- -- 20+-- --
21+-- As a special exception under Section 7 of GPL version 3, you are granted -- 21+-- As a special exception under Section 7 of GPL version 3, you are granted --
22+-- additional permissions described in the GCC Runtime Library Exception, -- 22+-- additional permissions described in the GCC Runtime Library Exception, --
23+-- version 3.1, as published by the Free Software Foundation. -- 23+-- version 3.1, as published by the Free Software Foundation. --
24+-- -- 24+-- --
25+-- You should have received a copy of the GNU General Public License and -- 25+-- You should have received a copy of the GNU General Public License and --
26+-- a copy of the GCC Runtime Library Exception along with this program; -- 26+-- a copy of the GCC Runtime Library Exception along with this program; --
27+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- 27+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
28+-- <http://www.gnu.org/licenses/>. -- 28+-- <http://www.gnu.org/licenses/>. --
29+-- -- 29+-- --
30+-- GNARL was developed by the GNARL team at Florida State University. -- 30+-- GNARL was developed by the GNARL team at Florida State University. --
31+-- Extensive contributions were provided by Ada Core Technologies, Inc. -- 31+-- Extensive contributions were provided by Ada Core Technologies, Inc. --
32+-- -- 32+-- --
33+-- Copyright (C) 2010 John Marino <draco@marino.st> -- 33+-- Copyright (C) 2010 John Marino <draco@marino.st> --
34+------------------------------------------------------------------------------ 34+------------------------------------------------------------------------------
35+ 35+
36+-- This is the DragonFly BSD THREADS version of this package 36+-- This is the DragonFly BSD THREADS version of this package
37+ 37+
38+with System.OS_Interface; 38+with System.OS_Interface;
39+ 39+
40+package Ada.Interrupts.Names is 40+package Ada.Interrupts.Names is
41+ 41+
42+ -- Beware that the mapping of names to signals may be many-to-one. There 42+ -- Beware that the mapping of names to signals may be many-to-one. There
43+ -- may be aliases. Also, for all signal names that are not supported on 43+ -- may be aliases. Also, for all signal names that are not supported on
44+ -- the current system the value of the corresponding constant will be zero. 44+ -- the current system the value of the corresponding constant will be zero.
45+ 45+
46+ SIGHUP : constant Interrupt_ID := 46+ SIGHUP : constant Interrupt_ID :=
47+ System.OS_Interface.SIGHUP; -- hangup 47+ System.OS_Interface.SIGHUP; -- hangup
48+ 48+
49+ SIGINT : constant Interrupt_ID := 49+ SIGINT : constant Interrupt_ID :=
50+ System.OS_Interface.SIGINT; -- interrupt (rubout) 50+ System.OS_Interface.SIGINT; -- interrupt (rubout)
51+ 51+
52+ SIGQUIT : constant Interrupt_ID := 52+ SIGQUIT : constant Interrupt_ID :=
53+ System.OS_Interface.SIGQUIT; -- quit (ASCD FS) 53+ System.OS_Interface.SIGQUIT; -- quit (ASCD FS)
54+ 54+
55+ SIGILL : constant Interrupt_ID := 55+ SIGILL : constant Interrupt_ID :=
56+ System.OS_Interface.SIGILL; -- illegal instruction (not reset) 56+ System.OS_Interface.SIGILL; -- illegal instruction (not reset)
57+ 57+
58+ SIGTRAP : constant Interrupt_ID := 58+ SIGTRAP : constant Interrupt_ID :=
59+ System.OS_Interface.SIGTRAP; -- trace trap (not reset) 59+ System.OS_Interface.SIGTRAP; -- trace trap (not reset)
60+ 60+
61+ SIGIOT : constant Interrupt_ID := 61+ SIGIOT : constant Interrupt_ID :=
62+ System.OS_Interface.SIGIOT; -- IOT instruction 62+ System.OS_Interface.SIGIOT; -- IOT instruction
63+ 63+
64+ SIGABRT : constant Interrupt_ID := -- used by abort, 64+ SIGABRT : constant Interrupt_ID := -- used by abort,
65+ System.OS_Interface.SIGABRT; -- replace SIGIOT in the future 65+ System.OS_Interface.SIGABRT; -- replace SIGIOT in the future
66+ 66+
67+ SIGFPE : constant Interrupt_ID := 67+ SIGFPE : constant Interrupt_ID :=
68+ System.OS_Interface.SIGFPE; -- floating point exception 68+ System.OS_Interface.SIGFPE; -- floating point exception
69+ 69+
70+ SIGKILL : constant Interrupt_ID := 70+ SIGKILL : constant Interrupt_ID :=
71+ System.OS_Interface.SIGKILL; -- kill (cannot be caught or ignored) 71+ System.OS_Interface.SIGKILL; -- kill (cannot be caught or ignored)
72+ 72+
73+ SIGBUS : constant Interrupt_ID := 73+ SIGBUS : constant Interrupt_ID :=
74+ System.OS_Interface.SIGBUS; -- bus error 74+ System.OS_Interface.SIGBUS; -- bus error
75+ 75+
76+ SIGSEGV : constant Interrupt_ID := 76+ SIGSEGV : constant Interrupt_ID :=
77+ System.OS_Interface.SIGSEGV; -- segmentation violation 77+ System.OS_Interface.SIGSEGV; -- segmentation violation
78+ 78+
79+ SIGPIPE : constant Interrupt_ID := -- write on a pipe with 79+ SIGPIPE : constant Interrupt_ID := -- write on a pipe with
80+ System.OS_Interface.SIGPIPE; -- no one to read it 80+ System.OS_Interface.SIGPIPE; -- no one to read it
81+ 81+
82+ SIGALRM : constant Interrupt_ID := 82+ SIGALRM : constant Interrupt_ID :=
83+ System.OS_Interface.SIGALRM; -- alarm clock 83+ System.OS_Interface.SIGALRM; -- alarm clock
84+ 84+
85+ SIGTERM : constant Interrupt_ID := 85+ SIGTERM : constant Interrupt_ID :=
86+ System.OS_Interface.SIGTERM; -- software termination signal from kill 86+ System.OS_Interface.SIGTERM; -- software termination signal from kill
87+ 87+
88+ SIGURG : constant Interrupt_ID := 88+ SIGURG : constant Interrupt_ID :=
89+ System.OS_Interface.SIGURG; -- urgent condition on IO channel 89+ System.OS_Interface.SIGURG; -- urgent condition on IO channel
90+ 90+
91+ SIGSTOP : constant Interrupt_ID := 91+ SIGSTOP : constant Interrupt_ID :=
92+ System.OS_Interface.SIGSTOP; -- stop (cannot be caught or ignored) 92+ System.OS_Interface.SIGSTOP; -- stop (cannot be caught or ignored)
93+ 93+
94+ SIGTSTP : constant Interrupt_ID := 94+ SIGTSTP : constant Interrupt_ID :=
95+ System.OS_Interface.SIGTSTP; -- user stop requested from tty 95+ System.OS_Interface.SIGTSTP; -- user stop requested from tty
96+ 96+
97+ SIGCONT : constant Interrupt_ID := 97+ SIGCONT : constant Interrupt_ID :=
98+ System.OS_Interface.SIGCONT; -- stopped process has been continued 98+ System.OS_Interface.SIGCONT; -- stopped process has been continued
99+ 99+
100+ SIGCHLD : constant Interrupt_ID := 100+ SIGCHLD : constant Interrupt_ID :=
101+ System.OS_Interface.SIGCHLD; -- 4.3BSD's/POSIX name for SIGCLD 101+ System.OS_Interface.SIGCHLD; -- 4.3BSD's/POSIX name for SIGCLD
102+ 102+
103+ SIGCLD : constant Interrupt_ID := 103+ SIGCLD : constant Interrupt_ID :=
104+ System.OS_Interface.SIGCLD; -- child status change 104+ System.OS_Interface.SIGCLD; -- child status change
105+ 105+
106+ SIGTTIN : constant Interrupt_ID := 106+ SIGTTIN : constant Interrupt_ID :=
107+ System.OS_Interface.SIGTTIN; -- background tty read attempted 107+ System.OS_Interface.SIGTTIN; -- background tty read attempted
108+ 108+
109+ SIGTTOU : constant Interrupt_ID := 109+ SIGTTOU : constant Interrupt_ID :=
110+ System.OS_Interface.SIGTTOU; -- background tty write attempted 110+ System.OS_Interface.SIGTTOU; -- background tty write attempted
111+ 111+
112+ SIGIO : constant Interrupt_ID := -- input/output possible, 112+ SIGIO : constant Interrupt_ID := -- input/output possible,
113+ System.OS_Interface.SIGIO; -- SIGPOLL alias (Solaris) 113+ System.OS_Interface.SIGIO; -- SIGPOLL alias (Solaris)
114+ 114+
115+ SIGXCPU : constant Interrupt_ID := 115+ SIGXCPU : constant Interrupt_ID :=
116+ System.OS_Interface.SIGXCPU; -- CPU time limit exceeded 116+ System.OS_Interface.SIGXCPU; -- CPU time limit exceeded
117+ 117+
118+ SIGXFSZ : constant Interrupt_ID := 118+ SIGXFSZ : constant Interrupt_ID :=
119+ System.OS_Interface.SIGXFSZ; -- filesize limit exceeded 119+ System.OS_Interface.SIGXFSZ; -- filesize limit exceeded
120+ 120+
121+ SIGVTALRM : constant Interrupt_ID := 121+ SIGVTALRM : constant Interrupt_ID :=
122+ System.OS_Interface.SIGVTALRM; -- virtual timer expired 122+ System.OS_Interface.SIGVTALRM; -- virtual timer expired
123+ 123+
124+ SIGPROF : constant Interrupt_ID := 124+ SIGPROF : constant Interrupt_ID :=
125+ System.OS_Interface.SIGPROF; -- profiling timer expired 125+ System.OS_Interface.SIGPROF; -- profiling timer expired
126+ 126+
127+ SIGWINCH : constant Interrupt_ID := 127+ SIGWINCH : constant Interrupt_ID :=
128+ System.OS_Interface.SIGWINCH; -- window size change 128+ System.OS_Interface.SIGWINCH; -- window size change
129+ 129+
130+ SIGUSR1 : constant Interrupt_ID := 130+ SIGUSR1 : constant Interrupt_ID :=
131+ System.OS_Interface.SIGUSR1; -- user defined signal 1 131+ System.OS_Interface.SIGUSR1; -- user defined signal 1
132+ 132+
133+ SIGUSR2 : constant Interrupt_ID := 133+ SIGUSR2 : constant Interrupt_ID :=
134+ System.OS_Interface.SIGUSR2; -- user defined signal 2 134+ System.OS_Interface.SIGUSR2; -- user defined signal 2
135+ 135+
136+end Ada.Interrupts.Names; 136+end Ada.Interrupts.Names;
137--- /dev/null 137--- /dev/null
138+++ gcc/ada/a-intnam-netbsd.ads 138+++ gcc/ada/a-intnam-netbsd.ads
139@@ -0,0 +1,136 @@ 139@@ -0,0 +1,136 @@
140+------------------------------------------------------------------------------ 140+------------------------------------------------------------------------------
141+-- -- 141+-- --
142+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- 142+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
143+-- -- 143+-- --
144+-- A D A . I N T E R R U P T S . N A M E S -- 144+-- A D A . I N T E R R U P T S . N A M E S --
145+-- -- 145+-- --
146+-- S p e c -- 146+-- S p e c --
147+-- -- 147+-- --
148+-- Copyright (C) 1991-2009, Free Software Foundation, Inc. -- 148+-- Copyright (C) 1991-2009, Free Software Foundation, Inc. --
149+-- -- 149+-- --
150+-- GNARL is free software; you can redistribute it and/or modify it under -- 150+-- GNARL is free software; you can redistribute it and/or modify it under --
151+-- terms of the GNU General Public License as published by the Free Soft- -- 151+-- terms of the GNU General Public License as published by the Free Soft- --
152+-- ware Foundation; either version 3, or (at your option) any later ver- -- 152+-- ware Foundation; either version 3, or (at your option) any later ver- --
153+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- 153+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
154+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- 154+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
155+-- or FITNESS FOR A PARTICULAR PURPOSE. -- 155+-- or FITNESS FOR A PARTICULAR PURPOSE. --
156+-- -- 156+-- --
157+-- As a special exception under Section 7 of GPL version 3, you are granted -- 157+-- As a special exception under Section 7 of GPL version 3, you are granted --
158+-- additional permissions described in the GCC Runtime Library Exception, -- 158+-- additional permissions described in the GCC Runtime Library Exception, --
159+-- version 3.1, as published by the Free Software Foundation. -- 159+-- version 3.1, as published by the Free Software Foundation. --
160+-- -- 160+-- --
161+-- You should have received a copy of the GNU General Public License and -- 161+-- You should have received a copy of the GNU General Public License and --
162+-- a copy of the GCC Runtime Library Exception along with this program; -- 162+-- a copy of the GCC Runtime Library Exception along with this program; --
163+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- 163+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
164+-- <http://www.gnu.org/licenses/>. -- 164+-- <http://www.gnu.org/licenses/>. --
165+-- -- 165+-- --
166+-- GNARL was developed by the GNARL team at Florida State University. -- 166+-- GNARL was developed by the GNARL team at Florida State University. --
167+-- Extensive contributions were provided by Ada Core Technologies, Inc. -- 167+-- Extensive contributions were provided by Ada Core Technologies, Inc. --
168+-- -- 168+-- --
169+-- Copyright (C) 2010 John Marino <draco@marino.st> -- 169+-- Copyright (C) 2010 John Marino <draco@marino.st> --
170+------------------------------------------------------------------------------ 170+------------------------------------------------------------------------------
171+ 171+
172+-- This is the NetBSD THREADS version of this package 172+-- This is the NetBSD THREADS version of this package
173+ 173+
174+with System.OS_Interface; 174+with System.OS_Interface;
175+ 175+
176+package Ada.Interrupts.Names is 176+package Ada.Interrupts.Names is
177+ 177+
178+ -- Beware that the mapping of names to signals may be many-to-one. There 178+ -- Beware that the mapping of names to signals may be many-to-one. There
179+ -- may be aliases. Also, for all signal names that are not supported on 179+ -- may be aliases. Also, for all signal names that are not supported on
180+ -- the current system the value of the corresponding constant will be zero. 180+ -- the current system the value of the corresponding constant will be zero.
181+ 181+
182+ SIGHUP : constant Interrupt_ID := 182+ SIGHUP : constant Interrupt_ID :=
183+ System.OS_Interface.SIGHUP; -- hangup 183+ System.OS_Interface.SIGHUP; -- hangup
184+ 184+
185+ SIGINT : constant Interrupt_ID := 185+ SIGINT : constant Interrupt_ID :=
186+ System.OS_Interface.SIGINT; -- interrupt (rubout) 186+ System.OS_Interface.SIGINT; -- interrupt (rubout)
187+ 187+
188+ SIGQUIT : constant Interrupt_ID := 188+ SIGQUIT : constant Interrupt_ID :=
189+ System.OS_Interface.SIGQUIT; -- quit (ASCD FS) 189+ System.OS_Interface.SIGQUIT; -- quit (ASCD FS)
190+ 190+
191+ SIGILL : constant Interrupt_ID := 191+ SIGILL : constant Interrupt_ID :=
192+ System.OS_Interface.SIGILL; -- illegal instruction (not reset) 192+ System.OS_Interface.SIGILL; -- illegal instruction (not reset)
193+ 193+
194+ SIGTRAP : constant Interrupt_ID := 194+ SIGTRAP : constant Interrupt_ID :=
195+ System.OS_Interface.SIGTRAP; -- trace trap (not reset) 195+ System.OS_Interface.SIGTRAP; -- trace trap (not reset)
196+ 196+
197+ SIGIOT : constant Interrupt_ID := 197+ SIGIOT : constant Interrupt_ID :=
198+ System.OS_Interface.SIGIOT; -- IOT instruction 198+ System.OS_Interface.SIGIOT; -- IOT instruction
199+ 199+
200+ SIGABRT : constant Interrupt_ID := -- used by abort, 200+ SIGABRT : constant Interrupt_ID := -- used by abort,
201+ System.OS_Interface.SIGABRT; -- replace SIGIOT in the future 201+ System.OS_Interface.SIGABRT; -- replace SIGIOT in the future
202+ 202+
203+ SIGFPE : constant Interrupt_ID := 203+ SIGFPE : constant Interrupt_ID :=
204+ System.OS_Interface.SIGFPE; -- floating point exception 204+ System.OS_Interface.SIGFPE; -- floating point exception
205+ 205+
206+ SIGKILL : constant Interrupt_ID := 206+ SIGKILL : constant Interrupt_ID :=
207+ System.OS_Interface.SIGKILL; -- kill (cannot be caught or ignored) 207+ System.OS_Interface.SIGKILL; -- kill (cannot be caught or ignored)
208+ 208+
209+ SIGBUS : constant Interrupt_ID := 209+ SIGBUS : constant Interrupt_ID :=
210+ System.OS_Interface.SIGBUS; -- bus error 210+ System.OS_Interface.SIGBUS; -- bus error
211+ 211+
212+ SIGSEGV : constant Interrupt_ID := 212+ SIGSEGV : constant Interrupt_ID :=
213+ System.OS_Interface.SIGSEGV; -- segmentation violation 213+ System.OS_Interface.SIGSEGV; -- segmentation violation
214+ 214+
215+ SIGPIPE : constant Interrupt_ID := -- write on a pipe with 215+ SIGPIPE : constant Interrupt_ID := -- write on a pipe with
216+ System.OS_Interface.SIGPIPE; -- no one to read it 216+ System.OS_Interface.SIGPIPE; -- no one to read it
217+ 217+
218+ SIGALRM : constant Interrupt_ID := 218+ SIGALRM : constant Interrupt_ID :=
219+ System.OS_Interface.SIGALRM; -- alarm clock 219+ System.OS_Interface.SIGALRM; -- alarm clock
220+ 220+
221+ SIGTERM : constant Interrupt_ID := 221+ SIGTERM : constant Interrupt_ID :=
222+ System.OS_Interface.SIGTERM; -- software termination signal from kill 222+ System.OS_Interface.SIGTERM; -- software termination signal from kill
223+ 223+
224+ SIGURG : constant Interrupt_ID := 224+ SIGURG : constant Interrupt_ID :=
225+ System.OS_Interface.SIGURG; -- urgent condition on IO channel 225+ System.OS_Interface.SIGURG; -- urgent condition on IO channel
226+ 226+
227+ SIGSTOP : constant Interrupt_ID := 227+ SIGSTOP : constant Interrupt_ID :=
228+ System.OS_Interface.SIGSTOP; -- stop (cannot be caught or ignored) 228+ System.OS_Interface.SIGSTOP; -- stop (cannot be caught or ignored)
229+ 229+
230+ SIGTSTP : constant Interrupt_ID := 230+ SIGTSTP : constant Interrupt_ID :=
231+ System.OS_Interface.SIGTSTP; -- user stop requested from tty 231+ System.OS_Interface.SIGTSTP; -- user stop requested from tty
232+ 232+
233+ SIGCONT : constant Interrupt_ID := 233+ SIGCONT : constant Interrupt_ID :=
234+ System.OS_Interface.SIGCONT; -- stopped process has been continued 234+ System.OS_Interface.SIGCONT; -- stopped process has been continued
235+ 235+
236+ SIGCHLD : constant Interrupt_ID := 236+ SIGCHLD : constant Interrupt_ID :=
237+ System.OS_Interface.SIGCHLD; -- 4.3BSD's/POSIX name for SIGCLD 237+ System.OS_Interface.SIGCHLD; -- 4.3BSD's/POSIX name for SIGCLD
238+ 238+
239+ SIGCLD : constant Interrupt_ID := 239+ SIGCLD : constant Interrupt_ID :=
240+ System.OS_Interface.SIGCLD; -- child status change 240+ System.OS_Interface.SIGCLD; -- child status change
241+ 241+
242+ SIGTTIN : constant Interrupt_ID := 242+ SIGTTIN : constant Interrupt_ID :=
243+ System.OS_Interface.SIGTTIN; -- background tty read attempted 243+ System.OS_Interface.SIGTTIN; -- background tty read attempted
244+ 244+
245+ SIGTTOU : constant Interrupt_ID := 245+ SIGTTOU : constant Interrupt_ID :=
246+ System.OS_Interface.SIGTTOU; -- background tty write attempted 246+ System.OS_Interface.SIGTTOU; -- background tty write attempted
247+ 247+
248+ SIGIO : constant Interrupt_ID := -- input/output possible, 248+ SIGIO : constant Interrupt_ID := -- input/output possible,
249+ System.OS_Interface.SIGIO; -- SIGPOLL alias (Solaris) 249+ System.OS_Interface.SIGIO; -- SIGPOLL alias (Solaris)
250+ 250+
251+ SIGXCPU : constant Interrupt_ID := 251+ SIGXCPU : constant Interrupt_ID :=
252+ System.OS_Interface.SIGXCPU; -- CPU time limit exceeded 252+ System.OS_Interface.SIGXCPU; -- CPU time limit exceeded
253+ 253+
254+ SIGXFSZ : constant Interrupt_ID := 254+ SIGXFSZ : constant Interrupt_ID :=
255+ System.OS_Interface.SIGXFSZ; -- filesize limit exceeded 255+ System.OS_Interface.SIGXFSZ; -- filesize limit exceeded
256+ 256+
257+ SIGVTALRM : constant Interrupt_ID := 257+ SIGVTALRM : constant Interrupt_ID :=
258+ System.OS_Interface.SIGVTALRM; -- virtual timer expired 258+ System.OS_Interface.SIGVTALRM; -- virtual timer expired
259+ 259+
260+ SIGPROF : constant Interrupt_ID := 260+ SIGPROF : constant Interrupt_ID :=
261+ System.OS_Interface.SIGPROF; -- profiling timer expired 261+ System.OS_Interface.SIGPROF; -- profiling timer expired
262+ 262+
263+ SIGWINCH : constant Interrupt_ID := 263+ SIGWINCH : constant Interrupt_ID :=
264+ System.OS_Interface.SIGWINCH; -- window size change 264+ System.OS_Interface.SIGWINCH; -- window size change
265+ 265+
266+ SIGUSR1 : constant Interrupt_ID := 266+ SIGUSR1 : constant Interrupt_ID :=
267+ System.OS_Interface.SIGUSR1; -- user defined signal 1 267+ System.OS_Interface.SIGUSR1; -- user defined signal 1
268+ 268+
269+ SIGUSR2 : constant Interrupt_ID := 269+ SIGUSR2 : constant Interrupt_ID :=
270+ System.OS_Interface.SIGUSR2; -- user defined signal 2 270+ System.OS_Interface.SIGUSR2; -- user defined signal 2
271+ 271+
272+ SIGPWR : constant Interrupt_ID := 272+ SIGPWR : constant Interrupt_ID :=
273+ System.OS_Interface.SIGPWR; -- power fail/restart 273+ System.OS_Interface.SIGPWR; -- power fail/restart
274+ 274+
275+end Ada.Interrupts.Names; 275+end Ada.Interrupts.Names;
276--- /dev/null 276--- /dev/null
277+++ gcc/ada/a-intnam-openbsd.ads 277+++ gcc/ada/a-intnam-openbsd.ads
278@@ -0,0 +1,133 @@ 278@@ -0,0 +1,133 @@
279+------------------------------------------------------------------------------ 279+------------------------------------------------------------------------------
280+-- -- 280+-- --
281+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- 281+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
282+-- -- 282+-- --
283+-- A D A . I N T E R R U P T S . N A M E S -- 283+-- A D A . I N T E R R U P T S . N A M E S --
284+-- -- 284+-- --
285+-- S p e c -- 285+-- S p e c --
286+-- -- 286+-- --
287+-- Copyright (C) 1991-2009, Free Software Foundation, Inc. -- 287+-- Copyright (C) 1991-2009, Free Software Foundation, Inc. --
288+-- -- 288+-- --
289+-- GNARL is free software; you can redistribute it and/or modify it under -- 289+-- GNARL is free software; you can redistribute it and/or modify it under --
290+-- terms of the GNU General Public License as published by the Free Soft- -- 290+-- terms of the GNU General Public License as published by the Free Soft- --
291+-- ware Foundation; either version 3, or (at your option) any later ver- -- 291+-- ware Foundation; either version 3, or (at your option) any later ver- --
292+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- 292+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
293+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- 293+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
294+-- or FITNESS FOR A PARTICULAR PURPOSE. -- 294+-- or FITNESS FOR A PARTICULAR PURPOSE. --
295+-- -- 295+-- --
296+-- As a special exception under Section 7 of GPL version 3, you are granted -- 296+-- As a special exception under Section 7 of GPL version 3, you are granted --
297+-- additional permissions described in the GCC Runtime Library Exception, -- 297+-- additional permissions described in the GCC Runtime Library Exception, --
298+-- version 3.1, as published by the Free Software Foundation. -- 298+-- version 3.1, as published by the Free Software Foundation. --
299+-- -- 299+-- --
300+-- You should have received a copy of the GNU General Public License and -- 300+-- You should have received a copy of the GNU General Public License and --
301+-- a copy of the GCC Runtime Library Exception along with this program; -- 301+-- a copy of the GCC Runtime Library Exception along with this program; --
302+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- 302+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
303+-- <http://www.gnu.org/licenses/>. -- 303+-- <http://www.gnu.org/licenses/>. --
304+-- -- 304+-- --
305+-- GNARL was developed by the GNARL team at Florida State University. -- 305+-- GNARL was developed by the GNARL team at Florida State University. --
306+-- Extensive contributions were provided by Ada Core Technologies, Inc. -- 306+-- Extensive contributions were provided by Ada Core Technologies, Inc. --
307+-- -- 307+-- --
308+-- Copyright (C) 2010 John Marino <draco@marino.st> -- 308+-- Copyright (C) 2010 John Marino <draco@marino.st> --
309+------------------------------------------------------------------------------ 309+------------------------------------------------------------------------------
310+ 310+
311+-- This is the OpenBSD THREADS version of this package 311+-- This is the OpenBSD THREADS version of this package
312+ 312+
313+with System.OS_Interface; 313+with System.OS_Interface;
314+ 314+
315+package Ada.Interrupts.Names is 315+package Ada.Interrupts.Names is
316+ 316+
317+ -- Beware that the mapping of names to signals may be many-to-one. There 317+ -- Beware that the mapping of names to signals may be many-to-one. There
318+ -- may be aliases. Also, for all signal names that are not supported on 318+ -- may be aliases. Also, for all signal names that are not supported on
319+ -- the current system the value of the corresponding constant will be zero. 319+ -- the current system the value of the corresponding constant will be zero.
320+ 320+
321+ SIGHUP : constant Interrupt_ID := 321+ SIGHUP : constant Interrupt_ID :=
322+ System.OS_Interface.SIGHUP; -- hangup 322+ System.OS_Interface.SIGHUP; -- hangup
323+ 323+
324+ SIGINT : constant Interrupt_ID := 324+ SIGINT : constant Interrupt_ID :=
325+ System.OS_Interface.SIGINT; -- interrupt (rubout) 325+ System.OS_Interface.SIGINT; -- interrupt (rubout)
326+ 326+
327+ SIGQUIT : constant Interrupt_ID := 327+ SIGQUIT : constant Interrupt_ID :=
328+ System.OS_Interface.SIGQUIT; -- quit (ASCD FS) 328+ System.OS_Interface.SIGQUIT; -- quit (ASCD FS)
329+ 329+
330+ SIGILL : constant Interrupt_ID := 330+ SIGILL : constant Interrupt_ID :=
331+ System.OS_Interface.SIGILL; -- illegal instruction (not reset) 331+ System.OS_Interface.SIGILL; -- illegal instruction (not reset)
332+ 332+
333+ SIGTRAP : constant Interrupt_ID := 333+ SIGTRAP : constant Interrupt_ID :=
334+ System.OS_Interface.SIGTRAP; -- trace trap (not reset) 334+ System.OS_Interface.SIGTRAP; -- trace trap (not reset)
335+ 335+
336+ SIGIOT : constant Interrupt_ID := 336+ SIGIOT : constant Interrupt_ID :=
337+ System.OS_Interface.SIGIOT; -- IOT instruction 337+ System.OS_Interface.SIGIOT; -- IOT instruction
338+ 338+
339+ SIGABRT : constant Interrupt_ID := -- used by abort, 339+ SIGABRT : constant Interrupt_ID := -- used by abort,
340+ System.OS_Interface.SIGABRT; -- replace SIGIOT in the future 340+ System.OS_Interface.SIGABRT; -- replace SIGIOT in the future
341+ 341+
342+ SIGFPE : constant Interrupt_ID := 342+ SIGFPE : constant Interrupt_ID :=
343+ System.OS_Interface.SIGFPE; -- floating point exception 343+ System.OS_Interface.SIGFPE; -- floating point exception
344+ 344+
345+ SIGKILL : constant Interrupt_ID := 345+ SIGKILL : constant Interrupt_ID :=
346+ System.OS_Interface.SIGKILL; -- kill (cannot be caught or ignored) 346+ System.OS_Interface.SIGKILL; -- kill (cannot be caught or ignored)
347+ 347+
348+ SIGBUS : constant Interrupt_ID := 348+ SIGBUS : constant Interrupt_ID :=
349+ System.OS_Interface.SIGBUS; -- bus error 349+ System.OS_Interface.SIGBUS; -- bus error
350+ 350+
351+ SIGSEGV : constant Interrupt_ID := 351+ SIGSEGV : constant Interrupt_ID :=
352+ System.OS_Interface.SIGSEGV; -- segmentation violation 352+ System.OS_Interface.SIGSEGV; -- segmentation violation
353+ 353+
354+ SIGPIPE : constant Interrupt_ID := -- write on a pipe with 354+ SIGPIPE : constant Interrupt_ID := -- write on a pipe with
355+ System.OS_Interface.SIGPIPE; -- no one to read it 355+ System.OS_Interface.SIGPIPE; -- no one to read it
356+ 356+
357+ SIGALRM : constant Interrupt_ID := 357+ SIGALRM : constant Interrupt_ID :=
358+ System.OS_Interface.SIGALRM; -- alarm clock 358+ System.OS_Interface.SIGALRM; -- alarm clock
359+ 359+
360+ SIGTERM : constant Interrupt_ID := 360+ SIGTERM : constant Interrupt_ID :=
361+ System.OS_Interface.SIGTERM; -- software termination signal from kill 361+ System.OS_Interface.SIGTERM; -- software termination signal from kill
362+ 362+
363+ SIGURG : constant Interrupt_ID := 363+ SIGURG : constant Interrupt_ID :=
364+ System.OS_Interface.SIGURG; -- urgent condition on IO channel 364+ System.OS_Interface.SIGURG; -- urgent condition on IO channel
365+ 365+
366+ SIGSTOP : constant Interrupt_ID := 366+ SIGSTOP : constant Interrupt_ID :=
367+ System.OS_Interface.SIGSTOP; -- stop (cannot be caught or ignored) 367+ System.OS_Interface.SIGSTOP; -- stop (cannot be caught or ignored)
368+ 368+
369+ SIGTSTP : constant Interrupt_ID := 369+ SIGTSTP : constant Interrupt_ID :=
370+ System.OS_Interface.SIGTSTP; -- user stop requested from tty 370+ System.OS_Interface.SIGTSTP; -- user stop requested from tty
371+ 371+
372+ SIGCONT : constant Interrupt_ID := 372+ SIGCONT : constant Interrupt_ID :=
373+ System.OS_Interface.SIGCONT; -- stopped process has been continued 373+ System.OS_Interface.SIGCONT; -- stopped process has been continued
374+ 374+
375+ SIGCHLD : constant Interrupt_ID := 375+ SIGCHLD : constant Interrupt_ID :=
376+ System.OS_Interface.SIGCHLD; -- 4.3BSD's/POSIX name for SIGCLD 376+ System.OS_Interface.SIGCHLD; -- 4.3BSD's/POSIX name for SIGCLD
377+ 377+
378+ SIGCLD : constant Interrupt_ID := 378+ SIGCLD : constant Interrupt_ID :=
379+ System.OS_Interface.SIGCLD; -- child status change 379+ System.OS_Interface.SIGCLD; -- child status change
380+ 380+
381+ SIGTTIN : constant Interrupt_ID := 381+ SIGTTIN : constant Interrupt_ID :=
382+ System.OS_Interface.SIGTTIN; -- background tty read attempted 382+ System.OS_Interface.SIGTTIN; -- background tty read attempted
383+ 383+
384+ SIGTTOU : constant Interrupt_ID := 384+ SIGTTOU : constant Interrupt_ID :=
385+ System.OS_Interface.SIGTTOU; -- background tty write attempted 385+ System.OS_Interface.SIGTTOU; -- background tty write attempted
386+ 386+
387+ SIGIO : constant Interrupt_ID := -- input/output possible, 387+ SIGIO : constant Interrupt_ID := -- input/output possible,
388+ System.OS_Interface.SIGIO; -- SIGPOLL alias (Solaris) 388+ System.OS_Interface.SIGIO; -- SIGPOLL alias (Solaris)
389+ 389+
390+ SIGXCPU : constant Interrupt_ID := 390+ SIGXCPU : constant Interrupt_ID :=
391+ System.OS_Interface.SIGXCPU; -- CPU time limit exceeded 391+ System.OS_Interface.SIGXCPU; -- CPU time limit exceeded
392+ 392+
393+ SIGXFSZ : constant Interrupt_ID := 393+ SIGXFSZ : constant Interrupt_ID :=
394+ System.OS_Interface.SIGXFSZ; -- filesize limit exceeded 394+ System.OS_Interface.SIGXFSZ; -- filesize limit exceeded
395+ 395+
396+ SIGVTALRM : constant Interrupt_ID := 396+ SIGVTALRM : constant Interrupt_ID :=
397+ System.OS_Interface.SIGVTALRM; -- virtual timer expired 397+ System.OS_Interface.SIGVTALRM; -- virtual timer expired
398+ 398+
399+ SIGPROF : constant Interrupt_ID := 399+ SIGPROF : constant Interrupt_ID :=
400+ System.OS_Interface.SIGPROF; -- profiling timer expired 400+ System.OS_Interface.SIGPROF; -- profiling timer expired
401+ 401+
402+ SIGWINCH : constant Interrupt_ID := 402+ SIGWINCH : constant Interrupt_ID :=
403+ System.OS_Interface.SIGWINCH; -- window size change 403+ System.OS_Interface.SIGWINCH; -- window size change
404+ 404+
405+ SIGUSR1 : constant Interrupt_ID := 405+ SIGUSR1 : constant Interrupt_ID :=
406+ System.OS_Interface.SIGUSR1; -- user defined signal 1 406+ System.OS_Interface.SIGUSR1; -- user defined signal 1
407+ 407+
408+ SIGUSR2 : constant Interrupt_ID := 408+ SIGUSR2 : constant Interrupt_ID :=
409+ System.OS_Interface.SIGUSR2; -- user defined signal 2 409+ System.OS_Interface.SIGUSR2; -- user defined signal 2
410+ 410+
411+end Ada.Interrupts.Names; 411+end Ada.Interrupts.Names;
412--- gcc/ada/adaint.c.orig 412--- gcc/ada/adaint.c.orig
413+++ gcc/ada/adaint.c 413+++ gcc/ada/adaint.c
414@@ -27,6 +27,7 @@ 414@@ -27,6 +27,7 @@
415 * GNAT was originally developed by the GNAT team at New York University. * 415 * GNAT was originally developed by the GNAT team at New York University. *
416 * Extensive contributions were provided by Ada Core Technologies Inc. * 416 * Extensive contributions were provided by Ada Core Technologies Inc. *
417 * * 417 * *
418+ * Copyright (C) 2010 John Marino <www.dragonlace.net> * 418+ * Copyright (C) 2010 John Marino <www.dragonlace.net> *
419 ****************************************************************************/ 419 ****************************************************************************/
420  420
421 /* This file contains those routines named by Import pragmas in 421 /* This file contains those routines named by Import pragmas in
422@@ -400,7 +401,11 @@ 422@@ -400,7 +401,11 @@
423 __gnat_current_time 423 __gnat_current_time
424 (void) 424 (void)
425 { 425 {
426+#if defined(__NetBSD__) && (__NetBSD__ > 5) 426+#if defined(__NetBSD__) && (__NetBSD__ > 5)
427+ time_t res = __time50 (NULL); 427+ time_t res = __time50 (NULL);
428+#else 428+#else
429 time_t res = time (NULL); 429 time_t res = time (NULL);
430+#endif 430+#endif
431 return (OS_Time) res; 431 return (OS_Time) res;
432 } 432 }
433  433
434@@ -1047,6 +1052,7 @@ 434@@ -1047,6 +1052,7 @@
435 strcpy (path, "GNAT-XXXXXX"); 435 strcpy (path, "GNAT-XXXXXX");
436  436
437 #if (defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) \ 437 #if (defined (__FreeBSD__) || defined (__NetBSD__) || defined (__OpenBSD__) \
438+ || defined (__DragonFly__) \ 438+ || defined (__DragonFly__) \
439 || defined (linux) || defined(__GLIBC__)) && !defined (__vxworks) 439 || defined (linux) || defined(__GLIBC__)) && !defined (__vxworks)
440 return mkstemp (path); 440 return mkstemp (path);
441 #elif defined (__Lynx__) 441 #elif defined (__Lynx__)
442@@ -1195,7 +1201,49 @@ 442@@ -1195,7 +1201,49 @@
443 free (pname); 443 free (pname);
444 } 444 }
445  445
446+#elif defined (__ANDROID__) 446+#elif defined (__ANDROID__)
447+ 447+
448+ /* 448+ /*
449+ * ext2 /ext3/ext4/fat16/fat32 have no path limits 449+ * ext2 /ext3/ext4/fat16/fat32 have no path limits
450+ * /data/local/tmp normally requires rooted devices, if it even exists 450+ * /data/local/tmp normally requires rooted devices, if it even exists
451+ * /sdcard is the standard location for external storage. Nativeactivity 451+ * /sdcard is the standard location for external storage. Nativeactivity
452+ * manifest needs to authorize its use, otherwise it might not have the 452+ * manifest needs to authorize its use, otherwise it might not have the
453+ * proper permissions. 453+ * proper permissions.
454+ */ 454+ */
455+ 455+
456+ int testfd; 456+ int testfd;
457+ char *datadir = getenv ("ANDROID_DATA"); 457+ char *datadir = getenv ("ANDROID_DATA");
458+ 458+
459+ if (datadir == NULL) 459+ if (datadir == NULL)
460+ strcpy (tmp_filename, "/data/local/tmp/gnat-XXXXXX"); 460+ strcpy (tmp_filename, "/data/local/tmp/gnat-XXXXXX");
461+ else 461+ else
462+ sprintf (tmp_filename, "%s/local/tmp/gnat-XXXXXX", datadir); 462+ sprintf (tmp_filename, "%s/local/tmp/gnat-XXXXXX", datadir);
463+ 463+
464+ testfd = mkstemp (tmp_filename); 464+ testfd = mkstemp (tmp_filename);
465+ if (testfd != -1) 465+ if (testfd != -1)
466+ { 466+ {
467+ close (testfd); 467+ close (testfd);
468+ return; 468+ return;
469+ } 469+ }
470+ 470+
471+ char *sdcard = getenv ("EXTERNAL_STORAGE"); 471+ char *sdcard = getenv ("EXTERNAL_STORAGE");
472+ 472+
473+ if (sdcard == NULL) 473+ if (sdcard == NULL)
474+ strcpy (tmp_filename, "/sdcard/gnat-XXXXXX"); 474+ strcpy (tmp_filename, "/sdcard/gnat-XXXXXX");
475+ else 475+ else
476+ sprintf (tmp_filename, "%s/gnat-XXXXXX", sdcard); 476+ sprintf (tmp_filename, "%s/gnat-XXXXXX", sdcard);
477+ 477+
478+ testfd = mkstemp (tmp_filename); 478+ testfd = mkstemp (tmp_filename);
479+ if (testfd != -1) 479+ if (testfd != -1)
480+ { 480+ {
481+ close (testfd); 481+ close (testfd);
482+ return; 482+ return;
483+ } 483+ }
484+ 484+
485+ tmpnam (tmp_filename); 485+ tmpnam (tmp_filename);
486+ 486+
487 #elif defined (linux) || defined (__FreeBSD__) || defined (__NetBSD__) \ 487 #elif defined (linux) || defined (__FreeBSD__) || defined (__NetBSD__) \
488+ || defined (__DragonFly__) \ 488+ || defined (__DragonFly__) \
489 || defined (__OpenBSD__) || defined(__GLIBC__) 489 || defined (__OpenBSD__) || defined(__GLIBC__)
490 #define MAX_SAFE_PATH 1000 490 #define MAX_SAFE_PATH 1000
491 char *tmpdir = getenv ("TMPDIR"); 491 char *tmpdir = getenv ("TMPDIR");
492@@ -1617,9 +1665,12 @@ 492@@ -1617,9 +1665,12 @@
493 /* Set access time to now in local time. */ 493 /* Set access time to now in local time. */
494 t = time ((time_t) 0); 494 t = time ((time_t) 0);
495 utimbuf.actime = mktime (localtime (&t)); 495 utimbuf.actime = mktime (localtime (&t));
496- 496-
497+#if defined(__NetBSD__) && (__NetBSD__ > 5) 497+#if defined(__NetBSD__) && (__NetBSD__ > 5)
498+ __utime50 (name, &utimbuf); 498+ __utime50 (name, &utimbuf);
499+#else 499+#else
500 utime (name, &utimbuf); 500 utime (name, &utimbuf);
501 #endif 501 #endif
502+#endif 502+#endif
503 } 503 }
504  504
505 /* Get the list of installed standard libraries from the 505 /* Get the list of installed standard libraries from the
506@@ -2384,6 +2435,8 @@ 506@@ -2384,6 +2435,8 @@
507 int cores = 1; 507 int cores = 1;
508  508
509 #if defined (linux) || defined (sun) || defined (AIX) \ 509 #if defined (linux) || defined (sun) || defined (AIX) \
510+ || defined (__FreeBSD__) || defined (__DragonFly__) \ 510+ || defined (__FreeBSD__) || defined (__DragonFly__) \
511+ || defined (__OpenBSD__) || defined (__NetBSD__) \ 511+ || defined (__OpenBSD__) || defined (__NetBSD__) \
512 || (defined (__alpha__) && defined (_osf_)) || defined (__APPLE__) 512 || (defined (__alpha__) && defined (_osf_)) || defined (__APPLE__)
513 cores = (int) sysconf (_SC_NPROCESSORS_ONLN); 513 cores = (int) sysconf (_SC_NPROCESSORS_ONLN);
514  514
515@@ -3421,25 +3474,214 @@ 515@@ -3421,25 +3474,214 @@
516 } 516 }
517 #endif 517 #endif
518  518
519-#if defined (IS_CROSS) \ 519-#if defined (IS_CROSS) \
520- || (! ((defined (sparc) || defined (i386)) && defined (sun) \ 520- || (! ((defined (sparc) || defined (i386)) && defined (sun) \
521- && defined (__SVR4)) \ 521- && defined (__SVR4)) \
522- && ! (defined (linux) && (defined (i386) || defined (__x86_64__))) \ 522- && ! (defined (linux) && (defined (i386) || defined (__x86_64__))) \
523- && ! (defined (linux) && defined (__ia64__)) \ 523- && ! (defined (linux) && defined (__ia64__)) \
524- && ! (defined (linux) && defined (powerpc)) \ 524- && ! (defined (linux) && defined (powerpc)) \
525- && ! defined (__FreeBSD__) \ 525- && ! defined (__FreeBSD__) \
526- && ! defined (__Lynx__) \ 526- && ! defined (__Lynx__) \
527- && ! defined (__hpux__) \ 527- && ! defined (__hpux__) \
528- && ! defined (__APPLE__) \ 528- && ! defined (__APPLE__) \
529- && ! defined (_AIX) \ 529- && ! defined (_AIX) \
530- && ! (defined (__alpha__) && defined (__osf__)) \ 530- && ! (defined (__alpha__) && defined (__osf__)) \
531- && ! defined (VMS) \ 531- && ! defined (VMS) \
532- && ! defined (__MINGW32__) \ 532- && ! defined (__MINGW32__) \
533- && ! (defined (__mips) && defined (__sgi))) 533- && ! (defined (__mips) && defined (__sgi)))
534- 534-
535-/* Dummy function to satisfy g-trasym.o. See the preprocessor conditional 535-/* Dummy function to satisfy g-trasym.o. See the preprocessor conditional
536- just above for a list of native platforms that provide a non-dummy 536- just above for a list of native platforms that provide a non-dummy
537- version of this procedure in libaddr2line.a. */ 537- version of this procedure in libaddr2line.a. */
538+/* run-time symbolic traceback support */ 538+/* run-time symbolic traceback support */
539+#if defined (__DragonFly__) \ 539+#if defined (__DragonFly__) \
540+ || defined (__FreeBSD__) \ 540+ || defined (__FreeBSD__) \
541+ || defined (__OpenBSD__) \ 541+ || defined (__OpenBSD__) \
542+ || defined (__NetBSD__) \ 542+ || defined (__NetBSD__) \
543+ || (defined (__sun__) && defined (__i386__) && defined (__SVR4)) 543+ || (defined (__sun__) && defined (__i386__) && defined (__SVR4))
544+ 544+
545+/* The above platforms use the external program /usr/bin/addr2line */ 545+/* The above platforms use the external program /usr/bin/addr2line */
546+#define EXTERNAL_SYMTRACE 546+#define EXTERNAL_SYMTRACE
547+ 547+
548+#elif defined (VMS) \ 548+#elif defined (VMS) \
549+ || defined (_AIX) \ 549+ || defined (_AIX) \
550+ || defined (__Lynx__) \ 550+ || defined (__Lynx__) \
551+ || defined (__hpux__) \ 551+ || defined (__hpux__) \
552+ || defined (__APPLE__) \ 552+ || defined (__APPLE__) \
553+ || defined (__MINGW32__) \ 553+ || defined (__MINGW32__) \
554+ || (defined (__mips) && defined (__sgi)) \ 554+ || (defined (__mips) && defined (__sgi)) \
555+ || (defined (__alpha__) && defined (__osf__)) \ 555+ || (defined (__alpha__) && defined (__osf__)) \
556+ || (defined (linux) && defined (i386)) \ 556+ || (defined (linux) && defined (i386)) \
557+ || (defined (linux) && defined (powerpc)) \ 557+ || (defined (linux) && defined (powerpc)) \
558+ || (defined (linux) && defined (__ia64__)) \ 558+ || (defined (linux) && defined (__ia64__)) \
559+ || (defined (linux) && defined (__x86_64__)) \ 559+ || (defined (linux) && defined (__x86_64__)) \
560+ || (defined (__SVR4) && defined (__sun__) && defined (sparc)) 560+ || (defined (__SVR4) && defined (__sun__) && defined (sparc))
561+ 561+
562+/* The above platforms use the system library libaddr2line.a */ 562+/* The above platforms use the system library libaddr2line.a */
563+#define NATIVE_SYMTRACE 563+#define NATIVE_SYMTRACE
564+#endif 564+#endif
565+ 565+
566+#if defined (EXTERNAL_SYMTRACE) && !defined (IS_CROSS) 566+#if defined (EXTERNAL_SYMTRACE) && !defined (IS_CROSS)
567+ 567+
568+/* 568+/*
569+ Copyright (C) 1999 by Juergen Pfeifer <juergen.pfeifer@gmx.net> 569+ Copyright (C) 1999 by Juergen Pfeifer <juergen.pfeifer@gmx.net>
570+ Ada for Linux Team (ALT) 570+ Ada for Linux Team (ALT)
571+ Heavily modified by John Marino <http://www.dragonlace.net> 571+ Heavily modified by John Marino <http://www.dragonlace.net>
572+ 572+
573+ Permission is hereby granted, free of charge, to any person obtaining a 573+ Permission is hereby granted, free of charge, to any person obtaining a
574+ copy of this software and associated documentation files (the 574+ copy of this software and associated documentation files (the
575+ "Software"), to deal in the Software without restriction, including 575+ "Software"), to deal in the Software without restriction, including
576+ without limitation the rights to use, copy, modify, merge, publish, 576+ without limitation the rights to use, copy, modify, merge, publish,
577+ distribute, distribute with modifications, sublicense, and/or sell 577+ distribute, distribute with modifications, sublicense, and/or sell
578+ copies of the Software, and to permit persons to whom the Software is 578+ copies of the Software, and to permit persons to whom the Software is
579+ furnished to do so, subject to the following conditions: 579+ furnished to do so, subject to the following conditions:
580+ 580+
581+ The above copyright notice and this permission notice shall be included 581+ The above copyright notice and this permission notice shall be included
582+ in all copies or substantial portions of the Software. 582+ in all copies or substantial portions of the Software.
583+ 583+
584+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 584+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
585+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 585+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
586+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 586+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
587+ IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 587+ IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
588+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 588+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
589+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 589+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
590+ THE USE OR OTHER DEALINGS IN THE SOFTWARE. 590+ THE USE OR OTHER DEALINGS IN THE SOFTWARE.
591+ 591+
592+ Except as contained in this notice, the name(s) of the above copyright 592+ Except as contained in this notice, the name(s) of the above copyright
593+ holders shall not be used in advertising or otherwise to promote the 593+ holders shall not be used in advertising or otherwise to promote the
594+ sale, use or other dealings in this Software without prior written 594+ sale, use or other dealings in this Software without prior written
595+ authorization. 595+ authorization.
596+*/ 596+*/
597+ 597+
598+#include <sys/types.h> 598+#include <sys/types.h>
599+#include <stdlib.h> 599+#include <stdlib.h>
600+#include <unistd.h> 600+#include <unistd.h>
601+#include <string.h> 601+#include <string.h>
602+#include <signal.h> 602+#include <signal.h>
603+ 603+
604+#define CLOSE_SENDPIPE close(sendpipe[0]); close(sendpipe[1]) 604+#define CLOSE_SENDPIPE close(sendpipe[0]); close(sendpipe[1])
605+#define CLOSE_READPIPE close(readpipe[0]); close(readpipe[1]) 605+#define CLOSE_READPIPE close(readpipe[0]); close(readpipe[1])
606+#define DUP2CLOSE(oldfd, newfd) dup2(oldfd, newfd); close(oldfd); 606+#define DUP2CLOSE(oldfd, newfd) dup2(oldfd, newfd); close(oldfd);
607+#define RESTSIG sigaction(SIGPIPE,&oact,NULL) 607+#define RESTSIG sigaction(SIGPIPE,&oact,NULL)
608+ 608+
609+#define MAX_LINE 1024 609+#define MAX_LINE 1024
610+#define PARENT_READ readpipe[0] 610+#define PARENT_READ readpipe[0]
611+#define CHILD_WRITE readpipe[1] 611+#define CHILD_WRITE readpipe[1]
612+#define CHILD_READ sendpipe[0] 612+#define CHILD_READ sendpipe[0]
613+#define PARENT_WRITE sendpipe[1] 613+#define PARENT_WRITE sendpipe[1]
614+ 614+
615+#if defined (__sun__) 615+#if defined (__sun__)
616+#define ADDR2LINE_PROG "/usr/gnu/bin/addr2line" 616+#define ADDR2LINE_PROG "/usr/gnu/bin/addr2line"
617+#else 617+#else
618+#define ADDR2LINE_PROG "/usr/bin/addr2line" 618+#define ADDR2LINE_PROG "/usr/bin/addr2line"
619+#endif 619+#endif
620+ 620+
621+void 621+void
622+convert_addresses (const char *file_name, 622+convert_addresses (const char *file_name,
623+ void *addrs, 623+ void *addrs,
624+ int n_addr, 624+ int n_addr,
625+ void *buf, 625+ void *buf,
626+ int *len) 626+ int *len)
627+{ 627+{
628+ int max_len = *len; 628+ int max_len = *len;
629+ pid_t childpid; 629+ pid_t childpid;
630+ 630+
631+ struct sigaction act, oact; 631+ struct sigaction act, oact;
632+ 632+
633+ int sendpipe[2] = {-1,-1}, /* parent -> child */ 633+ int sendpipe[2] = {-1,-1}, /* parent -> child */
634+ readpipe[2] = {-1,-1}; /* parent <- child */ 634+ readpipe[2] = {-1,-1}; /* parent <- child */
635+ 635+
636+ *len = 0; 636+ *len = 0;
637+ act.sa_handler = SIG_IGN; 637+ act.sa_handler = SIG_IGN;
638+ sigemptyset(&act.sa_mask); 638+ sigemptyset(&act.sa_mask);
639+ act.sa_flags = 0; 639+ act.sa_flags = 0;
640+ if (sigaction(SIGPIPE,&act,&oact) < 0) 640+ if (sigaction(SIGPIPE,&act,&oact) < 0)
641+ return; 641+ return;
642+ 642+
643+ if (pipe(sendpipe) < 0) { RESTSIG; return; } 643+ if (pipe(sendpipe) < 0) { RESTSIG; return; }
644+ if (pipe(readpipe) < 0) { CLOSE_SENDPIPE; RESTSIG; return; } 644+ if (pipe(readpipe) < 0) { CLOSE_SENDPIPE; RESTSIG; return; }
645+ if ((childpid = fork()) < 0) { 645+ if ((childpid = fork()) < 0) {
646+ CLOSE_READPIPE; 646+ CLOSE_READPIPE;
647+ CLOSE_SENDPIPE; 647+ CLOSE_SENDPIPE;
648+ RESTSIG; 648+ RESTSIG;
649+ return; 649+ return;
650+ } 650+ }
651+ 651+
652+ if (childpid == 0) { /* child process */ 652+ if (childpid == 0) { /* child process */
653+ close(PARENT_WRITE); 653+ close(PARENT_WRITE);
654+ close(PARENT_READ); 654+ close(PARENT_READ);
655+ if ((CHILD_READ != STDIN_FILENO) && (CHILD_WRITE != STDOUT_FILENO)) { 655+ if ((CHILD_READ != STDIN_FILENO) && (CHILD_WRITE != STDOUT_FILENO)) {
656+ if ((CHILD_READ == STDOUT_FILENO) && (CHILD_WRITE == STDIN_FILENO)) { 656+ if ((CHILD_READ == STDOUT_FILENO) && (CHILD_WRITE == STDIN_FILENO)) {
657+ const int temp_fd = dup(CHILD_WRITE); 657+ const int temp_fd = dup(CHILD_WRITE);
658+ close (CHILD_WRITE); 658+ close (CHILD_WRITE);
659+ DUP2CLOSE (CHILD_READ, STDIN_FILENO); 659+ DUP2CLOSE (CHILD_READ, STDIN_FILENO);
660+ DUP2CLOSE (temp_fd, STDOUT_FILENO); 660+ DUP2CLOSE (temp_fd, STDOUT_FILENO);
661+ } 661+ }
662+ else if ((CHILD_READ == STDIN_FILENO) && (CHILD_WRITE > 1)) { 662+ else if ((CHILD_READ == STDIN_FILENO) && (CHILD_WRITE > 1)) {
663+ DUP2CLOSE (CHILD_WRITE, STDOUT_FILENO); 663+ DUP2CLOSE (CHILD_WRITE, STDOUT_FILENO);
664+ } 664+ }
665+ else if ((CHILD_READ > 1) && (CHILD_WRITE == STDOUT_FILENO)) { 665+ else if ((CHILD_READ > 1) && (CHILD_WRITE == STDOUT_FILENO)) {
666+ DUP2CLOSE (CHILD_READ, STDIN_FILENO); 666+ DUP2CLOSE (CHILD_READ, STDIN_FILENO);
667+ } 667+ }
668+ else if ((CHILD_READ > 1) && (CHILD_WRITE == STDIN_FILENO)) { 668+ else if ((CHILD_READ > 1) && (CHILD_WRITE == STDIN_FILENO)) {
669+ DUP2CLOSE (CHILD_WRITE, STDOUT_FILENO); 669+ DUP2CLOSE (CHILD_WRITE, STDOUT_FILENO);
670+ DUP2CLOSE (CHILD_READ, STDIN_FILENO); 670+ DUP2CLOSE (CHILD_READ, STDIN_FILENO);
671+ } 671+ }
672+ else { 672+ else {
673+ /* CHILD_READ >= 1 and CHILD_WRITE > 1 */ 673+ /* CHILD_READ >= 1 and CHILD_WRITE > 1 */
674+ DUP2CLOSE (CHILD_READ, STDIN_FILENO); 674+ DUP2CLOSE (CHILD_READ, STDIN_FILENO);
675+ DUP2CLOSE (CHILD_WRITE, STDOUT_FILENO); 675+ DUP2CLOSE (CHILD_WRITE, STDOUT_FILENO);
676+ } 676+ }
677+ } 677+ }
678+ /* As pointed out by Florian Weimer to JP, it is a security threat to call 678+ /* As pointed out by Florian Weimer to JP, it is a security threat to call
679+ the script with a user defined environment and using the path. That 679+ the script with a user defined environment and using the path. That
680+ would be Trojans pleasure. Therefore the absolute path to addr2line 680+ would be Trojans pleasure. Therefore the absolute path to addr2line
681+ and an empty environment is used. That should be safe. 681+ and an empty environment is used. That should be safe.
682+ */ 682+ */
683+ char *const argv[] = { "addr2line", 683+ char *const argv[] = { "addr2line",
684+ "-e", file_name, 684+ "-e", file_name,
685+ "--demangle=gnat", 685+ "--demangle=gnat",
686+ "--functions", 686+ "--functions",
687+ "--basenames", 687+ "--basenames",
688+ NULL }; 688+ NULL };
689+ char *const envp[] = { NULL }; 689+ char *const envp[] = { NULL };
690+ if (execve(ADDR2LINE_PROG, argv, envp) < 0) { 690+ if (execve(ADDR2LINE_PROG, argv, envp) < 0) {
691+ close (CHILD_WRITE); 691+ close (CHILD_WRITE);
692+ close (CHILD_READ); 692+ close (CHILD_READ);
693+ RESTSIG; 693+ RESTSIG;
694+ exit (1); 694+ exit (1);
695+ } 695+ }
696+ } 696+ }
697+ 697+
698+ /* Below this line is parent process */ 698+ /* Below this line is parent process */
699+ int i, n; 699+ int i, n;
700+ char hex[16]; 700+ char hex[16];
701+ char line[MAX_LINE + 1]; 701+ char line[MAX_LINE + 1];
702+ char *p; 702+ char *p;
703+ char *s = buf; 703+ char *s = buf;
704+ long *trace_address = addrs; 704+ long *trace_address = addrs;
705+ 705+
706+ close(CHILD_WRITE); 706+ close(CHILD_WRITE);
707+ close(CHILD_READ); 707+ close(CHILD_READ);
708+ 708+
709+ for(i=0; i < n_addr; i++) { 709+ for(i=0; i < n_addr; i++) {
710+ snprintf(hex,sizeof(hex),"%#lx\n",*trace_address); 710+ snprintf(hex,sizeof(hex),"%#lx\n",*trace_address);
711+ write(PARENT_WRITE,hex,strlen(hex)); 711+ write(PARENT_WRITE,hex,strlen(hex));
712+ n = read(PARENT_READ,line,MAX_LINE); 712+ n = read(PARENT_READ,line,MAX_LINE);
713+ if (n<=0) 713+ if (n<=0)
714+ break; 714+ break;
715+ 715+
716+ line[n]=0; 716+ line[n]=0;
717+ /* We have approx. 16 additional chars for "%#lx in " clause. 717+ /* We have approx. 16 additional chars for "%#lx in " clause.
718+ We use this info to prevent a buffer overrun. */ 718+ We use this info to prevent a buffer overrun. */
719+ if (n + 16 + (*len) > max_len) 719+ if (n + 16 + (*len) > max_len)
720+ break; 720+ break;
721+ 721+
722+ p = strchr(line,'\n'); 722+ p = strchr(line,'\n');
723+ if (p) { 723+ if (p) {
724+ if (*(p+1)) { 724+ if (*(p+1)) {
725+ *p = 0; 725+ *p = 0;
726+ *len += snprintf(s, (max_len - (*len)), "%#lx in %s at %s", 726+ *len += snprintf(s, (max_len - (*len)), "%#lx in %s at %s",
727+ *trace_address, line, p+1); 727+ *trace_address, line, p+1);
728+ } 728+ }
729+ else { 729+ else {
730+ *len += snprintf(s, (max_len - (*len)), "%#lx at %s", 730+ *len += snprintf(s, (max_len - (*len)), "%#lx at %s",
731+ *trace_address, line); 731+ *trace_address, line);
732+ } 732+ }
733+ s = buf + (*len); 733+ s = buf + (*len);
734+ } 734+ }
735+ trace_address += 1; 735+ trace_address += 1;
736+ } 736+ }
737+ close (PARENT_WRITE); 737+ close (PARENT_WRITE);
738+ close (PARENT_READ); 738+ close (PARENT_READ);
739+ RESTSIG; 739+ RESTSIG;
740+} 740+}
741+ 741+
742+#elif defined (IS_CROSS) || !defined (NATIVE_SYMTRACE) 742+#elif defined (IS_CROSS) || !defined (NATIVE_SYMTRACE)
743+ 743+
744+/* run-time symbolic traceback support 744+/* run-time symbolic traceback support
745+ Dummy function to satisfy g-trasym.o. */ 745+ Dummy function to satisfy g-trasym.o. */
746  746
747 void 747 void
748 convert_addresses (const char *file_name ATTRIBUTE_UNUSED, 748 convert_addresses (const char *file_name ATTRIBUTE_UNUSED,
749@@ -3686,3 +3928,110 @@ 749@@ -3686,3 +3928,110 @@
750 return (void *) syscall (__NR_gettid); 750 return (void *) syscall (__NR_gettid);
751 } 751 }
752 #endif 752 #endif
753+ 753+
754+ 754+
755+ 755+
756+ 756+
757+#ifdef MARINO_DISABLED_THIS 757+#ifdef MARINO_DISABLED_THIS
758+/* JRM 31 OCT 2010: For some reason, gnatmake wouldn't function correct when 758+/* JRM 31 OCT 2010: For some reason, gnatmake wouldn't function correct when
759+ strcpy or sprintf & friends were replaced. I had to back out the patches. 759+ strcpy or sprintf & friends were replaced. I had to back out the patches.
760+ I'll leave the BSD routines here in case we ever want to try again. */ 760+ I'll leave the BSD routines here in case we ever want to try again. */
761+ 761+
762+ 762+
763+/* 763+/*
764+ * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com> 764+ * Copyright (c) 1998 Todd C. Miller <Todd.Miller@courtesan.com>
765+ * 765+ *
766+ * Permission to use, copy, modify, and distribute this software for any 766+ * Permission to use, copy, modify, and distribute this software for any
767+ * purpose with or without fee is hereby granted, provided that the above 767+ * purpose with or without fee is hereby granted, provided that the above
768+ * copyright notice and this permission notice appear in all copies. 768+ * copyright notice and this permission notice appear in all copies.
769+ * 769+ *
770+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 770+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
771+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 771+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
772+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 772+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
773+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 773+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
774+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 774+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
775+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 775+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
776+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 776+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
777+ */ 777+ */
778+ 778+
779+/* 779+/*
780+ * original function name: strlcpy 780+ * original function name: strlcpy
781+ * Copy src to string dst of size siz. At most siz-1 characters 781+ * Copy src to string dst of size siz. At most siz-1 characters
782+ * will be copied. Always NUL terminates (unless siz == 0). 782+ * will be copied. Always NUL terminates (unless siz == 0).
783+ * Returns strlen(src); if retval >= siz, truncation occurred. 783+ * Returns strlen(src); if retval >= siz, truncation occurred.
784+ * 784+ *
785+ * $OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp $ 785+ * OpenBSD: strlcpy.c,v 1.11 2006/05/05 15:27:38 millert Exp
786+ * $FreeBSD: src/lib/libc/string/strlcpy.c,v 1.10 2008/10/19 delphij Exp $ 786+ * FreeBSD: src/lib/libc/string/strlcpy.c,v 1.10 2008/10/19 delphij Exp
787+ * $DragonFly: src/lib/libc/string/strlcpy.c,v 1.4 2005/09/18 asmodai Exp $ 787+ * DragonFly: src/lib/libc/string/strlcpy.c,v 1.4 2005/09/18 asmodai Exp
788+ */ 788+ */
789+ 789+
790+size_t 790+size_t
791+bsd_strlcpy(char *dst, const char *src, size_t siz) 791+bsd_strlcpy(char *dst, const char *src, size_t siz)
792+{ 792+{
793+ char *d = dst; 793+ char *d = dst;
794+ const char *s = src; 794+ const char *s = src;
795+ size_t n = siz; 795+ size_t n = siz;
796+ 796+
797+ /* Copy as many bytes as will fit */ 797+ /* Copy as many bytes as will fit */
798+ if (n != 0) { 798+ if (n != 0) {
799+ while (--n != 0) { 799+ while (--n != 0) {
800+ if ((*d++ = *s++) == '\0') 800+ if ((*d++ = *s++) == '\0')
801+ break; 801+ break;
802+ } 802+ }
803+ } 803+ }
804+ 804+
805+ /* Not enough room in dst, add NUL and traverse rest of src */ 805+ /* Not enough room in dst, add NUL and traverse rest of src */
806+ if (n == 0) { 806+ if (n == 0) {
807+ if (siz != 0) 807+ if (siz != 0)
808+ *d = '\0'; /* NUL-terminate dst */ 808+ *d = '\0'; /* NUL-terminate dst */
809+ while (*s++) 809+ while (*s++)
810+ ; 810+ ;
811+ } 811+ }
812+ 812+
813+ return(s - src - 1); /* count does not include NUL */ 813+ return(s - src - 1); /* count does not include NUL */
814+} 814+}
815+ 815+
816+ 816+
817+ 817+
818+/* 818+/*
819+ * Original function name: strlcat 819+ * Original function name: strlcat
820+ * Appends src to string dst of size siz (unlike strncat, siz is the 820+ * Appends src to string dst of size siz (unlike strncat, siz is the
821+ * full size of dst, not space left). At most siz-1 characters 821+ * full size of dst, not space left). At most siz-1 characters
822+ * will be copied. Always NUL terminates (unless siz <= strlen(dst)). 822+ * will be copied. Always NUL terminates (unless siz <= strlen(dst)).
823+ * Returns strlen(src) + MIN(siz, strlen(initial dst)). 823+ * Returns strlen(src) + MIN(siz, strlen(initial dst)).
824+ * If retval >= siz, truncation occurred. 824+ * If retval >= siz, truncation occurred.
825+ * 825+ *
826+ * $OpenBSD: strlcat.c,v 1.13 2005/08/08 08:05:37 espie Exp $ 826+ * OpenBSD: strlcat.c,v 1.13 2005/08/08 08:05:37 espie Exp
827+ * $FreeBSD: src/lib/libc/string/strlcat.c,v 1.11 2009/01/12 delphij Exp $ 827+ * FreeBSD: src/lib/libc/string/strlcat.c,v 1.11 2009/01/12 delphij Exp
828+ * $DragonFly: src/lib/libc/string/strlcat.c,v 1.4 2004/12/18 asmodai Exp $ 828+ * DragonFly: src/lib/libc/string/strlcat.c,v 1.4 2004/12/18 asmodai Exp
829+ */ 829+ */
830+ 830+
831+size_t 831+size_t
832+bsd_strlcat(char *dst, const char *src, size_t siz) 832+bsd_strlcat(char *dst, const char *src, size_t siz)
833+{ 833+{
834+ char *d = dst; 834+ char *d = dst;
835+ const char *s = src; 835+ const char *s = src;
836+ size_t n = siz; 836+ size_t n = siz;
837+ size_t dlen; 837+ size_t dlen;
838+ 838+
839+ /* Find the end of dst and adjust bytes left but don't go past end */ 839+ /* Find the end of dst and adjust bytes left but don't go past end */
840+ while (n-- != 0 && *d != '\0') 840+ while (n-- != 0 && *d != '\0')
841+ d++; 841+ d++;
842+ dlen = d - dst; 842+ dlen = d - dst;
843+ n = siz - dlen; 843+ n = siz - dlen;
844+ 844+
845+ if (n == 0) 845+ if (n == 0)
846+ return(dlen + strlen(s)); 846+ return(dlen + strlen(s));
847+ while (*s != '\0') { 847+ while (*s != '\0') {
848+ if (n != 1) { 848+ if (n != 1) {
849+ *d++ = *s; 849+ *d++ = *s;
850+ n--; 850+ n--;
851+ } 851+ }
852+ s++; 852+ s++;
853+ } 853+ }
854+ *d = '\0'; 854+ *d = '\0';
855+ 855+
856+ return(dlen + (s - src)); /* count does not include NUL */ 856+ return(dlen + (s - src)); /* count does not include NUL */
857+} 857+}
858+#endif 858+#endif
859+ 859+
860--- gcc/ada/cio.c.orig 860--- gcc/ada/cio.c.orig
861+++ gcc/ada/cio.c 861+++ gcc/ada/cio.c
862@@ -27,6 +27,7 @@ 862@@ -27,6 +27,7 @@
863 * GNAT was originally developed by the GNAT team at New York University. * 863 * GNAT was originally developed by the GNAT team at New York University. *
864 * Extensive contributions were provided by Ada Core Technologies Inc. * 864 * Extensive contributions were provided by Ada Core Technologies Inc. *
865 * * 865 * *
866+ * Copyright (C) 2011 John Marino <www.dragonlace.net> * 866+ * Copyright (C) 2011 John Marino <www.dragonlace.net> *
867 ****************************************************************************/ 867 ****************************************************************************/
868  868
869 #ifdef IN_RTS 869 #ifdef IN_RTS
870@@ -42,7 +43,8 @@ 870@@ -42,7 +43,8 @@
871  871
872 /* Don't use macros on GNU/Linux since they cause incompatible changes between 872 /* Don't use macros on GNU/Linux since they cause incompatible changes between
873 glibc 2.0 and 2.1 */ 873 glibc 2.0 and 2.1 */
874-#ifdef linux 874-#ifdef linux
875+/* Android is The exception because it uses the BIONIC library */ 875+/* Android is The exception because it uses the BIONIC library */
876+#if defined(linux) && !defined(__ANDROID__) 876+#if defined(linux) && !defined(__ANDROID__)
877 #undef putchar 877 #undef putchar
878 #undef getchar 878 #undef getchar
879 #undef fputc 879 #undef fputc
880--- gcc/ada/cstreams.c.orig 880--- gcc/ada/cstreams.c.orig
881+++ gcc/ada/cstreams.c 881+++ gcc/ada/cstreams.c
882@@ -27,6 +27,7 @@ 882@@ -27,6 +27,7 @@
883 * GNAT was originally developed by the GNAT team at New York University. * 883 * GNAT was originally developed by the GNAT team at New York University. *
884 * Extensive contributions were provided by Ada Core Technologies Inc. * 884 * Extensive contributions were provided by Ada Core Technologies Inc. *
885 * * 885 * *
886+ * Copyright (C) 2010 John Marino <draco@marino.st> * 886+ * Copyright (C) 2010 John Marino <draco@marino.st> *
887 ****************************************************************************/ 887 ****************************************************************************/
888  888
889 /* Routines required for implementing routines in Interfaces.C.Streams */ 889 /* Routines required for implementing routines in Interfaces.C.Streams */
890@@ -50,9 +51,10 @@ 890@@ -50,9 +51,10 @@
891 #include <unixlib.h> 891 #include <unixlib.h>
892 #endif 892 #endif
893  893
894-#ifdef linux 894-#ifdef linux
895+#if defined(linux) && !defined(__ANDROID__) 895+#if defined(linux) && !defined(__ANDROID__)
896 /* Don't use macros on GNU/Linux since they cause incompatible changes between 896 /* Don't use macros on GNU/Linux since they cause incompatible changes between
897 glibc 2.0 and 2.1 */ 897 glibc 2.0 and 2.1 */
898+/* Android is The exception because it uses the BIONIC library */ 898+/* Android is The exception because it uses the BIONIC library */
899  899
900 #ifdef stderr 900 #ifdef stderr
901 # undef stderr 901 # undef stderr
902@@ -173,7 +175,9 @@ 902@@ -173,7 +175,9 @@
903 *p = '\\'; 903 *p = '\\';
904 } 904 }
905  905
906-#elif defined (sgi) || defined (__FreeBSD__) 906-#elif defined (sgi) || defined (__FreeBSD__)
907+#elif defined (sgi) || defined (__FreeBSD__) \ 907+#elif defined (sgi) || defined (__FreeBSD__) \
908+ || defined (__DragonFly__) \ 908+ || defined (__DragonFly__) \
909+ || defined (__OpenBSD__) 909+ || defined (__OpenBSD__)
910  910
911 /* Use realpath function which resolves links and references to . and .. 911 /* Use realpath function which resolves links and references to . and ..
912 on those Unix systems that support it. Note that GNU/Linux provides it but 912 on those Unix systems that support it. Note that GNU/Linux provides it but
913--- gcc/ada/env.c.orig 913--- gcc/ada/env.c.orig
914+++ gcc/ada/env.c 914+++ gcc/ada/env.c
915@@ -27,6 +27,7 @@ 915@@ -27,6 +27,7 @@
916 * GNAT was originally developed by the GNAT team at New York University. * 916 * GNAT was originally developed by the GNAT team at New York University. *
917 * Extensive contributions were provided by Ada Core Technologies Inc. * 917 * Extensive contributions were provided by Ada Core Technologies Inc. *
918 * * 918 * *
919+ * Copyright (C) 2010 John Marino <draco@marino.st> * 919+ * Copyright (C) 2010 John Marino <draco@marino.st> *
920 ****************************************************************************/ 920 ****************************************************************************/
921  921
922 /* Tru64 UNIX V4.0F <stdlib.h> declares unsetenv() only if AES_SOURCE (which 922 /* Tru64 UNIX V4.0F <stdlib.h> declares unsetenv() only if AES_SOURCE (which
923@@ -172,7 +173,8 @@ 923@@ -172,7 +173,8 @@
924 LIB$SIGNAL (status); 924 LIB$SIGNAL (status);
925 } 925 }
926  926
927-#elif (defined (__vxworks) && defined (__RTP__)) || defined (__APPLE__) 927-#elif (defined (__vxworks) && defined (__RTP__)) || defined (__APPLE__)
928+#elif (defined (__vxworks) && defined (__RTP__)) || defined (__APPLE__) \ 928+#elif (defined (__vxworks) && defined (__RTP__)) || defined (__APPLE__) \
929+ || defined (__OpenBSD__) 929+ || defined (__OpenBSD__)
930 setenv (name, value, 1); 930 setenv (name, value, 1);
931  931
932 #else 932 #else
933@@ -299,6 +301,7 @@ 933@@ -299,6 +301,7 @@
934 } 934 }
935 #elif defined (__MINGW32__) || defined (__FreeBSD__) || defined (__APPLE__) \ 935 #elif defined (__MINGW32__) || defined (__FreeBSD__) || defined (__APPLE__) \
936 || (defined (__vxworks) && defined (__RTP__)) || defined (__CYGWIN__) \ 936 || (defined (__vxworks) && defined (__RTP__)) || defined (__CYGWIN__) \
937+ || defined (__DragonFly__) \ 937+ || defined (__DragonFly__) \
938 || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__rtems__) 938 || defined (__NetBSD__) || defined (__OpenBSD__) || defined (__rtems__)
939 /* On Windows, FreeBSD and MacOS there is no function to clean all the 939 /* On Windows, FreeBSD and MacOS there is no function to clean all the
940 environment but there is a "clean" way to unset a variable. So go 940 environment but there is a "clean" way to unset a variable. So go
941--- gcc/ada/errno.c.orig 941--- gcc/ada/errno.c.orig
942+++ gcc/ada/errno.c 942+++ gcc/ada/errno.c
943@@ -27,6 +27,7 @@ 943@@ -27,6 +27,7 @@
944 * GNAT was originally developed by the GNAT team at New York University. * 944 * GNAT was originally developed by the GNAT team at New York University. *
945 * Extensive contributions were provided by Ada Core Technologies Inc. * 945 * Extensive contributions were provided by Ada Core Technologies Inc. *
946 * * 946 * *
947+ * Copyright (C) 2011 John Marino <www.dragonlace.net> * 947+ * Copyright (C) 2011 John Marino <www.dragonlace.net> *
948 ****************************************************************************/ 948 ****************************************************************************/
949  949
950 /* This file provides access to the C-language errno to the Ada interface 950 /* This file provides access to the C-language errno to the Ada interface
951@@ -39,6 +40,7 @@ 951@@ -39,6 +40,7 @@
952 #define _REENTRANT 952 #define _REENTRANT
953 #define _THREAD_SAFE 953 #define _THREAD_SAFE
954 #define _SGI_MP_SOURCE 954 #define _SGI_MP_SOURCE
955+#define GNAT_SET_ERRNO 955+#define GNAT_SET_ERRNO
956  956
957 #ifdef MaRTE 957 #ifdef MaRTE
958  958
959@@ -52,6 +54,17 @@ 959@@ -52,6 +54,17 @@
960  960
961 #endif 961 #endif
962  962
963+#ifdef __ANDROID__ 963+#ifdef __ANDROID__
964+ 964+
965+/* The ANDROID errno.h file also defines __set_errno as an external variable 965+/* The ANDROID errno.h file also defines __set_errno as an external variable
966+ for use with syscalls. It should not be referenced directly, but we are 966+ for use with syscalls. It should not be referenced directly, but we are
967+ going to do it anyway because the alternative solution is to rename all  967+ going to do it anyway because the alternative solution is to rename all
968+ uses of __set_errno in GNAT. */ 968+ uses of __set_errno in GNAT. */
969+ 969+
970+#undef GNAT_SET_ERRNO  970+#undef GNAT_SET_ERRNO
971+#endif 971+#endif
972+ 972+
973+ 973+
974 #include <errno.h> 974 #include <errno.h>
975 int 975 int
976 __get_errno(void) 976 __get_errno(void)
977@@ -59,8 +72,10 @@ 977@@ -59,8 +72,10 @@
978 return errno; 978 return errno;
979 } 979 }
980  980
981+#ifdef GNAT_SET_ERRNO 981+#ifdef GNAT_SET_ERRNO
982 void 982 void
983 __set_errno(int err) 983 __set_errno(int err)
984 { 984 {
985 errno = err; 985 errno = err;
986 } 986 }
987+#endif 987+#endif
988--- gcc/ada/g-comlin.adb.orig 988--- gcc/ada/g-comlin.adb.orig
989+++ gcc/ada/g-comlin.adb 989+++ gcc/ada/g-comlin.adb
990@@ -27,6 +27,7 @@ 990@@ -27,6 +27,7 @@
991 -- GNAT was originally developed by the GNAT team at New York University. -- 991 -- GNAT was originally developed by the GNAT team at New York University. --
992 -- Extensive contributions were provided by Ada Core Technologies Inc. -- 992 -- Extensive contributions were provided by Ada Core Technologies Inc. --
993 -- -- 993 -- --
994+-- Copyright (C) 2010 John Marino <draco@marino.st> -- 994+-- Copyright (C) 2010 John Marino <draco@marino.st> --
995 ------------------------------------------------------------------------------ 995 ------------------------------------------------------------------------------
996  996
997 with Ada.Characters.Handling; use Ada.Characters.Handling; 997 with Ada.Characters.Handling; use Ada.Characters.Handling;
998@@ -512,6 +513,7 @@ 998@@ -512,6 +513,7 @@
999 begin 999 begin
1000 Index_In_Switches := 0; 1000 Index_In_Switches := 0;
1001 Switch_Length := 0; 1001 Switch_Length := 0;
1002+ Param := Parameter_None; 1002+ Param := Parameter_None;
1003  1003
1004 -- Remove all leading spaces first to make sure that Index points 1004 -- Remove all leading spaces first to make sure that Index points
1005 -- at the start of the first switch. 1005 -- at the start of the first switch.
1006--- gcc/ada/g-expect.adb.orig 1006--- gcc/ada/g-expect.adb.orig
1007+++ gcc/ada/g-expect.adb 1007+++ gcc/ada/g-expect.adb
1008@@ -29,6 +29,7 @@ 1008@@ -29,6 +29,7 @@
1009 -- GNAT was originally developed by the GNAT team at New York University. -- 1009 -- GNAT was originally developed by the GNAT team at New York University. --
1010 -- Extensive contributions were provided by Ada Core Technologies Inc. -- 1010 -- Extensive contributions were provided by Ada Core Technologies Inc. --
1011 -- -- 1011 -- --
1012+-- Copyright (C) 2010 John Marino <draco@marino.st> -- 1012+-- Copyright (C) 2010 John Marino <draco@marino.st> --
1013 ------------------------------------------------------------------------------ 1013 ------------------------------------------------------------------------------
1014  1014
1015 with System; use System; 1015 with System; use System;
1016@@ -1333,15 +1334,21 @@ 1016@@ -1333,15 +1334,21 @@
1017  1017
1018 -- The following commands are not executed on Unix systems, and are only 1018 -- The following commands are not executed on Unix systems, and are only
1019 -- required for Windows systems. We are now in the parent process. 1019 -- required for Windows systems. We are now in the parent process.
1020+ -- Although the if-statement is redundant, it's here so the compiler 1020+ -- Although the if-statement is redundant, it's here so the compiler
1021+ -- doesn't complain about uninitialized variables. 1021+ -- doesn't complain about uninitialized variables.
1022  1022
1023- -- Restore the old descriptors 1023- -- Restore the old descriptors
1024+ if No_Fork_On_Target then 1024+ if No_Fork_On_Target then
1025+ 1025+
1026+ -- Restore the old descriptors 1026+ -- Restore the old descriptors
1027+ 1027+
1028+ Dup2 (Input, GNAT.OS_Lib.Standin); 1028+ Dup2 (Input, GNAT.OS_Lib.Standin);
1029+ Dup2 (Output, GNAT.OS_Lib.Standout); 1029+ Dup2 (Output, GNAT.OS_Lib.Standout);
1030+ Dup2 (Error, GNAT.OS_Lib.Standerr); 1030+ Dup2 (Error, GNAT.OS_Lib.Standerr);
1031+ Close (Input); 1031+ Close (Input);
1032+ Close (Output); 1032+ Close (Output);
1033+ Close (Error); 1033+ Close (Error);
1034+ end if; 1034+ end if;
1035  1035
1036- Dup2 (Input, GNAT.OS_Lib.Standin); 1036- Dup2 (Input, GNAT.OS_Lib.Standin);
1037- Dup2 (Output, GNAT.OS_Lib.Standout); 1037- Dup2 (Output, GNAT.OS_Lib.Standout);
1038- Dup2 (Error, GNAT.OS_Lib.Standerr); 1038- Dup2 (Error, GNAT.OS_Lib.Standerr);
1039- Close (Input); 1039- Close (Input);
1040- Close (Output); 1040- Close (Output);
1041- Close (Error); 1041- Close (Error);
1042 end Set_Up_Child_Communications; 1042 end Set_Up_Child_Communications;
1043  1043
1044 --------------------------- 1044 ---------------------------
1045--- /dev/null 1045--- /dev/null
1046+++ gcc/ada/g-socthi-bsd.adb 1046+++ gcc/ada/g-socthi-bsd.adb
1047@@ -0,0 +1,379 @@ 1047@@ -0,0 +1,379 @@
1048+------------------------------------------------------------------------------ 1048+------------------------------------------------------------------------------
1049+-- -- 1049+-- --
1050+-- GNAT COMPILER COMPONENTS -- 1050+-- GNAT COMPILER COMPONENTS --
1051+-- -- 1051+-- --
1052+-- G N A T . S O C K E T S . T H I N -- 1052+-- G N A T . S O C K E T S . T H I N --
1053+-- -- 1053+-- --
1054+-- B o d y -- 1054+-- B o d y --
1055+-- -- 1055+-- --
1056+-- Copyright (C) 2001-2009, AdaCore -- 1056+-- Copyright (C) 2001-2009, AdaCore --
1057+-- -- 1057+-- --
1058+-- GNAT is free software; you can redistribute it and/or modify it under -- 1058+-- GNAT is free software; you can redistribute it and/or modify it under --
1059+-- terms of the GNU General Public License as published by the Free Soft- -- 1059+-- terms of the GNU General Public License as published by the Free Soft- --
1060+-- ware Foundation; either version 2, or (at your option) any later ver- -- 1060+-- ware Foundation; either version 2, or (at your option) any later ver- --
1061+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- 1061+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
1062+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- 1062+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
1063+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- 1063+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
1064+-- for more details. You should have received a copy of the GNU General -- 1064+-- for more details. You should have received a copy of the GNU General --
1065+-- Public License distributed with GNAT; see file COPYING. If not, write -- 1065+-- Public License distributed with GNAT; see file COPYING. If not, write --
1066+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- 1066+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
1067+-- Boston, MA 02110-1301, USA. -- 1067+-- Boston, MA 02110-1301, USA. --
1068+-- -- 1068+-- --
1069+-- As a special exception, if other files instantiate generics from this -- 1069+-- As a special exception, if other files instantiate generics from this --
1070+-- unit, or you link this unit with other files to produce an executable, -- 1070+-- unit, or you link this unit with other files to produce an executable, --
1071+-- this unit does not by itself cause the resulting executable to be -- 1071+-- this unit does not by itself cause the resulting executable to be --
1072+-- covered by the GNU General Public License. This exception does not -- 1072+-- covered by the GNU General Public License. This exception does not --
1073+-- however invalidate any other reasons why the executable file might be -- 1073+-- however invalidate any other reasons why the executable file might be --
1074+-- covered by the GNU Public License. -- 1074+-- covered by the GNU Public License. --
1075+-- -- 1075+-- --
1076+-- GNAT was originally developed by the GNAT team at New York University. -- 1076+-- GNAT was originally developed by the GNAT team at New York University. --
1077+-- Extensive contributions were provided by Ada Core Technologies Inc. -- 1077+-- Extensive contributions were provided by Ada Core Technologies Inc. --
1078+-- -- 1078+-- --
1079+-- Copyright (C) 2010 John Marino <draco@marino.st> -- 1079+-- Copyright (C) 2010 John Marino <draco@marino.st> --
1080+------------------------------------------------------------------------------ 1080+------------------------------------------------------------------------------
1081+ 1081+
1082+-- This package provides a target dependent thin interface to the sockets 1082+-- This package provides a target dependent thin interface to the sockets
1083+-- layer for use by the GNAT.Sockets package (g-socket.ads). This package 1083+-- layer for use by the GNAT.Sockets package (g-socket.ads). This package
1084+-- should not be directly with'ed by an applications program. 1084+-- should not be directly with'ed by an applications program.
1085+ 1085+
1086+-- This is the *BSD version which uses fcntl rather than ioctl 1086+-- This is the *BSD version which uses fcntl rather than ioctl
1087+-- The constant SCON.Thread_Blocking_IO is always true (for all platforms, not 1087+-- The constant SCON.Thread_Blocking_IO is always true (for all platforms, not
1088+-- just *BSD), so this binding is significantly simpler than the standard 1088+-- just *BSD), so this binding is significantly simpler than the standard
1089+-- one it replaces. 1089+-- one it replaces.
1090+ 1090+
1091+with GNAT.OS_Lib; use GNAT.OS_Lib; 1091+with GNAT.OS_Lib; use GNAT.OS_Lib;
1092+ 1092+
1093+with Interfaces.C; use Interfaces.C; 1093+with Interfaces.C; use Interfaces.C;
1094+ 1094+
1095+package body GNAT.Sockets.Thin is 1095+package body GNAT.Sockets.Thin is
1096+ 1096+
1097+ Unknown_System_Error : constant C.Strings.chars_ptr := 1097+ Unknown_System_Error : constant C.Strings.chars_ptr :=
1098+ C.Strings.New_String ("Unknown system error"); 1098+ C.Strings.New_String ("Unknown system error");
1099+ 1099+
1100+ function Syscall_Accept 1100+ function Syscall_Accept
1101+ (S : C.int; 1101+ (S : C.int;
1102+ Addr : System.Address; 1102+ Addr : System.Address;
1103+ Addrlen : not null access C.int) return C.int; 1103+ Addrlen : not null access C.int) return C.int;
1104+ pragma Import (C, Syscall_Accept, "accept"); 1104+ pragma Import (C, Syscall_Accept, "accept");
1105+ -- The accept() function accepts a connection on a socket. An incoming 1105+ -- The accept() function accepts a connection on a socket. An incoming
1106+ -- connection is acknowledged and associated with an immediately created 1106+ -- connection is acknowledged and associated with an immediately created
1107+ -- socket. The original socket is returned to the listening state. 1107+ -- socket. The original socket is returned to the listening state.
1108+ 1108+
1109+ function Syscall_Connect 1109+ function Syscall_Connect
1110+ (S : C.int; 1110+ (S : C.int;
1111+ Name : System.Address; 1111+ Name : System.Address;
1112+ Namelen : C.int) return C.int; 1112+ Namelen : C.int) return C.int;
1113+ pragma Import (C, Syscall_Connect, "connect"); 1113+ pragma Import (C, Syscall_Connect, "connect");
1114+ -- The connect() system call initiates a connection on a socket. If the 1114+ -- The connect() system call initiates a connection on a socket. If the
1115+ -- parameter S is of type SOCK_DGRAM then connect() permanently specifies 1115+ -- parameter S is of type SOCK_DGRAM then connect() permanently specifies
1116+ -- the peer to which datagrams are to be sent. If S is type SOCK_STREAM 1116+ -- the peer to which datagrams are to be sent. If S is type SOCK_STREAM
1117+ -- then connect() attempts to make a connection with another socket, which 1117+ -- then connect() attempts to make a connection with another socket, which
1118+ -- is identified by the parameter Name. 1118+ -- is identified by the parameter Name.
1119+ 1119+
1120+ function Syscall_Recv 1120+ function Syscall_Recv
1121+ (S : C.int; 1121+ (S : C.int;
1122+ Msg : System.Address; 1122+ Msg : System.Address;
1123+ Len : C.int; 1123+ Len : C.int;
1124+ Flags : C.int) return C.int; 1124+ Flags : C.int) return C.int;
1125+ pragma Import (C, Syscall_Recv, "recv"); 1125+ pragma Import (C, Syscall_Recv, "recv");
1126+ -- The recv() function receives a message from a socket. The call can be 1126+ -- The recv() function receives a message from a socket. The call can be
1127+ -- used on a connection mode socket or a bound, connectionless socket. If 1127+ -- used on a connection mode socket or a bound, connectionless socket. If
1128+ -- no messages are available at the socket, the recv() call waits for a 1128+ -- no messages are available at the socket, the recv() call waits for a
1129+ -- message to arrive unless the socket is non-blocking. If a socket is 1129+ -- message to arrive unless the socket is non-blocking. If a socket is
1130+ -- non-blocking, the call returns a -1 and ERRNO is set to EWOULDBLOCK. 1130+ -- non-blocking, the call returns a -1 and ERRNO is set to EWOULDBLOCK.
1131+ 1131+
1132+ function Syscall_Recvfrom 1132+ function Syscall_Recvfrom
1133+ (S : C.int; 1133+ (S : C.int;
1134+ Msg : System.Address; 1134+ Msg : System.Address;
1135+ Len : C.int; 1135+ Len : C.int;
1136+ Flags : C.int; 1136+ Flags : C.int;
1137+ From : System.Address; 1137+ From : System.Address;
1138+ Fromlen : not null access C.int) return C.int; 1138+ Fromlen : not null access C.int) return C.int;
1139+ pragma Import (C, Syscall_Recvfrom, "recvfrom"); 1139+ pragma Import (C, Syscall_Recvfrom, "recvfrom");
1140+ -- The recvfrom() system call receives a message from a socket and captures 1140+ -- The recvfrom() system call receives a message from a socket and captures
1141+ -- the address from which the data was sent. It can be used to receive 1141+ -- the address from which the data was sent. It can be used to receive
1142+ -- data on an unconnected socket as well. If no messages are available, 1142+ -- data on an unconnected socket as well. If no messages are available,
1143+ -- the call waits for a message to arrive on blocking sockets. For 1143+ -- the call waits for a message to arrive on blocking sockets. For
1144+ -- non-blocking sockets without messages, -1 is returned and ERRNO is set 1144+ -- non-blocking sockets without messages, -1 is returned and ERRNO is set
1145+ -- to EAGAIN or EWOULDBLOCK. 1145+ -- to EAGAIN or EWOULDBLOCK.
1146+ 1146+
1147+ function Syscall_Recvmsg 1147+ function Syscall_Recvmsg
1148+ (S : C.int; 1148+ (S : C.int;
1149+ Msg : System.Address; 1149+ Msg : System.Address;
1150+ Flags : C.int) return System.CRTL.ssize_t; 1150+ Flags : C.int) return System.CRTL.ssize_t;
1151+ pragma Import (C, Syscall_Recvmsg, "recvmsg"); 1151+ pragma Import (C, Syscall_Recvmsg, "recvmsg");
1152+ -- The recvmsg call receives a message from a socket, and can be used to 1152+ -- The recvmsg call receives a message from a socket, and can be used to
1153+ -- receive data on an unconnected socket as well. If no messages are 1153+ -- receive data on an unconnected socket as well. If no messages are
1154+ -- available, the call waits for a message to arrive on blocking sockets. 1154+ -- available, the call waits for a message to arrive on blocking sockets.
1155+ -- For non-blocking sockets without messages, -1 is returned and ERRNO is 1155+ -- For non-blocking sockets without messages, -1 is returned and ERRNO is
1156+ -- set to EAGAIN or EWOULDBLOCK. 1156+ -- set to EAGAIN or EWOULDBLOCK.
1157+ 1157+
1158+ function Syscall_Sendmsg 1158+ function Syscall_Sendmsg
1159+ (S : C.int; 1159+ (S : C.int;
1160+ Msg : System.Address; 1160+ Msg : System.Address;
1161+ Flags : C.int) return System.CRTL.ssize_t; 1161+ Flags : C.int) return System.CRTL.ssize_t;
1162+ pragma Import (C, Syscall_Sendmsg, "sendmsg"); 1162+ pragma Import (C, Syscall_Sendmsg, "sendmsg");
1163+ -- The sendmsg() function sends a message to a socket, and can be used with 1163+ -- The sendmsg() function sends a message to a socket, and can be used with
1164+ -- unconnected sockets as well (the msg is ignored in this case). The 1164+ -- unconnected sockets as well (the msg is ignored in this case). The
1165+ -- function returns the number of bytes sent when successful, otherwise it 1165+ -- function returns the number of bytes sent when successful, otherwise it
1166+ -- returns -1 and ERRNO is set (many possible values). 1166+ -- returns -1 and ERRNO is set (many possible values).
1167+ 1167+
1168+ function Syscall_Sendto 1168+ function Syscall_Sendto
1169+ (S : C.int; 1169+ (S : C.int;
1170+ Msg : System.Address; 1170+ Msg : System.Address;
1171+ Len : C.int; 1171+ Len : C.int;
1172+ Flags : C.int; 1172+ Flags : C.int;
1173+ To : System.Address; 1173+ To : System.Address;
1174+ Tolen : C.int) return C.int; 1174+ Tolen : C.int) return C.int;
1175+ pragma Import (C, Syscall_Sendto, "sendto"); 1175+ pragma Import (C, Syscall_Sendto, "sendto");
1176+ -- The sendto() function only works for connected sockets and it initiates 1176+ -- The sendto() function only works for connected sockets and it initiates
1177+ -- the transmission of a message. A successful call returns the numbers of 1177+ -- the transmission of a message. A successful call returns the numbers of
1178+ -- bytes sent, and a failure returns a -1 and ERRNO is set. 1178+ -- bytes sent, and a failure returns a -1 and ERRNO is set.
1179+ 1179+
1180+ function Syscall_Socket 1180+ function Syscall_Socket
1181+ (Domain : C.int; 1181+ (Domain : C.int;
1182+ Typ : C.int; 1182+ Typ : C.int;
1183+ Protocol : C.int) return C.int; 1183+ Protocol : C.int) return C.int;
1184+ pragma Import (C, Syscall_Socket, "socket"); 1184+ pragma Import (C, Syscall_Socket, "socket");
1185+ -- The socket() function is used to create an unbound socket and returns a 1185+ -- The socket() function is used to create an unbound socket and returns a
1186+ -- file descriptor that can be used with other socket functions. Upon 1186+ -- file descriptor that can be used with other socket functions. Upon
1187+ -- failure, a -1 is returned and ERRNO is set. 1187+ -- failure, a -1 is returned and ERRNO is set.
1188+ 1188+
1189+ procedure Disable_SIGPIPE (S : C.int); 1189+ procedure Disable_SIGPIPE (S : C.int);
1190+ pragma Import (C, Disable_SIGPIPE, "__gnat_disable_sigpipe"); 1190+ pragma Import (C, Disable_SIGPIPE, "__gnat_disable_sigpipe");
1191+ 1191+
1192+ procedure Disable_All_SIGPIPEs; 1192+ procedure Disable_All_SIGPIPEs;
1193+ pragma Import (C, Disable_All_SIGPIPEs, "__gnat_disable_all_sigpipes"); 1193+ pragma Import (C, Disable_All_SIGPIPEs, "__gnat_disable_all_sigpipes");
1194+ -- Sets the process to ignore all SIGPIPE signals on platforms that 1194+ -- Sets the process to ignore all SIGPIPE signals on platforms that
1195+ -- don't support Disable_SIGPIPE for particular streams. 1195+ -- don't support Disable_SIGPIPE for particular streams.
1196+ 1196+
1197+ function C_Fcntl 1197+ function C_Fcntl
1198+ (Fd : C.int; 1198+ (Fd : C.int;
1199+ Cmd : C.int; 1199+ Cmd : C.int;
1200+ Val : C.int) return C.int; 1200+ Val : C.int) return C.int;
1201+ pragma Import (C, C_Fcntl, "fcntl"); 1201+ pragma Import (C, C_Fcntl, "fcntl");
1202+ -- The ioctl of 64-bit DragonFlyBSD, OpenBSD, and NetBSD does not support 1202+ -- The ioctl of 64-bit DragonFlyBSD, OpenBSD, and NetBSD does not support
1203+ -- setting a socket in non-blocking mode. fcntl must be used instead. 1203+ -- setting a socket in non-blocking mode. fcntl must be used instead.
1204+ 1204+
1205+ -------------- 1205+ --------------
1206+ -- C_Accept -- 1206+ -- C_Accept --
1207+ -------------- 1207+ --------------
1208+ 1208+
1209+ function C_Accept 1209+ function C_Accept
1210+ (S : C.int; 1210+ (S : C.int;
1211+ Addr : System.Address; 1211+ Addr : System.Address;
1212+ Addrlen : not null access C.int) return C.int 1212+ Addrlen : not null access C.int) return C.int
1213+ is 1213+ is
1214+ Res : constant C.int := Syscall_Accept (S, Addr, Addrlen); 1214+ Res : constant C.int := Syscall_Accept (S, Addr, Addrlen);
1215+ begin 1215+ begin
1216+ 1216+
1217+ Disable_SIGPIPE (Res); 1217+ Disable_SIGPIPE (Res);
1218+ return Res; 1218+ return Res;
1219+ 1219+
1220+ end C_Accept; 1220+ end C_Accept;
1221+ 1221+
1222+ --------------- 1222+ ---------------
1223+ -- C_Connect -- 1223+ -- C_Connect --
1224+ --------------- 1224+ ---------------
1225+ 1225+
1226+ function C_Connect 1226+ function C_Connect
1227+ (S : C.int; 1227+ (S : C.int;
1228+ Name : System.Address; 1228+ Name : System.Address;
1229+ Namelen : C.int) return C.int 1229+ Namelen : C.int) return C.int
1230+ is 1230+ is
1231+ begin 1231+ begin
1232+ 1232+
1233+ return Syscall_Connect (S, Name, Namelen); 1233+ return Syscall_Connect (S, Name, Namelen);
1234+ 1234+
1235+ end C_Connect; 1235+ end C_Connect;
1236+ 1236+
1237+ ------------------ 1237+ ------------------
1238+ -- Socket_Ioctl -- 1238+ -- Socket_Ioctl --
1239+ ------------------ 1239+ ------------------
1240+ 1240+
1241+ function Socket_Ioctl 1241+ function Socket_Ioctl
1242+ (S : C.int; 1242+ (S : C.int;
1243+ Req : C.int; 1243+ Req : C.int;
1244+ Arg : access C.int) return C.int 1244+ Arg : access C.int) return C.int
1245+ is 1245+ is
1246+ -- Currently all requests are of the FIONBIO type, so always calc flags 1246+ -- Currently all requests are of the FIONBIO type, so always calc flags
1247+ use Interfaces; 1247+ use Interfaces;
1248+ flags : constant Unsigned_32 := 1248+ flags : constant Unsigned_32 :=
1249+ Unsigned_32 (C_Fcntl (S, SOSC.F_GETFL, 0)); 1249+ Unsigned_32 (C_Fcntl (S, SOSC.F_GETFL, 0));
1250+ nonblock : constant Unsigned_32 := Unsigned_32 (SOSC.FNDELAY); 1250+ nonblock : constant Unsigned_32 := Unsigned_32 (SOSC.FNDELAY);
1251+ enabled : constant Boolean := Arg.all = 1; 1251+ enabled : constant Boolean := Arg.all = 1;
1252+ newval : C.int; 1252+ newval : C.int;
1253+ begin 1253+ begin
1254+ if Req = SOSC.FIONBIO then 1254+ if Req = SOSC.FIONBIO then
1255+ if enabled then 1255+ if enabled then
1256+ newval := C.int (flags or nonblock); 1256+ newval := C.int (flags or nonblock);
1257+ elsif (flags and nonblock) > 0 then 1257+ elsif (flags and nonblock) > 0 then
1258+ newval := C.int (flags - nonblock); 1258+ newval := C.int (flags - nonblock);
1259+ else 1259+ else
1260+ newval := C.int (flags); 1260+ newval := C.int (flags);
1261+ end if; 1261+ end if;
1262+ return C_Fcntl (Fd => S, Cmd => SOSC.F_SETFL, Val => newval); 1262+ return C_Fcntl (Fd => S, Cmd => SOSC.F_SETFL, Val => newval);
1263+ else 1263+ else
1264+ return C_Ioctl (Fd => S, Req => Req, Arg => Arg); 1264+ return C_Ioctl (Fd => S, Req => Req, Arg => Arg);
1265+ end if; 1265+ end if;
1266+ end Socket_Ioctl; 1266+ end Socket_Ioctl;
1267+ 1267+
1268+ ------------ 1268+ ------------
1269+ -- C_Recv -- 1269+ -- C_Recv --
1270+ ------------ 1270+ ------------
1271+ 1271+
1272+ function C_Recv 1272+ function C_Recv
1273+ (S : C.int; 1273+ (S : C.int;
1274+ Msg : System.Address; 1274+ Msg : System.Address;
1275+ Len : C.int; 1275+ Len : C.int;
1276+ Flags : C.int) return C.int 1276+ Flags : C.int) return C.int
1277+ is 1277+ is
1278+ begin 1278+ begin
1279+ 1279+
1280+ return Syscall_Recv (S, Msg, Len, Flags); 1280+ return Syscall_Recv (S, Msg, Len, Flags);
1281+ 1281+
1282+ end C_Recv; 1282+ end C_Recv;
1283+ 1283+
1284+ ---------------- 1284+ ----------------
1285+ -- C_Recvfrom -- 1285+ -- C_Recvfrom --
1286+ ---------------- 1286+ ----------------
1287+ 1287+
1288+ function C_Recvfrom 1288+ function C_Recvfrom
1289+ (S : C.int; 1289+ (S : C.int;
1290+ Msg : System.Address; 1290+ Msg : System.Address;
1291+ Len : C.int; 1291+ Len : C.int;
1292+ Flags : C.int; 1292+ Flags : C.int;
1293+ From : System.Address; 1293+ From : System.Address;
1294+ Fromlen : not null access C.int) return C.int 1294+ Fromlen : not null access C.int) return C.int
1295+ is 1295+ is
1296+ begin 1296+ begin
1297+ 1297+
1298+ return Syscall_Recvfrom (S, Msg, Len, Flags, From, Fromlen); 1298+ return Syscall_Recvfrom (S, Msg, Len, Flags, From, Fromlen);
1299+ 1299+
1300+ end C_Recvfrom; 1300+ end C_Recvfrom;
1301+ 1301+
1302+ --------------- 1302+ ---------------
1303+ -- C_Recvmsg -- 1303+ -- C_Recvmsg --
1304+ --------------- 1304+ ---------------
1305+ 1305+
1306+ function C_Recvmsg 1306+ function C_Recvmsg
1307+ (S : C.int; 1307+ (S : C.int;
1308+ Msg : System.Address; 1308+ Msg : System.Address;
1309+ Flags : C.int) return System.CRTL.ssize_t 1309+ Flags : C.int) return System.CRTL.ssize_t
1310+ is 1310+ is
1311+ begin 1311+ begin
1312+ 1312+
1313+ return Syscall_Recvmsg (S, Msg, Flags); 1313+ return Syscall_Recvmsg (S, Msg, Flags);
1314+ 1314+
1315+ end C_Recvmsg; 1315+ end C_Recvmsg;
1316+ 1316+
1317+ --------------- 1317+ ---------------
1318+ -- C_Sendmsg -- 1318+ -- C_Sendmsg --
1319+ --------------- 1319+ ---------------
1320+ 1320+
1321+ function C_Sendmsg 1321+ function C_Sendmsg
1322+ (S : C.int; 1322+ (S : C.int;
1323+ Msg : System.Address; 1323+ Msg : System.Address;
1324+ Flags : C.int) return System.CRTL.ssize_t 1324+ Flags : C.int) return System.CRTL.ssize_t
1325+ is 1325+ is
1326+ begin 1326+ begin
1327+ 1327+
1328+ return Syscall_Sendmsg (S, Msg, Flags); 1328+ return Syscall_Sendmsg (S, Msg, Flags);
1329+ 1329+
1330+ end C_Sendmsg; 1330+ end C_Sendmsg;
1331+ 1331+
1332+ -------------- 1332+ --------------
1333+ -- C_Sendto -- 1333+ -- C_Sendto --
1334+ -------------- 1334+ --------------
1335+ 1335+
1336+ function C_Sendto 1336+ function C_Sendto
1337+ (S : C.int; 1337+ (S : C.int;
1338+ Msg : System.Address; 1338+ Msg : System.Address;
1339+ Len : C.int; 1339+ Len : C.int;
1340+ Flags : C.int; 1340+ Flags : C.int;
1341+ To : System.Address; 1341+ To : System.Address;
1342+ Tolen : C.int) return C.int 1342+ Tolen : C.int) return C.int
1343+ is 1343+ is
1344+ begin 1344+ begin
1345+ 1345+
1346+ return Syscall_Sendto (S, Msg, Len, Flags, To, Tolen); 1346+ return Syscall_Sendto (S, Msg, Len, Flags, To, Tolen);
1347+ 1347+
1348+ end C_Sendto; 1348+ end C_Sendto;
1349+ 1349+
1350+ -------------- 1350+ --------------
1351+ -- C_Socket -- 1351+ -- C_Socket --
1352+ -------------- 1352+ --------------
1353+ 1353+
1354+ function C_Socket 1354+ function C_Socket
1355+ (Domain : C.int; 1355+ (Domain : C.int;
1356+ Typ : C.int; 1356+ Typ : C.int;
1357+ Protocol : C.int) return C.int 1357+ Protocol : C.int) return C.int
1358+ is 1358+ is
1359+ Res : constant C.int := Syscall_Socket (Domain, Typ, Protocol); 1359+ Res : constant C.int := Syscall_Socket (Domain, Typ, Protocol);
1360+ begin 1360+ begin
1361+ 1361+
1362+ Disable_SIGPIPE (Res); 1362+ Disable_SIGPIPE (Res);
1363+ return Res; 1363+ return Res;
1364+ 1364+
1365+ end C_Socket; 1365+ end C_Socket;
1366+ 1366+
1367+ -------------- 1367+ --------------
1368+ -- Finalize -- 1368+ -- Finalize --
1369+ -------------- 1369+ --------------
1370+ 1370+
1371+ procedure Finalize is 1371+ procedure Finalize is
1372+ begin 1372+ begin
1373+ null; 1373+ null;
1374+ end Finalize; 1374+ end Finalize;
1375+ 1375+
1376+ ------------------------- 1376+ -------------------------
1377+ -- Host_Error_Messages -- 1377+ -- Host_Error_Messages --
1378+ ------------------------- 1378+ -------------------------
1379+ 1379+
1380+ package body Host_Error_Messages is separate; 1380+ package body Host_Error_Messages is separate;
1381+ 1381+
1382+ ---------------- 1382+ ----------------
1383+ -- Initialize -- 1383+ -- Initialize --
1384+ ---------------- 1384+ ----------------
1385+ 1385+
1386+ procedure Initialize is 1386+ procedure Initialize is
1387+ begin 1387+ begin
1388+ Disable_All_SIGPIPEs; 1388+ Disable_All_SIGPIPEs;
1389+ end Initialize; 1389+ end Initialize;
1390+ 1390+
1391+ -------------------- 1391+ --------------------
1392+ -- Signalling_Fds -- 1392+ -- Signalling_Fds --
1393+ -------------------- 1393+ --------------------
1394+ 1394+
1395+ package body Signalling_Fds is 1395+ package body Signalling_Fds is
1396+ 1396+
1397+ -- In this default implementation, we use a C version of these 1397+ -- In this default implementation, we use a C version of these
1398+ -- subprograms provided by socket.c. 1398+ -- subprograms provided by socket.c.
1399+ 1399+
1400+ function C_Create (Fds : not null access Fd_Pair) return C.int; 1400+ function C_Create (Fds : not null access Fd_Pair) return C.int;
1401+ function C_Read (Rsig : C.int) return C.int; 1401+ function C_Read (Rsig : C.int) return C.int;
1402+ function C_Write (Wsig : C.int) return C.int; 1402+ function C_Write (Wsig : C.int) return C.int;
1403+ procedure C_Close (Sig : C.int); 1403+ procedure C_Close (Sig : C.int);
1404+ 1404+
1405+ pragma Import (C, C_Create, "__gnat_create_signalling_fds"); 1405+ pragma Import (C, C_Create, "__gnat_create_signalling_fds");
1406+ pragma Import (C, C_Read, "__gnat_read_signalling_fd"); 1406+ pragma Import (C, C_Read, "__gnat_read_signalling_fd");
1407+ pragma Import (C, C_Write, "__gnat_write_signalling_fd"); 1407+ pragma Import (C, C_Write, "__gnat_write_signalling_fd");
1408+ pragma Import (C, C_Close, "__gnat_close_signalling_fd"); 1408+ pragma Import (C, C_Close, "__gnat_close_signalling_fd");
1409+ 1409+
1410+ function Create 1410+ function Create
1411+ (Fds : not null access Fd_Pair) return C.int renames C_Create; 1411+ (Fds : not null access Fd_Pair) return C.int renames C_Create;
1412+ function Read (Rsig : C.int) return C.int renames C_Read; 1412+ function Read (Rsig : C.int) return C.int renames C_Read;
1413+ function Write (Wsig : C.int) return C.int renames C_Write; 1413+ function Write (Wsig : C.int) return C.int renames C_Write;
1414+ procedure Close (Sig : C.int) renames C_Close; 1414+ procedure Close (Sig : C.int) renames C_Close;
1415+ 1415+
1416+ end Signalling_Fds; 1416+ end Signalling_Fds;
1417+ 1417+
1418+ -------------------------- 1418+ --------------------------
1419+ -- Socket_Error_Message -- 1419+ -- Socket_Error_Message --
1420+ -------------------------- 1420+ --------------------------
1421+ 1421+
1422+ function Socket_Error_Message 1422+ function Socket_Error_Message
1423+ (Errno : Integer) return C.Strings.chars_ptr 1423+ (Errno : Integer) return C.Strings.chars_ptr
1424+ is separate; 1424+ is separate;
1425+ 1425+
1426+end GNAT.Sockets.Thin; 1426+end GNAT.Sockets.Thin;
1427--- /dev/null 1427--- /dev/null
1428+++ gcc/ada/g-socthi-netbsd.adb 1428+++ gcc/ada/g-socthi-netbsd.adb
1429@@ -0,0 +1,381 @@ 1429@@ -0,0 +1,381 @@
1430+------------------------------------------------------------------------------ 1430+------------------------------------------------------------------------------
1431+-- -- 1431+-- --
1432+-- GNAT COMPILER COMPONENTS -- 1432+-- GNAT COMPILER COMPONENTS --
1433+-- -- 1433+-- --
1434+-- G N A T . S O C K E T S . T H I N -- 1434+-- G N A T . S O C K E T S . T H I N --
1435+-- -- 1435+-- --
1436+-- B o d y -- 1436+-- B o d y --
1437+-- -- 1437+-- --
1438+-- Copyright (C) 2001-2009, AdaCore -- 1438+-- Copyright (C) 2001-2009, AdaCore --
1439+-- -- 1439+-- --
1440+-- GNAT is free software; you can redistribute it and/or modify it under -- 1440+-- GNAT is free software; you can redistribute it and/or modify it under --
1441+-- terms of the GNU General Public License as published by the Free Soft- -- 1441+-- terms of the GNU General Public License as published by the Free Soft- --
1442+-- ware Foundation; either version 2, or (at your option) any later ver- -- 1442+-- ware Foundation; either version 2, or (at your option) any later ver- --
1443+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- 1443+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
1444+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- 1444+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
1445+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- 1445+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
1446+-- for more details. You should have received a copy of the GNU General -- 1446+-- for more details. You should have received a copy of the GNU General --
1447+-- Public License distributed with GNAT; see file COPYING. If not, write -- 1447+-- Public License distributed with GNAT; see file COPYING. If not, write --
1448+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- 1448+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
1449+-- Boston, MA 02110-1301, USA. -- 1449+-- Boston, MA 02110-1301, USA. --
1450+-- -- 1450+-- --
1451+-- As a special exception, if other files instantiate generics from this -- 1451+-- As a special exception, if other files instantiate generics from this --
1452+-- unit, or you link this unit with other files to produce an executable, -- 1452+-- unit, or you link this unit with other files to produce an executable, --
1453+-- this unit does not by itself cause the resulting executable to be -- 1453+-- this unit does not by itself cause the resulting executable to be --
1454+-- covered by the GNU General Public License. This exception does not -- 1454+-- covered by the GNU General Public License. This exception does not --
1455+-- however invalidate any other reasons why the executable file might be -- 1455+-- however invalidate any other reasons why the executable file might be --
1456+-- covered by the GNU Public License. -- 1456+-- covered by the GNU Public License. --
1457+-- -- 1457+-- --
1458+-- GNAT was originally developed by the GNAT team at New York University. -- 1458+-- GNAT was originally developed by the GNAT team at New York University. --
1459+-- Extensive contributions were provided by Ada Core Technologies Inc. -- 1459+-- Extensive contributions were provided by Ada Core Technologies Inc. --
1460+-- -- 1460+-- --
1461+-- Copyright (C) 2010, 2011 John Marino <www.dragonlace.net> -- 1461+-- Copyright (C) 2010, 2011 John Marino <www.dragonlace.net> --
1462+------------------------------------------------------------------------------ 1462+------------------------------------------------------------------------------
1463+ 1463+
1464+-- This package provides a target dependent thin interface to the sockets 1464+-- This package provides a target dependent thin interface to the sockets
1465+-- layer for use by the GNAT.Sockets package (g-socket.ads). This package 1465+-- layer for use by the GNAT.Sockets package (g-socket.ads). This package
1466+-- should not be directly with'ed by an applications program. 1466+-- should not be directly with'ed by an applications program.
1467+ 1467+
1468+-- This is the NetBSD version which uses fcntl rather than ioctl 1468+-- This is the NetBSD version which uses fcntl rather than ioctl
1469+-- The constant SCON.Thread_Blocking_IO is always true (for all platforms, not 1469+-- The constant SCON.Thread_Blocking_IO is always true (for all platforms, not
1470+-- just *BSD), so this binding is significantly simpler than the standard 1470+-- just *BSD), so this binding is significantly simpler than the standard
1471+-- one it replaces. 1471+-- one it replaces.
1472+-- NetBSD uses binary compatibility functions that are forcing the use of 1472+-- NetBSD uses binary compatibility functions that are forcing the use of
1473+-- their own files rather than sharing the *BSD versions. 1473+-- their own files rather than sharing the *BSD versions.
1474+ 1474+
1475+with GNAT.OS_Lib; use GNAT.OS_Lib; 1475+with GNAT.OS_Lib; use GNAT.OS_Lib;
1476+ 1476+
1477+with Interfaces.C; use Interfaces.C; 1477+with Interfaces.C; use Interfaces.C;
1478+ 1478+
1479+package body GNAT.Sockets.Thin is 1479+package body GNAT.Sockets.Thin is
1480+ 1480+
1481+ Unknown_System_Error : constant C.Strings.chars_ptr := 1481+ Unknown_System_Error : constant C.Strings.chars_ptr :=
1482+ C.Strings.New_String ("Unknown system error"); 1482+ C.Strings.New_String ("Unknown system error");
1483+ 1483+
1484+ function Syscall_Accept 1484+ function Syscall_Accept
1485+ (S : C.int; 1485+ (S : C.int;
1486+ Addr : System.Address; 1486+ Addr : System.Address;
1487+ Addrlen : not null access C.int) return C.int; 1487+ Addrlen : not null access C.int) return C.int;
1488+ pragma Import (C, Syscall_Accept, "accept"); 1488+ pragma Import (C, Syscall_Accept, "accept");
1489+ -- The accept() function accepts a connection on a socket. An incoming 1489+ -- The accept() function accepts a connection on a socket. An incoming
1490+ -- connection is acknowledged and associated with an immediately created 1490+ -- connection is acknowledged and associated with an immediately created
1491+ -- socket. The original socket is returned to the listening state. 1491+ -- socket. The original socket is returned to the listening state.
1492+ 1492+
1493+ function Syscall_Connect 1493+ function Syscall_Connect
1494+ (S : C.int; 1494+ (S : C.int;
1495+ Name : System.Address; 1495+ Name : System.Address;
1496+ Namelen : C.int) return C.int; 1496+ Namelen : C.int) return C.int;
1497+ pragma Import (C, Syscall_Connect, "connect"); 1497+ pragma Import (C, Syscall_Connect, "connect");
1498+ -- The connect() system call initiates a connection on a socket. If the 1498+ -- The connect() system call initiates a connection on a socket. If the
1499+ -- parameter S is of type SOCK_DGRAM then connect() permanently specifies 1499+ -- parameter S is of type SOCK_DGRAM then connect() permanently specifies
1500+ -- the peer to which datagrams are to be sent. If S is type SOCK_STREAM 1500+ -- the peer to which datagrams are to be sent. If S is type SOCK_STREAM
1501+ -- then connect() attempts to make a connection with another socket, which 1501+ -- then connect() attempts to make a connection with another socket, which
1502+ -- is identified by the parameter Name. 1502+ -- is identified by the parameter Name.
1503+ 1503+
1504+ function Syscall_Recv 1504+ function Syscall_Recv
1505+ (S : C.int; 1505+ (S : C.int;
1506+ Msg : System.Address; 1506+ Msg : System.Address;
1507+ Len : C.int; 1507+ Len : C.int;
1508+ Flags : C.int) return C.int; 1508+ Flags : C.int) return C.int;
1509+ pragma Import (C, Syscall_Recv, "recv"); 1509+ pragma Import (C, Syscall_Recv, "recv");
1510+ -- The recv() function receives a message from a socket. The call can be 1510+ -- The recv() function receives a message from a socket. The call can be
1511+ -- used on a connection mode socket or a bound, connectionless socket. If 1511+ -- used on a connection mode socket or a bound, connectionless socket. If
1512+ -- no messages are available at the socket, the recv() call waits for a 1512+ -- no messages are available at the socket, the recv() call waits for a
1513+ -- message to arrive unless the socket is non-blocking. If a socket is 1513+ -- message to arrive unless the socket is non-blocking. If a socket is
1514+ -- non-blocking, the call returns a -1 and ERRNO is set to EWOULDBLOCK. 1514+ -- non-blocking, the call returns a -1 and ERRNO is set to EWOULDBLOCK.
1515+ 1515+
1516+ function Syscall_Recvfrom 1516+ function Syscall_Recvfrom
1517+ (S : C.int; 1517+ (S : C.int;
1518+ Msg : System.Address; 1518+ Msg : System.Address;
1519+ Len : C.int; 1519+ Len : C.int;
1520+ Flags : C.int; 1520+ Flags : C.int;
1521+ From : System.Address; 1521+ From : System.Address;
1522+ Fromlen : not null access C.int) return C.int; 1522+ Fromlen : not null access C.int) return C.int;
1523+ pragma Import (C, Syscall_Recvfrom, "recvfrom"); 1523+ pragma Import (C, Syscall_Recvfrom, "recvfrom");
1524+ -- The recvfrom() system call receives a message from a socket and captures 1524+ -- The recvfrom() system call receives a message from a socket and captures
1525+ -- the address from which the data was sent. It can be used to receive 1525+ -- the address from which the data was sent. It can be used to receive
1526+ -- data on an unconnected socket as well. If no messages are available, 1526+ -- data on an unconnected socket as well. If no messages are available,
1527+ -- the call waits for a message to arrive on blocking sockets. For 1527+ -- the call waits for a message to arrive on blocking sockets. For
1528+ -- non-blocking sockets without messages, -1 is returned and ERRNO is set 1528+ -- non-blocking sockets without messages, -1 is returned and ERRNO is set
1529+ -- to EAGAIN or EWOULDBLOCK. 1529+ -- to EAGAIN or EWOULDBLOCK.
1530+ 1530+
1531+ function Syscall_Recvmsg 1531+ function Syscall_Recvmsg
1532+ (S : C.int; 1532+ (S : C.int;
1533+ Msg : System.Address; 1533+ Msg : System.Address;
1534+ Flags : C.int) return System.CRTL.ssize_t; 1534+ Flags : C.int) return System.CRTL.ssize_t;
1535+ pragma Import (C, Syscall_Recvmsg, "recvmsg"); 1535+ pragma Import (C, Syscall_Recvmsg, "recvmsg");
1536+ -- The recvmsg call receives a message from a socket, and can be used to 1536+ -- The recvmsg call receives a message from a socket, and can be used to
1537+ -- receive data on an unconnected socket as well. If no messages are 1537+ -- receive data on an unconnected socket as well. If no messages are
1538+ -- available, the call waits for a message to arrive on blocking sockets. 1538+ -- available, the call waits for a message to arrive on blocking sockets.
1539+ -- For non-blocking sockets without messages, -1 is returned and ERRNO is 1539+ -- For non-blocking sockets without messages, -1 is returned and ERRNO is
1540+ -- set to EAGAIN or EWOULDBLOCK. 1540+ -- set to EAGAIN or EWOULDBLOCK.
1541+ 1541+
1542+ function Syscall_Sendmsg 1542+ function Syscall_Sendmsg
1543+ (S : C.int; 1543+ (S : C.int;
1544+ Msg : System.Address; 1544+ Msg : System.Address;
1545+ Flags : C.int) return System.CRTL.ssize_t; 1545+ Flags : C.int) return System.CRTL.ssize_t;
1546+ pragma Import (C, Syscall_Sendmsg, "sendmsg"); 1546+ pragma Import (C, Syscall_Sendmsg, "sendmsg");
1547+ -- The sendmsg() function sends a message to a socket, and can be used with 1547+ -- The sendmsg() function sends a message to a socket, and can be used with
1548+ -- unconnected sockets as well (the msg is ignored in this case). The 1548+ -- unconnected sockets as well (the msg is ignored in this case). The
1549+ -- function returns the number of bytes sent when successful, otherwise it 1549+ -- function returns the number of bytes sent when successful, otherwise it
1550+ -- returns -1 and ERRNO is set (many possible values). 1550+ -- returns -1 and ERRNO is set (many possible values).
1551+ 1551+
1552+ function Syscall_Sendto 1552+ function Syscall_Sendto
1553+ (S : C.int; 1553+ (S : C.int;
1554+ Msg : System.Address; 1554+ Msg : System.Address;
1555+ Len : C.int; 1555+ Len : C.int;
1556+ Flags : C.int; 1556+ Flags : C.int;
1557+ To : System.Address; 1557+ To : System.Address;
1558+ Tolen : C.int) return C.int; 1558+ Tolen : C.int) return C.int;
1559+ pragma Import (C, Syscall_Sendto, "sendto"); 1559+ pragma Import (C, Syscall_Sendto, "sendto");
1560+ -- The sendto() function only works for connected sockets and it initiates 1560+ -- The sendto() function only works for connected sockets and it initiates
1561+ -- the transmission of a message. A successful call returns the numbers of 1561+ -- the transmission of a message. A successful call returns the numbers of
1562+ -- bytes sent, and a failure returns a -1 and ERRNO is set. 1562+ -- bytes sent, and a failure returns a -1 and ERRNO is set.
1563+ 1563+
1564+ function Syscall_Socket 1564+ function Syscall_Socket
1565+ (Domain : C.int; 1565+ (Domain : C.int;
1566+ Typ : C.int; 1566+ Typ : C.int;
1567+ Protocol : C.int) return C.int; 1567+ Protocol : C.int) return C.int;
1568+ pragma Import (C, Syscall_Socket, "__socket30"); 1568+ pragma Import (C, Syscall_Socket, "__socket30");
1569+ -- The socket() function is used to create an unbound socket and returns a 1569+ -- The socket() function is used to create an unbound socket and returns a
1570+ -- file descriptor that can be used with other socket functions. Upon 1570+ -- file descriptor that can be used with other socket functions. Upon
1571+ -- failure, a -1 is returned and ERRNO is set. 1571+ -- failure, a -1 is returned and ERRNO is set.
1572+ 1572+
1573+ procedure Disable_SIGPIPE (S : C.int); 1573+ procedure Disable_SIGPIPE (S : C.int);
1574+ pragma Import (C, Disable_SIGPIPE, "__gnat_disable_sigpipe"); 1574+ pragma Import (C, Disable_SIGPIPE, "__gnat_disable_sigpipe");
1575+ 1575+
1576+ procedure Disable_All_SIGPIPEs; 1576+ procedure Disable_All_SIGPIPEs;
1577+ pragma Import (C, Disable_All_SIGPIPEs, "__gnat_disable_all_sigpipes"); 1577+ pragma Import (C, Disable_All_SIGPIPEs, "__gnat_disable_all_sigpipes");
1578+ -- Sets the process to ignore all SIGPIPE signals on platforms that 1578+ -- Sets the process to ignore all SIGPIPE signals on platforms that
1579+ -- don't support Disable_SIGPIPE for particular streams. 1579+ -- don't support Disable_SIGPIPE for particular streams.
1580+ 1580+
1581+ function C_Fcntl 1581+ function C_Fcntl
1582+ (Fd : C.int; 1582+ (Fd : C.int;
1583+ Cmd : C.int; 1583+ Cmd : C.int;
1584+ Val : C.int) return C.int; 1584+ Val : C.int) return C.int;
1585+ pragma Import (C, C_Fcntl, "fcntl"); 1585+ pragma Import (C, C_Fcntl, "fcntl");
1586+ -- The ioctl of 64-bit DragonFlyBSD, OpenBSD, and NetBSD does not support 1586+ -- The ioctl of 64-bit DragonFlyBSD, OpenBSD, and NetBSD does not support
1587+ -- setting a socket in non-blocking mode. fcntl must be used instead. 1587+ -- setting a socket in non-blocking mode. fcntl must be used instead.
1588+ 1588+
1589+ -------------- 1589+ --------------
1590+ -- C_Accept -- 1590+ -- C_Accept --
1591+ -------------- 1591+ --------------
1592+ 1592+
1593+ function C_Accept 1593+ function C_Accept
1594+ (S : C.int; 1594+ (S : C.int;
1595+ Addr : System.Address; 1595+ Addr : System.Address;
1596+ Addrlen : not null access C.int) return C.int 1596+ Addrlen : not null access C.int) return C.int
1597+ is 1597+ is
1598+ Res : constant C.int := Syscall_Accept (S, Addr, Addrlen); 1598+ Res : constant C.int := Syscall_Accept (S, Addr, Addrlen);
1599+ begin 1599+ begin
1600+ 1600+
1601+ Disable_SIGPIPE (Res); 1601+ Disable_SIGPIPE (Res);
1602+ return Res; 1602+ return Res;
1603+ 1603+
1604+ end C_Accept; 1604+ end C_Accept;
1605+ 1605+
1606+ --------------- 1606+ ---------------
1607+ -- C_Connect -- 1607+ -- C_Connect --
1608+ --------------- 1608+ ---------------
1609+ 1609+
1610+ function C_Connect 1610+ function C_Connect
1611+ (S : C.int; 1611+ (S : C.int;
1612+ Name : System.Address; 1612+ Name : System.Address;
1613+ Namelen : C.int) return C.int 1613+ Namelen : C.int) return C.int
1614+ is 1614+ is
1615+ begin 1615+ begin
1616+ 1616+
1617+ return Syscall_Connect (S, Name, Namelen); 1617+ return Syscall_Connect (S, Name, Namelen);
1618+ 1618+
1619+ end C_Connect; 1619+ end C_Connect;
1620+ 1620+
1621+ ------------------ 1621+ ------------------
1622+ -- Socket_Ioctl -- 1622+ -- Socket_Ioctl --
1623+ ------------------ 1623+ ------------------
1624+ 1624+
1625+ function Socket_Ioctl 1625+ function Socket_Ioctl
1626+ (S : C.int; 1626+ (S : C.int;
1627+ Req : C.int; 1627+ Req : C.int;
1628+ Arg : access C.int) return C.int 1628+ Arg : access C.int) return C.int
1629+ is 1629+ is
1630+ -- Currently all requests are of the FIONBIO type, so always calc flags 1630+ -- Currently all requests are of the FIONBIO type, so always calc flags
1631+ use Interfaces; 1631+ use Interfaces;
1632+ flags : constant Unsigned_32 := 1632+ flags : constant Unsigned_32 :=
1633+ Unsigned_32 (C_Fcntl (S, SOSC.F_GETFL, 0)); 1633+ Unsigned_32 (C_Fcntl (S, SOSC.F_GETFL, 0));
1634+ nonblock : constant Unsigned_32 := Unsigned_32 (SOSC.FNDELAY); 1634+ nonblock : constant Unsigned_32 := Unsigned_32 (SOSC.FNDELAY);
1635+ enabled : constant Boolean := Arg.all = 1; 1635+ enabled : constant Boolean := Arg.all = 1;
1636+ newval : C.int; 1636+ newval : C.int;
1637+ begin 1637+ begin
1638+ if Req = SOSC.FIONBIO then 1638+ if Req = SOSC.FIONBIO then
1639+ if enabled then 1639+ if enabled then
1640+ newval := C.int (flags or nonblock); 1640+ newval := C.int (flags or nonblock);
1641+ elsif (flags and nonblock) > 0 then 1641+ elsif (flags and nonblock) > 0 then
1642+ newval := C.int (flags - nonblock); 1642+ newval := C.int (flags - nonblock);
1643+ else 1643+ else
1644+ newval := C.int (flags); 1644+ newval := C.int (flags);
1645+ end if; 1645+ end if;
1646+ return C_Fcntl (Fd => S, Cmd => SOSC.F_SETFL, Val => newval); 1646+ return C_Fcntl (Fd => S, Cmd => SOSC.F_SETFL, Val => newval);
1647+ else 1647+ else
1648+ return C_Ioctl (Fd => S, Req => Req, Arg => Arg); 1648+ return C_Ioctl (Fd => S, Req => Req, Arg => Arg);
1649+ end if; 1649+ end if;
1650+ end Socket_Ioctl; 1650+ end Socket_Ioctl;
1651+ 1651+
1652+ ------------ 1652+ ------------
1653+ -- C_Recv -- 1653+ -- C_Recv --
1654+ ------------ 1654+ ------------
1655+ 1655+
1656+ function C_Recv 1656+ function C_Recv
1657+ (S : C.int; 1657+ (S : C.int;
1658+ Msg : System.Address; 1658+ Msg : System.Address;
1659+ Len : C.int; 1659+ Len : C.int;
1660+ Flags : C.int) return C.int 1660+ Flags : C.int) return C.int
1661+ is 1661+ is
1662+ begin 1662+ begin
1663+ 1663+
1664+ return Syscall_Recv (S, Msg, Len, Flags); 1664+ return Syscall_Recv (S, Msg, Len, Flags);
1665+ 1665+
1666+ end C_Recv; 1666+ end C_Recv;
1667+ 1667+
1668+ ---------------- 1668+ ----------------
1669+ -- C_Recvfrom -- 1669+ -- C_Recvfrom --
1670+ ---------------- 1670+ ----------------
1671+ 1671+
1672+ function C_Recvfrom 1672+ function C_Recvfrom
1673+ (S : C.int; 1673+ (S : C.int;
1674+ Msg : System.Address; 1674+ Msg : System.Address;
1675+ Len : C.int; 1675+ Len : C.int;
1676+ Flags : C.int; 1676+ Flags : C.int;
1677+ From : System.Address; 1677+ From : System.Address;
1678+ Fromlen : not null access C.int) return C.int 1678+ Fromlen : not null access C.int) return C.int
1679+ is 1679+ is
1680+ begin 1680+ begin
1681+ 1681+
1682+ return Syscall_Recvfrom (S, Msg, Len, Flags, From, Fromlen); 1682+ return Syscall_Recvfrom (S, Msg, Len, Flags, From, Fromlen);
1683+ 1683+
1684+ end C_Recvfrom; 1684+ end C_Recvfrom;
1685+ 1685+
1686+ --------------- 1686+ ---------------
1687+ -- C_Recvmsg -- 1687+ -- C_Recvmsg --
1688+ --------------- 1688+ ---------------
1689+ 1689+
1690+ function C_Recvmsg 1690+ function C_Recvmsg
1691+ (S : C.int; 1691+ (S : C.int;
1692+ Msg : System.Address; 1692+ Msg : System.Address;
1693+ Flags : C.int) return System.CRTL.ssize_t 1693+ Flags : C.int) return System.CRTL.ssize_t
1694+ is 1694+ is
1695+ begin 1695+ begin
1696+ 1696+
1697+ return Syscall_Recvmsg (S, Msg, Flags); 1697+ return Syscall_Recvmsg (S, Msg, Flags);
1698+ 1698+
1699+ end C_Recvmsg; 1699+ end C_Recvmsg;
1700+ 1700+
1701+ --------------- 1701+ ---------------
1702+ -- C_Sendmsg -- 1702+ -- C_Sendmsg --
1703+ --------------- 1703+ ---------------
1704+ 1704+
1705+ function C_Sendmsg 1705+ function C_Sendmsg
1706+ (S : C.int; 1706+ (S : C.int;
1707+ Msg : System.Address; 1707+ Msg : System.Address;
1708+ Flags : C.int) return System.CRTL.ssize_t 1708+ Flags : C.int) return System.CRTL.ssize_t
1709+ is 1709+ is
1710+ begin 1710+ begin
1711+ 1711+
1712+ return Syscall_Sendmsg (S, Msg, Flags); 1712+ return Syscall_Sendmsg (S, Msg, Flags);
1713+ 1713+
1714+ end C_Sendmsg; 1714+ end C_Sendmsg;
1715+ 1715+
1716+ -------------- 1716+ --------------
1717+ -- C_Sendto -- 1717+ -- C_Sendto --
1718+ -------------- 1718+ --------------
1719+ 1719+
1720+ function C_Sendto 1720+ function C_Sendto
1721+ (S : C.int; 1721+ (S : C.int;
1722+ Msg : System.Address; 1722+ Msg : System.Address;
1723+ Len : C.int; 1723+ Len : C.int;
1724+ Flags : C.int; 1724+ Flags : C.int;
1725+ To : System.Address; 1725+ To : System.Address;
1726+ Tolen : C.int) return C.int 1726+ Tolen : C.int) return C.int
1727+ is 1727+ is
1728+ begin 1728+ begin
1729+ 1729+
1730+ return Syscall_Sendto (S, Msg, Len, Flags, To, Tolen); 1730+ return Syscall_Sendto (S, Msg, Len, Flags, To, Tolen);
1731+ 1731+
1732+ end C_Sendto; 1732+ end C_Sendto;
1733+ 1733+
1734+ -------------- 1734+ --------------
1735+ -- C_Socket -- 1735+ -- C_Socket --
1736+ -------------- 1736+ --------------
1737+ 1737+
1738+ function C_Socket 1738+ function C_Socket
1739+ (Domain : C.int; 1739+ (Domain : C.int;
1740+ Typ : C.int; 1740+ Typ : C.int;
1741+ Protocol : C.int) return C.int 1741+ Protocol : C.int) return C.int
1742+ is 1742+ is
1743+ Res : constant C.int := Syscall_Socket (Domain, Typ, Protocol); 1743+ Res : constant C.int := Syscall_Socket (Domain, Typ, Protocol);
1744+ begin 1744+ begin
1745+ 1745+
1746+ Disable_SIGPIPE (Res); 1746+ Disable_SIGPIPE (Res);
1747+ return Res; 1747+ return Res;
1748+ 1748+
1749+ end C_Socket; 1749+ end C_Socket;
1750+ 1750+
1751+ -------------- 1751+ --------------
1752+ -- Finalize -- 1752+ -- Finalize --
1753+ -------------- 1753+ --------------
1754+ 1754+
1755+ procedure Finalize is 1755+ procedure Finalize is
1756+ begin 1756+ begin
1757+ null; 1757+ null;
1758+ end Finalize; 1758+ end Finalize;
1759+ 1759+
1760+ ------------------------- 1760+ -------------------------
1761+ -- Host_Error_Messages -- 1761+ -- Host_Error_Messages --
1762+ ------------------------- 1762+ -------------------------
1763+ 1763+
1764+ package body Host_Error_Messages is separate; 1764+ package body Host_Error_Messages is separate;
1765+ 1765+
1766+ ---------------- 1766+ ----------------
1767+ -- Initialize -- 1767+ -- Initialize --
1768+ ---------------- 1768+ ----------------
1769+ 1769+
1770+ procedure Initialize is 1770+ procedure Initialize is
1771+ begin 1771+ begin
1772+ Disable_All_SIGPIPEs; 1772+ Disable_All_SIGPIPEs;
1773+ end Initialize; 1773+ end Initialize;
1774+ 1774+
1775+ -------------------- 1775+ --------------------
1776+ -- Signalling_Fds -- 1776+ -- Signalling_Fds --
1777+ -------------------- 1777+ --------------------
1778+ 1778+
1779+ package body Signalling_Fds is 1779+ package body Signalling_Fds is
1780+ 1780+
1781+ -- In this default implementation, we use a C version of these 1781+ -- In this default implementation, we use a C version of these
1782+ -- subprograms provided by socket.c. 1782+ -- subprograms provided by socket.c.
1783+ 1783+
1784+ function C_Create (Fds : not null access Fd_Pair) return C.int; 1784+ function C_Create (Fds : not null access Fd_Pair) return C.int;
1785+ function C_Read (Rsig : C.int) return C.int; 1785+ function C_Read (Rsig : C.int) return C.int;
1786+ function C_Write (Wsig : C.int) return C.int; 1786+ function C_Write (Wsig : C.int) return C.int;
1787+ procedure C_Close (Sig : C.int); 1787+ procedure C_Close (Sig : C.int);
1788+ 1788+
1789+ pragma Import (C, C_Create, "__gnat_create_signalling_fds"); 1789+ pragma Import (C, C_Create, "__gnat_create_signalling_fds");
1790+ pragma Import (C, C_Read, "__gnat_read_signalling_fd"); 1790+ pragma Import (C, C_Read, "__gnat_read_signalling_fd");
1791+ pragma Import (C, C_Write, "__gnat_write_signalling_fd"); 1791+ pragma Import (C, C_Write, "__gnat_write_signalling_fd");
1792+ pragma Import (C, C_Close, "__gnat_close_signalling_fd"); 1792+ pragma Import (C, C_Close, "__gnat_close_signalling_fd");
1793+ 1793+
1794+ function Create 1794+ function Create
1795+ (Fds : not null access Fd_Pair) return C.int renames C_Create; 1795+ (Fds : not null access Fd_Pair) return C.int renames C_Create;
1796+ function Read (Rsig : C.int) return C.int renames C_Read; 1796+ function Read (Rsig : C.int) return C.int renames C_Read;
1797+ function Write (Wsig : C.int) return C.int renames C_Write; 1797+ function Write (Wsig : C.int) return C.int renames C_Write;
1798+ procedure Close (Sig : C.int) renames C_Close; 1798+ procedure Close (Sig : C.int) renames C_Close;
1799+ 1799+
1800+ end Signalling_Fds; 1800+ end Signalling_Fds;
1801+ 1801+
1802+ -------------------------- 1802+ --------------------------
1803+ -- Socket_Error_Message -- 1803+ -- Socket_Error_Message --
1804+ -------------------------- 1804+ --------------------------
1805+ 1805+
1806+ function Socket_Error_Message 1806+ function Socket_Error_Message
1807+ (Errno : Integer) return C.Strings.chars_ptr 1807+ (Errno : Integer) return C.Strings.chars_ptr
1808+ is separate; 1808+ is separate;
1809+ 1809+
1810+end GNAT.Sockets.Thin; 1810+end GNAT.Sockets.Thin;
1811--- /dev/null 1811--- /dev/null
1812+++ gcc/ada/g-socthi-netbsd6.ads 1812+++ gcc/ada/g-socthi-netbsd6.ads
1813@@ -0,0 +1,263 @@ 1813@@ -0,0 +1,263 @@
1814+------------------------------------------------------------------------------ 1814+------------------------------------------------------------------------------
1815+-- -- 1815+-- --
1816+-- GNAT COMPILER COMPONENTS -- 1816+-- GNAT COMPILER COMPONENTS --
1817+-- -- 1817+-- --
1818+-- G N A T . S O C K E T S . T H I N -- 1818+-- G N A T . S O C K E T S . T H I N --
1819+-- -- 1819+-- --
1820+-- S p e c -- 1820+-- S p e c --
1821+-- -- 1821+-- --
1822+-- Copyright (C) 2001-2009, AdaCore -- 1822+-- Copyright (C) 2001-2009, AdaCore --
1823+-- -- 1823+-- --
1824+-- GNAT is free software; you can redistribute it and/or modify it under -- 1824+-- GNAT is free software; you can redistribute it and/or modify it under --
1825+-- terms of the GNU General Public License as published by the Free Soft- -- 1825+-- terms of the GNU General Public License as published by the Free Soft- --
1826+-- ware Foundation; either version 2, or (at your option) any later ver- -- 1826+-- ware Foundation; either version 2, or (at your option) any later ver- --
1827+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- 1827+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
1828+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- 1828+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
1829+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- 1829+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
1830+-- for more details. You should have received a copy of the GNU General -- 1830+-- for more details. You should have received a copy of the GNU General --
1831+-- Public License distributed with GNAT; see file COPYING. If not, write -- 1831+-- Public License distributed with GNAT; see file COPYING. If not, write --
1832+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- 1832+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
1833+-- Boston, MA 02110-1301, USA. -- 1833+-- Boston, MA 02110-1301, USA. --
1834+-- -- 1834+-- --
1835+-- As a special exception, if other files instantiate generics from this -- 1835+-- As a special exception, if other files instantiate generics from this --
1836+-- unit, or you link this unit with other files to produce an executable, -- 1836+-- unit, or you link this unit with other files to produce an executable, --
1837+-- this unit does not by itself cause the resulting executable to be -- 1837+-- this unit does not by itself cause the resulting executable to be --
1838+-- covered by the GNU General Public License. This exception does not -- 1838+-- covered by the GNU General Public License. This exception does not --
1839+-- however invalidate any other reasons why the executable file might be -- 1839+-- however invalidate any other reasons why the executable file might be --
1840+-- covered by the GNU Public License. -- 1840+-- covered by the GNU Public License. --
1841+-- -- 1841+-- --
1842+-- GNAT was originally developed by the GNAT team at New York University. -- 1842+-- GNAT was originally developed by the GNAT team at New York University. --
1843+-- Extensive contributions were provided by Ada Core Technologies Inc. -- 1843+-- Extensive contributions were provided by Ada Core Technologies Inc. --
1844+-- -- 1844+-- --
1845+-- Copyright (C) 2011 John Marino <www.dragonlace.net> -- 1845+-- Copyright (C) 2011 John Marino <www.dragonlace.net> --
1846+------------------------------------------------------------------------------ 1846+------------------------------------------------------------------------------
1847+ 1847+
1848+-- This package provides a target dependent thin interface to the sockets 1848+-- This package provides a target dependent thin interface to the sockets
1849+-- layer for use by the GNAT.Sockets package (g-socket.ads). This package 1849+-- layer for use by the GNAT.Sockets package (g-socket.ads). This package
1850+-- should not be directly with'ed by an applications program. 1850+-- should not be directly with'ed by an applications program.
1851+ 1851+
1852+-- This is the NetBSD 6+ version 1852+-- This is the NetBSD 6+ version
1853+ 1853+
1854+with Interfaces.C.Strings; 1854+with Interfaces.C.Strings;
1855+ 1855+
1856+with GNAT.OS_Lib; 1856+with GNAT.OS_Lib;
1857+with GNAT.Sockets.Thin_Common; 1857+with GNAT.Sockets.Thin_Common;
1858+ 1858+
1859+with System; 1859+with System;
1860+with System.CRTL; 1860+with System.CRTL;
1861+ 1861+
1862+package GNAT.Sockets.Thin is 1862+package GNAT.Sockets.Thin is
1863+ 1863+
1864+ -- This package is intended for hosts implementing BSD sockets with a 1864+ -- This package is intended for hosts implementing BSD sockets with a
1865+ -- standard interface. It will be used as a default for all the platforms 1865+ -- standard interface. It will be used as a default for all the platforms
1866+ -- that do not have a specific version of this file. 1866+ -- that do not have a specific version of this file.
1867+ 1867+
1868+ use Thin_Common; 1868+ use Thin_Common;
1869+ 1869+
1870+ package C renames Interfaces.C; 1870+ package C renames Interfaces.C;
1871+ 1871+
1872+ use type System.CRTL.ssize_t; 1872+ use type System.CRTL.ssize_t;
1873+ 1873+
1874+ function Socket_Errno return Integer renames GNAT.OS_Lib.Errno; 1874+ function Socket_Errno return Integer renames GNAT.OS_Lib.Errno;
1875+ -- Returns last socket error number 1875+ -- Returns last socket error number
1876+ 1876+
1877+ function Socket_Error_Message (Errno : Integer) return C.Strings.chars_ptr; 1877+ function Socket_Error_Message (Errno : Integer) return C.Strings.chars_ptr;
1878+ -- Returns the error message string for the error number Errno. If Errno is 1878+ -- Returns the error message string for the error number Errno. If Errno is
1879+ -- not known, returns "Unknown system error". 1879+ -- not known, returns "Unknown system error".
1880+ 1880+
1881+ function Host_Errno return Integer; 1881+ function Host_Errno return Integer;
1882+ pragma Import (C, Host_Errno, "__gnat_get_h_errno"); 1882+ pragma Import (C, Host_Errno, "__gnat_get_h_errno");
1883+ -- Returns last host error number 1883+ -- Returns last host error number
1884+ 1884+
1885+ package Host_Error_Messages is 1885+ package Host_Error_Messages is
1886+ 1886+
1887+ function Host_Error_Message 1887+ function Host_Error_Message
1888+ (H_Errno : Integer) return C.Strings.chars_ptr; 1888+ (H_Errno : Integer) return C.Strings.chars_ptr;
1889+ -- Returns the error message string for the host error number H_Errno. 1889+ -- Returns the error message string for the host error number H_Errno.
1890+ -- If H_Errno is not known, returns "Unknown system error". 1890+ -- If H_Errno is not known, returns "Unknown system error".
1891+ 1891+
1892+ end Host_Error_Messages; 1892+ end Host_Error_Messages;
1893+ 1893+
1894+ -------------------------------- 1894+ --------------------------------
1895+ -- Standard library functions -- 1895+ -- Standard library functions --
1896+ -------------------------------- 1896+ --------------------------------
1897+ 1897+
1898+ function C_Accept 1898+ function C_Accept
1899+ (S : C.int; 1899+ (S : C.int;
1900+ Addr : System.Address; 1900+ Addr : System.Address;
1901+ Addrlen : not null access C.int) return C.int; 1901+ Addrlen : not null access C.int) return C.int;
1902+ 1902+
1903+ function C_Bind 1903+ function C_Bind
1904+ (S : C.int; 1904+ (S : C.int;
1905+ Name : System.Address; 1905+ Name : System.Address;
1906+ Namelen : C.int) return C.int; 1906+ Namelen : C.int) return C.int;
1907+ 1907+
1908+ function C_Close 1908+ function C_Close
1909+ (Fd : C.int) return C.int; 1909+ (Fd : C.int) return C.int;
1910+ 1910+
1911+ function C_Connect 1911+ function C_Connect
1912+ (S : C.int; 1912+ (S : C.int;
1913+ Name : System.Address; 1913+ Name : System.Address;
1914+ Namelen : C.int) return C.int; 1914+ Namelen : C.int) return C.int;
1915+ 1915+
1916+ function C_Gethostname 1916+ function C_Gethostname
1917+ (Name : System.Address; 1917+ (Name : System.Address;
1918+ Namelen : C.int) return C.int; 1918+ Namelen : C.int) return C.int;
1919+ 1919+
1920+ function C_Getpeername 1920+ function C_Getpeername
1921+ (S : C.int; 1921+ (S : C.int;
1922+ Name : System.Address; 1922+ Name : System.Address;
1923+ Namelen : not null access C.int) return C.int; 1923+ Namelen : not null access C.int) return C.int;
1924+ 1924+
1925+ function C_Getsockname 1925+ function C_Getsockname
1926+ (S : C.int; 1926+ (S : C.int;
1927+ Name : System.Address; 1927+ Name : System.Address;
1928+ Namelen : not null access C.int) return C.int; 1928+ Namelen : not null access C.int) return C.int;
1929+ 1929+
1930+ function C_Getsockopt 1930+ function C_Getsockopt
1931+ (S : C.int; 1931+ (S : C.int;
1932+ Level : C.int; 1932+ Level : C.int;
1933+ Optname : C.int; 1933+ Optname : C.int;
1934+ Optval : System.Address; 1934+ Optval : System.Address;
1935+ Optlen : not null access C.int) return C.int; 1935+ Optlen : not null access C.int) return C.int;
1936+ 1936+
1937+ function Socket_Ioctl 1937+ function Socket_Ioctl
1938+ (S : C.int; 1938+ (S : C.int;
1939+ Req : C.int; 1939+ Req : C.int;
1940+ Arg : access C.int) return C.int; 1940+ Arg : access C.int) return C.int;
1941+ 1941+
1942+ function C_Listen 1942+ function C_Listen
1943+ (S : C.int; 1943+ (S : C.int;
1944+ Backlog : C.int) return C.int; 1944+ Backlog : C.int) return C.int;
1945+ 1945+
1946+ function C_Recv 1946+ function C_Recv
1947+ (S : C.int; 1947+ (S : C.int;
1948+ Msg : System.Address; 1948+ Msg : System.Address;
1949+ Len : C.int; 1949+ Len : C.int;
1950+ Flags : C.int) return C.int; 1950+ Flags : C.int) return C.int;
1951+ 1951+
1952+ function C_Recvfrom 1952+ function C_Recvfrom
1953+ (S : C.int; 1953+ (S : C.int;
1954+ Msg : System.Address; 1954+ Msg : System.Address;
1955+ Len : C.int; 1955+ Len : C.int;
1956+ Flags : C.int; 1956+ Flags : C.int;
1957+ From : System.Address; 1957+ From : System.Address;
1958+ Fromlen : not null access C.int) return C.int; 1958+ Fromlen : not null access C.int) return C.int;
1959+ 1959+
1960+ function C_Recvmsg 1960+ function C_Recvmsg
1961+ (S : C.int; 1961+ (S : C.int;
1962+ Msg : System.Address; 1962+ Msg : System.Address;
1963+ Flags : C.int) return System.CRTL.ssize_t; 1963+ Flags : C.int) return System.CRTL.ssize_t;
1964+ 1964+
1965+ function C_Select 1965+ function C_Select
1966+ (Nfds : C.int; 1966+ (Nfds : C.int;
1967+ Readfds : access Fd_Set; 1967+ Readfds : access Fd_Set;
1968+ Writefds : access Fd_Set; 1968+ Writefds : access Fd_Set;
1969+ Exceptfds : access Fd_Set; 1969+ Exceptfds : access Fd_Set;
1970+ Timeout : Timeval_Access) return C.int; 1970+ Timeout : Timeval_Access) return C.int;
1971+ 1971+
1972+ function C_Sendmsg 1972+ function C_Sendmsg
1973+ (S : C.int; 1973+ (S : C.int;
1974+ Msg : System.Address; 1974+ Msg : System.Address;
1975+ Flags : C.int) return System.CRTL.ssize_t; 1975+ Flags : C.int) return System.CRTL.ssize_t;
1976+ 1976+
1977+ function C_Sendto 1977+ function C_Sendto
1978+ (S : C.int; 1978+ (S : C.int;
1979+ Msg : System.Address; 1979+ Msg : System.Address;
1980+ Len : C.int; 1980+ Len : C.int;
1981+ Flags : C.int; 1981+ Flags : C.int;
1982+ To : System.Address; 1982+ To : System.Address;
1983+ Tolen : C.int) return C.int; 1983+ Tolen : C.int) return C.int;
1984+ 1984+
1985+ function C_Setsockopt 1985+ function C_Setsockopt
1986+ (S : C.int; 1986+ (S : C.int;
1987+ Level : C.int; 1987+ Level : C.int;
1988+ Optname : C.int; 1988+ Optname : C.int;
1989+ Optval : System.Address; 1989+ Optval : System.Address;
1990+ Optlen : C.int) return C.int; 1990+ Optlen : C.int) return C.int;
1991+ 1991+
1992+ function C_Shutdown 1992+ function C_Shutdown
1993+ (S : C.int; 1993+ (S : C.int;
1994+ How : C.int) return C.int; 1994+ How : C.int) return C.int;
1995+ 1995+
1996+ function C_Socket 1996+ function C_Socket
1997+ (Domain : C.int; 1997+ (Domain : C.int;
1998+ Typ : C.int; 1998+ Typ : C.int;
1999+ Protocol : C.int) return C.int; 1999+ Protocol : C.int) return C.int;
2000+ 2000+
2001+ function C_System 2001+ function C_System
2002+ (Command : System.Address) return C.int; 2002+ (Command : System.Address) return C.int;
2003+ 2003+
2004+ ------------------------------------------------------- 2004+ -------------------------------------------------------
2005+ -- Signalling file descriptors for selector abortion -- 2005+ -- Signalling file descriptors for selector abortion --
2006+ ------------------------------------------------------- 2006+ -------------------------------------------------------
2007+ 2007+
2008+ package Signalling_Fds is 2008+ package Signalling_Fds is
2009+ 2009+
2010+ function Create (Fds : not null access Fd_Pair) return C.int; 2010+ function Create (Fds : not null access Fd_Pair) return C.int;
2011+ pragma Convention (C, Create); 2011+ pragma Convention (C, Create);
2012+ -- Create a pair of connected descriptors suitable for use with C_Select 2012+ -- Create a pair of connected descriptors suitable for use with C_Select
2013+ -- (used for signalling in Selector objects). 2013+ -- (used for signalling in Selector objects).
2014+ 2014+
2015+ function Read (Rsig : C.int) return C.int; 2015+ function Read (Rsig : C.int) return C.int;
2016+ pragma Convention (C, Read); 2016+ pragma Convention (C, Read);
2017+ -- Read one byte of data from rsig, the read end of a pair of signalling 2017+ -- Read one byte of data from rsig, the read end of a pair of signalling
2018+ -- fds created by Create_Signalling_Fds. 2018+ -- fds created by Create_Signalling_Fds.
2019+ 2019+
2020+ function Write (Wsig : C.int) return C.int; 2020+ function Write (Wsig : C.int) return C.int;
2021+ pragma Convention (C, Write); 2021+ pragma Convention (C, Write);
2022+ -- Write one byte of data to wsig, the write end of a pair of signalling 2022+ -- Write one byte of data to wsig, the write end of a pair of signalling
2023+ -- fds created by Create_Signalling_Fds. 2023+ -- fds created by Create_Signalling_Fds.
2024+ 2024+
2025+ procedure Close (Sig : C.int); 2025+ procedure Close (Sig : C.int);
2026+ pragma Convention (C, Close); 2026+ pragma Convention (C, Close);
2027+ -- Close one end of a pair of signalling fds (ignoring any error) 2027+ -- Close one end of a pair of signalling fds (ignoring any error)
2028+ 2028+
2029+ end Signalling_Fds; 2029+ end Signalling_Fds;
2030+ 2030+
2031+ ------------------------------------------- 2031+ -------------------------------------------
2032+ -- Nonreentrant network databases access -- 2032+ -- Nonreentrant network databases access --
2033+ ------------------------------------------- 2033+ -------------------------------------------
2034+ 2034+
2035+ -- The following are used only on systems that have nonreentrant 2035+ -- The following are used only on systems that have nonreentrant
2036+ -- getXXXbyYYY functions, and do NOT have corresponding getXXXbyYYY_ 2036+ -- getXXXbyYYY functions, and do NOT have corresponding getXXXbyYYY_
2037+ -- functions. Currently, LynxOS is the only such system. 2037+ -- functions. Currently, LynxOS is the only such system.
2038+ 2038+
2039+ function Nonreentrant_Gethostbyname 2039+ function Nonreentrant_Gethostbyname
2040+ (Name : C.char_array) return Hostent_Access; 2040+ (Name : C.char_array) return Hostent_Access;
2041+ 2041+
2042+ function Nonreentrant_Gethostbyaddr 2042+ function Nonreentrant_Gethostbyaddr
2043+ (Addr : System.Address; 2043+ (Addr : System.Address;
2044+ Addr_Len : C.int; 2044+ Addr_Len : C.int;
2045+ Addr_Type : C.int) return Hostent_Access; 2045+ Addr_Type : C.int) return Hostent_Access;
2046+ 2046+
2047+ function Nonreentrant_Getservbyname 2047+ function Nonreentrant_Getservbyname
2048+ (Name : C.char_array; 2048+ (Name : C.char_array;
2049+ Proto : C.char_array) return Servent_Access; 2049+ Proto : C.char_array) return Servent_Access;
2050+ 2050+
2051+ function Nonreentrant_Getservbyport 2051+ function Nonreentrant_Getservbyport
2052+ (Port : C.int; 2052+ (Port : C.int;
2053+ Proto : C.char_array) return Servent_Access; 2053+ Proto : C.char_array) return Servent_Access;
2054+ 2054+
2055+ procedure Initialize; 2055+ procedure Initialize;
2056+ procedure Finalize; 2056+ procedure Finalize;
2057+ 2057+
2058+private 2058+private
2059+ pragma Import (C, C_Bind, "bind"); 2059+ pragma Import (C, C_Bind, "bind");
2060+ pragma Import (C, C_Close, "close"); 2060+ pragma Import (C, C_Close, "close");
2061+ pragma Import (C, C_Gethostname, "gethostname"); 2061+ pragma Import (C, C_Gethostname, "gethostname");
2062+ pragma Import (C, C_Getpeername, "getpeername"); 2062+ pragma Import (C, C_Getpeername, "getpeername");
2063+ pragma Import (C, C_Getsockname, "getsockname"); 2063+ pragma Import (C, C_Getsockname, "getsockname");
2064+ pragma Import (C, C_Getsockopt, "getsockopt"); 2064+ pragma Import (C, C_Getsockopt, "getsockopt");
2065+ pragma Import (C, C_Listen, "listen"); 2065+ pragma Import (C, C_Listen, "listen");
2066+ pragma Import (C, C_Select, "__select50"); 2066+ pragma Import (C, C_Select, "__select50");
2067+ pragma Import (C, C_Setsockopt, "setsockopt"); 2067+ pragma Import (C, C_Setsockopt, "setsockopt");
2068+ pragma Import (C, C_Shutdown, "shutdown"); 2068+ pragma Import (C, C_Shutdown, "shutdown");
2069+ pragma Import (C, C_System, "system"); 2069+ pragma Import (C, C_System, "system");
2070+ 2070+
2071+ pragma Import (C, Nonreentrant_Gethostbyname, "gethostbyname"); 2071+ pragma Import (C, Nonreentrant_Gethostbyname, "gethostbyname");
2072+ pragma Import (C, Nonreentrant_Gethostbyaddr, "gethostbyaddr"); 2072+ pragma Import (C, Nonreentrant_Gethostbyaddr, "gethostbyaddr");
2073+ pragma Import (C, Nonreentrant_Getservbyname, "getservbyname"); 2073+ pragma Import (C, Nonreentrant_Getservbyname, "getservbyname");
2074+ pragma Import (C, Nonreentrant_Getservbyport, "getservbyport"); 2074+ pragma Import (C, Nonreentrant_Getservbyport, "getservbyport");
2075+ 2075+
2076+end GNAT.Sockets.Thin; 2076+end GNAT.Sockets.Thin;
2077--- /dev/null 2077--- /dev/null
2078+++ gcc/ada/g-trasym-bsd.adb 2078+++ gcc/ada/g-trasym-bsd.adb
2079@@ -0,0 +1,150 @@ 2079@@ -0,0 +1,150 @@
2080+------------------------------------------------------------------------------ 2080+------------------------------------------------------------------------------
2081+-- -- 2081+-- --
2082+-- GNAT RUN-TIME COMPONENTS -- 2082+-- GNAT RUN-TIME COMPONENTS --
2083+-- -- 2083+-- --
2084+-- G N A T . T R A C E B A C K . S Y M B O L I C -- 2084+-- G N A T . T R A C E B A C K . S Y M B O L I C --
2085+-- -- 2085+-- --
2086+-- B o d y -- 2086+-- B o d y --
2087+-- -- 2087+-- --
2088+-- Copyright (C) 1999-2009, AdaCore -- 2088+-- Copyright (C) 1999-2009, AdaCore --
2089+-- -- 2089+-- --
2090+-- GNAT is free software; you can redistribute it and/or modify it under -- 2090+-- GNAT is free software; you can redistribute it and/or modify it under --
2091+-- terms of the GNU General Public License as published by the Free Soft- -- 2091+-- terms of the GNU General Public License as published by the Free Soft- --
2092+-- ware Foundation; either version 2, or (at your option) any later ver- -- 2092+-- ware Foundation; either version 2, or (at your option) any later ver- --
2093+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- 2093+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
2094+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- 2094+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
2095+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- 2095+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
2096+-- for more details. You should have received a copy of the GNU General -- 2096+-- for more details. You should have received a copy of the GNU General --
2097+-- Public License distributed with GNAT; see file COPYING. If not, write -- 2097+-- Public License distributed with GNAT; see file COPYING. If not, write --
2098+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- 2098+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
2099+-- Boston, MA 02110-1301, USA. -- 2099+-- Boston, MA 02110-1301, USA. --
2100+-- -- 2100+-- --
2101+-- As a special exception, if other files instantiate generics from this -- 2101+-- As a special exception, if other files instantiate generics from this --
2102+-- unit, or you link this unit with other files to produce an executable, -- 2102+-- unit, or you link this unit with other files to produce an executable, --
2103+-- this unit does not by itself cause the resulting executable to be -- 2103+-- this unit does not by itself cause the resulting executable to be --
2104+-- covered by the GNU General Public License. This exception does not -- 2104+-- covered by the GNU General Public License. This exception does not --
2105+-- however invalidate any other reasons why the executable file might be -- 2105+-- however invalidate any other reasons why the executable file might be --
2106+-- covered by the GNU Public License. -- 2106+-- covered by the GNU Public License. --
2107+-- -- 2107+-- --
2108+-- GNAT was originally developed by the GNAT team at New York University. -- 2108+-- GNAT was originally developed by the GNAT team at New York University. --
2109+-- Extensive contributions were provided by Ada Core Technologies Inc. -- 2109+-- Extensive contributions were provided by Ada Core Technologies Inc. --
2110+-- -- 2110+-- --
2111+------------------------------------------------------------------------------ 2111+------------------------------------------------------------------------------
2112+ 2112+
2113+-- Run-time symbolic traceback support 2113+-- Run-time symbolic traceback support
2114+-- This file is based on the work by Juergen Pfiefer which is still used 2114+-- This file is based on the work by Juergen Pfiefer which is still used
2115+-- today to provide symbolic traceback support for gnu/kFreeBSD. 2115+-- today to provide symbolic traceback support for gnu/kFreeBSD.
2116+-- Incorporated in GNAT-AUX by John Marino <http://www.dragonlace.net> 2116+-- Incorporated in GNAT-AUX by John Marino <http://www.dragonlace.net>
2117+ 2117+
2118+with System.Soft_Links; 2118+with System.Soft_Links;
2119+with Ada.Exceptions.Traceback; use Ada.Exceptions.Traceback; 2119+with Ada.Exceptions.Traceback; use Ada.Exceptions.Traceback;
2120+ 2120+
2121+package body GNAT.Traceback.Symbolic is 2121+package body GNAT.Traceback.Symbolic is
2122+ 2122+
2123+ package TSL renames System.Soft_Links; 2123+ package TSL renames System.Soft_Links;
2124+ 2124+
2125+ -- To perform the raw addresses to symbolic form translation we rely on a 2125+ -- To perform the raw addresses to symbolic form translation we rely on a
2126+ -- libaddr2line symbolizer which examines debug info from a provided 2126+ -- libaddr2line symbolizer which examines debug info from a provided
2127+ -- executable file name, and an absolute path is needed to ensure the file 2127+ -- executable file name, and an absolute path is needed to ensure the file
2128+ -- is always found. This is "__gnat_locate_exec_on_path (gnat_argv [0])" 2128+ -- is always found. This is "__gnat_locate_exec_on_path (gnat_argv [0])"
2129+ -- for our executable file, a fairly heavy operation so we cache the 2129+ -- for our executable file, a fairly heavy operation so we cache the
2130+ -- result. 2130+ -- result.
2131+ 2131+
2132+ Exename : System.Address; 2132+ Exename : System.Address;
2133+ -- Pointer to the name of the executable file to be used on all 2133+ -- Pointer to the name of the executable file to be used on all
2134+ -- invocations of the libaddr2line symbolization service. 2134+ -- invocations of the libaddr2line symbolization service.
2135+ 2135+
2136+ Exename_Resolved : Boolean := False; 2136+ Exename_Resolved : Boolean := False;
2137+ -- Flag to indicate whether we have performed the executable file name 2137+ -- Flag to indicate whether we have performed the executable file name
2138+ -- resolution already. Relying on a not null Exename for this purpose 2138+ -- resolution already. Relying on a not null Exename for this purpose
2139+ -- would be potentially inefficient as this is what we will get if the 2139+ -- would be potentially inefficient as this is what we will get if the
2140+ -- resolution attempt fails. 2140+ -- resolution attempt fails.
2141+ 2141+
2142+ ------------------------ 2142+ ------------------------
2143+ -- Symbolic_Traceback -- 2143+ -- Symbolic_Traceback --
2144+ ------------------------ 2144+ ------------------------
2145+ 2145+
2146+ function Symbolic_Traceback (Traceback : Tracebacks_Array) return String is 2146+ function Symbolic_Traceback (Traceback : Tracebacks_Array) return String is
2147+ 2147+
2148+ procedure convert_addresses 2148+ procedure convert_addresses
2149+ (filename : System.Address; 2149+ (filename : System.Address;
2150+ addrs : System.Address; 2150+ addrs : System.Address;
2151+ n_addrs : Integer; 2151+ n_addrs : Integer;
2152+ buf : System.Address; 2152+ buf : System.Address;
2153+ len : System.Address); 2153+ len : System.Address);
2154+ pragma Import (C, convert_addresses, "convert_addresses"); 2154+ pragma Import (C, convert_addresses, "convert_addresses");
2155+ -- This is the procedure version of the Ada-aware addr2line. It places 2155+ -- This is the procedure version of the Ada-aware addr2line. It places
2156+ -- in BUF a string representing the symbolic translation of the N_ADDRS 2156+ -- in BUF a string representing the symbolic translation of the N_ADDRS
2157+ -- raw addresses provided in ADDRS, looked up in debug information from 2157+ -- raw addresses provided in ADDRS, looked up in debug information from
2158+ -- FILENAME. LEN points to an integer which contains the size of the 2158+ -- FILENAME. LEN points to an integer which contains the size of the
2159+ -- BUF buffer at input and the result length at output. 2159+ -- BUF buffer at input and the result length at output.
2160+ -- 2160+ --
2161+ -- Note that this procedure is *not* thread-safe. 2161+ -- Note that this procedure is *not* thread-safe.
2162+ 2162+
2163+ type Argv_Array is array (0 .. 0) of System.Address; 2163+ type Argv_Array is array (0 .. 0) of System.Address;
2164+ gnat_argv : access Argv_Array; 2164+ gnat_argv : access Argv_Array;
2165+ pragma Import (C, gnat_argv, "gnat_argv"); 2165+ pragma Import (C, gnat_argv, "gnat_argv");
2166+ 2166+
2167+ function locate_exec_on_path 2167+ function locate_exec_on_path
2168+ (c_exename : System.Address) return System.Address; 2168+ (c_exename : System.Address) return System.Address;
2169+ pragma Import (C, locate_exec_on_path, "__gnat_locate_exec_on_path"); 2169+ pragma Import (C, locate_exec_on_path, "__gnat_locate_exec_on_path");
2170+ 2170+
2171+ B_Size : constant Integer := 256 * Traceback'Length; 2171+ B_Size : constant Integer := 256 * Traceback'Length;
2172+ Len : Integer := B_Size; 2172+ Len : Integer := B_Size;
2173+ Res : String (1 .. B_Size); 2173+ Res : String (1 .. B_Size);
2174+ 2174+
2175+ use type System.Address; 2175+ use type System.Address;
2176+ 2176+
2177+ begin 2177+ begin
2178+ -- The symbolic translation of an empty set of addresses is an empty 2178+ -- The symbolic translation of an empty set of addresses is an empty
2179+ -- string. 2179+ -- string.
2180+ 2180+
2181+ if Traceback'Length = 0 then 2181+ if Traceback'Length = 0 then
2182+ return ""; 2182+ return "";
2183+ end if; 2183+ end if;
2184+ 2184+
2185+ -- If our input set of raw addresses is not empty, resort to the 2185+ -- If our input set of raw addresses is not empty, resort to the
2186+ -- libaddr2line service to symbolize it all. 2186+ -- libaddr2line service to symbolize it all.
2187+ 2187+
2188+ -- Compute, cache and provide the absolute path to our executable file 2188+ -- Compute, cache and provide the absolute path to our executable file
2189+ -- name as the binary file where the relevant debug information is to be 2189+ -- name as the binary file where the relevant debug information is to be
2190+ -- found. If the executable file name resolution fails, we have no 2190+ -- found. If the executable file name resolution fails, we have no
2191+ -- sensible basis to invoke the symbolizer at all. 2191+ -- sensible basis to invoke the symbolizer at all.
2192+ 2192+
2193+ -- Protect all this against concurrent accesses explicitly, as the 2193+ -- Protect all this against concurrent accesses explicitly, as the
2194+ -- underlying services are potentially thread unsafe. 2194+ -- underlying services are potentially thread unsafe.
2195+ 2195+
2196+ TSL.Lock_Task.all; 2196+ TSL.Lock_Task.all;
2197+ 2197+
2198+ if not Exename_Resolved then 2198+ if not Exename_Resolved then
2199+ Exename := locate_exec_on_path (gnat_argv (0)); 2199+ Exename := locate_exec_on_path (gnat_argv (0));
2200+ Exename_Resolved := True; 2200+ Exename_Resolved := True;
2201+ end if; 2201+ end if;
2202+ 2202+
2203+ if Exename /= System.Null_Address then 2203+ if Exename /= System.Null_Address then
2204+ Len := Res'Length; 2204+ Len := Res'Length;
2205+ convert_addresses 2205+ convert_addresses
2206+ (Exename, Traceback'Address, Traceback'Length, 2206+ (Exename, Traceback'Address, Traceback'Length,
2207+ Res (1)'Address, Len'Address); 2207+ Res (1)'Address, Len'Address);
2208+ end if; 2208+ end if;
2209+ 2209+
2210+ TSL.Unlock_Task.all; 2210+ TSL.Unlock_Task.all;
2211+ 2211+
2212+ -- Return what the addr2line symbolizer has produced if we have called 2212+ -- Return what the addr2line symbolizer has produced if we have called
2213+ -- it (the executable name resolution succeeded), or an empty string 2213+ -- it (the executable name resolution succeeded), or an empty string
2214+ -- otherwise. 2214+ -- otherwise.
2215+ 2215+
2216+ if Exename /= System.Null_Address then 2216+ if Exename /= System.Null_Address then
2217+ return Res (1 .. Len); 2217+ return Res (1 .. Len);
2218+ else 2218+ else
2219+ return ""; 2219+ return "";
2220+ end if; 2220+ end if;
2221+ 2221+
2222+ end Symbolic_Traceback; 2222+ end Symbolic_Traceback;
2223+ 2223+
2224+ function Symbolic_Traceback (E : Exception_Occurrence) return String is 2224+ function Symbolic_Traceback (E : Exception_Occurrence) return String is
2225+ begin 2225+ begin
2226+ return Symbolic_Traceback (Tracebacks (E)); 2226+ return Symbolic_Traceback (Tracebacks (E));
2227+ end Symbolic_Traceback; 2227+ end Symbolic_Traceback;
2228+ 2228+
2229+end GNAT.Traceback.Symbolic; 2229+end GNAT.Traceback.Symbolic;
2230--- gcc/ada/gnatchop.adb.orig 2230--- gcc/ada/gnatchop.adb.orig
2231+++ gcc/ada/gnatchop.adb 2231+++ gcc/ada/gnatchop.adb
2232@@ -21,6 +21,7 @@ 2232@@ -21,6 +21,7 @@
2233 -- GNAT was originally developed by the GNAT team at New York University. -- 2233 -- GNAT was originally developed by the GNAT team at New York University. --
2234 -- Extensive contributions were provided by Ada Core Technologies Inc. -- 2234 -- Extensive contributions were provided by Ada Core Technologies Inc. --
2235 -- -- 2235 -- --
2236+-- Copyright (C) 2010 John Marino <draco@marino.st> -- 2236+-- Copyright (C) 2010 John Marino <draco@marino.st> --
2237 ------------------------------------------------------------------------------ 2237 ------------------------------------------------------------------------------
2238  2238
2239 with Ada.Characters.Conversions; use Ada.Characters.Conversions; 2239 with Ada.Characters.Conversions; use Ada.Characters.Conversions;
2240@@ -45,7 +46,7 @@ 2240@@ -45,7 +46,7 @@
2241 Config_File_Name : constant String_Access := new String'("gnat.adc"); 2241 Config_File_Name : constant String_Access := new String'("gnat.adc");
2242 -- The name of the file holding the GNAT configuration pragmas 2242 -- The name of the file holding the GNAT configuration pragmas
2243  2243
2244- Gcc : String_Access := new String'("gcc"); 2244- Gcc : String_Access := new String'("gcc");
2245+ Gcc : String_Access := new String'("gnatgcc"); 2245+ Gcc : String_Access := new String'("gnatgcc");
2246 -- May be modified by switch --GCC= 2246 -- May be modified by switch --GCC=
2247  2247
2248 Gcc_Set : Boolean := False; 2248 Gcc_Set : Boolean := False;
2249--- gcc/ada/gnatlink.adb.orig 2249--- gcc/ada/gnatlink.adb.orig
2250+++ gcc/ada/gnatlink.adb 2250+++ gcc/ada/gnatlink.adb
2251@@ -21,6 +21,7 @@ 2251@@ -21,6 +21,7 @@
2252 -- GNAT was originally developed by the GNAT team at New York University. -- 2252 -- GNAT was originally developed by the GNAT team at New York University. --
2253 -- Extensive contributions were provided by Ada Core Technologies Inc. -- 2253 -- Extensive contributions were provided by Ada Core Technologies Inc. --
2254 -- -- 2254 -- --
2255+-- Copyright (C) 2010 John Marino <draco@marino.st> -- 2255+-- Copyright (C) 2010 John Marino <draco@marino.st> --
2256 ------------------------------------------------------------------------------ 2256 ------------------------------------------------------------------------------
2257  2257
2258 -- Gnatlink usage: please consult the gnat documentation 2258 -- Gnatlink usage: please consult the gnat documentation
2259@@ -137,7 +138,7 @@ 2259@@ -137,7 +138,7 @@
2260 -- This table collects the arguments to be passed to compile the binder 2260 -- This table collects the arguments to be passed to compile the binder
2261 -- generated file. 2261 -- generated file.
2262  2262
2263- Gcc : String_Access := Program_Name ("gcc", "gnatlink"); 2263- Gcc : String_Access := Program_Name ("gcc", "gnatlink");
2264+ Gcc : String_Access := Program_Name ("gnatgcc", "gnatlink"); 2264+ Gcc : String_Access := Program_Name ("gnatgcc", "gnatlink");
2265  2265
2266 Read_Mode : constant String := "r" & ASCII.NUL; 2266 Read_Mode : constant String := "r" & ASCII.NUL;
2267  2267
2268--- gcc/ada/gnatvsn.ads.orig 2268--- gcc/ada/gnatvsn.ads.orig
2269+++ gcc/ada/gnatvsn.ads 2269+++ gcc/ada/gnatvsn.ads
2270@@ -27,6 +27,7 @@ 2270@@ -27,6 +27,7 @@
2271 -- GNAT was originally developed by the GNAT team at New York University. -- 2271 -- GNAT was originally developed by the GNAT team at New York University. --
2272 -- Extensive contributions were provided by Ada Core Technologies Inc. -- 2272 -- Extensive contributions were provided by Ada Core Technologies Inc. --
2273 -- -- 2273 -- --
2274+-- Copyright (C) 2010 John Marino <draco@marino.st> -- 2274+-- Copyright (C) 2010 John Marino <draco@marino.st> --
2275 ------------------------------------------------------------------------------ 2275 ------------------------------------------------------------------------------
2276  2276
2277 -- This package spec holds version information for the GNAT tools. 2277 -- This package spec holds version information for the GNAT tools.
2278@@ -34,7 +35,7 @@ 2278@@ -34,7 +35,7 @@
2279  2279
2280 package Gnatvsn is 2280 package Gnatvsn is
2281  2281
2282- Gnat_Static_Version_String : constant String := "GNU Ada"; 2282- Gnat_Static_Version_String : constant String := "GNU Ada";
2283+ Gnat_Static_Version_String : constant String := "GNAT AUX"; 2283+ Gnat_Static_Version_String : constant String := "GNAT AUX";
2284 -- Static string identifying this version, that can be used as an argument 2284 -- Static string identifying this version, that can be used as an argument
2285 -- to e.g. pragma Ident. 2285 -- to e.g. pragma Ident.
2286  2286
2287--- gcc/ada/gsocket.h.orig 2287--- gcc/ada/gsocket.h.orig
2288+++ gcc/ada/gsocket.h 2288+++ gcc/ada/gsocket.h
2289@@ -27,6 +27,7 @@ 2289@@ -27,6 +27,7 @@
2290 * GNAT was originally developed by the GNAT team at New York University. * 2290 * GNAT was originally developed by the GNAT team at New York University. *
2291 * Extensive contributions were provided by Ada Core Technologies Inc. * 2291 * Extensive contributions were provided by Ada Core Technologies Inc. *
2292 * * 2292 * *
2293+ * Copyright (C) 2010 John Marino <draco@marino.st> * 2293+ * Copyright (C) 2010 John Marino <draco@marino.st> *
2294 ****************************************************************************/ 2294 ****************************************************************************/
2295  2295
2296 #if defined(__nucleus__) || defined(VTHREADS) 2296 #if defined(__nucleus__) || defined(VTHREADS)
2297@@ -194,7 +195,14 @@ 2297@@ -194,7 +195,14 @@
2298 #include <netdb.h> 2298 #include <netdb.h>
2299 #endif 2299 #endif
2300  2300
2301+#if defined(__ANDROID__) 2301+#if defined(__ANDROID__)
2302+#include <sys/select.h> 2302+#include <sys/select.h>
2303+#endif 2303+#endif
2304+ 2304+
2305 #if defined (_AIX) || defined (__FreeBSD__) || defined (__hpux__) || \ 2305 #if defined (_AIX) || defined (__FreeBSD__) || defined (__hpux__) || \
2306+ defined (__OpenBSD__) || \ 2306+ defined (__OpenBSD__) || \
2307+ defined (__NetBSD__) || \ 2307+ defined (__NetBSD__) || \
2308+ defined (__DragonFly__) || \ 2308+ defined (__DragonFly__) || \
2309 defined (__osf__) || defined (_WIN32) || defined (__APPLE__) 2309 defined (__osf__) || defined (_WIN32) || defined (__APPLE__)
2310 # define HAVE_THREAD_SAFE_GETxxxBYyyy 1 2310 # define HAVE_THREAD_SAFE_GETxxxBYyyy 1
2311  2311
2312@@ -227,7 +235,13 @@ 2312@@ -227,7 +235,13 @@
2313 # endif 2313 # endif
2314 #endif 2314 #endif
2315  2315
2316-#if defined (__FreeBSD__) || defined (__vxworks) || defined(__rtems__) 2316-#if defined (__FreeBSD__) || defined (__vxworks) || defined(__rtems__)
2317+#if defined (__FreeBSD__) \ 2317+#if defined (__FreeBSD__) \
2318+ || defined (__DragonFly__) \ 2318+ || defined (__DragonFly__) \
2319+ || defined (__OpenBSD__) \ 2319+ || defined (__OpenBSD__) \
2320+ || defined (__NetBSD__) \ 2320+ || defined (__NetBSD__) \
2321+ || defined (__ANDROID__) \ 2321+ || defined (__ANDROID__) \
2322+ || defined (__vxworks) \ 2322+ || defined (__vxworks) \
2323+ || defined(__rtems__) 2323+ || defined(__rtems__)
2324 # define Has_Sockaddr_Len 1 2324 # define Has_Sockaddr_Len 1
2325 #else 2325 #else
2326 # define Has_Sockaddr_Len 0 2326 # define Has_Sockaddr_Len 0
2327--- gcc/ada/init.c.orig 2327--- gcc/ada/init.c.orig
2328+++ gcc/ada/init.c 2328+++ gcc/ada/init.c
2329@@ -27,6 +27,7 @@ 2329@@ -27,6 +27,7 @@
2330 * GNAT was originally developed by the GNAT team at New York University. * 2330 * GNAT was originally developed by the GNAT team at New York University. *
2331 * Extensive contributions were provided by Ada Core Technologies Inc. * 2331 * Extensive contributions were provided by Ada Core Technologies Inc. *
2332 * * 2332 * *
2333+ * Copyright (C) 2010, 2011 John Marino <www.dragonlace.net> * 2333+ * Copyright (C) 2010, 2011 John Marino <www.dragonlace.net> *
2334 ****************************************************************************/ 2334 ****************************************************************************/
2335  2335
2336 /* This unit contains initialization circuits that are system dependent. 2336 /* This unit contains initialization circuits that are system dependent.
2337@@ -519,7 +520,7 @@ 2337@@ -519,7 +520,7 @@
2338 /* GNU/Linux Section */ 2338 /* GNU/Linux Section */
2339 /*********************/ 2339 /*********************/
2340  2340
2341-#elif defined (linux) 2341-#elif defined (linux)
2342+#elif defined (linux) && !defined(__ANDROID__) 2342+#elif defined (linux) && !defined(__ANDROID__)
2343  2343
2344 #include <signal.h> 2344 #include <signal.h>
2345  2345
2346@@ -1724,7 +1725,7 @@ 2346@@ -1724,7 +1725,7 @@
2347 /* FreeBSD Section */ 2347 /* FreeBSD Section */
2348 /*******************/ 2348 /*******************/
2349  2349
2350-#elif defined (__FreeBSD__) 2350-#elif defined (__FreeBSD__)
2351+#elif defined (__FreeBSD__) || defined (__DragonFly__) 2351+#elif defined (__FreeBSD__) || defined (__DragonFly__)
2352  2352
2353 #include <signal.h> 2353 #include <signal.h>
2354 #include <sys/ucontext.h> 2354 #include <sys/ucontext.h>
2355@@ -1769,7 +1770,7 @@ 2355@@ -1769,7 +1770,7 @@
2356 } 2356 }
2357  2357
2358 void 2358 void
2359-__gnat_install_handler () 2359-__gnat_install_handler ()
2360+__gnat_install_handler (void) 2360+__gnat_install_handler (void)
2361 { 2361 {
2362 struct sigaction act; 2362 struct sigaction act;
2363  2363
2364@@ -1791,6 +1792,77 @@ 2364@@ -1791,6 +1792,77 @@
2365 } 2365 }
2366  2366
2367 /*******************/ 2367 /*******************/
2368+/* Android Section */ 2368+/* Android Section */
2369+/*******************/ 2369+/*******************/
2370+ 2370+
2371+#elif defined(__ANDROID__) 2371+#elif defined(__ANDROID__)
2372+ 2372+
2373+#include <signal.h> 2373+#include <signal.h>
2374+ 2374+
2375+static void 2375+static void
2376+__gnat_error_handler (int sig, 2376+__gnat_error_handler (int sig,
2377+ struct siginfo *si ATTRIBUTE_UNUSED, 2377+ struct siginfo *si ATTRIBUTE_UNUSED,
2378+ void *ucontext ATTRIBUTE_UNUSED) 2378+ void *ucontext ATTRIBUTE_UNUSED)
2379+{ 2379+{
2380+ struct Exception_Data *exception; 2380+ struct Exception_Data *exception;
2381+ const char *msg; 2381+ const char *msg;
2382+ 2382+
2383+ switch (sig) 2383+ switch (sig)
2384+ { 2384+ {
2385+ case SIGFPE: 2385+ case SIGFPE:
2386+ exception = &constraint_error; 2386+ exception = &constraint_error;
2387+ msg = "SIGFPE"; 2387+ msg = "SIGFPE";
2388+ break; 2388+ break;
2389+ 2389+
2390+ case SIGILL: 2390+ case SIGILL:
2391+ exception = &constraint_error; 2391+ exception = &constraint_error;
2392+ msg = "SIGILL"; 2392+ msg = "SIGILL";
2393+ break; 2393+ break;
2394+  2394+
2395+ case SIGSEGV: 2395+ case SIGSEGV:
2396+ exception = &storage_error; 2396+ exception = &storage_error;
2397+ msg = "stack overflow or erroneous memory access"; 2397+ msg = "stack overflow or erroneous memory access";
2398+ break; 2398+ break;
2399+ 2399+
2400+ case SIGBUS: 2400+ case SIGBUS:
2401+ exception = &constraint_error; 2401+ exception = &constraint_error;
2402+ msg = "SIGBUS"; 2402+ msg = "SIGBUS";
2403+ break; 2403+ break;
2404+ 2404+
2405+ default: 2405+ default:
2406+ exception = &program_error; 2406+ exception = &program_error;
2407+ msg = "unhandled signal"; 2407+ msg = "unhandled signal";
2408+ } 2408+ }
2409+ 2409+
2410+ Raise_From_Signal_Handler (exception, msg); 2410+ Raise_From_Signal_Handler (exception, msg);
2411+} 2411+}
2412+ 2412+
2413+void 2413+void
2414+__gnat_install_handler (void) 2414+__gnat_install_handler (void)
2415+{ 2415+{
2416+ struct sigaction act; 2416+ struct sigaction act;
2417+ 2417+
2418+ act.sa_sigaction = __gnat_error_handler; 2418+ act.sa_sigaction = __gnat_error_handler;
2419+ act.sa_flags = SA_NODEFER | SA_RESTART | SA_SIGINFO; 2419+ act.sa_flags = SA_NODEFER | SA_RESTART | SA_SIGINFO;
2420+ sigemptyset (&act.sa_mask); 2420+ sigemptyset (&act.sa_mask);
2421+ 2421+
2422+ /* Do not install handlers if interrupt state is "System". */ 2422+ /* Do not install handlers if interrupt state is "System". */
2423+ if (__gnat_get_interrupt_state (SIGABRT) != 's')  2423+ if (__gnat_get_interrupt_state (SIGABRT) != 's')
2424+ sigaction (SIGABRT, &act, NULL); 2424+ sigaction (SIGABRT, &act, NULL);
2425+ if (__gnat_get_interrupt_state (SIGFPE) != 's') 2425+ if (__gnat_get_interrupt_state (SIGFPE) != 's')
2426+ sigaction (SIGFPE, &act, NULL); 2426+ sigaction (SIGFPE, &act, NULL);
2427+ if (__gnat_get_interrupt_state (SIGILL) != 's') 2427+ if (__gnat_get_interrupt_state (SIGILL) != 's')
2428+ sigaction (SIGILL, &act, NULL); 2428+ sigaction (SIGILL, &act, NULL);
2429+ if (__gnat_get_interrupt_state (SIGBUS) != 's') 2429+ if (__gnat_get_interrupt_state (SIGBUS) != 's')
2430+ sigaction (SIGBUS, &act, NULL); 2430+ sigaction (SIGBUS, &act, NULL);
2431+ if (__gnat_get_interrupt_state (SIGSEGV) != 's') 2431+ if (__gnat_get_interrupt_state (SIGSEGV) != 's')
2432+ sigaction (SIGSEGV, &act, NULL); 2432+ sigaction (SIGSEGV, &act, NULL);
2433+ 2433+
2434+ __gnat_handler_installed = 1; 2434+ __gnat_handler_installed = 1;
2435+} 2435+}
2436+ 2436+
2437+ 2437+
2438+/*******************/ 2438+/*******************/
2439 /* VxWorks Section */ 2439 /* VxWorks Section */
2440 /*******************/ 2440 /*******************/
2441  2441
2442@@ -2320,6 +2392,7 @@ 2442@@ -2341,6 +2413,7 @@
2443  2443
2444 #if defined (_WIN32) || defined (__INTERIX) \ 2444 #if defined (_WIN32) || defined (__INTERIX) \
2445 || defined (__Lynx__) || defined(__NetBSD__) || defined(__FreeBSD__) \ 2445 || defined (__Lynx__) || defined(__NetBSD__) || defined(__FreeBSD__) \
2446+ || defined (__DragonFly__) \ 2446+ || defined (__DragonFly__) \
2447 || defined (__OpenBSD__) 2447 || defined (__OpenBSD__)
2448  2448
2449 #define HAVE_GNAT_INIT_FLOAT 2449 #define HAVE_GNAT_INIT_FLOAT
2450--- gcc/ada/initialize.c.orig 2450--- gcc/ada/initialize.c.orig
2451+++ gcc/ada/initialize.c 2451+++ gcc/ada/initialize.c
2452@@ -27,6 +27,7 @@ 2452@@ -27,6 +27,7 @@
2453 * GNAT was originally developed by the GNAT team at New York University. * 2453 * GNAT was originally developed by the GNAT team at New York University. *
2454 * Extensive contributions were provided by Ada Core Technologies Inc. * 2454 * Extensive contributions were provided by Ada Core Technologies Inc. *
2455 * * 2455 * *
2456+ * Copyright (C) 2010 John Marino <draco@marino.st> * 2456+ * Copyright (C) 2010 John Marino <draco@marino.st> *
2457 ****************************************************************************/ 2457 ****************************************************************************/
2458  2458
2459 /* This unit provides default implementation for __gnat_initialize () 2459 /* This unit provides default implementation for __gnat_initialize ()
2460@@ -255,6 +256,7 @@ 2460@@ -255,6 +256,7 @@
2461 /******************************************/ 2461 /******************************************/
2462  2462
2463 #elif defined (__Lynx__) || defined (__FreeBSD__) || defined(__NetBSD__) \ 2463 #elif defined (__Lynx__) || defined (__FreeBSD__) || defined(__NetBSD__) \
2464+ || defined (__DragonFly__) \ 2464+ || defined (__DragonFly__) \
2465 || defined (__OpenBSD__) 2465 || defined (__OpenBSD__)
2466  2466
2467 extern void __gnat_init_float (void); 2467 extern void __gnat_init_float (void);
2468--- gcc/ada/link.c.orig 2468--- gcc/ada/link.c.orig
2469+++ gcc/ada/link.c 2469+++ gcc/ada/link.c
2470@@ -27,6 +27,7 @@ 2470@@ -27,6 +27,7 @@
2471 * GNAT was originally developed by the GNAT team at New York University. * 2471 * GNAT was originally developed by the GNAT team at New York University. *
2472 * Extensive contributions were provided by Ada Core Technologies Inc. * 2472 * Extensive contributions were provided by Ada Core Technologies Inc. *
2473 * * 2473 * *
2474+ * Copyright (C) 2010, 2011 John Marino <www.dragonlace.net> * 2474+ * Copyright (C) 2010, 2011 John Marino <www.dragonlace.net> *
2475 ****************************************************************************/ 2475 ****************************************************************************/
2476  2476
2477 /* This file contains host-specific parameters describing the behavior */ 2477 /* This file contains host-specific parameters describing the behavior */
2478@@ -187,7 +188,10 @@ 2478@@ -187,7 +188,10 @@
2479 const char *__gnat_default_libgcc_subdir = "lib"; 2479 const char *__gnat_default_libgcc_subdir = "lib";
2480 #endif 2480 #endif
2481  2481
2482-#elif defined (__FreeBSD__) 2482-#elif defined (__FreeBSD__)
2483+#elif defined (__FreeBSD__) \ 2483+#elif defined (__FreeBSD__) \
2484+ || defined (__OpenBSD__) \ 2484+ || defined (__OpenBSD__) \
2485+ || defined (__NetBSD__) \ 2485+ || defined (__NetBSD__) \
2486+ || defined (__DragonFly__) 2486+ || defined (__DragonFly__)
2487 const char *__gnat_object_file_option = ""; 2487 const char *__gnat_object_file_option = "";
2488 const char *__gnat_run_path_option = "-Wl,-rpath,"; 2488 const char *__gnat_run_path_option = "-Wl,-rpath,";
2489 char __gnat_shared_libgnat_default = STATIC; 2489 char __gnat_shared_libgnat_default = STATIC;
2490--- gcc/ada/make.adb.orig 2490--- gcc/ada/make.adb.orig
2491+++ gcc/ada/make.adb 2491+++ gcc/ada/make.adb
2492@@ -21,6 +21,7 @@ 2492@@ -21,6 +21,7 @@
2493 -- GNAT was originally developed by the GNAT team at New York University. -- 2493 -- GNAT was originally developed by the GNAT team at New York University. --
2494 -- Extensive contributions were provided by Ada Core Technologies Inc. -- 2494 -- Extensive contributions were provided by Ada Core Technologies Inc. --
2495 -- -- 2495 -- --
2496+-- Copyright (C) 2010 John Marino <draco@marino.st> -- 2496+-- Copyright (C) 2010 John Marino <draco@marino.st> --
2497 ------------------------------------------------------------------------------ 2497 ------------------------------------------------------------------------------
2498  2498
2499 with ALI; use ALI; 2499 with ALI; use ALI;
2500@@ -652,7 +653,7 @@ 2500@@ -652,7 +653,7 @@
2501 -- Compiler, Binder & Linker Data and Subprograms -- 2501 -- Compiler, Binder & Linker Data and Subprograms --
2502 ---------------------------------------------------- 2502 ----------------------------------------------------
2503  2503
2504- Gcc : String_Access := Program_Name ("gcc", "gnatmake"); 2504- Gcc : String_Access := Program_Name ("gcc", "gnatmake");
2505+ Gcc : String_Access := Program_Name ("gnatgcc", "gnatmake"); 2505+ Gcc : String_Access := Program_Name ("gnatgcc", "gnatmake");
2506 Gnatbind : String_Access := Program_Name ("gnatbind", "gnatmake"); 2506 Gnatbind : String_Access := Program_Name ("gnatbind", "gnatmake");
2507 Gnatlink : String_Access := Program_Name ("gnatlink", "gnatmake"); 2507 Gnatlink : String_Access := Program_Name ("gnatlink", "gnatmake");
2508 -- Default compiler, binder, linker programs 2508 -- Default compiler, binder, linker programs
2509--- gcc/ada/mlib-prj.adb.orig 2509--- gcc/ada/mlib-prj.adb.orig
2510+++ gcc/ada/mlib-prj.adb 2510+++ gcc/ada/mlib-prj.adb
2511@@ -341,6 +341,11 @@ 2511@@ -341,6 +341,11 @@
2512  2512
2513 Foreign_Sources : Boolean; 2513 Foreign_Sources : Boolean;
2514  2514
2515+ Rpath_Disabled : Boolean := False; 2515+ Rpath_Disabled : Boolean := False;
2516+ -- If -R is passed through the library options for the linker, it will 2516+ -- If -R is passed through the library options for the linker, it will
2517+ -- prevent the implemented libraries portion of the rpath switch from 2517+ -- prevent the implemented libraries portion of the rpath switch from
2518+ -- being built, even if the linker is capable of supporting rpath. 2518+ -- being built, even if the linker is capable of supporting rpath.
2519+ 2519+
2520 Rpath : String_Access := null; 2520 Rpath : String_Access := null;
2521 -- Allocated only if Path Option is supported 2521 -- Allocated only if Path Option is supported
2522  2522
2523@@ -790,7 +795,7 @@ 2523@@ -790,7 +795,7 @@
2524 Opts.Table (Opts.Last) := 2524 Opts.Table (Opts.Last) :=
2525 new String'("-L" & Name_Buffer (1 .. Name_Len)); 2525 new String'("-L" & Name_Buffer (1 .. Name_Len));
2526  2526
2527- if Path_Option /= null then 2527- if Path_Option /= null then
2528+ if not Rpath_Disabled and then Path_Option /= null then 2528+ if not Rpath_Disabled and then Path_Option /= null then
2529 Add_Rpath (Name_Buffer (1 .. Name_Len)); 2529 Add_Rpath (Name_Buffer (1 .. Name_Len));
2530 end if; 2530 end if;
2531  2531
2532@@ -1285,6 +1290,9 @@ 2532@@ -1285,6 +1290,9 @@
2533 Opts.Increment_Last; 2533 Opts.Increment_Last;
2534 Opts.Table (Opts.Last) := 2534 Opts.Table (Opts.Last) :=
2535 new String'(Name_Buffer (1 .. Name_Len)); 2535 new String'(Name_Buffer (1 .. Name_Len));
2536+ if Name_Len = 2 and then Name_Buffer (1 .. 2) = "-R" then 2536+ if Name_Len = 2 and then Name_Buffer (1 .. 2) = "-R" then
2537+ Rpath_Disabled := True; 2537+ Rpath_Disabled := True;
2538+ end if; 2538+ end if;
2539 end if; 2539 end if;
2540  2540
2541 Current := Element.Next; 2541 Current := Element.Next;
2542--- gcc/ada/mlib-utl.adb.orig 2542--- gcc/ada/mlib-utl.adb.orig
2543+++ gcc/ada/mlib-utl.adb 2543+++ gcc/ada/mlib-utl.adb
2544@@ -21,6 +21,7 @@ 2544@@ -21,6 +21,7 @@
2545 -- GNAT was originally developed by the GNAT team at New York University. -- 2545 -- GNAT was originally developed by the GNAT team at New York University. --
2546 -- Extensive contributions were provided by Ada Core Technologies Inc. -- 2546 -- Extensive contributions were provided by Ada Core Technologies Inc. --
2547 -- -- 2547 -- --
2548+-- Copyright (C) 2010 John Marino <draco@marino.st> -- 2548+-- Copyright (C) 2010 John Marino <draco@marino.st> --
2549 ------------------------------------------------------------------------------ 2549 ------------------------------------------------------------------------------
2550  2550
2551 with MLib.Fil; use MLib.Fil; 2551 with MLib.Fil; use MLib.Fil;
2552@@ -412,7 +413,7 @@ 2552@@ -412,7 +413,7 @@
2553 if Driver_Name = No_Name then 2553 if Driver_Name = No_Name then
2554 if Gcc_Exec = null then 2554 if Gcc_Exec = null then
2555 if Gcc_Name = null then 2555 if Gcc_Name = null then
2556- Gcc_Name := Osint.Program_Name ("gcc", "gnatmake"); 2556- Gcc_Name := Osint.Program_Name ("gcc", "gnatmake");
2557+ Gcc_Name := Osint.Program_Name ("gnatgcc", "gnatmake"); 2557+ Gcc_Name := Osint.Program_Name ("gnatgcc", "gnatmake");
2558 end if; 2558 end if;
2559  2559
2560 Gcc_Exec := Locate_Exec_On_Path (Gcc_Name.all); 2560 Gcc_Exec := Locate_Exec_On_Path (Gcc_Name.all);
2561--- gcc/ada/prj-makr.adb.orig 2561--- gcc/ada/prj-makr.adb.orig
2562+++ gcc/ada/prj-makr.adb 2562+++ gcc/ada/prj-makr.adb
2563@@ -21,6 +21,7 @@ 2563@@ -21,6 +21,7 @@
2564 -- GNAT was originally developed by the GNAT team at New York University. -- 2564 -- GNAT was originally developed by the GNAT team at New York University. --
2565 -- Extensive contributions were provided by Ada Core Technologies Inc. -- 2565 -- Extensive contributions were provided by Ada Core Technologies Inc. --
2566 -- -- 2566 -- --
2567+-- Copyright (C) 2010 John Marino <draco@marino.st> -- 2567+-- Copyright (C) 2010 John Marino <draco@marino.st> --
2568 ------------------------------------------------------------------------------ 2568 ------------------------------------------------------------------------------
2569  2569
2570 with Csets; 2570 with Csets;
2571@@ -110,7 +111,7 @@ 2571@@ -110,7 +111,7 @@
2572  2572
2573 procedure Dup2 (Old_Fd, New_Fd : File_Descriptor); 2573 procedure Dup2 (Old_Fd, New_Fd : File_Descriptor);
2574  2574
2575- Gcc : constant String := "gcc"; 2575- Gcc : constant String := "gcc";
2576+ Gcc : constant String := "gnatgcc"; 2576+ Gcc : constant String := "gnatgcc";
2577 Gcc_Path : String_Access := null; 2577 Gcc_Path : String_Access := null;
2578  2578
2579 Non_Empty_Node : constant Project_Node_Id := 1; 2579 Non_Empty_Node : constant Project_Node_Id := 1;
2580--- gcc/ada/s-fileio.adb.orig 2580--- gcc/ada/s-fileio.adb.orig
2581+++ gcc/ada/s-fileio.adb 2581+++ gcc/ada/s-fileio.adb
2582@@ -231,7 +231,7 @@ 2582@@ -231,7 +231,7 @@
2583 Close_Status : int := 0; 2583 Close_Status : int := 0;
2584 Dup_Strm : Boolean := False; 2584 Dup_Strm : Boolean := False;
2585 File : AFCB_Ptr renames File_Ptr.all; 2585 File : AFCB_Ptr renames File_Ptr.all;
2586- Errno : Integer; 2586- Errno : Integer;
2587+ Errno : Integer := 0; 2587+ Errno : Integer := 0;
2588  2588
2589 begin 2589 begin
2590 -- Take a task lock, to protect the global data value Open_Files 2590 -- Take a task lock, to protect the global data value Open_Files
2591--- /dev/null 2591--- /dev/null
2592+++ gcc/ada/s-osinte-android.ads 2592+++ gcc/ada/s-osinte-android.ads
2593@@ -0,0 +1,566 @@ 2593@@ -0,0 +1,566 @@
2594+------------------------------------------------------------------------------ 2594+------------------------------------------------------------------------------
2595+-- -- 2595+-- --
2596+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- 2596+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
2597+-- -- 2597+-- --
2598+-- S Y S T E M . O S _ I N T E R F A C E -- 2598+-- S Y S T E M . O S _ I N T E R F A C E --
2599+-- -- 2599+-- --
2600+-- S p e c -- 2600+-- S p e c --
2601+-- -- 2601+-- --
2602+-- Copyright (C) 1991-1994, Florida State University -- 2602+-- Copyright (C) 1991-1994, Florida State University --
2603+-- Copyright (C) 1995-2010, Free Software Foundation, Inc. -- 2603+-- Copyright (C) 1995-2010, Free Software Foundation, Inc. --
2604+-- -- 2604+-- --
2605+-- GNARL is free software; you can redistribute it and/or modify it under -- 2605+-- GNARL is free software; you can redistribute it and/or modify it under --
2606+-- terms of the GNU General Public License as published by the Free Soft- -- 2606+-- terms of the GNU General Public License as published by the Free Soft- --
2607+-- ware Foundation; either version 2, or (at your option) any later ver- -- 2607+-- ware Foundation; either version 2, or (at your option) any later ver- --
2608+-- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- 2608+-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
2609+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- 2609+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
2610+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- 2610+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
2611+-- for more details. You should have received a copy of the GNU General -- 2611+-- for more details. You should have received a copy of the GNU General --
2612+-- Public License distributed with GNARL; see file COPYING. If not, write -- 2612+-- Public License distributed with GNARL; see file COPYING. If not, write --
2613+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- 2613+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
2614+-- Boston, MA 02110-1301, USA. -- 2614+-- Boston, MA 02110-1301, USA. --
2615+-- -- 2615+-- --
2616+-- As a special exception, if other files instantiate generics from this -- 2616+-- As a special exception, if other files instantiate generics from this --
2617+-- unit, or you link this unit with other files to produce an executable, -- 2617+-- unit, or you link this unit with other files to produce an executable, --
2618+-- this unit does not by itself cause the resulting executable to be -- 2618+-- this unit does not by itself cause the resulting executable to be --
2619+-- covered by the GNU General Public License. This exception does not -- 2619+-- covered by the GNU General Public License. This exception does not --
2620+-- however invalidate any other reasons why the executable file might be -- 2620+-- however invalidate any other reasons why the executable file might be --
2621+-- covered by the GNU Public License. -- 2621+-- covered by the GNU Public License. --
2622+-- -- 2622+-- --
2623+-- GNARL was developed by the GNARL team at Florida State University. -- 2623+-- GNARL was developed by the GNARL team at Florida State University. --
2624+-- Extensive contributions were provided by Ada Core Technologies, Inc. -- 2624+-- Extensive contributions were provided by Ada Core Technologies, Inc. --
2625+-- -- 2625+-- --
2626+------------------------------------------------------------------------------ 2626+------------------------------------------------------------------------------
2627+ 2627+
2628+-- This is a GNU/Linux (GNU/LinuxThreads) version of this package 2628+-- This is a GNU/Linux (GNU/LinuxThreads) version of this package
2629+ 2629+
2630+-- This package encapsulates all direct interfaces to OS services 2630+-- This package encapsulates all direct interfaces to OS services
2631+-- that are needed by the tasking run-time (libgnarl). 2631+-- that are needed by the tasking run-time (libgnarl).
2632+ 2632+
2633+-- PLEASE DO NOT add any with-clauses to this package or remove the pragma 2633+-- PLEASE DO NOT add any with-clauses to this package or remove the pragma
2634+-- Preelaborate. This package is designed to be a bottom-level (leaf) package. 2634+-- Preelaborate. This package is designed to be a bottom-level (leaf) package.
2635+ 2635+
2636+with Ada.Unchecked_Conversion; 2636+with Ada.Unchecked_Conversion;
2637+with Interfaces.C; 2637+with Interfaces.C;
2638+with System.Linux; 2638+with System.Linux;
2639+ 2639+
2640+package System.OS_Interface is 2640+package System.OS_Interface is
2641+ pragma Preelaborate; 2641+ pragma Preelaborate;
2642+ 2642+
2643+ subtype int is Interfaces.C.int; 2643+ subtype int is Interfaces.C.int;
2644+ subtype char is Interfaces.C.char; 2644+ subtype char is Interfaces.C.char;
2645+ subtype short is Interfaces.C.short; 2645+ subtype short is Interfaces.C.short;
2646+ subtype long is Interfaces.C.long; 2646+ subtype long is Interfaces.C.long;
2647+ subtype unsigned is Interfaces.C.unsigned; 2647+ subtype unsigned is Interfaces.C.unsigned;
2648+ subtype unsigned_short is Interfaces.C.unsigned_short; 2648+ subtype unsigned_short is Interfaces.C.unsigned_short;
2649+ subtype unsigned_long is Interfaces.C.unsigned_long; 2649+ subtype unsigned_long is Interfaces.C.unsigned_long;
2650+ subtype unsigned_char is Interfaces.C.unsigned_char; 2650+ subtype unsigned_char is Interfaces.C.unsigned_char;
2651+ subtype plain_char is Interfaces.C.plain_char; 2651+ subtype plain_char is Interfaces.C.plain_char;
2652+ subtype size_t is Interfaces.C.size_t; 2652+ subtype size_t is Interfaces.C.size_t;
2653+ 2653+
2654+ ----------- 2654+ -----------
2655+ -- Errno -- 2655+ -- Errno --
2656+ ----------- 2656+ -----------
2657+ 2657+
2658+ function errno return int; 2658+ function errno return int;
2659+ pragma Import (C, errno, "__get_errno"); 2659+ pragma Import (C, errno, "__get_errno");
2660+ 2660+
2661+ EAGAIN : constant := System.Linux.EAGAIN; 2661+ EAGAIN : constant := System.Linux.EAGAIN;
2662+ EINTR : constant := System.Linux.EINTR; 2662+ EINTR : constant := System.Linux.EINTR;
2663+ EINVAL : constant := System.Linux.EINVAL; 2663+ EINVAL : constant := System.Linux.EINVAL;
2664+ ENOMEM : constant := System.Linux.ENOMEM; 2664+ ENOMEM : constant := System.Linux.ENOMEM;
2665+ EPERM : constant := System.Linux.EPERM; 2665+ EPERM : constant := System.Linux.EPERM;
2666+ ETIMEDOUT : constant := System.Linux.ETIMEDOUT; 2666+ ETIMEDOUT : constant := System.Linux.ETIMEDOUT;
2667+ 2667+
2668+ ------------- 2668+ -------------
2669+ -- Signals -- 2669+ -- Signals --
2670+ ------------- 2670+ -------------
2671+ 2671+
2672+ Max_Interrupt : constant := 63; 2672+ Max_Interrupt : constant := 63;
2673+ type Signal is new int range 0 .. Max_Interrupt; 2673+ type Signal is new int range 0 .. Max_Interrupt;
2674+ for Signal'Size use int'Size; 2674+ for Signal'Size use int'Size;
2675+ 2675+
2676+ SIGHUP : constant := System.Linux.SIGHUP; 2676+ SIGHUP : constant := System.Linux.SIGHUP;
2677+ SIGINT : constant := System.Linux.SIGINT; 2677+ SIGINT : constant := System.Linux.SIGINT;
2678+ SIGQUIT : constant := System.Linux.SIGQUIT; 2678+ SIGQUIT : constant := System.Linux.SIGQUIT;
2679+ SIGILL : constant := System.Linux.SIGILL; 2679+ SIGILL : constant := System.Linux.SIGILL;
2680+ SIGTRAP : constant := System.Linux.SIGTRAP; 2680+ SIGTRAP : constant := System.Linux.SIGTRAP;
2681+ SIGIOT : constant := System.Linux.SIGIOT; 2681+ SIGIOT : constant := System.Linux.SIGIOT;
2682+ SIGABRT : constant := System.Linux.SIGABRT; 2682+ SIGABRT : constant := System.Linux.SIGABRT;
2683+ SIGFPE : constant := System.Linux.SIGFPE; 2683+ SIGFPE : constant := System.Linux.SIGFPE;
2684+ SIGKILL : constant := System.Linux.SIGKILL; 2684+ SIGKILL : constant := System.Linux.SIGKILL;
2685+ SIGBUS : constant := System.Linux.SIGBUS; 2685+ SIGBUS : constant := System.Linux.SIGBUS;
2686+ SIGSEGV : constant := System.Linux.SIGSEGV; 2686+ SIGSEGV : constant := System.Linux.SIGSEGV;
2687+ SIGPIPE : constant := System.Linux.SIGPIPE; 2687+ SIGPIPE : constant := System.Linux.SIGPIPE;
2688+ SIGALRM : constant := System.Linux.SIGALRM; 2688+ SIGALRM : constant := System.Linux.SIGALRM;
2689+ SIGTERM : constant := System.Linux.SIGTERM; 2689+ SIGTERM : constant := System.Linux.SIGTERM;
2690+ SIGUSR1 : constant := System.Linux.SIGUSR1; 2690+ SIGUSR1 : constant := System.Linux.SIGUSR1;
2691+ SIGUSR2 : constant := System.Linux.SIGUSR2; 2691+ SIGUSR2 : constant := System.Linux.SIGUSR2;
2692+ SIGCLD : constant := System.Linux.SIGCLD; 2692+ SIGCLD : constant := System.Linux.SIGCLD;
2693+ SIGCHLD : constant := System.Linux.SIGCHLD; 2693+ SIGCHLD : constant := System.Linux.SIGCHLD;
2694+ SIGPWR : constant := System.Linux.SIGPWR; 2694+ SIGPWR : constant := System.Linux.SIGPWR;
2695+ SIGWINCH : constant := System.Linux.SIGWINCH; 2695+ SIGWINCH : constant := System.Linux.SIGWINCH;
2696+ SIGURG : constant := System.Linux.SIGURG; 2696+ SIGURG : constant := System.Linux.SIGURG;
2697+ SIGPOLL : constant := System.Linux.SIGPOLL; 2697+ SIGPOLL : constant := System.Linux.SIGPOLL;
2698+ SIGIO : constant := System.Linux.SIGIO; 2698+ SIGIO : constant := System.Linux.SIGIO;
2699+ SIGLOST : constant := System.Linux.SIGLOST; 2699+ SIGLOST : constant := System.Linux.SIGLOST;
2700+ SIGSTOP : constant := System.Linux.SIGSTOP; 2700+ SIGSTOP : constant := System.Linux.SIGSTOP;
2701+ SIGTSTP : constant := System.Linux.SIGTSTP; 2701+ SIGTSTP : constant := System.Linux.SIGTSTP;
2702+ SIGCONT : constant := System.Linux.SIGCONT; 2702+ SIGCONT : constant := System.Linux.SIGCONT;
2703+ SIGTTIN : constant := System.Linux.SIGTTIN; 2703+ SIGTTIN : constant := System.Linux.SIGTTIN;
2704+ SIGTTOU : constant := System.Linux.SIGTTOU; 2704+ SIGTTOU : constant := System.Linux.SIGTTOU;
2705+ SIGVTALRM : constant := System.Linux.SIGVTALRM; 2705+ SIGVTALRM : constant := System.Linux.SIGVTALRM;
2706+ SIGPROF : constant := System.Linux.SIGPROF; 2706+ SIGPROF : constant := System.Linux.SIGPROF;
2707+ SIGXCPU : constant := System.Linux.SIGXCPU; 2707+ SIGXCPU : constant := System.Linux.SIGXCPU;
2708+ SIGXFSZ : constant := System.Linux.SIGXFSZ; 2708+ SIGXFSZ : constant := System.Linux.SIGXFSZ;
2709+ SIGUNUSED : constant := System.Linux.SIGUNUSED; 2709+ SIGUNUSED : constant := System.Linux.SIGUNUSED;
2710+ SIGSTKFLT : constant := System.Linux.SIGSTKFLT; 2710+ SIGSTKFLT : constant := System.Linux.SIGSTKFLT;
2711+ SIGLTHRRES : constant := System.Linux.SIGLTHRRES; 2711+ SIGLTHRRES : constant := System.Linux.SIGLTHRRES;
2712+ SIGLTHRCAN : constant := System.Linux.SIGLTHRCAN; 2712+ SIGLTHRCAN : constant := System.Linux.SIGLTHRCAN;
2713+ SIGLTHRDBG : constant := System.Linux.SIGLTHRDBG; 2713+ SIGLTHRDBG : constant := System.Linux.SIGLTHRDBG;
2714+ 2714+
2715+ SIGADAABORT : constant := SIGABRT; 2715+ SIGADAABORT : constant := SIGABRT;
2716+ -- Change this if you want to use another signal for task abort. 2716+ -- Change this if you want to use another signal for task abort.
2717+ -- SIGTERM might be a good one. 2717+ -- SIGTERM might be a good one.
2718+ 2718+
2719+ type Signal_Set is array (Natural range <>) of Signal; 2719+ type Signal_Set is array (Natural range <>) of Signal;
2720+ 2720+
2721+ Unmasked : constant Signal_Set := ( 2721+ Unmasked : constant Signal_Set := (
2722+ SIGTRAP, 2722+ SIGTRAP,
2723+ -- To enable debugging on multithreaded applications, mark SIGTRAP to 2723+ -- To enable debugging on multithreaded applications, mark SIGTRAP to
2724+ -- be kept unmasked. 2724+ -- be kept unmasked.
2725+ 2725+
2726+ SIGBUS, 2726+ SIGBUS,
2727+ 2727+
2728+ SIGTTIN, SIGTTOU, SIGTSTP, 2728+ SIGTTIN, SIGTTOU, SIGTSTP,
2729+ -- Keep these three signals unmasked so that background processes 2729+ -- Keep these three signals unmasked so that background processes
2730+ -- and IO behaves as normal "C" applications 2730+ -- and IO behaves as normal "C" applications
2731+ 2731+
2732+ SIGPROF, 2732+ SIGPROF,
2733+ -- To avoid confusing the profiler 2733+ -- To avoid confusing the profiler
2734+ 2734+
2735+ SIGKILL, SIGSTOP, 2735+ SIGKILL, SIGSTOP,
2736+ -- These two signals actually cannot be masked; 2736+ -- These two signals actually cannot be masked;
2737+ -- POSIX simply won't allow it. 2737+ -- POSIX simply won't allow it.
2738+ 2738+
2739+ SIGLTHRRES, SIGLTHRCAN, SIGLTHRDBG); 2739+ SIGLTHRRES, SIGLTHRCAN, SIGLTHRDBG);
2740+ -- These three signals are used by GNU/LinuxThreads starting from 2740+ -- These three signals are used by GNU/LinuxThreads starting from
2741+ -- glibc 2.1 (future 2.2). 2741+ -- glibc 2.1 (future 2.2).
2742+ 2742+
2743+ Reserved : constant Signal_Set := 2743+ Reserved : constant Signal_Set :=
2744+ -- I am not sure why the following two signals are reserved. 2744+ -- I am not sure why the following two signals are reserved.
2745+ -- I guess they are not supported by this version of GNU/Linux. 2745+ -- I guess they are not supported by this version of GNU/Linux.
2746+ (SIGVTALRM, SIGUNUSED); 2746+ (SIGVTALRM, SIGUNUSED);
2747+ 2747+
2748+ type sigset_t is private; 2748+ type sigset_t is private;
2749+ 2749+
2750+ function sigaddset (set : access sigset_t; sig : Signal) return int; 2750+ function sigaddset (set : access sigset_t; sig : Signal) return int;
2751+ pragma Import (C, sigaddset, "sigaddset"); 2751+ pragma Import (C, sigaddset, "sigaddset");
2752+ 2752+
2753+ function sigdelset (set : access sigset_t; sig : Signal) return int; 2753+ function sigdelset (set : access sigset_t; sig : Signal) return int;
2754+ pragma Import (C, sigdelset, "sigdelset"); 2754+ pragma Import (C, sigdelset, "sigdelset");
2755+ 2755+
2756+ function sigfillset (set : access sigset_t) return int; 2756+ function sigfillset (set : access sigset_t) return int;
2757+ pragma Import (C, sigfillset, "sigfillset"); 2757+ pragma Import (C, sigfillset, "sigfillset");
2758+ 2758+
2759+ function sigismember (set : access sigset_t; sig : Signal) return int; 2759+ function sigismember (set : access sigset_t; sig : Signal) return int;
2760+ pragma Import (C, sigismember, "sigismember"); 2760+ pragma Import (C, sigismember, "sigismember");
2761+ 2761+
2762+ function sigemptyset (set : access sigset_t) return int; 2762+ function sigemptyset (set : access sigset_t) return int;
2763+ pragma Import (C, sigemptyset, "sigemptyset"); 2763+ pragma Import (C, sigemptyset, "sigemptyset");
2764+ 2764+
2765+ type union_type_3 is new String (1 .. 116); 2765+ type union_type_3 is new String (1 .. 116);
2766+ type siginfo_t is record 2766+ type siginfo_t is record
2767+ si_signo : int; 2767+ si_signo : int;
2768+ si_code : int; 2768+ si_code : int;
2769+ si_errno : int; 2769+ si_errno : int;
2770+ X_data : union_type_3; 2770+ X_data : union_type_3;
2771+ end record; 2771+ end record;
2772+ pragma Convention (C, siginfo_t); 2772+ pragma Convention (C, siginfo_t);
2773+ 2773+
2774+ type struct_sigaction is record 2774+ type struct_sigaction is record
2775+ sa_handler : System.Address; 2775+ sa_handler : System.Address;
2776+ sa_mask : sigset_t; 2776+ sa_mask : sigset_t;
2777+ sa_flags : Interfaces.C.unsigned_long; 2777+ sa_flags : Interfaces.C.unsigned_long;
2778+ sa_restorer : System.Address; 2778+ sa_restorer : System.Address;
2779+ end record; 2779+ end record;
2780+ pragma Convention (C, struct_sigaction); 2780+ pragma Convention (C, struct_sigaction);
2781+ 2781+
2782+ type struct_sigaction_ptr is access all struct_sigaction; 2782+ type struct_sigaction_ptr is access all struct_sigaction;
2783+ 2783+
2784+ type Machine_State is record 2784+ type Machine_State is record
2785+ eip : unsigned_long; 2785+ eip : unsigned_long;
2786+ ebx : unsigned_long; 2786+ ebx : unsigned_long;
2787+ esp : unsigned_long; 2787+ esp : unsigned_long;
2788+ ebp : unsigned_long; 2788+ ebp : unsigned_long;
2789+ esi : unsigned_long; 2789+ esi : unsigned_long;
2790+ edi : unsigned_long; 2790+ edi : unsigned_long;
2791+ end record; 2791+ end record;
2792+ type Machine_State_Ptr is access all Machine_State; 2792+ type Machine_State_Ptr is access all Machine_State;
2793+ 2793+
2794+ SA_SIGINFO : constant := System.Linux.SA_SIGINFO; 2794+ SA_SIGINFO : constant := System.Linux.SA_SIGINFO;
2795+ SA_ONSTACK : constant := System.Linux.SA_ONSTACK; 2795+ SA_ONSTACK : constant := System.Linux.SA_ONSTACK;
2796+ 2796+
2797+ SIG_BLOCK : constant := 0; 2797+ SIG_BLOCK : constant := 0;
2798+ SIG_UNBLOCK : constant := 1; 2798+ SIG_UNBLOCK : constant := 1;
2799+ SIG_SETMASK : constant := 2; 2799+ SIG_SETMASK : constant := 2;
2800+ 2800+
2801+ SIG_DFL : constant := 0; 2801+ SIG_DFL : constant := 0;
2802+ SIG_IGN : constant := 1; 2802+ SIG_IGN : constant := 1;
2803+ 2803+
2804+ function sigaction 2804+ function sigaction
2805+ (sig : Signal; 2805+ (sig : Signal;
2806+ act : struct_sigaction_ptr; 2806+ act : struct_sigaction_ptr;
2807+ oact : struct_sigaction_ptr) return int; 2807+ oact : struct_sigaction_ptr) return int;
2808+ pragma Import (C, sigaction, "sigaction"); 2808+ pragma Import (C, sigaction, "sigaction");
2809+ 2809+
2810+ ---------- 2810+ ----------
2811+ -- Time -- 2811+ -- Time --
2812+ ---------- 2812+ ----------
2813+ 2813+
2814+ type timespec is private; 2814+ type timespec is private;
2815+ 2815+
2816+ function To_Duration (TS : timespec) return Duration; 2816+ function To_Duration (TS : timespec) return Duration;
2817+ pragma Inline (To_Duration); 2817+ pragma Inline (To_Duration);
2818+ 2818+
2819+ function To_Timespec (D : Duration) return timespec; 2819+ function To_Timespec (D : Duration) return timespec;
2820+ pragma Inline (To_Timespec); 2820+ pragma Inline (To_Timespec);
2821+ 2821+
2822+ function sysconf (name : int) return long; 2822+ function sysconf (name : int) return long;
2823+ pragma Import (C, sysconf); 2823+ pragma Import (C, sysconf);
2824+ 2824+
2825+ SC_CLK_TCK : constant := 2; 2825+ SC_CLK_TCK : constant := 2;
2826+ SC_NPROCESSORS_ONLN : constant := 84; 2826+ SC_NPROCESSORS_ONLN : constant := 84;
2827+ 2827+
2828+ ------------------------- 2828+ -------------------------
2829+ -- Priority Scheduling -- 2829+ -- Priority Scheduling --
2830+ ------------------------- 2830+ -------------------------
2831+ 2831+
2832+ SCHED_OTHER : constant := 0; 2832+ SCHED_OTHER : constant := 0;
2833+ SCHED_FIFO : constant := 1; 2833+ SCHED_FIFO : constant := 1;
2834+ SCHED_RR : constant := 2; 2834+ SCHED_RR : constant := 2;
2835+ 2835+
2836+ function To_Target_Priority 2836+ function To_Target_Priority
2837+ (Prio : System.Any_Priority) return Interfaces.C.int; 2837+ (Prio : System.Any_Priority) return Interfaces.C.int;
2838+ -- Maps System.Any_Priority to a POSIX priority 2838+ -- Maps System.Any_Priority to a POSIX priority
2839+ 2839+
2840+ ------------- 2840+ -------------
2841+ -- Process -- 2841+ -- Process --
2842+ ------------- 2842+ -------------
2843+ 2843+
2844+ type pid_t is private; 2844+ type pid_t is private;
2845+ 2845+
2846+ function kill (pid : pid_t; sig : Signal) return int; 2846+ function kill (pid : pid_t; sig : Signal) return int;
2847+ pragma Import (C, kill, "kill"); 2847+ pragma Import (C, kill, "kill");
2848+ 2848+
2849+ function getpid return pid_t; 2849+ function getpid return pid_t;
2850+ pragma Import (C, getpid, "getpid"); 2850+ pragma Import (C, getpid, "getpid");
2851+ 2851+
2852+ ------------- 2852+ -------------
2853+ -- Threads -- 2853+ -- Threads --
2854+ ------------- 2854+ -------------
2855+ 2855+
2856+ type Thread_Body is access 2856+ type Thread_Body is access
2857+ function (arg : System.Address) return System.Address; 2857+ function (arg : System.Address) return System.Address;
2858+ pragma Convention (C, Thread_Body); 2858+ pragma Convention (C, Thread_Body);
2859+ 2859+
2860+ function Thread_Body_Access is new 2860+ function Thread_Body_Access is new
2861+ Ada.Unchecked_Conversion (System.Address, Thread_Body); 2861+ Ada.Unchecked_Conversion (System.Address, Thread_Body);
2862+ 2862+
2863+ type pthread_t is new unsigned_long; 2863+ type pthread_t is new unsigned_long;
2864+ subtype Thread_Id is pthread_t; 2864+ subtype Thread_Id is pthread_t;
2865+ 2865+
2866+ function To_pthread_t is new Ada.Unchecked_Conversion 2866+ function To_pthread_t is new Ada.Unchecked_Conversion
2867+ (unsigned_long, pthread_t); 2867+ (unsigned_long, pthread_t);
2868+ 2868+
2869+ type pthread_mutex_t is limited private; 2869+ type pthread_mutex_t is limited private;
2870+ type pthread_cond_t is limited private; 2870+ type pthread_cond_t is limited private;
2871+ type pthread_attr_t is limited private; 2871+ type pthread_attr_t is limited private;
2872+ type pthread_mutexattr_t is limited private; 2872+ type pthread_mutexattr_t is limited private;
2873+ type pthread_condattr_t is limited private; 2873+ type pthread_condattr_t is limited private;
2874+ type pthread_key_t is private; 2874+ type pthread_key_t is private;
2875+ 2875+
2876+ PTHREAD_CREATE_DETACHED : constant := 1; 2876+ PTHREAD_CREATE_DETACHED : constant := 1;
2877+ 2877+
2878+ ----------- 2878+ -----------
2879+ -- Stack -- 2879+ -- Stack --
2880+ ----------- 2880+ -----------
2881+ 2881+
2882+ type stack_t is record 2882+ type stack_t is record
2883+ ss_sp : System.Address; 2883+ ss_sp : System.Address;
2884+ ss_flags : int; 2884+ ss_flags : int;
2885+ ss_size : size_t; 2885+ ss_size : size_t;
2886+ end record; 2886+ end record;
2887+ pragma Convention (C, stack_t); 2887+ pragma Convention (C, stack_t);
2888+ 2888+
2889+ function sigaltstack 2889+ function sigaltstack
2890+ (ss : not null access stack_t; 2890+ (ss : not null access stack_t;
2891+ oss : access stack_t) return int; 2891+ oss : access stack_t) return int;
2892+ pragma Import (C, sigaltstack, "sigaltstack"); 2892+ pragma Import (C, sigaltstack, "sigaltstack");
2893+ 2893+
2894+ Alternate_Stack : aliased System.Address; 2894+ Alternate_Stack : aliased System.Address;
2895+ pragma Import (C, Alternate_Stack, "__gnat_alternate_stack"); 2895+ pragma Import (C, Alternate_Stack, "__gnat_alternate_stack");
2896+ -- The alternate signal stack for stack overflows 2896+ -- The alternate signal stack for stack overflows
2897+ 2897+
2898+ Alternate_Stack_Size : constant := 16 * 1024; 2898+ Alternate_Stack_Size : constant := 16 * 1024;
2899+ -- This must be in keeping with init.c:__gnat_alternate_stack 2899+ -- This must be in keeping with init.c:__gnat_alternate_stack
2900+ 2900+
2901+ function Get_Stack_Base (thread : pthread_t) return Address; 2901+ function Get_Stack_Base (thread : pthread_t) return Address;
2902+ pragma Inline (Get_Stack_Base); 2902+ pragma Inline (Get_Stack_Base);
2903+ -- This is a dummy procedure to share some GNULLI files 2903+ -- This is a dummy procedure to share some GNULLI files
2904+ 2904+
2905+ --------------------------------------- 2905+ ---------------------------------------
2906+ -- Nonstandard Thread Initialization -- 2906+ -- Nonstandard Thread Initialization --
2907+ --------------------------------------- 2907+ ---------------------------------------
2908+ 2908+
2909+ procedure pthread_init; 2909+ procedure pthread_init;
2910+ pragma Inline (pthread_init); 2910+ pragma Inline (pthread_init);
2911+ -- This is a dummy procedure to share some GNULLI files 2911+ -- This is a dummy procedure to share some GNULLI files
2912+ 2912+
2913+ ------------------------- 2913+ -------------------------
2914+ -- POSIX.1c Section 3 -- 2914+ -- POSIX.1c Section 3 --
2915+ ------------------------- 2915+ -------------------------
2916+ 2916+
2917+ function sigwait (set : access sigset_t; sig : access Signal) return int; 2917+ function sigwait (set : access sigset_t; sig : access Signal) return int;
2918+ pragma Import (C, sigwait, "sigwait"); 2918+ pragma Import (C, sigwait, "sigwait");
2919+ 2919+
2920+ function pthread_kill (thread : pthread_t; sig : Signal) return int; 2920+ function pthread_kill (thread : pthread_t; sig : Signal) return int;
2921+ pragma Import (C, pthread_kill, "pthread_kill"); 2921+ pragma Import (C, pthread_kill, "pthread_kill");
2922+ 2922+
2923+ function pthread_sigmask 2923+ function pthread_sigmask
2924+ (how : int; 2924+ (how : int;
2925+ set : access sigset_t; 2925+ set : access sigset_t;
2926+ oset : access sigset_t) return int; 2926+ oset : access sigset_t) return int;
2927+ pragma Import (C, pthread_sigmask, "pthread_sigmask"); 2927+ pragma Import (C, pthread_sigmask, "pthread_sigmask");
2928+ 2928+
2929+ -------------------------- 2929+ --------------------------
2930+ -- POSIX.1c Section 11 -- 2930+ -- POSIX.1c Section 11 --
2931+ -------------------------- 2931+ --------------------------
2932+ 2932+
2933+ function pthread_mutexattr_init 2933+ function pthread_mutexattr_init
2934+ (attr : access pthread_mutexattr_t) return int; 2934+ (attr : access pthread_mutexattr_t) return int;
2935+ pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init"); 2935+ pragma Import (C, pthread_mutexattr_init, "pthread_mutexattr_init");
2936+ 2936+
2937+ function pthread_mutexattr_destroy 2937+ function pthread_mutexattr_destroy
2938+ (attr : access pthread_mutexattr_t) return int; 2938+ (attr : access pthread_mutexattr_t) return int;
2939+ pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy"); 2939+ pragma Import (C, pthread_mutexattr_destroy, "pthread_mutexattr_destroy");
2940+ 2940+
2941+ function pthread_mutex_init 2941+ function pthread_mutex_init
2942+ (mutex : access pthread_mutex_t; 2942+ (mutex : access pthread_mutex_t;
2943+ attr : access pthread_mutexattr_t) return int; 2943+ attr : access pthread_mutexattr_t) return int;
2944+ pragma Import (C, pthread_mutex_init, "pthread_mutex_init"); 2944+ pragma Import (C, pthread_mutex_init, "pthread_mutex_init");
2945+ 2945+
2946+ function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int; 2946+ function pthread_mutex_destroy (mutex : access pthread_mutex_t) return int;
2947+ pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy"); 2947+ pragma Import (C, pthread_mutex_destroy, "pthread_mutex_destroy");
2948+ 2948+
2949+ function pthread_mutex_lock (mutex : access pthread_mutex_t) return int; 2949+ function pthread_mutex_lock (mutex : access pthread_mutex_t) return int;
2950+ pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock"); 2950+ pragma Import (C, pthread_mutex_lock, "pthread_mutex_lock");
2951+ 2951+
2952+ function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int; 2952+ function pthread_mutex_unlock (mutex : access pthread_mutex_t) return int;
2953+ pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock"); 2953+ pragma Import (C, pthread_mutex_unlock, "pthread_mutex_unlock");
2954+ 2954+
2955+ function pthread_condattr_init 2955+ function pthread_condattr_init
2956+ (attr : access pthread_condattr_t) return int; 2956+ (attr : access pthread_condattr_t) return int;
2957+ pragma Import (C, pthread_condattr_init, "pthread_condattr_init"); 2957+ pragma Import (C, pthread_condattr_init, "pthread_condattr_init");
2958+ 2958+
2959+ function pthread_condattr_destroy 2959+ function pthread_condattr_destroy
2960+ (attr : access pthread_condattr_t) return int; 2960+ (attr : access pthread_condattr_t) return int;
2961+ pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy"); 2961+ pragma Import (C, pthread_condattr_destroy, "pthread_condattr_destroy");
2962+ 2962+
2963+ function pthread_cond_init 2963+ function pthread_cond_init
2964+ (cond : access pthread_cond_t; 2964+ (cond : access pthread_cond_t;
2965+ attr : access pthread_condattr_t) return int; 2965+ attr : access pthread_condattr_t) return int;
2966+ pragma Import (C, pthread_cond_init, "pthread_cond_init"); 2966+ pragma Import (C, pthread_cond_init, "pthread_cond_init");
2967+ 2967+
2968+ function pthread_cond_destroy (cond : access pthread_cond_t) return int; 2968+ function pthread_cond_destroy (cond : access pthread_cond_t) return int;
2969+ pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy"); 2969+ pragma Import (C, pthread_cond_destroy, "pthread_cond_destroy");
2970+ 2970+
2971+ function pthread_cond_signal (cond : access pthread_cond_t) return int; 2971+ function pthread_cond_signal (cond : access pthread_cond_t) return int;
2972+ pragma Import (C, pthread_cond_signal, "pthread_cond_signal"); 2972+ pragma Import (C, pthread_cond_signal, "pthread_cond_signal");
2973+ 2973+
2974+ function pthread_cond_wait 2974+ function pthread_cond_wait
2975+ (cond : access pthread_cond_t; 2975+ (cond : access pthread_cond_t;
2976+ mutex : access pthread_mutex_t) return int; 2976+ mutex : access pthread_mutex_t) return int;
2977+ pragma Import (C, pthread_cond_wait, "pthread_cond_wait"); 2977+ pragma Import (C, pthread_cond_wait, "pthread_cond_wait");
2978+ 2978+
2979+ function pthread_cond_timedwait 2979+ function pthread_cond_timedwait
2980+ (cond : access pthread_cond_t; 2980+ (cond : access pthread_cond_t;
2981+ mutex : access pthread_mutex_t; 2981+ mutex : access pthread_mutex_t;
2982+ abstime : access timespec) return int; 2982+ abstime : access timespec) return int;
2983+ pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait"); 2983+ pragma Import (C, pthread_cond_timedwait, "pthread_cond_timedwait");
2984+ 2984+
2985+ -------------------------- 2985+ --------------------------
2986+ -- POSIX.1c Section 13 -- 2986+ -- POSIX.1c Section 13 --
2987+ -------------------------- 2987+ --------------------------
2988+ 2988+
2989+ type struct_sched_param is record 2989+ type struct_sched_param is record
2990+ sched_priority : int; -- scheduling priority 2990+ sched_priority : int; -- scheduling priority
2991+ end record; 2991+ end record;
2992+ pragma Convention (C, struct_sched_param); 2992+ pragma Convention (C, struct_sched_param);
2993+ 2993+
2994+ function pthread_setschedparam 2994+ function pthread_setschedparam
2995+ (thread : pthread_t; 2995+ (thread : pthread_t;
2996+ policy : int; 2996+ policy : int;
2997+ param : access struct_sched_param) return int; 2997+ param : access struct_sched_param) return int;
2998+ pragma Import (C, pthread_setschedparam, "pthread_setschedparam"); 2998+ pragma Import (C, pthread_setschedparam, "pthread_setschedparam");
2999+ 2999+
3000+ function pthread_attr_setschedpolicy 3000+ function pthread_attr_setschedpolicy
3001+ (attr : access pthread_attr_t; 3001+ (attr : access pthread_attr_t;
3002+ policy : int) return int; 3002+ policy : int) return int;
3003+ pragma Import 3003+ pragma Import
3004+ (C, pthread_attr_setschedpolicy, "pthread_attr_setschedpolicy"); 3004+ (C, pthread_attr_setschedpolicy, "pthread_attr_setschedpolicy");
3005+ 3005+
3006+ function sched_yield return int; 3006+ function sched_yield return int;
3007+ pragma Import (C, sched_yield, "sched_yield"); 3007+ pragma Import (C, sched_yield, "sched_yield");
3008+ 3008+
3009+ --------------------------- 3009+ ---------------------------
3010+ -- P1003.1c - Section 16 -- 3010+ -- P1003.1c - Section 16 --
3011+ --------------------------- 3011+ ---------------------------
3012+ 3012+
3013+ function pthread_attr_init 3013+ function pthread_attr_init
3014+ (attributes : access pthread_attr_t) return int; 3014+ (attributes : access pthread_attr_t) return int;
3015+ pragma Import (C, pthread_attr_init, "pthread_attr_init"); 3015+ pragma Import (C, pthread_attr_init, "pthread_attr_init");
3016+ 3016+
3017+ function pthread_attr_destroy 3017+ function pthread_attr_destroy
3018+ (attributes : access pthread_attr_t) return int; 3018+ (attributes : access pthread_attr_t) return int;
3019+ pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy"); 3019+ pragma Import (C, pthread_attr_destroy, "pthread_attr_destroy");
3020+ 3020+
3021+ function pthread_attr_setdetachstate 3021+ function pthread_attr_setdetachstate
3022+ (attr : access pthread_attr_t; 3022+ (attr : access pthread_attr_t;
3023+ detachstate : int) return int; 3023+ detachstate : int) return int;
3024+ pragma Import 3024+ pragma Import
3025+ (C, pthread_attr_setdetachstate, "pthread_attr_setdetachstate"); 3025+ (C, pthread_attr_setdetachstate, "pthread_attr_setdetachstate");
3026+ 3026+
3027+ function pthread_attr_setstacksize 3027+ function pthread_attr_setstacksize
3028+ (attr : access pthread_attr_t; 3028+ (attr : access pthread_attr_t;
3029+ stacksize : size_t) return int; 3029+ stacksize : size_t) return int;
3030+ pragma Import (C, pthread_attr_setstacksize, "pthread_attr_setstacksize"); 3030+ pragma Import (C, pthread_attr_setstacksize, "pthread_attr_setstacksize");
3031+ 3031+
3032+ function pthread_create 3032+ function pthread_create
3033+ (thread : access pthread_t; 3033+ (thread : access pthread_t;
3034+ attributes : access pthread_attr_t; 3034+ attributes : access pthread_attr_t;
3035+ start_routine : Thread_Body; 3035+ start_routine : Thread_Body;
3036+ arg : System.Address) return int; 3036+ arg : System.Address) return int;
3037+ pragma Import (C, pthread_create, "pthread_create"); 3037+ pragma Import (C, pthread_create, "pthread_create");
3038+ 3038+
3039+ procedure pthread_exit (status : System.Address); 3039+ procedure pthread_exit (status : System.Address);
3040+ pragma Import (C, pthread_exit, "pthread_exit"); 3040+ pragma Import (C, pthread_exit, "pthread_exit");
3041+ 3041+
3042+ function pthread_self return pthread_t; 3042+ function pthread_self return pthread_t;
3043+ pragma Import (C, pthread_self, "pthread_self"); 3043+ pragma Import (C, pthread_self, "pthread_self");
3044+ 3044+
3045+ function lwp_self return System.Address; 3045+ function lwp_self return System.Address;
3046+ pragma Import (C, lwp_self, "__gnat_lwp_self"); 3046+ pragma Import (C, lwp_self, "__gnat_lwp_self");
3047+ 3047+
3048+ -------------------------- 3048+ --------------------------
3049+ -- POSIX.1c Section 17 -- 3049+ -- POSIX.1c Section 17 --
3050+ -------------------------- 3050+ --------------------------
3051+ 3051+
3052+ function pthread_setspecific 3052+ function pthread_setspecific
3053+ (key : pthread_key_t; 3053+ (key : pthread_key_t;
3054+ value : System.Address) return int; 3054+ value : System.Address) return int;
3055+ pragma Import (C, pthread_setspecific, "pthread_setspecific"); 3055+ pragma Import (C, pthread_setspecific, "pthread_setspecific");
3056+ 3056+
3057+ function pthread_getspecific (key : pthread_key_t) return System.Address; 3057+ function pthread_getspecific (key : pthread_key_t) return System.Address;
3058+ pragma Import (C, pthread_getspecific, "pthread_getspecific"); 3058+ pragma Import (C, pthread_getspecific, "pthread_getspecific");
3059+ 3059+
3060+ type destructor_pointer is access procedure (arg : System.Address); 3060+ type destructor_pointer is access procedure (arg : System.Address);
3061+ pragma Convention (C, destructor_pointer); 3061+ pragma Convention (C, destructor_pointer);
3062+ 3062+
3063+ function pthread_key_create 3063+ function pthread_key_create
3064+ (key : access pthread_key_t; 3064+ (key : access pthread_key_t;
3065+ destructor : destructor_pointer) return int; 3065+ destructor : destructor_pointer) return int;
3066+ pragma Import (C, pthread_key_create, "pthread_key_create"); 3066+ pragma Import (C, pthread_key_create, "pthread_key_create");
3067+ 3067+
3068+ CPU_SETSIZE : constant := 1_024; 3068+ CPU_SETSIZE : constant := 1_024;
3069+ 3069+
3070+ type bit_field is array (1 .. CPU_SETSIZE) of Boolean; 3070+ type bit_field is array (1 .. CPU_SETSIZE) of Boolean;
3071+ for bit_field'Size use CPU_SETSIZE; 3071+ for bit_field'Size use CPU_SETSIZE;
3072+ pragma Pack (bit_field); 3072+ pragma Pack (bit_field);
3073+ pragma Convention (C, bit_field); 3073+ pragma Convention (C, bit_field);
3074+ 3074+
3075+ type cpu_set_t is record 3075+ type cpu_set_t is record
3076+ bits : bit_field; 3076+ bits : bit_field;
3077+ end record; 3077+ end record;
3078+ pragma Convention (C, cpu_set_t); 3078+ pragma Convention (C, cpu_set_t);
3079+ 3079+
3080+ function pthread_setaffinity_np 3080+ function pthread_setaffinity_np
3081+ (thread : pthread_t; 3081+ (thread : pthread_t;
3082+ cpusetsize : size_t; 3082+ cpusetsize : size_t;
3083+ cpuset : access cpu_set_t) return int; 3083+ cpuset : access cpu_set_t) return int;
3084+ pragma Import (C, pthread_setaffinity_np, "pthread_setaffinity_np"); 3084+ pragma Import (C, pthread_setaffinity_np, "pthread_setaffinity_np");
3085+ pragma Weak_External (pthread_setaffinity_np); 3085+ pragma Weak_External (pthread_setaffinity_np);
3086+ -- Use a weak symbol because this function may be available or not, 3086+ -- Use a weak symbol because this function may be available or not,
3087+ -- depending on the version of the system. 3087+ -- depending on the version of the system.
3088+ 3088+
3089+ function pthread_attr_setaffinity_np 3089+ function pthread_attr_setaffinity_np
3090+ (attr : access pthread_attr_t; 3090+ (attr : access pthread_attr_t;
3091+ cpusetsize : size_t; 3091+ cpusetsize : size_t;
3092+ cpuset : access cpu_set_t) return int; 3092+ cpuset : access cpu_set_t) return int;
3093+ pragma Import (C, pthread_attr_setaffinity_np, 3093+ pragma Import (C, pthread_attr_setaffinity_np,
3094+ "pthread_attr_setaffinity_np"); 3094+ "pthread_attr_setaffinity_np");
3095+ pragma Weak_External (pthread_attr_setaffinity_np); 3095+ pragma Weak_External (pthread_attr_setaffinity_np);
3096+ -- Use a weak symbol because this function may be available or not, 3096+ -- Use a weak symbol because this function may be available or not,
3097+ -- depending on the version of the system. 3097+ -- depending on the version of the system.
3098+ 3098+
3099+private 3099+private
3100+ 3100+
3101+ type sigset_t is array (0 .. 127) of unsigned_char; 3101+ type sigset_t is array (0 .. 127) of unsigned_char;
3102+ pragma Convention (C, sigset_t); 3102+ pragma Convention (C, sigset_t);
3103+ for sigset_t'Alignment use Interfaces.C.unsigned_long'Alignment; 3103+ for sigset_t'Alignment use Interfaces.C.unsigned_long'Alignment;
3104+ 3104+
3105+ pragma Warnings (Off); 3105+ pragma Warnings (Off);
3106+ for struct_sigaction use record 3106+ for struct_sigaction use record
3107+ sa_handler at Linux.sa_handler_pos range 0 .. Standard'Address_Size - 1; 3107+ sa_handler at Linux.sa_handler_pos range 0 .. Standard'Address_Size - 1;
3108+ sa_mask at Linux.sa_mask_pos range 0 .. 1023; 3108+ sa_mask at Linux.sa_mask_pos range 0 .. 1023;
3109+ sa_flags at Linux.sa_flags_pos range 0 .. Standard'Address_Size - 1; 3109+ sa_flags at Linux.sa_flags_pos range 0 .. Standard'Address_Size - 1;
3110+ end record; 3110+ end record;
3111+ -- We intentionally leave sa_restorer unspecified and let the compiler 3111+ -- We intentionally leave sa_restorer unspecified and let the compiler
3112+ -- append it after the last field, so disable corresponding warning. 3112+ -- append it after the last field, so disable corresponding warning.
3113+ pragma Warnings (On); 3113+ pragma Warnings (On);
3114+ 3114+
3115+ type pid_t is new int; 3115+ type pid_t is new int;
3116+ 3116+
3117+ type time_t is new long; 3117+ type time_t is new long;
3118+ 3118+
3119+ type timespec is record 3119+ type timespec is record
3120+ tv_sec : time_t; 3120+ tv_sec : time_t;
3121+ tv_nsec : long; 3121+ tv_nsec : long;
3122+ end record; 3122+ end record;
3123+ pragma Convention (C, timespec); 3123+ pragma Convention (C, timespec);
3124+ 3124+
3125+ type pthread_attr_t is record 3125+ type pthread_attr_t is record
3126+ detachstate : int; 3126+ detachstate : int;
3127+ schedpolicy : int; 3127+ schedpolicy : int;
3128+ schedparam : struct_sched_param; 3128+ schedparam : struct_sched_param;
3129+ inheritsched : int; 3129+ inheritsched : int;
3130+ scope : int; 3130+ scope : int;
3131+ guardsize : size_t; 3131+ guardsize : size_t;
3132+ stackaddr_set : int; 3132+ stackaddr_set : int;
3133+ stackaddr : System.Address; 3133+ stackaddr : System.Address;
3134+ stacksize : size_t; 3134+ stacksize : size_t;
3135+ end record; 3135+ end record;
3136+ pragma Convention (C, pthread_attr_t); 3136+ pragma Convention (C, pthread_attr_t);
3137+ 3137+
3138+ type pthread_condattr_t is record 3138+ type pthread_condattr_t is record
3139+ dummy : int; 3139+ dummy : int;
3140+ end record; 3140+ end record;
3141+ pragma Convention (C, pthread_condattr_t); 3141+ pragma Convention (C, pthread_condattr_t);
3142+ 3142+
3143+ type pthread_mutexattr_t is record 3143+ type pthread_mutexattr_t is record
3144+ mutexkind : int; 3144+ mutexkind : int;
3145+ end record; 3145+ end record;
3146+ pragma Convention (C, pthread_mutexattr_t); 3146+ pragma Convention (C, pthread_mutexattr_t);
3147+ 3147+
3148+ type pthread_mutex_t is new System.Linux.pthread_mutex_t; 3148+ type pthread_mutex_t is new System.Linux.pthread_mutex_t;
3149+ 3149+
3150+ type unsigned_long_long_t is mod 2 ** 64; 3150+ type unsigned_long_long_t is mod 2 ** 64;
3151+ -- Interfaces.C.Extensions isn't preelaborated so cannot be with-ed 3151+ -- Interfaces.C.Extensions isn't preelaborated so cannot be with-ed
3152+ 3152+
3153+ type pthread_cond_t is array (0 .. 47) of unsigned_char; 3153+ type pthread_cond_t is array (0 .. 47) of unsigned_char;
3154+ pragma Convention (C, pthread_cond_t); 3154+ pragma Convention (C, pthread_cond_t);
3155+ for pthread_cond_t'Alignment use unsigned_long_long_t'Alignment; 3155+ for pthread_cond_t'Alignment use unsigned_long_long_t'Alignment;
3156+ 3156+
3157+ type pthread_key_t is new unsigned; 3157+ type pthread_key_t is new unsigned;
3158+ 3158+
3159+end System.OS_Interface; 3159+end System.OS_Interface;
3160--- /dev/null 3160--- /dev/null
3161+++ gcc/ada/s-osinte-dragonfly.adb 3161+++ gcc/ada/s-osinte-dragonfly.adb
3162@@ -0,0 +1,117 @@ 3162@@ -0,0 +1,117 @@
3163+------------------------------------------------------------------------------ 3163+------------------------------------------------------------------------------
3164+-- -- 3164+-- --
3165+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- 3165+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
3166+-- -- 3166+-- --
3167+-- S Y S T E M . O S _ I N T E R F A C E -- 3167+-- S Y S T E M . O S _ I N T E R F A C E --
3168+-- -- 3168+-- --
3169+-- B o d y -- 3169+-- B o d y --
3170+-- -- 3170+-- --
3171+-- Copyright (C) 1991-2009, Free Software Foundation, Inc. -- 3171+-- Copyright (C) 1991-2009, Free Software Foundation, Inc. --
3172+-- -- 3172+-- --
3173+-- GNARL is free software; you can redistribute it and/or modify it under -- 3173+-- GNARL is free software; you can redistribute it and/or modify it under --
3174+-- terms of the GNU General Public License as published by the Free Soft- -- 3174+-- terms of the GNU General Public License as published by the Free Soft- --
3175+-- ware Foundation; either version 3, or (at your option) any later ver- -- 3175+-- ware Foundation; either version 3, or (at your option) any later ver- --
3176+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- 3176+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
3177+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- 3177+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
3178+-- or FITNESS FOR A PARTICULAR PURPOSE. -- 3178+-- or FITNESS FOR A PARTICULAR PURPOSE. --
3179+-- -- 3179+-- --
3180+-- As a special exception under Section 7 of GPL version 3, you are granted -- 3180+-- As a special exception under Section 7 of GPL version 3, you are granted --
3181+-- additional permissions described in the GCC Runtime Library Exception, -- 3181+-- additional permissions described in the GCC Runtime Library Exception, --
3182+-- version 3.1, as published by the Free Software Foundation. -- 3182+-- version 3.1, as published by the Free Software Foundation. --
3183+-- -- 3183+-- --
3184+-- You should have received a copy of the GNU General Public License and -- 3184+-- You should have received a copy of the GNU General Public License and --
3185+-- a copy of the GCC Runtime Library Exception along with this program; -- 3185+-- a copy of the GCC Runtime Library Exception along with this program; --
3186+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -- 3186+-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
3187+-- <http://www.gnu.org/licenses/>. -- 3187+-- <http://www.gnu.org/licenses/>. --
3188+-- -- 3188+-- --
3189+-- GNARL was developed by the GNARL team at Florida State University. It is -- 3189+-- GNARL was developed by the GNARL team at Florida State University. It is --
3190+-- now maintained by Ada Core Technologies Inc. in cooperation with Florida -- 3190+-- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
3191+-- State University (http://www.gnat.com). -- 3191+-- State University (http://www.gnat.com). --
3192+-- -- 3192+-- --
3193+-- Copyright (C) 2010 John Marino <draco@marino.st> -- 3193+-- Copyright (C) 2010 John Marino <draco@marino.st> --
3194+------------------------------------------------------------------------------ 3194+------------------------------------------------------------------------------
3195+ 3195+
3196+-- This is the DragonFly THREADS version of this package 3196+-- This is the DragonFly THREADS version of this package
3197+ 3197+
3198+with Interfaces.C; use Interfaces.C; 3198+with Interfaces.C; use Interfaces.C;
3199+ 3199+
3200+package body System.OS_Interface is 3200+package body System.OS_Interface is
3201+ 3201+
3202+ ----------- 3202+ -----------
3203+ -- Errno -- 3203+ -- Errno --
3204+ ----------- 3204+ -----------
3205+ 3205+
3206+ function Errno return int is 3206+ function Errno return int is
3207+ type int_ptr is access all int; 3207+ type int_ptr is access all int;
3208+ 3208+
3209+ function internal_errno return int_ptr; 3209+ function internal_errno return int_ptr;
3210+ pragma Import (C, internal_errno, "__get_errno"); 3210+ pragma Import (C, internal_errno, "__get_errno");
3211+ 3211+
3212+ begin 3212+ begin
3213+ return (internal_errno.all); 3213+ return (internal_errno.all);
3214+ end Errno; 3214+ end Errno;
3215+ 3215+
3216+ -------------------- 3216+ --------------------
3217+ -- Get_Stack_Base -- 3217+ -- Get_Stack_Base --
3218+ -------------------- 3218+ --------------------
3219+ 3219+
3220+ function Get_Stack_Base (thread : pthread_t) return Address is 3220+ function Get_Stack_Base (thread : pthread_t) return Address is
3221+ pragma Unreferenced (thread); 3221+ pragma Unreferenced (thread);
3222+ begin 3222+ begin
3223+ return Null_Address; 3223+ return Null_Address;
3224+ end Get_Stack_Base; 3224+ end Get_Stack_Base;
3225+ 3225+
3226+ ------------------ 3226+ ------------------
3227+ -- pthread_init -- 3227+ -- pthread_init --
3228+ ------------------ 3228+ ------------------
3229+ 3229+
3230+ procedure pthread_init is 3230+ procedure pthread_init is
3231+ begin 3231+ begin
3232+ null; 3232+ null;
3233+ end pthread_init; 3233+ end pthread_init;
3234+ 3234+
3235+ ----------------- 3235+ -----------------
3236+ -- To_Duration -- 3236+ -- To_Duration --
3237+ ----------------- 3237+ -----------------
3238+ 3238+
3239+ function To_Duration (TS : timespec) return Duration is 3239+ function To_Duration (TS : timespec) return Duration is
3240+ begin 3240+ begin
3241+ return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9; 3241+ return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9;
3242+ end To_Duration; 3242+ end To_Duration;
3243+ 3243+
3244+ ------------------------ 3244+ ------------------------
3245+ -- To_Target_Priority -- 3245+ -- To_Target_Priority --
3246+ ------------------------ 3246+ ------------------------
3247+ 3247+
3248+ function To_Target_Priority 3248+ function To_Target_Priority
3249+ (Prio : System.Any_Priority) return Interfaces.C.int 3249+ (Prio : System.Any_Priority) return Interfaces.C.int
3250+ is 3250+ is
3251+ begin 3251+ begin
3252+ return Interfaces.C.int (Prio); 3252+ return Interfaces.C.int (Prio);
3253+ end To_Target_Priority; 3253+ end To_Target_Priority;
3254+ 3254+
3255+ ----------------- 3255+ -----------------
3256+ -- To_Timespec -- 3256+ -- To_Timespec --
3257+ ----------------- 3257+ -----------------
3258+ 3258+
3259+ function To_Timespec (D : Duration) return timespec is 3259+ function To_Timespec (D : Duration) return timespec is
3260+ S : time_t; 3260+ S : time_t;
3261+ F : Duration; 3261+ F : Duration;
3262+ 3262+
3263+ begin 3263+ begin
3264+ S := time_t (Long_Long_Integer (D)); 3264+ S := time_t (Long_Long_Integer (D));
3265+ F := D - Duration (S); 3265+ F := D - Duration (S);
3266+ 3266+
3267+ -- If F has negative value due to a round-up, adjust for positive F 3267+ -- If F has negative value due to a round-up, adjust for positive F
3268+ -- value. 3268+ -- value.
3269+ 3269+
3270+ if F < 0.0 then 3270+ if F < 0.0 then
3271+ S := S - 1; 3271+ S := S - 1;
3272+ F := F + 1.0; 3272+ F := F + 1.0;
3273+ end if; 3273+ end if;
3274+ 3274+
3275+ return timespec'(tv_sec => S, 3275+ return timespec'(tv_sec => S,
3276+ tv_nsec => long (Long_Long_Integer (F * 10#1#E9))); 3276+ tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
3277+ end To_Timespec; 3277+ end To_Timespec;
3278+ 3278+
3279+end System.OS_Interface; 3279+end System.OS_Interface;
3280--- /dev/null 3280--- /dev/null
3281+++ gcc/ada/s-osinte-dragonfly.ads 3281+++ gcc/ada/s-osinte-dragonfly.ads
3282@@ -0,0 +1,648 @@ 3282@@ -0,0 +1,648 @@
3283+------------------------------------------------------------------------------ 3283+------------------------------------------------------------------------------
3284+-- -- 3284+-- --
3285+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- 3285+-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
3286+-- -- 3286+-- --
3287+-- S Y S T E M . O S _ I N T E R F A C E -- 3287+-- S Y S T E M . O S _ I N T E R F A C E --
3288+-- -- 3288+-- --
3289+-- S p e c -- 3289+-- S p e c --
3290+-- -- 3290+-- --
3291+-- Copyright (C) 1991-1994, Florida State University -- 3291+-- Copyright (C) 1991-1994, Florida State University --
3292+-- Copyright (C) 1995-2009, Free Software Foundation, Inc. -- 3292+-- Copyright (C) 1995-2009, Free Software Foundation, Inc. --
3293+-- -- 3293+-- --
3294+-- GNARL is free software; you can redistribute it and/or modify it under -- 3294+-- GNARL is free software; you can redistribute it and/or modify it under --
3295+-- terms of the GNU General Public License as published by the Free Soft- -- 3295+-- terms of the GNU General Public License as published by the Free Soft- --
3296+-- ware Foundation; either version 2, or (at your option) any later ver- -- 3296+-- ware Foundation; either version 2, or (at your option) any later ver- --
3297+-- sion. GNARL is distributed in the hope that it will be useful, but WITH- -- 3297+-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
3298+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- 3298+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
3299+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- 3299+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
3300+-- for more details. You should have received a copy of the GNU General -- 3300+-- for more details. You should have received a copy of the GNU General --
3301+-- Public License distributed with GNARL; see file COPYING. If not, write -- 3301+-- Public License distributed with GNARL; see file COPYING. If not, write --
3302+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, -- 3302+-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
3303+-- Boston, MA 02110-1301, USA. -- 3303+-- Boston, MA 02110-1301, USA. --
3304+-- -- 3304+-- --
3305+-- As a special exception, if other files instantiate generics from this -- 3305+-- As a special exception, if other files instantiate generics from this --
3306+-- unit, or you link this unit with other files to produce an executable, -- 3306+-- unit, or you link this unit with other files to produce an executable, --
3307+-- this unit does not by itself cause the resulting executable to be -- 3307+-- this unit does not by itself cause the resulting executable to be --
3308+-- covered by the GNU General Public License. This exception does not -- 3308+-- covered by the GNU General Public License. This exception does not --
3309+-- however invalidate any other reasons why the executable file might be -- 3309+-- however invalidate any other reasons why the executable file might be --
3310+-- covered by the GNU Public License. -- 3310+-- covered by the GNU Public License. --
3311+-- -- 3311+-- --
3312+-- GNARL was developed by the GNARL team at Florida State University. It is -- 3312+-- GNARL was developed by the GNARL team at Florida State University. It is --
3313+-- now maintained by Ada Core Technologies Inc. in cooperation with Florida -- 3313+-- now maintained by Ada Core Technologies Inc. in cooperation with Florida --
3314+-- State University (http://www.gnat.com). -- 3314+-- State University (http://www.gnat.com). --
3315+-- -- 3315+-- --
3316+-- Copyright (C) 2010 John Marino <draco@marino.st> -- 3316+-- Copyright (C) 2010 John Marino <draco@marino.st> --
3317+------------------------------------------------------------------------------ 3317+------------------------------------------------------------------------------
3318+ 3318+
3319+-- This is the DragonFly BSD PTHREADS version of this package 3319+-- This is the DragonFly BSD PTHREADS version of this package
3320+ 3320+
3321+-- This package encapsulates all direct interfaces to OS services 3321+-- This package encapsulates all direct interfaces to OS services
3322+-- that are needed by the tasking run-time (libgnarl). 3322+-- that are needed by the tasking run-time (libgnarl).
3323+ 3323+
3324+-- PLEASE DO NOT add any with-clauses to this package or remove the pragma 3324+-- PLEASE DO NOT add any with-clauses to this package or remove the pragma
3325+-- Preelaborate. This package is designed to be a bottom-level (leaf) package. 3325+-- Preelaborate. This package is designed to be a bottom-level (leaf) package.
3326+ 3326+
3327+with Ada.Unchecked_Conversion; 3327+with Ada.Unchecked_Conversion;
3328+ 3328+
3329+with Interfaces.C; 3329+with Interfaces.C;
3330+ 3330+
3331+package System.OS_Interface is 3331+package System.OS_Interface is
3332+ pragma Preelaborate; 3332+ pragma Preelaborate;
3333+ 3333+
3334+ pragma Linker_Options ("-pthread"); 3334+ pragma Linker_Options ("-pthread");
3335+ 3335+
3336+ subtype int is Interfaces.C.int; 3336+ subtype int is Interfaces.C.int;
3337+ subtype short is Interfaces.C.short; 3337+ subtype short is Interfaces.C.short;
3338+ subtype long is Interfaces.C.long; 3338+ subtype long is Interfaces.C.long;
3339+ subtype unsigned is Interfaces.C.unsigned; 3339+ subtype unsigned is Interfaces.C.unsigned;
3340+ subtype unsigned_short is Interfaces.C.unsigned_short; 3340+ subtype unsigned_short is Interfaces.C.unsigned_short;
3341+ subtype unsigned_long is Interfaces.C.unsigned_long; 3341+ subtype unsigned_long is Interfaces.C.unsigned_long;
3342+ subtype unsigned_char is Interfaces.C.unsigned_char; 3342+ subtype unsigned_char is Interfaces.C.unsigned_char;
3343+ subtype plain_char is Interfaces.C.plain_char; 3343+ subtype plain_char is Interfaces.C.plain_char;
3344+ subtype size_t is Interfaces.C.size_t; 3344+ subtype size_t is Interfaces.C.size_t;
3345+ 3345+
3346+ ----------- 3346+ -----------
3347+ -- Errno -- 3347+ -- Errno --
3348+ ----------- 3348+ -----------
3349+ 3349+
3350+ function Errno return int; 3350+ function Errno return int;
3351+ pragma Inline (Errno); 3351+ pragma Inline (Errno);
3352+ 3352+
3353+ EAGAIN : constant := 35; 3353+ EAGAIN : constant := 35;
3354+ EINTR : constant := 4; 3354+ EINTR : constant := 4;
3355+ EINVAL : constant := 22; 3355+ EINVAL : constant := 22;
3356+ ENOMEM : constant := 12; 3356+ ENOMEM : constant := 12;
3357+ ETIMEDOUT : constant := 60; 3357+ ETIMEDOUT : constant := 60;
3358+ 3358+
3359+ ------------- 3359+ -------------
3360+ -- Signals -- 3360+ -- Signals --
3361+ ------------- 3361+ -------------
3362+ 3362+
3363+ Max_Interrupt : constant := 31; 3363+ Max_Interrupt : constant := 31;
3364+ type Signal is new int range 0 .. Max_Interrupt; 3364+ type Signal is new int range 0 .. Max_Interrupt;
3365+ for Signal'Size use int'Size; 3365+ for Signal'Size use int'Size;
3366+ 3366+
3367+ SIGHUP : constant := 1; -- hangup 3367+ SIGHUP : constant := 1; -- hangup
3368+ SIGINT : constant := 2; -- interrupt (rubout) 3368+ SIGINT : constant := 2; -- interrupt (rubout)
3369+ SIGQUIT : constant := 3; -- quit (ASCD FS) 3369+ SIGQUIT : constant := 3; -- quit (ASCD FS)
3370+ SIGILL : constant := 4; -- illegal instruction (not reset) 3370+ SIGILL : constant := 4; -- illegal instruction (not reset)
3371+ SIGTRAP : constant := 5; -- trace trap (not reset) 3371+ SIGTRAP : constant := 5; -- trace trap (not reset)
3372+ SIGIOT : constant := 6; -- IOT instruction 3372+ SIGIOT : constant := 6; -- IOT instruction
3373+ SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future 3373+ SIGABRT : constant := 6; -- used by abort, replace SIGIOT in the future
3374+ SIGEMT : constant := 7; -- EMT instruction 3374+ SIGEMT : constant := 7; -- EMT instruction
3375+ SIGFPE : constant := 8; -- floating point exception 3375+ SIGFPE : constant := 8; -- floating point exception
3376+ SIGKILL : constant := 9; -- kill (cannot be caught or ignored) 3376+ SIGKILL : constant := 9; -- kill (cannot be caught or ignored)
3377+ SIGBUS : constant := 10; -- bus error 3377+ SIGBUS : constant := 10; -- bus error
3378+ SIGSEGV : constant := 11; -- segmentation violation 3378+ SIGSEGV : constant := 11; -- segmentation violation
3379+ SIGSYS : constant := 12; -- bad argument to system call 3379+ SIGSYS : constant := 12; -- bad argument to system call
3380+ SIGPIPE : constant := 13; -- write on a pipe with no one to read it 3380+ SIGPIPE : constant := 13; -- write on a pipe with no one to read it
3381+ SIGALRM : constant := 14; -- alarm clock 3381+ SIGALRM : constant := 14; -- alarm clock
3382+ SIGTERM : constant := 15; -- software termination signal from kill 3382+ SIGTERM : constant := 15; -- software termination signal from kill
3383+ SIGURG : constant := 16; -- urgent condition on IO channel 3383+ SIGURG : constant := 16; -- urgent condition on IO channel
3384+ SIGSTOP : constant := 17; -- stop (cannot be caught or ignored) 3384+ SIGSTOP : constant := 17; -- stop (cannot be caught or ignored)
3385+ SIGTSTP : constant := 18; -- user stop requested from tty 3385+ SIGTSTP : constant := 18; -- user stop requested from tty
3386+ SIGCONT : constant := 19; -- stopped process has been continued 3386+ SIGCONT : constant := 19; -- stopped process has been continued
3387+ SIGCLD : constant := 20; -- alias for SIGCHLD 3387+ SIGCLD : constant := 20; -- alias for SIGCHLD
3388+ SIGCHLD : constant := 20; -- child status change 3388+ SIGCHLD : constant := 20; -- child status change
3389+ SIGTTIN : constant := 21; -- background tty read attempted 3389+ SIGTTIN : constant := 21; -- background tty read attempted
3390+ SIGTTOU : constant := 22; -- background tty write attempted 3390+ SIGTTOU : constant := 22; -- background tty write attempted
3391+ SIGIO : constant := 23; -- I/O possible (Solaris SIGPOLL alias) 3391+ SIGIO : constant := 23; -- I/O possible (Solaris SIGPOLL alias)
3392+ SIGXCPU : constant := 24; -- CPU time limit exceeded 3392+ SIGXCPU : constant := 24; -- CPU time limit exceeded
3393+ SIGXFSZ : constant := 25; -- filesize limit exceeded 3393+ SIGXFSZ : constant := 25; -- filesize limit exceeded
3394+ SIGVTALRM : constant := 26; -- virtual timer expired 3394+ SIGVTALRM : constant := 26; -- virtual timer expired
3395+ SIGPROF : constant := 27; -- profiling timer expired 3395+ SIGPROF : constant := 27; -- profiling timer expired
3396+ SIGWINCH : constant := 28; -- window size change 3396+ SIGWINCH : constant := 28; -- window size change
3397+ SIGINFO : constant := 29; -- information request (BSD) 3397+ SIGINFO : constant := 29; -- information request (BSD)
3398+ SIGUSR1 : constant := 30; -- user defined signal 1 3398+ SIGUSR1 : constant := 30; -- user defined signal 1
3399+ SIGUSR2 : constant := 31; -- user defined signal 2 3399+ SIGUSR2 : constant := 31; -- user defined signal 2
3400+ 3400+
3401+ SIGADAABORT : constant := SIGABRT; 3401+ SIGADAABORT : constant := SIGABRT;
3402+ -- Change this if you want to use another signal for task abort. 3402+ -- Change this if you want to use another signal for task abort.
3403+ -- SIGTERM might be a good one. 3403+ -- SIGTERM might be a good one.
3404+ 3404+
3405+ type Signal_Set is array (Natural range <>) of Signal; 3405+ type Signal_Set is array (Natural range <>) of Signal;
3406+ 3406+
3407+ -- Interrupts that must be unmasked at all times. DragonFlyBSD 3407+ -- Interrupts that must be unmasked at all times. DragonFlyBSD
3408+ -- pthreads will not allow an application to mask out any 3408+ -- pthreads will not allow an application to mask out any
3409+ -- interrupt needed by the threads library. 3409+ -- interrupt needed by the threads library.
3410+ Unmasked : constant Signal_Set := 3410+ Unmasked : constant Signal_Set :=
3411+ (SIGTRAP, SIGBUS, SIGTTIN, SIGTTOU, SIGTSTP); 3411+ (SIGTRAP, SIGBUS, SIGTTIN, SIGTTOU, SIGTSTP);
3412+ 3412+
3413+ -- DragonFlyBSD will uses SIGPROF for timing. Do not allow a 3413+ -- DragonFlyBSD will uses SIGPROF for timing. Do not allow a
3414+ -- handler to attach to this signal. 3414+ -- handler to attach to this signal.
3415+ Reserved : constant Signal_Set := (0 .. 0 => SIGPROF); 3415+ Reserved : constant Signal_Set := (0 .. 0 => SIGPROF);
3416+ 3416+
3417+ type sigset_t is private; 3417+ type sigset_t is private;
3418+ 3418+
3419+ function sigaddset 3419+ function sigaddset
3420+ (set : access sigset_t; 3420+ (set : access sigset_t;
3421+ sig : Signal) return int; 3421+ sig : Signal) return int;
3422+ pragma Import (C, sigaddset, "sigaddset"); 3422+ pragma Import (C, sigaddset, "sigaddset");
3423+ 3423+
3424+ function sigdelset 3424+ function sigdelset
3425+ (set : access sigset_t; 3425+ (set : access sigset_t;
3426+ sig : Signal) return int; 3426+ sig : Signal) return int;
3427+ pragma Import (C, sigdelset, "sigdelset"); 3427+ pragma Import (C, sigdelset, "sigdelset");
3428+ 3428+
3429+ function sigfillset (set : access sigset_t) return int; 3429+ function sigfillset (set : access sigset_t) return int;
3430+ pragma Import (C, sigfillset, "sigfillset"); 3430+ pragma Import (C, sigfillset, "sigfillset");
3431+ 3431+
3432+ function sigismember 3432+ function sigismember
3433+ (set : access sigset_t; 3433+ (set : access sigset_t;
3434+ sig : Signal) return int; 3434+ sig : Signal) return int;
3435+ pragma Import (C, sigismember, "sigismember"); 3435+ pragma Import (C, sigismember, "sigismember");
3436+ 3436+
3437+ function sigemptyset (set : access sigset_t) return int; 3437+ function sigemptyset (set : access sigset_t) return int;
3438+ pragma Import (C, sigemptyset, "sigemptyset"); 3438+ pragma Import (C, sigemptyset, "sigemptyset");
3439+ 3439+
3440+ -- sigcontext is architecture dependent, so define it private 3440+ -- sigcontext is architecture dependent, so define it private
3441+ type struct_sigcontext is private; 3441+ type struct_sigcontext is private;

cvs diff -r1.1 -r1.2 pkgsrc/lang/gnat-aux/files/Attic/diff-core (switch to unified diff)

--- pkgsrc/lang/gnat-aux/files/Attic/diff-core 2012/01/08 11:17:07 1.1
+++ pkgsrc/lang/gnat-aux/files/Attic/diff-core 2012/03/02 16:00:58 1.2
@@ -1,1903 +1,1930 @@ @@ -1,1903 +1,1930 @@
1--- gcc/config.gcc.orig 1--- gcc/config.gcc.orig
2+++ gcc/config.gcc 2+++ gcc/config.gcc
3@@ -529,7 +529,7 @@ 3@@ -529,7 +529,7 @@
4 extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o" 4 extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
5 fbsd_major=`echo ${target} | sed -e 's/.*freebsd//g' | sed -e 's/\..*//g'` 5 fbsd_major=`echo ${target} | sed -e 's/.*freebsd//g' | sed -e 's/\..*//g'`
6 tm_defines="${tm_defines} FBSD_MAJOR=${fbsd_major}" 6 tm_defines="${tm_defines} FBSD_MAJOR=${fbsd_major}"
7- tmake_file="t-slibgcc-elf-ver t-freebsd" 7- tmake_file="t-slibgcc-elf-ver t-freebsd"
8+ tmake_file="t-slibgcc-elf-ver t-libc-ok t-libgcc-pic t-exceptions" 8+ tmake_file="t-slibgcc-elf-ver t-libc-ok t-libgcc-pic t-exceptions"
9 case ${enable_threads} in 9 case ${enable_threads} in
10 no) 10 no)
11 fbsd_tm_file="${fbsd_tm_file} freebsd-nthr.h" 11 fbsd_tm_file="${fbsd_tm_file} freebsd-nthr.h"
12@@ -545,6 +545,9 @@ 12@@ -545,6 +545,9 @@
13 ;; 13 ;;
14 esac 14 esac
15 ;; 15 ;;
16+ gnat | single) 16+ gnat | single)
17+ # Let these non-posix thread selections fall through if requested 17+ # Let these non-posix thread selections fall through if requested
18+ ;; 18+ ;;
19 *) 19 *)
20 echo 'Unknown thread configuration for FreeBSD' 20 echo 'Unknown thread configuration for FreeBSD'
21 exit 1 21 exit 1
22@@ -561,6 +564,39 @@ 22@@ -561,6 +564,39 @@
23 # need_64bit_hwint=yes # system compiler has this for all arch! 23 # need_64bit_hwint=yes # system compiler has this for all arch!
24 use_gcc_stdint=wrap 24 use_gcc_stdint=wrap
25 ;; 25 ;;
26+*-*-dragonfly*) 26+*-*-dragonfly*)
27+ gas=yes 27+ gas=yes
28+ gnu_ld=yes 28+ gnu_ld=yes
29+ extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o" 29+ extra_parts="crtbegin.o crtend.o crtbeginS.o crtendS.o"
30+ tmake_file="t-slibgcc-elf-ver t-libc-ok t-libgcc-pic t-exceptions" 30+ tmake_file="t-slibgcc-elf-ver t-libc-ok t-libgcc-pic t-exceptions"
31+ case ${enable_threads} in 31+ case ${enable_threads} in
32+ "" | yes | posix) 32+ "" | yes | posix)
33+ thread_file='posix' 33+ thread_file='posix'
34+ ;; 34+ ;;
35+ no | gnat | single) 35+ no | gnat | single)
36+ # Let these non-posix thread selections fall through if requested 36+ # Let these non-posix thread selections fall through if requested
37+ ;; 37+ ;;
38+ *) 38+ *)
39+ echo 'Unknown thread configuration for DragonFly BSD' 39+ echo 'Unknown thread configuration for DragonFly BSD'
40+ exit 1 40+ exit 1
41+ ;; 41+ ;;
42+ esac 42+ esac
43+ extra_options="$extra_options rpath.opt dragonfly.opt" 43+ extra_options="$extra_options rpath.opt dragonfly.opt"
44+ default_use_cxa_atexit=yes 44+ default_use_cxa_atexit=yes
45+ ;; 45+ ;;
46+*-android-eabi*) 46+*-android-eabi*)
47+ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o" 47+ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
48+ gas=yes 48+ gas=yes
49+ gnu_ld=yes 49+ gnu_ld=yes
50+ case ${enable_threads} in 50+ case ${enable_threads} in
51+ "" | yes | posix) thread_file='posix' ;; 51+ "" | yes | posix) thread_file='posix' ;;
52+ esac 52+ esac
53+ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_BIONIC ANDROID_DEFAULT=1" 53+ tm_defines="$tm_defines DEFAULT_LIBC=LIBC_BIONIC ANDROID_DEFAULT=1"
54+ extra_options="$extra_options linux.opt linux-android.opt" 54+ extra_options="$extra_options linux.opt linux-android.opt"
55+ default_use_cxa_atexit=yes 55+ default_use_cxa_atexit=yes
56+ use_gcc_tgmath=no 56+ use_gcc_tgmath=no
57+ use_gcc_stdint=wrap 57+ use_gcc_stdint=wrap
58+ ;; 58+ ;;
59 *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu) 59 *-*-linux* | frv-*-*linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu | *-*-gnu* | *-*-kopensolaris*-gnu)
60 extra_options="$extra_options gnu-user.opt" 60 extra_options="$extra_options gnu-user.opt"
61 extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o" 61 extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
62@@ -618,9 +654,11 @@ 62@@ -618,9 +654,11 @@
63 esac 63 esac
64 ;; 64 ;;
65 *-*-netbsd*) 65 *-*-netbsd*)
66- tmake_file="t-slibgcc-elf-ver t-libc-ok t-netbsd t-libgcc-pic" 66- tmake_file="t-slibgcc-elf-ver t-libc-ok t-netbsd t-libgcc-pic"
67+ tmake_file="t-slibgcc-elf-ver t-libc-ok t-libgcc-pic t-exceptions" 67+ tmake_file="t-slibgcc-elf-ver t-libc-ok t-libgcc-pic t-exceptions"
68 gas=yes 68 gas=yes
69 gnu_ld=yes 69 gnu_ld=yes
70+ nbsd_major=`echo ${target} | sed -e 's/.*netbsd\(elf\)\{0,1\}//g' | sed -e 's/\..*//g'` 70+ nbsd_major=`echo ${target} | sed -e 's/.*netbsd\(elf\)\{0,1\}//g' | sed -e 's/\..*//g'`
71+ tm_defines="${tm_defines} NBSD_MAJOR=${nbsd_major}" 71+ tm_defines="${tm_defines} NBSD_MAJOR=${nbsd_major}"
72  72
73 # NetBSD 2.0 and later get POSIX threads enabled by default. 73 # NetBSD 2.0 and later get POSIX threads enabled by default.
74 # Allow them to be explicitly enabled on any other version. 74 # Allow them to be explicitly enabled on any other version.
75@@ -657,12 +695,22 @@ 75@@ -657,12 +695,22 @@
76 esac 76 esac
77 ;; 77 ;;
78 *-*-openbsd*) 78 *-*-openbsd*)
79+ gas=yes 79+ gas=yes
80+ gnu_ld=yes 80+ gnu_ld=yes
81+ # Do NOT add crt*.o extra parts! 81+ # Do NOT add crt*.o extra parts!
82 tmake_file="t-libc-ok t-openbsd t-libgcc-pic" 82 tmake_file="t-libc-ok t-openbsd t-libgcc-pic"
83 case ${enable_threads} in 83 case ${enable_threads} in
84- yes) 84- yes)
85+ "" | yes | posix) 85+ "" | yes | posix)
86 thread_file='posix' 86 thread_file='posix'
87 tmake_file="${tmake_file} t-openbsd-thread" 87 tmake_file="${tmake_file} t-openbsd-thread"
88 ;; 88 ;;
89+ no | gnat | single) 89+ no | gnat | single)
90+ # Let these non-posix thread selections fall through 90+ # Let these non-posix thread selections fall through
91+ ;; 91+ ;;
92+ *) 92+ *)
93+ echo 'Unknown thread configuration for OpenBSD' 93+ echo 'Unknown thread configuration for OpenBSD'
94+ exit 1 94+ exit 1
95+ ;; 95+ ;;
96 esac 96 esac
97 case ${target} in 97 case ${target} in
98 *-*-openbsd2.*|*-*-openbsd3.[012]) 98 *-*-openbsd2.*|*-*-openbsd3.[012])
99@@ -793,6 +841,24 @@ 99@@ -793,6 +841,24 @@
100 tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}" 100 tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}"
101 extra_parts="crtinit.o crtfini.o" 101 extra_parts="crtinit.o crtfini.o"
102 ;; 102 ;;
103+arm*-android-eabi*) 103+arm*-android-eabi*)
104+ case $target in 104+ case $target in
105+ arm*b-*) 105+ arm*b-*)
106+ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1" 106+ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
107+ ;; 107+ ;;
108+ esac 108+ esac
109+ tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h" 109+ tm_file="dbxelf.h elfos.h gnu-user.h linux.h linux-android.h glibc-stdint.h"
110+ tm_file="$tm_file arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/bpabi.h arm/linux-eabi.h" 110+ tm_file="$tm_file arm/elf.h arm/linux-gas.h arm/linux-elf.h arm/bpabi.h arm/linux-eabi.h"
111+ tm_file="$tm_file ../../libgcc/config/arm/bpabi-lib.h arm/aout.h arm/arm.h" 111+ tm_file="$tm_file ../../libgcc/config/arm/bpabi-lib.h arm/aout.h arm/arm.h"
112+ 112+
113+ tmake_file="t-slibgcc-elf-ver t-linux arm/t-arm" 113+ tmake_file="t-slibgcc-elf-ver t-linux arm/t-arm"
114+ tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi t-slibgcc-libgcc" 114+ tmake_file="$tmake_file arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi t-slibgcc-libgcc"
115+ tmake_file="$tmake_file arm/t-linux-androideabi arm/t-arm-softfp soft-fp/t-softfp" 115+ tmake_file="$tmake_file arm/t-linux-androideabi arm/t-arm-softfp soft-fp/t-softfp"
116+ 116+
117+ # The BPABI long long divmod functions return a 128-bit value in registers r0-r3. 117+ # The BPABI long long divmod functions return a 128-bit value in registers r0-r3.
118+ # Correctly modeling that requires the use of TImode. 118+ # Correctly modeling that requires the use of TImode.
119+ need_64bit_hwint=yes 119+ need_64bit_hwint=yes
120+ ;; 120+ ;;
121 arm-wrs-vxworks) 121 arm-wrs-vxworks)
122 tm_file="elfos.h arm/elf.h arm/aout.h ${tm_file} vx-common.h vxworks.h arm/vxworks.h" 122 tm_file="elfos.h arm/elf.h arm/aout.h ${tm_file} vx-common.h vxworks.h arm/vxworks.h"
123 extra_options="${extra_options} arm/vxworks.opt" 123 extra_options="${extra_options} arm/vxworks.opt"
124@@ -1219,9 +1285,18 @@ 124@@ -1219,9 +1285,18 @@
125 tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h" 125 tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h ${fbsd_tm_file} i386/x86-64.h i386/freebsd.h i386/freebsd64.h"
126 tmake_file="${tmake_file} i386/t-crtstuff" 126 tmake_file="${tmake_file} i386/t-crtstuff"
127 ;; 127 ;;
128+i[34567]86-*-dragonfly*) 128+i[34567]86-*-dragonfly*)
129+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/dragonfly.h" 129+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/dragonfly.h"
130+ tmake_file="${tmake_file} i386/t-crtstuff" 130+ tmake_file="${tmake_file} i386/t-crtstuff"
131+ ;; 131+ ;;
132+x86_64-*-dragonfly*) 132+x86_64-*-dragonfly*)
133+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/x86-64.h i386/dragonfly.h i386/dragonfly64.h" 133+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h dragonfly.h dragonfly-stdint.h i386/x86-64.h i386/dragonfly.h i386/dragonfly64.h"
134+ tmake_file="${tmake_file} i386/t-crtstuff" 134+ tmake_file="${tmake_file} i386/t-crtstuff"
135+ ;; 135+ ;;
136 i[34567]86-*-netbsdelf*) 136 i[34567]86-*-netbsdelf*)
137- tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h" 137- tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h"
138+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h netbsd-stdint.h" 138+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/netbsd-elf.h netbsd-stdint.h"
139 extra_options="${extra_options} netbsd.opt netbsd-elf.opt" 139 extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
140+ tmake_file="${tmake_file} i386/t-crtstuff" 140+ tmake_file="${tmake_file} i386/t-crtstuff"
141 ;; 141 ;;
142 i[34567]86-*-netbsd*) 142 i[34567]86-*-netbsd*)
143 tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h netbsd.h netbsd-aout.h i386/netbsd.h" 143 tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/gstabs.h netbsd.h netbsd-aout.h i386/netbsd.h"
144@@ -1231,7 +1306,7 @@ 144@@ -1231,7 +1306,7 @@
145 use_collect2=yes 145 use_collect2=yes
146 ;; 146 ;;
147 x86_64-*-netbsd*) 147 x86_64-*-netbsd*)
148- tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h" 148- tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h"
149+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h netbsd-stdint.h" 149+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h netbsd.h netbsd-elf.h i386/x86-64.h i386/netbsd64.h netbsd-stdint.h"
150 extra_options="${extra_options} netbsd.opt netbsd-elf.opt" 150 extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
151 tmake_file="${tmake_file} i386/t-crtstuff" 151 tmake_file="${tmake_file} i386/t-crtstuff"
152 ;; 152 ;;
153@@ -1247,8 +1322,12 @@ 153@@ -1247,8 +1322,12 @@
154 tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h" 154 tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h"
155 tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h i386/openbsdelf.h" 155 tm_file="${tm_file} openbsd.h openbsd-stdint.h openbsd-libpthread.h i386/openbsdelf.h"
156 extra_options="${extra_options} openbsd.opt" 156 extra_options="${extra_options} openbsd.opt"
157- gas=yes 157- gas=yes
158- gnu_ld=yes 158- gnu_ld=yes
159+ ;; 159+ ;;
160+x86_64-*-openbsd*) 160+x86_64-*-openbsd*)
161+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h" 161+ tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h"
162+ tm_file="${tm_file} openbsd.h openbsd-libpthread.h i386/x86-64.h i386/openbsd64.h exec-stack.h" 162+ tm_file="${tm_file} openbsd.h openbsd-libpthread.h i386/x86-64.h i386/openbsd64.h exec-stack.h"
163+ extra_options="${extra_options} openbsd.opt" 163+ extra_options="${extra_options} openbsd.opt"
164+ tmake_file="${tmake_file} i386/t-crtstuff" 164+ tmake_file="${tmake_file} i386/t-crtstuff"
165 ;; 165 ;;
166 i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu) 166 i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu* | i[34567]86-*-kopensolaris*-gnu)
167 # Intel 80386's running GNU/* 167 # Intel 80386's running GNU/*
168@@ -3673,6 +3752,11 @@ 168@@ -3673,6 +3752,11 @@
169 i[34567]86-*-freebsd* | x86_64-*-freebsd*) 169 i[34567]86-*-freebsd* | x86_64-*-freebsd*)
170 tmake_file="${tmake_file} i386/t-fprules-softfp soft-fp/t-softfp" 170 tmake_file="${tmake_file} i386/t-fprules-softfp soft-fp/t-softfp"
171 ;; 171 ;;
172+ i[34567]86-*-dragonfly* | x86_64-*-dragonfly*) 172+ i[34567]86-*-dragonfly* | x86_64-*-dragonfly*)
173+ tmake_file="${tmake_file} i386/t-fprules-softfp soft-fp/t-softfp" 173+ tmake_file="${tmake_file} i386/t-fprules-softfp soft-fp/t-softfp"
174+ ;; 174+ ;;
175+ i[34567]86-*-openbsd* | x86_64-*-openbsd*) 175+ i[34567]86-*-openbsd* | x86_64-*-openbsd*)
176+ ;; 176+ ;;
177 ia64*-*-linux*) 177 ia64*-*-linux*)
178 tmake_file="${tmake_file} ia64/t-fprules-softfp soft-fp/t-softfp" 178 tmake_file="${tmake_file} ia64/t-fprules-softfp soft-fp/t-softfp"
179 ;; 179 ;;
180--- gcc/crtstuff.c.orig 180--- gcc/crtstuff.c.orig
181+++ gcc/crtstuff.c 181+++ gcc/crtstuff.c
182@@ -79,11 +79,19 @@ 182@@ -79,11 +79,19 @@
183 } 183 }
184 #endif 184 #endif
185  185
186+#if defined(TARGET_DL_ITERATE_PHDR) && \ 186+#if defined(TARGET_DL_ITERATE_PHDR) && \
187+ ( defined(__FreeBSD__) \ 187+ ( defined(__FreeBSD__) \
188+ || defined(__OpenBSD__) \ 188+ || defined(__OpenBSD__) \
189+ || defined(__NetBSD__) \ 189+ || defined(__NetBSD__) \
190+ || defined(__DragonFly__)) 190+ || defined(__DragonFly__))
191+#define BSD_DL_ITERATE_PHDR_AVAILABLE 191+#define BSD_DL_ITERATE_PHDR_AVAILABLE
192+#endif 192+#endif
193+ 193+
194 #if defined(OBJECT_FORMAT_ELF) \ 194 #if defined(OBJECT_FORMAT_ELF) \
195 && !defined(OBJECT_FORMAT_FLAT) \ 195 && !defined(OBJECT_FORMAT_FLAT) \
196 && defined(HAVE_LD_EH_FRAME_HDR) \ 196 && defined(HAVE_LD_EH_FRAME_HDR) \
197 && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \ 197 && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
198- && defined(__FreeBSD__) && __FreeBSD__ >= 7 198- && defined(__FreeBSD__) && __FreeBSD__ >= 7
199+ && defined(BSD_DL_ITERATE_PHDR_AVAILABLE) 199+ && defined(BSD_DL_ITERATE_PHDR_AVAILABLE)
200 #include <link.h> 200 #include <link.h>
201 # define USE_PT_GNU_EH_FRAME 201 # define USE_PT_GNU_EH_FRAME
202 #endif 202 #endif
203--- gcc/DEV-PHASE.orig 203--- gcc/DEV-PHASE.orig
204+++ gcc/DEV-PHASE 204+++ gcc/DEV-PHASE
205@@ -0,0 +1 @@ 205@@ -0,0 +1 @@
206+release 206+release
207--- gcc/unwind-dw2-fde-glibc.c.orig 207--- gcc/unwind-dw2-fde-glibc.c.orig
208+++ gcc/unwind-dw2-fde-glibc.c 208+++ gcc/unwind-dw2-fde-glibc.c
209@@ -53,13 +53,21 @@ 209@@ -53,13 +53,21 @@
210 #endif 210 #endif
211  211
212 #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ 212 #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
213- && defined(__FreeBSD__) && __FreeBSD__ >= 7 213- && defined(__FreeBSD__) && __FreeBSD__ >= 7
214+ && defined(TARGET_DL_ITERATE_PHDR) \ 214+ && defined(TARGET_DL_ITERATE_PHDR) \
215+ && (defined(__FreeBSD__) || defined(__DragonFly__)) 215+ && (defined(__FreeBSD__) || defined(__DragonFly__))
216 # define ElfW __ElfN 216 # define ElfW __ElfN
217 # define USE_PT_GNU_EH_FRAME 217 # define USE_PT_GNU_EH_FRAME
218 #endif 218 #endif
219  219
220 #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ 220 #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
221 && defined(TARGET_DL_ITERATE_PHDR) \ 221 && defined(TARGET_DL_ITERATE_PHDR) \
222+ && (defined(__OpenBSD__) || defined(__NetBSD__)) 222+ && (defined(__OpenBSD__) || defined(__NetBSD__))
223+# define ElfW(n) Elf_##n 223+# define ElfW(n) Elf_##n
224+# define USE_PT_GNU_EH_FRAME 224+# define USE_PT_GNU_EH_FRAME
225+#endif 225+#endif
226+ 226+
227+#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ 227+#if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \
228+ && defined(TARGET_DL_ITERATE_PHDR) \ 228+ && defined(TARGET_DL_ITERATE_PHDR) \
229 && defined(__sun__) && defined(__svr4__) 229 && defined(__sun__) && defined(__svr4__)
230 # define USE_PT_GNU_EH_FRAME 230 # define USE_PT_GNU_EH_FRAME
231 #endif 231 #endif
232--- /dev/null 232--- /dev/null
233+++ gcc/config/dragonfly-stdint.h 233+++ gcc/config/dragonfly-stdint.h
234@@ -0,0 +1,56 @@ 234@@ -0,0 +1,56 @@
235+/* Definitions for <stdint.h> types for DragonFly systems. 235+/* Definitions for <stdint.h> types for DragonFly systems.
236+ Copyright (C) 2009 Free Software Foundation, Inc. 236+ Copyright (C) 2009 Free Software Foundation, Inc.
237+ Contributed by Gerald Pfeifer <gerald@pfeifer.com>. 237+ Contributed by Gerald Pfeifer <gerald@pfeifer.com>.
238+ 238+
239+This file is part of GCC. 239+This file is part of GCC.
240+ 240+
241+GCC is free software; you can redistribute it and/or modify 241+GCC is free software; you can redistribute it and/or modify
242+it under the terms of the GNU General Public License as published by 242+it under the terms of the GNU General Public License as published by
243+the Free Software Foundation; either version 3, or (at your option) 243+the Free Software Foundation; either version 3, or (at your option)
244+any later version. 244+any later version.
245+ 245+
246+GCC is distributed in the hope that it will be useful, 246+GCC is distributed in the hope that it will be useful,
247+but WITHOUT ANY WARRANTY; without even the implied warranty of 247+but WITHOUT ANY WARRANTY; without even the implied warranty of
248+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 248+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
249+GNU General Public License for more details. 249+GNU General Public License for more details.
250+ 250+
251+Under Section 7 of GPL version 3, you are granted additional 251+Under Section 7 of GPL version 3, you are granted additional
252+permissions described in the GCC Runtime Library Exception, version 252+permissions described in the GCC Runtime Library Exception, version
253+3.1, as published by the Free Software Foundation. 253+3.1, as published by the Free Software Foundation.
254+ 254+
255+You should have received a copy of the GNU General Public License and 255+You should have received a copy of the GNU General Public License and
256+a copy of the GCC Runtime Library Exception along with this program; 256+a copy of the GCC Runtime Library Exception along with this program;
257+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 257+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
258+<http://www.gnu.org/licenses/>. */ 258+<http://www.gnu.org/licenses/>. */
259+ 259+
260+#define SIG_ATOMIC_TYPE "int" 260+#define SIG_ATOMIC_TYPE "int"
261+ 261+
262+#define INT8_TYPE "signed char" 262+#define INT8_TYPE "signed char"
263+#define INT16_TYPE "short int" 263+#define INT16_TYPE "short int"
264+#define INT32_TYPE "int" 264+#define INT32_TYPE "int"
265+#define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") 265+#define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
266+#define UINT8_TYPE "unsigned char" 266+#define UINT8_TYPE "unsigned char"
267+#define UINT16_TYPE "short unsigned int" 267+#define UINT16_TYPE "short unsigned int"
268+#define UINT32_TYPE "unsigned int" 268+#define UINT32_TYPE "unsigned int"
269+#define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") 269+#define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
270+ 270+
271+#define INT_LEAST8_TYPE INT8_TYPE 271+#define INT_LEAST8_TYPE INT8_TYPE
272+#define INT_LEAST16_TYPE INT16_TYPE 272+#define INT_LEAST16_TYPE INT16_TYPE
273+#define INT_LEAST32_TYPE INT32_TYPE 273+#define INT_LEAST32_TYPE INT32_TYPE
274+#define INT_LEAST64_TYPE INT64_TYPE 274+#define INT_LEAST64_TYPE INT64_TYPE
275+#define UINT_LEAST8_TYPE UINT8_TYPE 275+#define UINT_LEAST8_TYPE UINT8_TYPE
276+#define UINT_LEAST16_TYPE UINT16_TYPE 276+#define UINT_LEAST16_TYPE UINT16_TYPE
277+#define UINT_LEAST32_TYPE UINT32_TYPE 277+#define UINT_LEAST32_TYPE UINT32_TYPE
278+#define UINT_LEAST64_TYPE UINT64_TYPE 278+#define UINT_LEAST64_TYPE UINT64_TYPE
279+ 279+
280+#define INT_FAST8_TYPE INT32_TYPE 280+#define INT_FAST8_TYPE INT32_TYPE
281+#define INT_FAST16_TYPE INT32_TYPE 281+#define INT_FAST16_TYPE INT32_TYPE
282+#define INT_FAST32_TYPE INT32_TYPE 282+#define INT_FAST32_TYPE INT32_TYPE
283+#define INT_FAST64_TYPE INT64_TYPE 283+#define INT_FAST64_TYPE INT64_TYPE
284+#define UINT_FAST8_TYPE UINT32_TYPE 284+#define UINT_FAST8_TYPE UINT32_TYPE
285+#define UINT_FAST16_TYPE UINT32_TYPE 285+#define UINT_FAST16_TYPE UINT32_TYPE
286+#define UINT_FAST32_TYPE UINT32_TYPE 286+#define UINT_FAST32_TYPE UINT32_TYPE
287+#define UINT_FAST64_TYPE UINT64_TYPE 287+#define UINT_FAST64_TYPE UINT64_TYPE
288+ 288+
289+#define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? INT64_TYPE : INT32_TYPE) 289+#define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? INT64_TYPE : INT32_TYPE)
290+#define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? UINT64_TYPE : UINT32_TYPE) 290+#define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? UINT64_TYPE : UINT32_TYPE)
291--- /dev/null 291--- /dev/null
292+++ gcc/config/dragonfly.h 292+++ gcc/config/dragonfly.h
293@@ -0,0 +1,141 @@ 293@@ -0,0 +1,139 @@
294+/* Base configuration file for all DragonFly targets. 294+/* Base configuration file for all DragonFly targets.
295+ Copyright (C) 1999, 2000, 2001, 2007, 2008 Free Software Foundation, Inc. 295+ Copyright (C) 1999, 2000, 2001, 2007, 2008 Free Software Foundation, Inc.
296+ Copyright (C) 2010-2012 John R. Marino <www.dragonlace.net> 296+ Copyright (C) 2010-2012 John R. Marino <www.dragonlace.net>
297+ 297+
298+This file is part of GCC. 298+This file is part of GCC.
299+ 299+
300+GCC is free software; you can redistribute it and/or modify 300+GCC is free software; you can redistribute it and/or modify
301+it under the terms of the GNU General Public License as published by 301+it under the terms of the GNU General Public License as published by
302+the Free Software Foundation; either version 3, or (at your option) 302+the Free Software Foundation; either version 3, or (at your option)
303+any later version. 303+any later version.
304+ 304+
305+GCC is distributed in the hope that it will be useful, 305+GCC is distributed in the hope that it will be useful,
306+but WITHOUT ANY WARRANTY; without even the implied warranty of 306+but WITHOUT ANY WARRANTY; without even the implied warranty of
307+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 307+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
308+GNU General Public License for more details. 308+GNU General Public License for more details.
309+ 309+
310+You should have received a copy of the GNU General Public License 310+You should have received a copy of the GNU General Public License
311+along with GCC; see the file COPYING3. If not see 311+along with GCC; see the file COPYING3. If not see
312+<http://www.gnu.org/licenses/>. */ 312+<http://www.gnu.org/licenses/>. */
313+ 313+
314+/* Common DragonFly configuration. 314+/* Common DragonFly configuration.
315+ All DragonFly architectures should include this file, which will specify 315+ All DragonFly architectures should include this file, which will specify
316+ their commonalities. 316+ their commonalities.
317+ 317+
318+ Adapted from gcc/config/freebsd.h by 318+ Adapted from gcc/config/freebsd.h by
319+ Joerg Sonnenberger <joerg@bec.de> 319+ Joerg Sonnenberger <joerg@bec.de>
320+ 320+
321+ Adapted from gcc/config/i386/freebsd-elf.h by 321+ Adapted from gcc/config/i386/freebsd-elf.h by
322+ David O'Brien <obrien@FreeBSD.org>. 322+ David O'Brien <obrien@FreeBSD.org>.
323+ Further work by David O'Brien <obrien@FreeBSD.org> and 323+ Further work by David O'Brien <obrien@FreeBSD.org> and
324+ Loren J. Rittle <ljrittle@acm.org>. */ 324+ Loren J. Rittle <ljrittle@acm.org>. */
325+ 325+
326+/* JRM: 15 Nov 2010 326+/* JRM: 15 Nov 2010
327+ SWITCH_TAKES_ARG & WORD_SWITCH_TAKES_ARG removed due to poisoning. 327+ SWITCH_TAKES_ARG & WORD_SWITCH_TAKES_ARG removed due to poisoning.
328+ http://gcc.gnu.org/ml/gcc-patches/2010-10/msg02102.html 328+ http://gcc.gnu.org/ml/gcc-patches/2010-10/msg02102.html
329+ http://gcc.gnu.org/ml/gcc-patches/2010-10/msg02373.html */ 329+ http://gcc.gnu.org/ml/gcc-patches/2010-10/msg02373.html */
330+  330+
331+#undef TARGET_OS_CPP_BUILTINS 331+#undef TARGET_OS_CPP_BUILTINS
332+#define TARGET_OS_CPP_BUILTINS() \ 332+#define TARGET_OS_CPP_BUILTINS() \
333+ do \ 333+ do \
334+ { \ 334+ { \
335+ builtin_define_std ("unix"); \ 335+ builtin_define_std ("unix"); \
336+ builtin_define ("__DragonFly__"); \ 336+ builtin_define ("__DragonFly__"); \
337+ builtin_assert ("system=unix"); \ 337+ builtin_assert ("system=unix"); \
338+ builtin_assert ("system=bsd"); \ 338+ builtin_assert ("system=bsd"); \
339+ builtin_assert ("system=DragonFly"); \ 339+ builtin_assert ("system=DragonFly"); \
340+ } \ 340+ } \
341+ while (0) 341+ while (0)
342+ 342+
343+#undef CPP_SPEC 343+#undef CPP_SPEC
344+#define CPP_SPEC \ 344+#define CPP_SPEC \
345+ "%(cpp_cpu) %(cpp_arch) %{posix:-D_POSIX_SOURCE}" 345+ "%(cpp_cpu) %(cpp_arch) %{posix:-D_POSIX_SOURCE}"
346+ 346+
347+#undef STARTFILE_SPEC 347+#undef STARTFILE_SPEC
348+#define STARTFILE_SPEC \ 348+#define STARTFILE_SPEC \
349+ "%{!shared: \ 349+ "%{!shared: \
350+ %{pg:gcrt1.o%s} \ 350+ %{pg:gcrt1.o%s} \
351+ %{!pg: \ 351+ %{!pg: \
352+ %{p:gcrt1.o%s} \ 352+ %{p:gcrt1.o%s} \
353+ %{!p: \ 353+ %{!p: \
354+ %{profile: gcrt1.o%s} \ 354+ %{profile: gcrt1.o%s} \
355+ %{!profile: \ 355+ %{!profile: \
356+ %{pie: Scrt1.o%s;:crt1.o%s}}}}} \ 356+ %{pie: Scrt1.o%s;:crt1.o%s}}}}} \
357+ crti.o%s \ 357+ crti.o%s \
358+ %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}" 358+ %{shared|pie:crtbeginS.o%s;:crtbegin.o%s}"
359+ 359+
360+#undef ENDFILE_SPEC 360+#undef ENDFILE_SPEC
361+#define ENDFILE_SPEC \ 361+#define ENDFILE_SPEC \
362+ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s" 362+ "%{shared|pie:crtendS.o%s;:crtend.o%s} crtn.o%s"
363+ 363+
364+#undef LIB_SPEC 364+#undef LIB_SPEC
365+#define LIB_SPEC \ 365+#define LIB_SPEC \
366+ "%{pthread:-lpthread} -lc" 366+ "%{pthread:-lpthread} -lc"
367+ 367+
368+/* Provide a LINK_SPEC appropriate for DragonFly. Here we provide support 368+/* Provide a LINK_SPEC appropriate for DragonFly. Here we provide support
369+ for the special GCC options -static and -shared, which allow us to 369+ for the special GCC options -static and -shared, which allow us to
370+ link things in one of these three modes by applying the appropriate 370+ link things in one of these three modes by applying the appropriate
371+ combinations of options at link-time. 371+ combinations of options at link-time.
372+ 372+
373+ When the -shared link option is used a final link is not being 373+ When the -shared link option is used a final link is not being
374+ done. */ 374+ done. */
375+ 375+
376+#define DFBSD_LINK_SPEC \ 376+#define DFBSD_LINK_SPEC \
377+ "%{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \ 377+ "%{p:%nconsider using '-pg' instead of '-p' with gprof(1)} \
378+ %{v:-V} \ 378+ %{v:-V} \
379+ %{assert*} %{R*} %{rpath*} %{defsym*} \ 379+ %{assert*} %{R*} %{rpath*} %{defsym*} \
380+ %{shared:-Bshareable %{h*} %{soname*}} \ 380+ %{shared:-Bshareable %{h*} %{soname*}} \
381+ %{!shared: \ 381+ %{!shared: \
382+ %{!static: \ 382+ %{!static: \
383+ %{rdynamic:-export-dynamic} \ 383+ %{rdynamic:-export-dynamic} \
384+ -dynamic-linker %(dfbsd_dynamic_linker) } \ 384+ -dynamic-linker %(dfbsd_dynamic_linker) } \
385+ %{static:-Bstatic}} \ 385+ %{static:-Bstatic}} \
386+ %{symbolic:-Bsymbolic}" 386+ %{symbolic:-Bsymbolic}"
387+ 387+
388+#undef LINK_SPEC 388+#undef LINK_SPEC
389+#define LINK_SPEC DFBSD_LINK_SPEC 389+#define LINK_SPEC DFBSD_LINK_SPEC
390+ 390+
391+#define DFBSD_DYNAMIC_LINKER \ 391+#define DFBSD_DYNAMIC_LINKER "/usr/libexec/ld-elf.so.2"
392+ "/usr/libexec/ld-elf.so.2" 
393+ 392+
394+#if defined(HAVE_LD_EH_FRAME_HDR) 393+#if defined(HAVE_LD_EH_FRAME_HDR)
395+#define LINK_EH_SPEC \ 394+#define LINK_EH_SPEC "--eh-frame-hdr"
396+ "%{!static:--eh-frame-hdr}" 
397+#endif 395+#endif
398+ 396+
399+/* Use --as-needed -lgcc_s for eh support. */ 397+/* Use --as-needed -lgcc_s for eh support. */
400+#ifdef HAVE_LD_AS_NEEDED 398+#ifdef HAVE_LD_AS_NEEDED
401+#define USE_LD_AS_NEEDED 1 399+#define USE_LD_AS_NEEDED 1
402+#endif 400+#endif
403+ 401+
404+/************************[ Target stuff ]***********************************/ 402+/************************[ Target stuff ]***********************************/
405+ 403+
406+/* All DragonFly Architectures support the ELF object file format. */ 404+/* All DragonFly Architectures support the ELF object file format. */
407+#undef OBJECT_FORMAT_ELF 405+#undef OBJECT_FORMAT_ELF
408+#define OBJECT_FORMAT_ELF 406+#define OBJECT_FORMAT_ELF
409+ 407+
410+/* Don't assume anything about the header files. */ 408+/* Don't assume anything about the header files. */
411+#undef NO_IMPLICIT_EXTERN_C 409+#undef NO_IMPLICIT_EXTERN_C
412+#define NO_IMPLICIT_EXTERN_C 1 410+#define NO_IMPLICIT_EXTERN_C 1
413+ 411+
414+/* Follow DragonFly's standard headers (<machine/stdint.h>, etc...). */ 412+/* Follow DragonFly's standard headers (<machine/stdint.h>, etc...). */
415+ 413+
416+#undef WCHAR_TYPE 414+#undef WCHAR_TYPE
417+#define WCHAR_TYPE "int" 415+#define WCHAR_TYPE "int"
418+ 416+
419+#undef WINT_TYPE 417+#undef WINT_TYPE
420+#define WINT_TYPE "int" 418+#define WINT_TYPE "int"
421+ 419+
422+#define MATH_LIBRARY_PROFILE "m_p" 420+#define MATH_LIBRARY_PROFILE "m_p"
423+ 421+
424+/* Code generation parameters. */ 422+/* Code generation parameters. */
425+ 423+
426+/* Use periods rather than dollar signs in special g++ assembler names. 424+/* Use periods rather than dollar signs in special g++ assembler names.
427+ This ensures the configuration knows our system correctly so we can link 425+ This ensures the configuration knows our system correctly so we can link
428+ with libraries compiled with the native cc. */ 426+ with libraries compiled with the native cc. */
429+#undef NO_DOLLAR_IN_LABEL 427+#undef NO_DOLLAR_IN_LABEL
430+ 428+
431+/* Used by libgcc2.c. We support file locking with fcntl / F_SETLKW. 429+/* Used by libgcc2.c. We support file locking with fcntl / F_SETLKW.
432+ This enables the test coverage code to use file locking when exiting a 430+ This enables the test coverage code to use file locking when exiting a
433+ program, which avoids race conditions if the program has forked. */ 431+ program, which avoids race conditions if the program has forked. */
434+#define TARGET_POSIX_IO 432+#define TARGET_POSIX_IO
435--- /dev/null 433--- /dev/null
436+++ gcc/config/dragonfly.opt 434+++ gcc/config/dragonfly.opt
437@@ -0,0 +1,59 @@ 435@@ -0,0 +1,59 @@
438+; DragonFlyBSD options. 436+; DragonFlyBSD options.
439+ 437+
440+; Copyright (C) 2010 438+; Copyright (C) 2010
441+; Free Software Foundation, Inc. 439+; Free Software Foundation, Inc.
442+; 440+;
443+; This file is part of GCC. 441+; This file is part of GCC.
444+; 442+;
445+; GCC is free software; you can redistribute it and/or modify it under 443+; GCC is free software; you can redistribute it and/or modify it under
446+; the terms of the GNU General Public License as published by the Free 444+; the terms of the GNU General Public License as published by the Free
447+; Software Foundation; either version 3, or (at your option) any later 445+; Software Foundation; either version 3, or (at your option) any later
448+; version. 446+; version.
449+; 447+;
450+; GCC is distributed in the hope that it will be useful, but WITHOUT ANY 448+; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
451+; WARRANTY; without even the implied warranty of MERCHANTABILITY or 449+; WARRANTY; without even the implied warranty of MERCHANTABILITY or
452+; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 450+; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
453+; for more details. 451+; for more details.
454+; 452+;
455+; You should have received a copy of the GNU General Public License 453+; You should have received a copy of the GNU General Public License
456+; along with GCC; see the file COPYING3. If not see 454+; along with GCC; see the file COPYING3. If not see
457+; <http://www.gnu.org/licenses/>. 455+; <http://www.gnu.org/licenses/>.
458+ 456+
459+; See the GCC internals manual (options.texi) for a description of this file's format. 457+; See the GCC internals manual (options.texi) for a description of this file's format.
460+ 458+
461+; Please try to keep this file in ASCII collating order. 459+; Please try to keep this file in ASCII collating order.
462+ 460+
463+assert 461+assert
464+Driver Separate 462+Driver Separate
465+ 463+
466+assert= 464+assert=
467+Driver JoinedOrMissing 465+Driver JoinedOrMissing
468+ 466+
469+defsym 467+defsym
470+Driver Separate 468+Driver Separate
471+ 469+
472+defsym= 470+defsym=
473+Driver JoinedOrMissing 471+Driver JoinedOrMissing
474+ 472+
475+profile 473+profile
476+Driver 474+Driver
477+ 475+
478+pthread 476+pthread
479+Driver 477+Driver
480+ 478+
481+rpath-link 479+rpath-link
482+Driver Separate 480+Driver Separate
483+ 481+
484+rpath-link= 482+rpath-link=
485+Driver JoinedOrMissing 483+Driver JoinedOrMissing
486+ 484+
487+rpath= 485+rpath=
488+Driver JoinedOrMissing 486+Driver JoinedOrMissing
489+ 487+
490+soname 488+soname
491+Driver Separate 489+Driver Separate
492+ 490+
493+soname= 491+soname=
494+Driver JoinedOrMissing 492+Driver JoinedOrMissing
495+ 493+
496+; This comment is to ensure we retain the blank line above. 494+; This comment is to ensure we retain the blank line above.
497--- /dev/null 495--- /dev/null
498+++ gcc/config/exec-stack.h 496+++ gcc/config/exec-stack.h
499@@ -0,0 +1,41 @@ 497@@ -0,0 +1,41 @@
500+/* Enable stack execute around trampoline address. 498+/* Enable stack execute around trampoline address.
501+ Copyright (C) 2002 Free Software Foundation, Inc. 499+ Copyright (C) 2002 Free Software Foundation, Inc.
502+ 500+
503+This file is part of GNU CC. 501+This file is part of GNU CC.
504+ 502+
505+GNU CC is free software; you can redistribute it and/or modify 503+GNU CC is free software; you can redistribute it and/or modify
506+it under the terms of the GNU General Public License as published by 504+it under the terms of the GNU General Public License as published by
507+the Free Software Foundation; either version 2, or (at your option) 505+the Free Software Foundation; either version 2, or (at your option)
508+any later version. 506+any later version.
509+ 507+
510+GNU CC is distributed in the hope that it will be useful, 508+GNU CC is distributed in the hope that it will be useful,
511+but WITHOUT ANY WARRANTY; without even the implied warranty of 509+but WITHOUT ANY WARRANTY; without even the implied warranty of
512+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 510+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
513+GNU General Public License for more details. 511+GNU General Public License for more details.
514+ 512+
515+You should have received a copy of the GNU General Public License 513+You should have received a copy of the GNU General Public License
516+along with GNU CC; see the file COPYING. If not, write to 514+along with GNU CC; see the file COPYING. If not, write to
517+the Free Software Foundation, 59 Temple Place - Suite 330, 515+the Free Software Foundation, 59 Temple Place - Suite 330,
518+Boston, MA 02111-1307, USA. */ 516+Boston, MA 02111-1307, USA. */
519+ 517+
520+#undef FINALIZE_TRAMPOLINE 518+#undef FINALIZE_TRAMPOLINE
521+#define FINALIZE_TRAMPOLINE(TRAMP) \ 519+#define FINALIZE_TRAMPOLINE(TRAMP) \
522+ emit_library_call(gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"), \ 520+ emit_library_call(gen_rtx_SYMBOL_REF (Pmode, "__enable_execute_stack"), \
523+ 0, VOIDmode, 1, memory_address (SImode, (TRAMP)), Pmode) 521+ 0, VOIDmode, 1, memory_address (SImode, (TRAMP)), Pmode)
524+ 522+
525+#undef TRANSFER_FROM_TRAMPOLINE 523+#undef TRANSFER_FROM_TRAMPOLINE
526+#define TRANSFER_FROM_TRAMPOLINE \ 524+#define TRANSFER_FROM_TRAMPOLINE \
527+extern void __enable_execute_stack (void *); \ 525+extern void __enable_execute_stack (void *); \
528+void \ 526+void \
529+__enable_execute_stack (addr) \ 527+__enable_execute_stack (addr) \
530+ void *addr; \ 528+ void *addr; \
531+{ \ 529+{ \
532+ long size = getpagesize (); \ 530+ long size = getpagesize (); \
533+ long mask = ~(size-1); \ 531+ long mask = ~(size-1); \
534+ char *page = (char *) (((long) addr) & mask); \ 532+ char *page = (char *) (((long) addr) & mask); \
535+ char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \ 533+ char *end = (char *) ((((long) (addr + TRAMPOLINE_SIZE)) & mask) + size); \
536+ \ 534+ \
537+ if (mprotect (page, end - page, PROT_READ | PROT_WRITE | PROT_EXEC) < 0) \ 535+ if (mprotect (page, end - page, PROT_READ | PROT_WRITE | PROT_EXEC) < 0) \
538+ perror ("mprotect of trampoline code"); \ 536+ perror ("mprotect of trampoline code"); \
539+} 537+}
540+ 538+
541--- /dev/null 539--- /dev/null
542+++ gcc/config/netbsd-stdint.h 540+++ gcc/config/netbsd-stdint.h
543@@ -0,0 +1,56 @@ 541@@ -0,0 +1,56 @@
544+/* Definitions for <stdint.h> types for NetBSD systems. 542+/* Definitions for <stdint.h> types for NetBSD systems.
545+ Copyright (C) 2009 Free Software Foundation, Inc. 543+ Copyright (C) 2009 Free Software Foundation, Inc.
546+ Contributed by Gerald Pfeifer <gerald@pfeifer.com>. 544+ Contributed by Gerald Pfeifer <gerald@pfeifer.com>.
547+ 545+
548+This file is part of GCC. 546+This file is part of GCC.
549+ 547+
550+GCC is free software; you can redistribute it and/or modify 548+GCC is free software; you can redistribute it and/or modify
551+it under the terms of the GNU General Public License as published by 549+it under the terms of the GNU General Public License as published by
552+the Free Software Foundation; either version 3, or (at your option) 550+the Free Software Foundation; either version 3, or (at your option)
553+any later version. 551+any later version.
554+ 552+
555+GCC is distributed in the hope that it will be useful, 553+GCC is distributed in the hope that it will be useful,
556+but WITHOUT ANY WARRANTY; without even the implied warranty of 554+but WITHOUT ANY WARRANTY; without even the implied warranty of
557+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 555+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
558+GNU General Public License for more details. 556+GNU General Public License for more details.
559+ 557+
560+Under Section 7 of GPL version 3, you are granted additional 558+Under Section 7 of GPL version 3, you are granted additional
561+permissions described in the GCC Runtime Library Exception, version 559+permissions described in the GCC Runtime Library Exception, version
562+3.1, as published by the Free Software Foundation. 560+3.1, as published by the Free Software Foundation.
563+ 561+
564+You should have received a copy of the GNU General Public License and 562+You should have received a copy of the GNU General Public License and
565+a copy of the GCC Runtime Library Exception along with this program; 563+a copy of the GCC Runtime Library Exception along with this program;
566+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 564+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
567+<http://www.gnu.org/licenses/>. */ 565+<http://www.gnu.org/licenses/>. */
568+ 566+
569+#define SIG_ATOMIC_TYPE "int" 567+#define SIG_ATOMIC_TYPE "int"
570+ 568+
571+#define INT8_TYPE "signed char" 569+#define INT8_TYPE "signed char"
572+#define INT16_TYPE "short int" 570+#define INT16_TYPE "short int"
573+#define INT32_TYPE "int" 571+#define INT32_TYPE "int"
574+#define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") 572+#define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int")
575+#define UINT8_TYPE "unsigned char" 573+#define UINT8_TYPE "unsigned char"
576+#define UINT16_TYPE "short unsigned int" 574+#define UINT16_TYPE "short unsigned int"
577+#define UINT32_TYPE "unsigned int" 575+#define UINT32_TYPE "unsigned int"
578+#define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") 576+#define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int")
579+ 577+
580+#define INT_LEAST8_TYPE INT8_TYPE 578+#define INT_LEAST8_TYPE INT8_TYPE
581+#define INT_LEAST16_TYPE INT16_TYPE 579+#define INT_LEAST16_TYPE INT16_TYPE
582+#define INT_LEAST32_TYPE INT32_TYPE 580+#define INT_LEAST32_TYPE INT32_TYPE
583+#define INT_LEAST64_TYPE INT64_TYPE 581+#define INT_LEAST64_TYPE INT64_TYPE
584+#define UINT_LEAST8_TYPE UINT8_TYPE 582+#define UINT_LEAST8_TYPE UINT8_TYPE
585+#define UINT_LEAST16_TYPE UINT16_TYPE 583+#define UINT_LEAST16_TYPE UINT16_TYPE
586+#define UINT_LEAST32_TYPE UINT32_TYPE 584+#define UINT_LEAST32_TYPE UINT32_TYPE
587+#define UINT_LEAST64_TYPE UINT64_TYPE 585+#define UINT_LEAST64_TYPE UINT64_TYPE
588+ 586+
589+#define INT_FAST8_TYPE INT32_TYPE 587+#define INT_FAST8_TYPE INT32_TYPE
590+#define INT_FAST16_TYPE INT32_TYPE 588+#define INT_FAST16_TYPE INT32_TYPE
591+#define INT_FAST32_TYPE INT32_TYPE 589+#define INT_FAST32_TYPE INT32_TYPE
592+#define INT_FAST64_TYPE INT64_TYPE 590+#define INT_FAST64_TYPE INT64_TYPE
593+#define UINT_FAST8_TYPE UINT32_TYPE 591+#define UINT_FAST8_TYPE UINT32_TYPE
594+#define UINT_FAST16_TYPE UINT32_TYPE 592+#define UINT_FAST16_TYPE UINT32_TYPE
595+#define UINT_FAST32_TYPE UINT32_TYPE 593+#define UINT_FAST32_TYPE UINT32_TYPE
596+#define UINT_FAST64_TYPE UINT64_TYPE 594+#define UINT_FAST64_TYPE UINT64_TYPE
597+ 595+
598+#define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? INT64_TYPE : INT32_TYPE) 596+#define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? INT64_TYPE : INT32_TYPE)
599+#define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? UINT64_TYPE : UINT32_TYPE) 597+#define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? UINT64_TYPE : UINT32_TYPE)
600--- gcc/config/netbsd.h.orig 598--- gcc/config/netbsd.h.orig
601+++ gcc/config/netbsd.h 599+++ gcc/config/netbsd.h
602@@ -22,7 +22,7 @@ 600@@ -22,7 +22,7 @@
603 #define NETBSD_OS_CPP_BUILTINS_COMMON() \ 601 #define NETBSD_OS_CPP_BUILTINS_COMMON() \
604 do \ 602 do \
605 { \ 603 { \
606- builtin_define ("__NetBSD__"); \ 604- builtin_define ("__NetBSD__"); \
607+ builtin_define_with_int_value ("__NetBSD__", NBSD_MAJOR); \ 605+ builtin_define_with_int_value ("__NetBSD__", NBSD_MAJOR); \
608 builtin_define ("__unix__"); \ 606 builtin_define ("__unix__"); \
609 builtin_assert ("system=bsd"); \ 607 builtin_assert ("system=bsd"); \
610 builtin_assert ("system=unix"); \ 608 builtin_assert ("system=unix"); \
611--- /dev/null 609--- /dev/null
612+++ gcc/config/t-exceptions 610+++ gcc/config/t-exceptions
613@@ -0,0 +1,7 @@ 611@@ -0,0 +1,7 @@
614+# Use unwind-dw2-fde-glibc 612+# Use unwind-dw2-fde-glibc
615+# Required to utilize dl_iterate_phdr functionality 613+# Required to utilize dl_iterate_phdr functionality
616+ 614+
617+LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-glibc.c \ 615+LIB2ADDEH = $(srcdir)/unwind-dw2.c $(srcdir)/unwind-dw2-fde-glibc.c \
618+ $(srcdir)/unwind-sjlj.c $(srcdir)/gthr-gnat.c $(srcdir)/unwind-c.c 616+ $(srcdir)/unwind-sjlj.c $(srcdir)/gthr-gnat.c $(srcdir)/unwind-c.c
619+LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h unwind-dw2-fde.c 617+LIB2ADDEHDEP = unwind.inc unwind-dw2-fde.h unwind-dw2-fde.c
620+ 618+
621--- gcc/config/t-openbsd-thread.orig 619--- gcc/config/t-openbsd-thread.orig
622+++ gcc/config/t-openbsd-thread 620+++ gcc/config/t-openbsd-thread
623@@ -1,3 +1,3 @@ 621@@ -1,3 +1,3 @@
624 # This is currently needed to compile libgcc2 for threads support 622 # This is currently needed to compile libgcc2 for threads support
625-TARGET_LIBGCC2_CFLAGS=-pthread 623-TARGET_LIBGCC2_CFLAGS=-pthread
626+TARGET_LIBGCC2_CFLAGS += -pthread 624+TARGET_LIBGCC2_CFLAGS += -pthread
627  625
628--- /dev/null 626--- /dev/null
629+++ gcc/config/i386/dragonfly-unwind.h 627+++ gcc/config/i386/dragonfly-unwind.h
630@@ -0,0 +1,158 @@ 628@@ -0,0 +1,158 @@
631+/* DWARF2 EH unwinding support for DragonFly BSD: AMD x86-64 and x86. 629+/* DWARF2 EH unwinding support for DragonFly BSD: AMD x86-64 and x86.
632+ Copyright (C) 2010 John Marino <draco@marino.st> */ 630+ Copyright (C) 2010 John Marino <draco@marino.st> */
633+ 631+
634+/* Do code reading to identify a signal frame, and set the frame 632+/* Do code reading to identify a signal frame, and set the frame
635+ state data appropriately. See unwind-dw2.c for the structs. */ 633+ state data appropriately. See unwind-dw2.c for the structs. */
636+ 634+
637+#include <sys/types.h> 635+#include <sys/types.h>
638+#include <sys/sysctl.h> 636+#include <sys/sysctl.h>
639+#include <signal.h> 637+#include <signal.h>
640+#include <sys/ucontext.h> 638+#include <sys/ucontext.h>
641+#include <machine/sigframe.h> 639+#include <machine/sigframe.h>
642+ 640+
643+ 641+
644+#define REG_NAME(reg) sf_uc.uc_mcontext.mc_## reg 642+#define REG_NAME(reg) sf_uc.uc_mcontext.mc_## reg
645+ 643+
646+#ifdef __x86_64__ 644+#ifdef __x86_64__
647+#define MD_FALLBACK_FRAME_STATE_FOR x86_64_dragonfly_fallback_frame_state 645+#define MD_FALLBACK_FRAME_STATE_FOR x86_64_dragonfly_fallback_frame_state
648+ 646+
649+ 647+
650+static void 648+static void
651+x86_64_sigtramp_range (unsigned char **start, unsigned char **end) 649+x86_64_sigtramp_range (unsigned char **start, unsigned char **end)
652+{ 650+{
653+ unsigned long ps_strings; 651+ unsigned long ps_strings;
654+ int mib[2]; 652+ int mib[2];
655+ size_t len; 653+ size_t len;
656+ 654+
657+ mib[0] = CTL_KERN; 655+ mib[0] = CTL_KERN;
658+ mib[1] = KERN_PS_STRINGS; 656+ mib[1] = KERN_PS_STRINGS;
659+ len = sizeof (ps_strings); 657+ len = sizeof (ps_strings);
660+ sysctl (mib, 2, &ps_strings, &len, NULL, 0); 658+ sysctl (mib, 2, &ps_strings, &len, NULL, 0);
661+ 659+
662+ *start = (unsigned char *)ps_strings - 32; 660+ *start = (unsigned char *)ps_strings - 32;
663+ *end = (unsigned char *)ps_strings; 661+ *end = (unsigned char *)ps_strings;
664+} 662+}
665+ 663+
666+ 664+
667+static _Unwind_Reason_Code 665+static _Unwind_Reason_Code
668+x86_64_dragonfly_fallback_frame_state 666+x86_64_dragonfly_fallback_frame_state
669+(struct _Unwind_Context *context, _Unwind_FrameState *fs) 667+(struct _Unwind_Context *context, _Unwind_FrameState *fs)
670+{ 668+{
671+ unsigned char *pc = context->ra; 669+ unsigned char *pc = context->ra;
672+ unsigned char *sigtramp_start, *sigtramp_end; 670+ unsigned char *sigtramp_start, *sigtramp_end;
673+ struct sigframe *sf; 671+ struct sigframe *sf;
674+ long new_cfa; 672+ long new_cfa;
675+ 673+
676+ x86_64_sigtramp_range(&sigtramp_start, &sigtramp_end); 674+ x86_64_sigtramp_range(&sigtramp_start, &sigtramp_end);
677+ if (pc >= sigtramp_end || pc < sigtramp_start) 675+ if (pc >= sigtramp_end || pc < sigtramp_start)
678+ return _URC_END_OF_STACK; 676+ return _URC_END_OF_STACK;
679+ 677+
680+ sf = (struct sigframe *) context->cfa; 678+ sf = (struct sigframe *) context->cfa;
681+ new_cfa = sf->REG_NAME(rsp); 679+ new_cfa = sf->REG_NAME(rsp);
682+ fs->regs.cfa_how = CFA_REG_OFFSET; 680+ fs->regs.cfa_how = CFA_REG_OFFSET;
683+ /* Register 7 is rsp */ 681+ /* Register 7 is rsp */
684+ fs->regs.cfa_reg = 7; 682+ fs->regs.cfa_reg = 7;
685+ fs->regs.cfa_offset = new_cfa - (long) context->cfa; 683+ fs->regs.cfa_offset = new_cfa - (long) context->cfa;
686+ 684+
687+ /* The SVR4 register numbering macros aren't usable in libgcc. */ 685+ /* The SVR4 register numbering macros aren't usable in libgcc. */
688+ fs->regs.reg[0].how = REG_SAVED_OFFSET; 686+ fs->regs.reg[0].how = REG_SAVED_OFFSET;
689+ fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(rax) - new_cfa; 687+ fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(rax) - new_cfa;
690+ fs->regs.reg[1].how = REG_SAVED_OFFSET; 688+ fs->regs.reg[1].how = REG_SAVED_OFFSET;
691+ fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(rdx) - new_cfa; 689+ fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(rdx) - new_cfa;
692+ fs->regs.reg[2].how = REG_SAVED_OFFSET; 690+ fs->regs.reg[2].how = REG_SAVED_OFFSET;
693+ fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(rcx) - new_cfa; 691+ fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(rcx) - new_cfa;
694+ fs->regs.reg[3].how = REG_SAVED_OFFSET; 692+ fs->regs.reg[3].how = REG_SAVED_OFFSET;
695+ fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(rbx) - new_cfa; 693+ fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(rbx) - new_cfa;
696+ fs->regs.reg[4].how = REG_SAVED_OFFSET; 694+ fs->regs.reg[4].how = REG_SAVED_OFFSET;
697+ fs->regs.reg[4].loc.offset = (long)&sf->REG_NAME(rsi) - new_cfa; 695+ fs->regs.reg[4].loc.offset = (long)&sf->REG_NAME(rsi) - new_cfa;
698+ fs->regs.reg[5].how = REG_SAVED_OFFSET; 696+ fs->regs.reg[5].how = REG_SAVED_OFFSET;
699+ fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(rdi) - new_cfa; 697+ fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(rdi) - new_cfa;
700+ fs->regs.reg[6].how = REG_SAVED_OFFSET; 698+ fs->regs.reg[6].how = REG_SAVED_OFFSET;
701+ fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(rbp) - new_cfa; 699+ fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(rbp) - new_cfa;
702+ fs->regs.reg[8].how = REG_SAVED_OFFSET; 700+ fs->regs.reg[8].how = REG_SAVED_OFFSET;
703+ fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(r8) - new_cfa; 701+ fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(r8) - new_cfa;
704+ fs->regs.reg[9].how = REG_SAVED_OFFSET; 702+ fs->regs.reg[9].how = REG_SAVED_OFFSET;
705+ fs->regs.reg[9].loc.offset = (long)&sf->REG_NAME(r9) - new_cfa; 703+ fs->regs.reg[9].loc.offset = (long)&sf->REG_NAME(r9) - new_cfa;
706+ fs->regs.reg[10].how = REG_SAVED_OFFSET; 704+ fs->regs.reg[10].how = REG_SAVED_OFFSET;
707+ fs->regs.reg[10].loc.offset = (long)&sf->REG_NAME(r10) - new_cfa; 705+ fs->regs.reg[10].loc.offset = (long)&sf->REG_NAME(r10) - new_cfa;
708+ fs->regs.reg[11].how = REG_SAVED_OFFSET; 706+ fs->regs.reg[11].how = REG_SAVED_OFFSET;
709+ fs->regs.reg[11].loc.offset = (long)&sf->REG_NAME(r11) - new_cfa; 707+ fs->regs.reg[11].loc.offset = (long)&sf->REG_NAME(r11) - new_cfa;
710+ fs->regs.reg[12].how = REG_SAVED_OFFSET; 708+ fs->regs.reg[12].how = REG_SAVED_OFFSET;
711+ fs->regs.reg[12].loc.offset = (long)&sf->REG_NAME(r12) - new_cfa; 709+ fs->regs.reg[12].loc.offset = (long)&sf->REG_NAME(r12) - new_cfa;
712+ fs->regs.reg[13].how = REG_SAVED_OFFSET; 710+ fs->regs.reg[13].how = REG_SAVED_OFFSET;
713+ fs->regs.reg[13].loc.offset = (long)&sf->REG_NAME(r13) - new_cfa; 711+ fs->regs.reg[13].loc.offset = (long)&sf->REG_NAME(r13) - new_cfa;
714+ fs->regs.reg[14].how = REG_SAVED_OFFSET; 712+ fs->regs.reg[14].how = REG_SAVED_OFFSET;
715+ fs->regs.reg[14].loc.offset = (long)&sf->REG_NAME(r14) - new_cfa; 713+ fs->regs.reg[14].loc.offset = (long)&sf->REG_NAME(r14) - new_cfa;
716+ fs->regs.reg[15].how = REG_SAVED_OFFSET; 714+ fs->regs.reg[15].how = REG_SAVED_OFFSET;
717+ fs->regs.reg[15].loc.offset = (long)&sf->REG_NAME(r15) - new_cfa; 715+ fs->regs.reg[15].loc.offset = (long)&sf->REG_NAME(r15) - new_cfa;
718+ fs->regs.reg[16].how = REG_SAVED_OFFSET; 716+ fs->regs.reg[16].how = REG_SAVED_OFFSET;
719+ fs->regs.reg[16].loc.offset = (long)&sf->REG_NAME(rip) - new_cfa; 717+ fs->regs.reg[16].loc.offset = (long)&sf->REG_NAME(rip) - new_cfa;
720+ fs->retaddr_column = 16; 718+ fs->retaddr_column = 16;
721+ fs->signal_frame = 1; 719+ fs->signal_frame = 1;
722+ return _URC_NO_REASON; 720+ return _URC_NO_REASON;
723+} 721+}
724+ 722+
725+#else /* Next section is for i386 */ 723+#else /* Next section is for i386 */
726+ 724+
727+#define MD_FALLBACK_FRAME_STATE_FOR x86_dragonfly_fallback_frame_state 725+#define MD_FALLBACK_FRAME_STATE_FOR x86_dragonfly_fallback_frame_state
728+ 726+
729+ 727+
730+static void 728+static void
731+x86_sigtramp_range (unsigned char **start, unsigned char **end) 729+x86_sigtramp_range (unsigned char **start, unsigned char **end)
732+{ 730+{
733+ unsigned long ps_strings; 731+ unsigned long ps_strings;
734+ int mib[2]; 732+ int mib[2];
735+ size_t len; 733+ size_t len;
736+ 734+
737+ mib[0] = CTL_KERN; 735+ mib[0] = CTL_KERN;
738+ mib[1] = KERN_PS_STRINGS; 736+ mib[1] = KERN_PS_STRINGS;
739+ len = sizeof (ps_strings); 737+ len = sizeof (ps_strings);
740+ sysctl (mib, 2, &ps_strings, &len, NULL, 0); 738+ sysctl (mib, 2, &ps_strings, &len, NULL, 0);
741+ 739+
742+ *start = (unsigned char *)ps_strings - 128; 740+ *start = (unsigned char *)ps_strings - 128;
743+ *end = (unsigned char *)ps_strings; 741+ *end = (unsigned char *)ps_strings;
744+} 742+}
745+ 743+
746+ 744+
747+static _Unwind_Reason_Code 745+static _Unwind_Reason_Code
748+x86_dragonfly_fallback_frame_state 746+x86_dragonfly_fallback_frame_state
749+(struct _Unwind_Context *context, _Unwind_FrameState *fs) 747+(struct _Unwind_Context *context, _Unwind_FrameState *fs)
750+{ 748+{
751+ unsigned char *pc = context->ra; 749+ unsigned char *pc = context->ra;
752+ unsigned char *sigtramp_start, *sigtramp_end; 750+ unsigned char *sigtramp_start, *sigtramp_end;
753+ struct sigframe *sf; 751+ struct sigframe *sf;
754+ long new_cfa; 752+ long new_cfa;
755+ 753+
756+ x86_sigtramp_range(&sigtramp_start, &sigtramp_end); 754+ x86_sigtramp_range(&sigtramp_start, &sigtramp_end);
757+ 755+
758+ if (pc >= sigtramp_end || pc < sigtramp_start) 756+ if (pc >= sigtramp_end || pc < sigtramp_start)
759+ return _URC_END_OF_STACK; 757+ return _URC_END_OF_STACK;
760+ 758+
761+ sf = (struct sigframe *) context->cfa; 759+ sf = (struct sigframe *) context->cfa;
762+ new_cfa = sf->REG_NAME(esp); 760+ new_cfa = sf->REG_NAME(esp);
763+ fs->regs.cfa_how = CFA_REG_OFFSET; 761+ fs->regs.cfa_how = CFA_REG_OFFSET;
764+ fs->regs.cfa_reg = 4; 762+ fs->regs.cfa_reg = 4;
765+ fs->regs.cfa_offset = new_cfa - (long) context->cfa; 763+ fs->regs.cfa_offset = new_cfa - (long) context->cfa;
766+ 764+
767+ /* The SVR4 register numbering macros aren't usable in libgcc. */ 765+ /* The SVR4 register numbering macros aren't usable in libgcc. */
768+ fs->regs.reg[0].how = REG_SAVED_OFFSET; 766+ fs->regs.reg[0].how = REG_SAVED_OFFSET;
769+ fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(eax) - new_cfa; 767+ fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(eax) - new_cfa;
770+ fs->regs.reg[3].how = REG_SAVED_OFFSET; 768+ fs->regs.reg[3].how = REG_SAVED_OFFSET;
771+ fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(ebx) - new_cfa; 769+ fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(ebx) - new_cfa;
772+ fs->regs.reg[1].how = REG_SAVED_OFFSET; 770+ fs->regs.reg[1].how = REG_SAVED_OFFSET;
773+ fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ecx) - new_cfa; 771+ fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ecx) - new_cfa;
774+ fs->regs.reg[2].how = REG_SAVED_OFFSET; 772+ fs->regs.reg[2].how = REG_SAVED_OFFSET;
775+ fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(edx) - new_cfa; 773+ fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(edx) - new_cfa;
776+ fs->regs.reg[6].how = REG_SAVED_OFFSET; 774+ fs->regs.reg[6].how = REG_SAVED_OFFSET;
777+ fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(esi) - new_cfa; 775+ fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(esi) - new_cfa;
778+ fs->regs.reg[7].how = REG_SAVED_OFFSET; 776+ fs->regs.reg[7].how = REG_SAVED_OFFSET;
779+ fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(edi) - new_cfa; 777+ fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(edi) - new_cfa;
780+ fs->regs.reg[5].how = REG_SAVED_OFFSET; 778+ fs->regs.reg[5].how = REG_SAVED_OFFSET;
781+ fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(ebp) - new_cfa; 779+ fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(ebp) - new_cfa;
782+ fs->regs.reg[8].how = REG_SAVED_OFFSET; 780+ fs->regs.reg[8].how = REG_SAVED_OFFSET;
783+ fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(eip) - new_cfa; 781+ fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(eip) - new_cfa;
784+ fs->retaddr_column = 8; 782+ fs->retaddr_column = 8;
785+ fs->signal_frame = 1; 783+ fs->signal_frame = 1;
786+ return _URC_NO_REASON; 784+ return _URC_NO_REASON;
787+} 785+}
788+#endif /* ifdef __x86_64__ */ 786+#endif /* ifdef __x86_64__ */
789--- /dev/null 787--- /dev/null
790+++ gcc/config/i386/dragonfly.h 788+++ gcc/config/i386/dragonfly.h
791@@ -0,0 +1,107 @@ 789@@ -0,0 +1,107 @@
792+/* Definitions for Intel 386 running DragonFly with ELF format 790+/* Definitions for Intel 386 running DragonFly with ELF format
793+ Copyright (C) 1996, 2000, 2002, 2004, 2007 Free Software Foundation, Inc. 791+ Copyright (C) 1996, 2000, 2002, 2004, 2007 Free Software Foundation, Inc.
794+ Contributed by Eric Youngdale. 792+ Contributed by Eric Youngdale.
795+ Modified for stabs-in-ELF by H.J. Lu. 793+ Modified for stabs-in-ELF by H.J. Lu.
796+ Adapted from GNU/Linux version by John Polstra. 794+ Adapted from GNU/Linux version by John Polstra.
797+ Continued development by David O'Brien <obrien@freebsd.org> 795+ Continued development by David O'Brien <obrien@freebsd.org>
798+ Copyright (C) 2010, 2011 John Marino <www.dragonlace.net> 796+ Copyright (C) 2010, 2011 John Marino <www.dragonlace.net>
799+ 797+
800+This file is part of GCC. 798+This file is part of GCC.
801+ 799+
802+GCC is free software; you can redistribute it and/or modify 800+GCC is free software; you can redistribute it and/or modify
803+it under the terms of the GNU General Public License as published by 801+it under the terms of the GNU General Public License as published by
804+the Free Software Foundation; either version 3, or (at your option) 802+the Free Software Foundation; either version 3, or (at your option)
805+any later version. 803+any later version.
806+ 804+
807+GCC is distributed in the hope that it will be useful, 805+GCC is distributed in the hope that it will be useful,
808+but WITHOUT ANY WARRANTY; without even the implied warranty of 806+but WITHOUT ANY WARRANTY; without even the implied warranty of
809+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 807+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
810+GNU General Public License for more details. 808+GNU General Public License for more details.
811+ 809+
812+You should have received a copy of the GNU General Public License 810+You should have received a copy of the GNU General Public License
813+along with GCC; see the file COPYING3. If not see 811+along with GCC; see the file COPYING3. If not see
814+<http://www.gnu.org/licenses/>. */ 812+<http://www.gnu.org/licenses/>. */
815+ 813+
816+ 814+
817+#define TARGET_VERSION fprintf (stderr, " (i386 DragonFly/ELF)"); 815+#define TARGET_VERSION fprintf (stderr, " (i386 DragonFly/ELF)");
818+ 816+
819+/* Override the default comment-starter of "/". */ 817+/* Override the default comment-starter of "/". */
820+#undef ASM_COMMENT_START 818+#undef ASM_COMMENT_START
821+#define ASM_COMMENT_START "#" 819+#define ASM_COMMENT_START "#"
822+ 820+
823+#undef ASM_APP_ON 821+#undef ASM_APP_ON
824+#define ASM_APP_ON "#APP\n" 822+#define ASM_APP_ON "#APP\n"
825+ 823+
826+#undef ASM_APP_OFF 824+#undef ASM_APP_OFF
827+#define ASM_APP_OFF "#NO_APP\n" 825+#define ASM_APP_OFF "#NO_APP\n"
828+ 826+
829+#undef DBX_REGISTER_NUMBER 827+#undef DBX_REGISTER_NUMBER
830+#define DBX_REGISTER_NUMBER(n) \ 828+#define DBX_REGISTER_NUMBER(n) \
831+ (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n]) 829+ (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n])
832+ 830+
833+#undef NO_PROFILE_COUNTERS 831+#undef NO_PROFILE_COUNTERS
834+#define NO_PROFILE_COUNTERS 1 832+#define NO_PROFILE_COUNTERS 1
835+ 833+
836+/* Tell final.c that we don't need a label passed to mcount. */ 834+/* Tell final.c that we don't need a label passed to mcount. */
837+ 835+
838+#undef MCOUNT_NAME 836+#undef MCOUNT_NAME
839+#define MCOUNT_NAME ".mcount" 837+#define MCOUNT_NAME ".mcount"
840+ 838+
841+/* Make gcc agree with <machine/ansi.h>. */ 839+/* Make gcc agree with <machine/ansi.h>. */
842+ 840+
843+#undef SIZE_TYPE 841+#undef SIZE_TYPE
844+#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int") 842+#define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
845+ 843+
846+#undef PTRDIFF_TYPE 844+#undef PTRDIFF_TYPE
847+#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int") 845+#define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
848+ 846+
849+#undef WCHAR_TYPE_SIZE 847+#undef WCHAR_TYPE_SIZE
850+#define WCHAR_TYPE_SIZE (TARGET_64BIT ? 32 : BITS_PER_WORD) 848+#define WCHAR_TYPE_SIZE (TARGET_64BIT ? 32 : BITS_PER_WORD)
851+ 849+
852+#undef SUBTARGET_EXTRA_SPECS /* i386.h bogusly defines it. */ 850+#undef SUBTARGET_EXTRA_SPECS /* i386.h bogusly defines it. */
853+#define SUBTARGET_EXTRA_SPECS \ 851+#define SUBTARGET_EXTRA_SPECS \
854+ { "dfbsd_dynamic_linker", DFBSD_DYNAMIC_LINKER } 852+ { "dfbsd_dynamic_linker", DFBSD_DYNAMIC_LINKER }
855+ 853+
856+ 854+
857+/* A C statement to output to the stdio stream FILE an assembler 855+/* A C statement to output to the stdio stream FILE an assembler
858+ command to advance the location counter to a multiple of 1<<LOG 856+ command to advance the location counter to a multiple of 1<<LOG
859+ bytes if it is within MAX_SKIP bytes. 857+ bytes if it is within MAX_SKIP bytes.
860+ 858+
861+ This is used to align code labels according to Intel recommendations. */ 859+ This is used to align code labels according to Intel recommendations. */
862+ 860+
863+#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN 861+#ifdef HAVE_GAS_MAX_SKIP_P2ALIGN
864+#undef ASM_OUTPUT_MAX_SKIP_ALIGN 862+#undef ASM_OUTPUT_MAX_SKIP_ALIGN
865+#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \ 863+#define ASM_OUTPUT_MAX_SKIP_ALIGN(FILE, LOG, MAX_SKIP) \
866+ if ((LOG) != 0) { \ 864+ if ((LOG) != 0) { \
867+ if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \ 865+ if ((MAX_SKIP) == 0) fprintf ((FILE), "\t.p2align %d\n", (LOG)); \
868+ else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \ 866+ else fprintf ((FILE), "\t.p2align %d,,%d\n", (LOG), (MAX_SKIP)); \
869+ } 867+ }
870+#endif 868+#endif
871+ 869+
872+/* Don't default to pcc-struct-return, we want to retain compatibility with 870+/* Don't default to pcc-struct-return, we want to retain compatibility with
873+ older gcc versions AND pcc-struct-return is nonreentrant. 871+ older gcc versions AND pcc-struct-return is nonreentrant.
874+ (even though the SVR4 ABI for the i386 says that records and unions are 872+ (even though the SVR4 ABI for the i386 says that records and unions are
875+ returned in memory). */ 873+ returned in memory). */
876+ 874+
877+#undef DEFAULT_PCC_STRUCT_RETURN 875+#undef DEFAULT_PCC_STRUCT_RETURN
878+#define DEFAULT_PCC_STRUCT_RETURN 0 876+#define DEFAULT_PCC_STRUCT_RETURN 0
879+ 877+
880+/* DragonFly sets the rounding precision of the FPU to 53 bits, but GNAT 878+/* DragonFly sets the rounding precision of the FPU to 53 bits, but GNAT
881+ resets it to full precision. */ 879+ resets it to full precision. */
882+#undef TARGET_96_ROUND_53_LONG_DOUBLE 880+#undef TARGET_96_ROUND_53_LONG_DOUBLE
883+#define TARGET_96_ROUND_53_LONG_DOUBLE 0 881+#define TARGET_96_ROUND_53_LONG_DOUBLE 0
884+ 882+
885+/* Put all *tf routines in libgcc. */ 883+/* Put all *tf routines in libgcc. */
886+#undef LIBGCC2_HAS_TF_MODE 884+#undef LIBGCC2_HAS_TF_MODE
887+#define LIBGCC2_HAS_TF_MODE 1 885+#define LIBGCC2_HAS_TF_MODE 1
888+#define LIBGCC2_TF_CEXT q 886+#define LIBGCC2_TF_CEXT q
889+#define TF_SIZE 113 887+#define TF_SIZE 113
890+ 888+
891+/* Define this to be nonzero if static stack checking is supported. */ 889+/* Define this to be nonzero if static stack checking is supported. */
892+#define STACK_CHECK_STATIC_BUILTIN 1 890+#define STACK_CHECK_STATIC_BUILTIN 1
893+ 891+
894+/* Support for i386 has been removed from DragonFly for several releases */ 892+/* Support for i386 has been removed from DragonFly for several releases */
895+#define SUBTARGET32_DEFAULT_CPU "i486" 893+#define SUBTARGET32_DEFAULT_CPU "i486"
896+ 894+
897+/* Define location of OS-specific unwind support configuration. */ 895+/* Define location of OS-specific unwind support configuration. */
898+#define MD_UNWIND_SUPPORT "config/i386/dragonfly-unwind.h" 896+#define MD_UNWIND_SUPPORT "config/i386/dragonfly-unwind.h"
899--- /dev/null 897--- /dev/null
900+++ gcc/config/i386/dragonfly64.h 898+++ gcc/config/i386/dragonfly64.h
901@@ -0,0 +1,5 @@ 899@@ -0,0 +1,5 @@
902+/* Definitions for AMD x86_64 running DragonFly BSD with ELF Format */ 900+/* Definitions for AMD x86_64 running DragonFly BSD with ELF Format */
903+ 901+
904+#undef TARGET_VERSION 902+#undef TARGET_VERSION
905+#define TARGET_VERSION fprintf (stderr, " (x86-64 DragonFly/ELF)"); 903+#define TARGET_VERSION fprintf (stderr, " (x86-64 DragonFly/ELF)");
906+ 904+
907--- /dev/null 905--- /dev/null
908+++ gcc/config/i386/freebsd-unwind.h 906+++ gcc/config/i386/freebsd-unwind.h
909@@ -0,0 +1,184 @@ 907@@ -0,0 +1,184 @@
910+/* DWARF2 EH unwinding support for FreeBSD: AMD x86-64 and x86. 908+/* DWARF2 EH unwinding support for FreeBSD: AMD x86-64 and x86.
911+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. 909+ Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
912+ Copyright (C) 2010 John Marino <draco@marino.st> 910+ Copyright (C) 2010 John Marino <draco@marino.st>
913+ 911+
914+This file is part of GCC. 912+This file is part of GCC.
915+ 913+
916+GCC is free software; you can redistribute it and/or modify 914+GCC is free software; you can redistribute it and/or modify
917+it under the terms of the GNU General Public License as published by 915+it under the terms of the GNU General Public License as published by
918+the Free Software Foundation; either version 2, or (at your option) 916+the Free Software Foundation; either version 2, or (at your option)
919+any later version. 917+any later version.
920+ 918+
921+In addition to the permissions in the GNU General Public License, the 919+In addition to the permissions in the GNU General Public License, the
922+Free Software Foundation gives you unlimited permission to link the 920+Free Software Foundation gives you unlimited permission to link the
923+compiled version of this file with other programs, and to distribute 921+compiled version of this file with other programs, and to distribute
924+those programs without any restriction coming from the use of this 922+those programs without any restriction coming from the use of this
925+file. (The General Public License restrictions do apply in other 923+file. (The General Public License restrictions do apply in other
926+respects; for example, they cover modification of the file, and 924+respects; for example, they cover modification of the file, and
927+distribution when not linked into another program.) 925+distribution when not linked into another program.)
928+ 926+
929+GCC is distributed in the hope that it will be useful, 927+GCC is distributed in the hope that it will be useful,
930+but WITHOUT ANY WARRANTY; without even the implied warranty of 928+but WITHOUT ANY WARRANTY; without even the implied warranty of
931+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 929+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
932+GNU General Public License for more details. 930+GNU General Public License for more details.
933+ 931+
934+You should have received a copy of the GNU General Public License 932+You should have received a copy of the GNU General Public License
935+along with GCC; see the file COPYING. If not, write to 933+along with GCC; see the file COPYING. If not, write to
936+the Free Software Foundation, 51 Franklin Street, Fifth Floor, 934+the Free Software Foundation, 51 Franklin Street, Fifth Floor,
937+Boston, MA 02110-1301, USA. */ 935+Boston, MA 02110-1301, USA. */
938+ 936+
939+/* Do code reading to identify a signal frame, and set the frame 937+/* Do code reading to identify a signal frame, and set the frame
940+ state data appropriately. See unwind-dw2.c for the structs. */ 938+ state data appropriately. See unwind-dw2.c for the structs. */
941+ 939+
942+#include <sys/types.h> 940+#include <sys/types.h>
943+#include <sys/sysctl.h> 941+#include <sys/sysctl.h>
944+#include <signal.h> 942+#include <signal.h>
945+#include <sys/ucontext.h> 943+#include <sys/ucontext.h>
946+#include <machine/sigframe.h> 944+#include <machine/sigframe.h>
947+ 945+
948+ 946+
949+#define REG_NAME(reg) sf_uc.uc_mcontext.mc_## reg 947+#define REG_NAME(reg) sf_uc.uc_mcontext.mc_## reg
950+ 948+
951+#ifdef __x86_64__ 949+#ifdef __x86_64__
952+#define MD_FALLBACK_FRAME_STATE_FOR x86_64_freebsd_fallback_frame_state 950+#define MD_FALLBACK_FRAME_STATE_FOR x86_64_freebsd_fallback_frame_state
953+ 951+
954+ 952+
955+static void 953+static void
956+x86_64_sigtramp_range (unsigned char **start, unsigned char **end) 954+x86_64_sigtramp_range (unsigned char **start, unsigned char **end)
957+{ 955+{
958+ unsigned long ps_strings; 956+ unsigned long ps_strings;
959+ int mib[2]; 957+ int mib[2];
960+ size_t len; 958+ size_t len;
961+ 959+
962+ mib[0] = CTL_KERN; 960+ mib[0] = CTL_KERN;
963+ mib[1] = KERN_PS_STRINGS; 961+ mib[1] = KERN_PS_STRINGS;
964+ len = sizeof (ps_strings); 962+ len = sizeof (ps_strings);
965+ sysctl (mib, 2, &ps_strings, &len, NULL, 0); 963+ sysctl (mib, 2, &ps_strings, &len, NULL, 0);
966+ 964+
967+ *start = (unsigned char *)ps_strings - 32; 965+ *start = (unsigned char *)ps_strings - 32;
968+ *end = (unsigned char *)ps_strings; 966+ *end = (unsigned char *)ps_strings;
969+} 967+}
970+ 968+
971+ 969+
972+static _Unwind_Reason_Code 970+static _Unwind_Reason_Code
973+x86_64_freebsd_fallback_frame_state 971+x86_64_freebsd_fallback_frame_state
974+(struct _Unwind_Context *context, _Unwind_FrameState *fs) 972+(struct _Unwind_Context *context, _Unwind_FrameState *fs)
975+{ 973+{
976+ unsigned char *pc = context->ra; 974+ unsigned char *pc = context->ra;
977+ unsigned char *sigtramp_start, *sigtramp_end; 975+ unsigned char *sigtramp_start, *sigtramp_end;
978+ struct sigframe *sf; 976+ struct sigframe *sf;
979+ long new_cfa; 977+ long new_cfa;
980+ 978+
981+ x86_64_sigtramp_range(&sigtramp_start, &sigtramp_end); 979+ x86_64_sigtramp_range(&sigtramp_start, &sigtramp_end);
982+ if (pc >= sigtramp_end || pc < sigtramp_start) 980+ if (pc >= sigtramp_end || pc < sigtramp_start)
983+ return _URC_END_OF_STACK; 981+ return _URC_END_OF_STACK;
984+ 982+
985+ sf = (struct sigframe *) context->cfa; 983+ sf = (struct sigframe *) context->cfa;
986+ new_cfa = sf->REG_NAME(rsp); 984+ new_cfa = sf->REG_NAME(rsp);
987+ fs->regs.cfa_how = CFA_REG_OFFSET; 985+ fs->regs.cfa_how = CFA_REG_OFFSET;
988+ /* Register 7 is rsp */ 986+ /* Register 7 is rsp */
989+ fs->regs.cfa_reg = 7; 987+ fs->regs.cfa_reg = 7;
990+ fs->regs.cfa_offset = new_cfa - (long) context->cfa; 988+ fs->regs.cfa_offset = new_cfa - (long) context->cfa;
991+ 989+
992+ /* The SVR4 register numbering macros aren't usable in libgcc. */ 990+ /* The SVR4 register numbering macros aren't usable in libgcc. */
993+ fs->regs.reg[0].how = REG_SAVED_OFFSET; 991+ fs->regs.reg[0].how = REG_SAVED_OFFSET;
994+ fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(rax) - new_cfa; 992+ fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(rax) - new_cfa;
995+ fs->regs.reg[1].how = REG_SAVED_OFFSET; 993+ fs->regs.reg[1].how = REG_SAVED_OFFSET;
996+ fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(rdx) - new_cfa; 994+ fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(rdx) - new_cfa;
997+ fs->regs.reg[2].how = REG_SAVED_OFFSET; 995+ fs->regs.reg[2].how = REG_SAVED_OFFSET;
998+ fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(rcx) - new_cfa; 996+ fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(rcx) - new_cfa;
999+ fs->regs.reg[3].how = REG_SAVED_OFFSET; 997+ fs->regs.reg[3].how = REG_SAVED_OFFSET;
1000+ fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(rbx) - new_cfa; 998+ fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(rbx) - new_cfa;
1001+ fs->regs.reg[4].how = REG_SAVED_OFFSET; 999+ fs->regs.reg[4].how = REG_SAVED_OFFSET;
1002+ fs->regs.reg[4].loc.offset = (long)&sf->REG_NAME(rsi) - new_cfa; 1000+ fs->regs.reg[4].loc.offset = (long)&sf->REG_NAME(rsi) - new_cfa;
1003+ fs->regs.reg[5].how = REG_SAVED_OFFSET; 1001+ fs->regs.reg[5].how = REG_SAVED_OFFSET;
1004+ fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(rdi) - new_cfa; 1002+ fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(rdi) - new_cfa;
1005+ fs->regs.reg[6].how = REG_SAVED_OFFSET; 1003+ fs->regs.reg[6].how = REG_SAVED_OFFSET;
1006+ fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(rbp) - new_cfa; 1004+ fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(rbp) - new_cfa;
1007+ fs->regs.reg[8].how = REG_SAVED_OFFSET; 1005+ fs->regs.reg[8].how = REG_SAVED_OFFSET;
1008+ fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(r8) - new_cfa; 1006+ fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(r8) - new_cfa;
1009+ fs->regs.reg[9].how = REG_SAVED_OFFSET; 1007+ fs->regs.reg[9].how = REG_SAVED_OFFSET;
1010+ fs->regs.reg[9].loc.offset = (long)&sf->REG_NAME(r9) - new_cfa; 1008+ fs->regs.reg[9].loc.offset = (long)&sf->REG_NAME(r9) - new_cfa;
1011+ fs->regs.reg[10].how = REG_SAVED_OFFSET; 1009+ fs->regs.reg[10].how = REG_SAVED_OFFSET;
1012+ fs->regs.reg[10].loc.offset = (long)&sf->REG_NAME(r10) - new_cfa; 1010+ fs->regs.reg[10].loc.offset = (long)&sf->REG_NAME(r10) - new_cfa;
1013+ fs->regs.reg[11].how = REG_SAVED_OFFSET; 1011+ fs->regs.reg[11].how = REG_SAVED_OFFSET;
1014+ fs->regs.reg[11].loc.offset = (long)&sf->REG_NAME(r11) - new_cfa; 1012+ fs->regs.reg[11].loc.offset = (long)&sf->REG_NAME(r11) - new_cfa;
1015+ fs->regs.reg[12].how = REG_SAVED_OFFSET; 1013+ fs->regs.reg[12].how = REG_SAVED_OFFSET;
1016+ fs->regs.reg[12].loc.offset = (long)&sf->REG_NAME(r12) - new_cfa; 1014+ fs->regs.reg[12].loc.offset = (long)&sf->REG_NAME(r12) - new_cfa;
1017+ fs->regs.reg[13].how = REG_SAVED_OFFSET; 1015+ fs->regs.reg[13].how = REG_SAVED_OFFSET;
1018+ fs->regs.reg[13].loc.offset = (long)&sf->REG_NAME(r13) - new_cfa; 1016+ fs->regs.reg[13].loc.offset = (long)&sf->REG_NAME(r13) - new_cfa;
1019+ fs->regs.reg[14].how = REG_SAVED_OFFSET; 1017+ fs->regs.reg[14].how = REG_SAVED_OFFSET;
1020+ fs->regs.reg[14].loc.offset = (long)&sf->REG_NAME(r14) - new_cfa; 1018+ fs->regs.reg[14].loc.offset = (long)&sf->REG_NAME(r14) - new_cfa;
1021+ fs->regs.reg[15].how = REG_SAVED_OFFSET; 1019+ fs->regs.reg[15].how = REG_SAVED_OFFSET;
1022+ fs->regs.reg[15].loc.offset = (long)&sf->REG_NAME(r15) - new_cfa; 1020+ fs->regs.reg[15].loc.offset = (long)&sf->REG_NAME(r15) - new_cfa;
1023+ fs->regs.reg[16].how = REG_SAVED_OFFSET; 1021+ fs->regs.reg[16].how = REG_SAVED_OFFSET;
1024+ fs->regs.reg[16].loc.offset = (long)&sf->REG_NAME(rip) - new_cfa; 1022+ fs->regs.reg[16].loc.offset = (long)&sf->REG_NAME(rip) - new_cfa;
1025+ fs->retaddr_column = 16; 1023+ fs->retaddr_column = 16;
1026+ fs->signal_frame = 1; 1024+ fs->signal_frame = 1;
1027+ return _URC_NO_REASON; 1025+ return _URC_NO_REASON;
1028+} 1026+}
1029+ 1027+
1030+#else /* Next section is for i386 */ 1028+#else /* Next section is for i386 */
1031+ 1029+
1032+#define MD_FALLBACK_FRAME_STATE_FOR x86_freebsd_fallback_frame_state 1030+#define MD_FALLBACK_FRAME_STATE_FOR x86_freebsd_fallback_frame_state
1033+ 1031+
1034+ 1032+
1035+static void 1033+static void
1036+x86_sigtramp_range (unsigned char **start, unsigned char **end) 1034+x86_sigtramp_range (unsigned char **start, unsigned char **end)
1037+{ 1035+{
1038+ unsigned long ps_strings; 1036+ unsigned long ps_strings;
1039+ int mib[2]; 1037+ int mib[2];
1040+ size_t len; 1038+ size_t len;
1041+ 1039+
1042+ mib[0] = CTL_KERN; 1040+ mib[0] = CTL_KERN;
1043+ mib[1] = KERN_PS_STRINGS; 1041+ mib[1] = KERN_PS_STRINGS;
1044+ len = sizeof (ps_strings); 1042+ len = sizeof (ps_strings);
1045+ sysctl (mib, 2, &ps_strings, &len, NULL, 0); 1043+ sysctl (mib, 2, &ps_strings, &len, NULL, 0);
1046+ 1044+
1047+ *start = (unsigned char *)ps_strings - 128; 1045+ *start = (unsigned char *)ps_strings - 128;
1048+ *end = (unsigned char *)ps_strings; 1046+ *end = (unsigned char *)ps_strings;
1049+} 1047+}
1050+ 1048+
1051+ 1049+
1052+static _Unwind_Reason_Code 1050+static _Unwind_Reason_Code
1053+x86_freebsd_fallback_frame_state 1051+x86_freebsd_fallback_frame_state
1054+(struct _Unwind_Context *context, _Unwind_FrameState *fs) 1052+(struct _Unwind_Context *context, _Unwind_FrameState *fs)
1055+{ 1053+{
1056+ unsigned char *pc = context->ra; 1054+ unsigned char *pc = context->ra;
1057+ unsigned char *sigtramp_start, *sigtramp_end; 1055+ unsigned char *sigtramp_start, *sigtramp_end;
1058+ struct sigframe *sf; 1056+ struct sigframe *sf;
1059+ long new_cfa; 1057+ long new_cfa;
1060+ 1058+
1061+ x86_sigtramp_range(&sigtramp_start, &sigtramp_end); 1059+ x86_sigtramp_range(&sigtramp_start, &sigtramp_end);
1062+ 1060+
1063+ if (pc >= sigtramp_end || pc < sigtramp_start) 1061+ if (pc >= sigtramp_end || pc < sigtramp_start)
1064+ return _URC_END_OF_STACK; 1062+ return _URC_END_OF_STACK;
1065+ 1063+
1066+ sf = (struct sigframe *) context->cfa; 1064+ sf = (struct sigframe *) context->cfa;
1067+ new_cfa = sf->REG_NAME(esp); 1065+ new_cfa = sf->REG_NAME(esp);
1068+ fs->regs.cfa_how = CFA_REG_OFFSET; 1066+ fs->regs.cfa_how = CFA_REG_OFFSET;
1069+ fs->regs.cfa_reg = 4; 1067+ fs->regs.cfa_reg = 4;
1070+ fs->regs.cfa_offset = new_cfa - (long) context->cfa; 1068+ fs->regs.cfa_offset = new_cfa - (long) context->cfa;
1071+ 1069+
1072+ /* The SVR4 register numbering macros aren't usable in libgcc. */ 1070+ /* The SVR4 register numbering macros aren't usable in libgcc. */
1073+ fs->regs.reg[0].how = REG_SAVED_OFFSET; 1071+ fs->regs.reg[0].how = REG_SAVED_OFFSET;
1074+ fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(eax) - new_cfa; 1072+ fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(eax) - new_cfa;
1075+ fs->regs.reg[3].how = REG_SAVED_OFFSET; 1073+ fs->regs.reg[3].how = REG_SAVED_OFFSET;
1076+ fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(ebx) - new_cfa; 1074+ fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(ebx) - new_cfa;
1077+ fs->regs.reg[1].how = REG_SAVED_OFFSET; 1075+ fs->regs.reg[1].how = REG_SAVED_OFFSET;
1078+ fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ecx) - new_cfa; 1076+ fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ecx) - new_cfa;
1079+ fs->regs.reg[2].how = REG_SAVED_OFFSET; 1077+ fs->regs.reg[2].how = REG_SAVED_OFFSET;
1080+ fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(edx) - new_cfa; 1078+ fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(edx) - new_cfa;
1081+ fs->regs.reg[6].how = REG_SAVED_OFFSET; 1079+ fs->regs.reg[6].how = REG_SAVED_OFFSET;
1082+ fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(esi) - new_cfa; 1080+ fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(esi) - new_cfa;
1083+ fs->regs.reg[7].how = REG_SAVED_OFFSET; 1081+ fs->regs.reg[7].how = REG_SAVED_OFFSET;
1084+ fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(edi) - new_cfa; 1082+ fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(edi) - new_cfa;
1085+ fs->regs.reg[5].how = REG_SAVED_OFFSET; 1083+ fs->regs.reg[5].how = REG_SAVED_OFFSET;
1086+ fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(ebp) - new_cfa; 1084+ fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(ebp) - new_cfa;
1087+ fs->regs.reg[8].how = REG_SAVED_OFFSET; 1085+ fs->regs.reg[8].how = REG_SAVED_OFFSET;
1088+ fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(eip) - new_cfa; 1086+ fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(eip) - new_cfa;
1089+ fs->retaddr_column = 8; 1087+ fs->retaddr_column = 8;
1090+ fs->signal_frame = 1; 1088+ fs->signal_frame = 1;
1091+ return _URC_NO_REASON; 1089+ return _URC_NO_REASON;
1092+} 1090+}
1093+#endif /* ifdef __x86_64__ */ 1091+#endif /* ifdef __x86_64__ */
1094--- gcc/config/i386/freebsd.h.orig 1092--- gcc/config/i386/freebsd.h.orig
1095+++ gcc/config/i386/freebsd.h 1093+++ gcc/config/i386/freebsd.h
1096@@ -5,6 +5,7 @@ 1094@@ -5,6 +5,7 @@
1097 Modified for stabs-in-ELF by H.J. Lu. 1095 Modified for stabs-in-ELF by H.J. Lu.
1098 Adapted from GNU/Linux version by John Polstra. 1096 Adapted from GNU/Linux version by John Polstra.
1099 Continued development by David O'Brien <obrien@freebsd.org> 1097 Continued development by David O'Brien <obrien@freebsd.org>
1100+ Copyright (C) 2010, 2011 John Marino <www.dragonlace.net> 1098+ Copyright (C) 2010, 2011 John Marino <www.dragonlace.net>
1101  1099
1102 This file is part of GCC. 1100 This file is part of GCC.
1103  1101
1104@@ -51,22 +52,22 @@ 1102@@ -51,22 +52,22 @@
1105  1103
1106 #undef SIZE_TYPE 1104 #undef SIZE_TYPE
1107 #define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int") 1105 #define SIZE_TYPE (TARGET_64BIT ? "long unsigned int" : "unsigned int")
1108-  1106-
1109+ 1107+
1110 #undef PTRDIFF_TYPE 1108 #undef PTRDIFF_TYPE
1111 #define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int") 1109 #define PTRDIFF_TYPE (TARGET_64BIT ? "long int" : "int")
1112-  1110-
1113+ 1111+
1114 #undef WCHAR_TYPE_SIZE 1112 #undef WCHAR_TYPE_SIZE
1115 #define WCHAR_TYPE_SIZE (TARGET_64BIT ? 32 : BITS_PER_WORD) 1113 #define WCHAR_TYPE_SIZE (TARGET_64BIT ? 32 : BITS_PER_WORD)
1116  1114
1117 #undef SUBTARGET_EXTRA_SPECS /* i386.h bogusly defines it. */ 1115 #undef SUBTARGET_EXTRA_SPECS /* i386.h bogusly defines it. */
1118 #define SUBTARGET_EXTRA_SPECS \ 1116 #define SUBTARGET_EXTRA_SPECS \
1119 { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER } 1117 { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
1120-  1118-
1121+ 1119+
1122 /* Provide a STARTFILE_SPEC appropriate for FreeBSD. Here we add 1120 /* Provide a STARTFILE_SPEC appropriate for FreeBSD. Here we add
1123- the magical crtbegin.o file (see crtstuff.c) which provides part  1121- the magical crtbegin.o file (see crtstuff.c) which provides part
1124- of the support for getting C++ file-scope static object constructed  1122- of the support for getting C++ file-scope static object constructed
1125+ the magical crtbegin.o file (see crtstuff.c) which provides part 1123+ the magical crtbegin.o file (see crtstuff.c) which provides part
1126+ of the support for getting C++ file-scope static object constructed 1124+ of the support for getting C++ file-scope static object constructed
1127 before entering `main'. */ 1125 before entering `main'. */
1128-  1126-
1129+ 1127+
1130 #undef STARTFILE_SPEC 1128 #undef STARTFILE_SPEC
1131 #define STARTFILE_SPEC \ 1129 #define STARTFILE_SPEC \
1132 "%{!shared: \ 1130 "%{!shared: \
1133@@ -76,9 +77,9 @@ 1131@@ -76,9 +77,9 @@
1134 crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}" 1132 crti.o%s %{!shared:crtbegin.o%s} %{shared:crtbeginS.o%s}"
1135  1133
1136 /* Provide a ENDFILE_SPEC appropriate for FreeBSD. Here we tack on 1134 /* Provide a ENDFILE_SPEC appropriate for FreeBSD. Here we tack on
1137- the magical crtend.o file (see crtstuff.c) which provides part of  1135- the magical crtend.o file (see crtstuff.c) which provides part of
1138- the support for getting C++ file-scope static object constructed  1136- the support for getting C++ file-scope static object constructed
1139- before entering `main', followed by a normal "finalizer" file,  1137- before entering `main', followed by a normal "finalizer" file,
1140+ the magical crtend.o file (see crtstuff.c) which provides part of 1138+ the magical crtend.o file (see crtstuff.c) which provides part of
1141+ the support for getting C++ file-scope static object constructed 1139+ the support for getting C++ file-scope static object constructed
1142+ before entering `main', followed by a normal "finalizer" file, 1140+ before entering `main', followed by a normal "finalizer" file,
1143 `crtn.o'. */ 1141 `crtn.o'. */
1144  1142
1145 #undef ENDFILE_SPEC 1143 #undef ENDFILE_SPEC
1146@@ -129,10 +130,10 @@ 1144@@ -129,10 +130,10 @@
1147 #undef DEFAULT_PCC_STRUCT_RETURN 1145 #undef DEFAULT_PCC_STRUCT_RETURN
1148 #define DEFAULT_PCC_STRUCT_RETURN 0 1146 #define DEFAULT_PCC_STRUCT_RETURN 0
1149  1147
1150-/* FreeBSD sets the rounding precision of the FPU to 53 bits. Let the 1148-/* FreeBSD sets the rounding precision of the FPU to 53 bits. Let the
1151- compiler get the contents of <float.h> and std::numeric_limits correct. */ 1149- compiler get the contents of <float.h> and std::numeric_limits correct. */
1152+/* FreeBSD sets the rounding precision of the FPU to 53 bits, but GNAT 1150+/* FreeBSD sets the rounding precision of the FPU to 53 bits, but GNAT
1153+ resets it to full precision. */ 1151+ resets it to full precision. */
1154 #undef TARGET_96_ROUND_53_LONG_DOUBLE 1152 #undef TARGET_96_ROUND_53_LONG_DOUBLE
1155-#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT) 1153-#define TARGET_96_ROUND_53_LONG_DOUBLE (!TARGET_64BIT)
1156+#define TARGET_96_ROUND_53_LONG_DOUBLE 0 1154+#define TARGET_96_ROUND_53_LONG_DOUBLE 0
1157  1155
1158 /* Put all *tf routines in libgcc. */ 1156 /* Put all *tf routines in libgcc. */
1159 #undef LIBGCC2_HAS_TF_MODE 1157 #undef LIBGCC2_HAS_TF_MODE
1160@@ -147,3 +148,39 @@ 1158@@ -148,5 +149,38 @@
1161 #if FBSD_MAJOR >= 6 
1162 #define SUBTARGET32_DEFAULT_CPU "i486" 1159 #define SUBTARGET32_DEFAULT_CPU "i486"
1163 #endif 1160 #endif
1164+ 1161
 1162-#define TARGET_ASM_FILE_END file_end_indicate_exec_stack
1165+/* Define location of OS-specific unwind support configuration. */ 1163+/* Define location of OS-specific unwind support configuration. */
1166+#define MD_UNWIND_SUPPORT "config/i386/freebsd-unwind.h" 1164+#define MD_UNWIND_SUPPORT "config/i386/freebsd-unwind.h"
1167+ 1165+
1168+/* Through FreeBSD 8.2 at least, stack is denied execution rights by libthr 1166+/* Through FreeBSD 8.2 at least, stack is denied execution rights by libthr
1169+ This only affects AMD64 since i386 ignores the nx bit (non-PAE) 1167+ This only affects AMD64 since i386 ignores the nx bit (non-PAE)
1170+ However, it's still included in i386 because it's possible an AMD64 1168+ However, it's still included in i386 because it's possible an AMD64
1171+ machine will be required to run a binary generated by i386 GNAT. 1169+ machine will be required to run a binary generated by i386 GNAT.
1172+ perms = PROT_READ | PROT_WRITE | PROT_EXEC; 1170+ perms = PROT_READ | PROT_WRITE | PROT_EXEC;
1173+*/ 1171+*/
1174+#define ENABLE_EXECUTE_STACK \ 1172+#define ENABLE_EXECUTE_STACK \
1175+extern void __enable_execute_stack (void *); \ 1173+extern void __enable_execute_stack (void *); \
1176+void \ 1174+void \
1177+__enable_execute_stack (void *addr) \ 1175+__enable_execute_stack (void *addr) \
1178+{ \ 1176+{ \
1179+ extern int getpagesize (void); \ 1177+ extern int getpagesize (void); \
1180+ extern int mprotect (void *, size_t, int); \ 1178+ extern int mprotect (void *, size_t, int); \
1181+ \ 1179+ \
1182+ static int size; \ 1180+ static int size; \
1183+ long mask; \ 1181+ long mask; \
1184+ char *page, *ends; \ 1182+ char *page, *ends; \
1185+ long page_addr = (long) addr; \ 1183+ long page_addr = (long) addr; \
1186+ long ends_addr = (long) (addr + TRAMPOLINE_SIZE); \ 1184+ long ends_addr = (long) (addr + TRAMPOLINE_SIZE); \
1187+ int perms = 7; \ 1185+ int perms = 7; \
1188+ \ 1186+ \
1189+ if (size == 0) \ 1187+ if (size == 0) \
1190+ { \ 1188+ { \
1191+ size = getpagesize(); \ 1189+ size = getpagesize(); \
1192+ } \ 1190+ } \
1193+ mask = ~((long) size - 1); \ 1191+ mask = ~((long) size - 1); \
1194+ page = (char *) (page_addr & mask); \ 1192+ page = (char *) (page_addr & mask); \
1195+ ends = (char *) ((ends_addr & mask) + size); \ 1193+ ends = (char *) ((ends_addr & mask) + size); \
1196+ (void) mprotect (page, ends - page, perms); \ 1194+ (void) mprotect (page, ends - page, perms); \
1197+} 1195+}
1198+ 1196+
1199+ 1197
1200--- gcc/config/i386/netbsd-elf.h.orig 1198--- gcc/config/i386/netbsd-elf.h.orig
1201+++ gcc/config/i386/netbsd-elf.h 1199+++ gcc/config/i386/netbsd-elf.h
1202@@ -2,6 +2,7 @@ 1200@@ -2,6 +2,7 @@
1203 for i386/ELF NetBSD systems. 1201 for i386/ELF NetBSD systems.
1204 Copyright (C) 2001, 2002, 2004, 2007 Free Software Foundation, Inc. 1202 Copyright (C) 2001, 2002, 2004, 2007 Free Software Foundation, Inc.
1205 Contributed by matthew green <mrg@eterna.com.au> 1203 Contributed by matthew green <mrg@eterna.com.au>
1206+ Copyright (C) 2010, 2011 John Marino <www.dragonlace.net> 1204+ Copyright (C) 2010, 2011 John Marino <www.dragonlace.net>
1207  1205
1208 This file is part of GCC. 1206 This file is part of GCC.
1209  1207
1210@@ -39,6 +40,7 @@ 1208@@ -39,6 +40,7 @@
1211  1209
1212 #undef LINK_SPEC 1210 #undef LINK_SPEC
1213 #define LINK_SPEC NETBSD_LINK_SPEC_ELF 1211 #define LINK_SPEC NETBSD_LINK_SPEC_ELF
1214+#define LINK_LIBGCC_SPEC "%D -R @EXEC_PREFIX@/lib" 1212+#define LINK_LIBGCC_SPEC "%D -R @EXEC_PREFIX@/lib"
1215  1213
1216 #define NETBSD_ENTRY_POINT "__start" 1214 #define NETBSD_ENTRY_POINT "__start"
1217  1215
1218@@ -122,3 +124,14 @@ 1216@@ -122,3 +124,14 @@
1219 #define ENABLE_EXECUTE_STACK NETBSD_ENABLE_EXECUTE_STACK 1217 #define ENABLE_EXECUTE_STACK NETBSD_ENABLE_EXECUTE_STACK
1220  1218
1221 #define TARGET_VERSION fprintf (stderr, " (NetBSD/i386 ELF)"); 1219 #define TARGET_VERSION fprintf (stderr, " (NetBSD/i386 ELF)");
1222+ 1220+
1223+/* ADDED FOR GNAT AUX SUPPORT */ 1221+/* ADDED FOR GNAT AUX SUPPORT */
1224+/* Define this to be nonzero if static stack checking is supported. */ 1222+/* Define this to be nonzero if static stack checking is supported. */
1225+#define STACK_CHECK_STATIC_BUILTIN 1 1223+#define STACK_CHECK_STATIC_BUILTIN 1
1226+ 1224+
1227+/* Define location of OS-specific unwind support configuration. */ 1225+/* Define location of OS-specific unwind support configuration. */
1228+#define MD_UNWIND_SUPPORT "config/i386/netbsd-unwind.h" 1226+#define MD_UNWIND_SUPPORT "config/i386/netbsd-unwind.h"
1229+ 1227+
1230+#if defined(HAVE_LD_EH_FRAME_HDR) 1228+#if defined(HAVE_LD_EH_FRAME_HDR)
1231+#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " 1229+#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
1232+#endif 1230+#endif
1233--- /dev/null 1231--- /dev/null
1234+++ gcc/config/i386/netbsd-unwind.h 1232+++ gcc/config/i386/netbsd-unwind.h
1235@@ -0,0 +1,169 @@ 1233@@ -0,0 +1,169 @@
1236+/* DWARF2 EH unwinding support for x86 NetBSD 1234+/* DWARF2 EH unwinding support for x86 NetBSD
1237+ Copyright (C) 2010 John Marino (www.dragonlace.net) */ 1235+ Copyright (C) 2010 John Marino (www.dragonlace.net) */
1238+ 1236+
1239+/* Do code reading to identify a signal frame, and set the frame 1237+/* Do code reading to identify a signal frame, and set the frame
1240+ state data appropriately. See unwind-dw2.c for the structs. */ 1238+ state data appropriately. See unwind-dw2.c for the structs. */
1241+ 1239+
1242+#include <sys/ucontext.h> 1240+#include <sys/ucontext.h>
1243+#include <machine/frame.h> 1241+#include <machine/frame.h>
1244+ 1242+
1245+#define REG_NAME(reg) sf_uc.uc_mcontext.__gregs[_REG_## reg] 1243+#define REG_NAME(reg) sf_uc.uc_mcontext.__gregs[_REG_## reg]
1246+ 1244+
1247+#ifdef __x86_64__ 1245+#ifdef __x86_64__
1248+ 1246+
1249+ 1247+
1250+ 1248+
1251+ 1249+
1252+#define MD_FALLBACK_FRAME_STATE_FOR x86_64_netbsd_fallback_frame_state 1250+#define MD_FALLBACK_FRAME_STATE_FOR x86_64_netbsd_fallback_frame_state
1253+ 1251+
1254+static _Unwind_Reason_Code 1252+static _Unwind_Reason_Code
1255+x86_64_netbsd_fallback_frame_state 1253+x86_64_netbsd_fallback_frame_state
1256+(struct _Unwind_Context *context, _Unwind_FrameState *fs) 1254+(struct _Unwind_Context *context, _Unwind_FrameState *fs)
1257+{ 1255+{
1258+ /* signal_frame is sigframe_siginfo minus sf_ra handler return address */ 1256+ /* signal_frame is sigframe_siginfo minus sf_ra handler return address */
1259+ struct signal_frame { 1257+ struct signal_frame {
1260+ siginfo_t sf_si; /* actual saved siginfo */ 1258+ siginfo_t sf_si; /* actual saved siginfo */
1261+ ucontext_t sf_uc; /* actual saved ucontext */ 1259+ ucontext_t sf_uc; /* actual saved ucontext */
1262+ }; 1260+ };
1263+ struct signal_frame *sf; 1261+ struct signal_frame *sf;
1264+ long new_cfa; 1262+ long new_cfa;
1265+ 1263+
1266+ /* We are looking for the following signal trampoline pattern. If we don't 1264+ /* We are looking for the following signal trampoline pattern. If we don't
1267+ find it, we are at the end of the stack and can't unwind. 1265+ find it, we are at the end of the stack and can't unwind.
1268+ 1266+
1269+ <__sigtramp_siginfo_2+12>: mov $0xffffffffffffffff,%rdi 1267+ <__sigtramp_siginfo_2+12>: mov $0xffffffffffffffff,%rdi
1270+ <__sigtramp_siginfo_2+19>: mov $0x1,%rax 1268+ <__sigtramp_siginfo_2+19>: mov $0x1,%rax
1271+ <__sigtramp_siginfo_2+26>: syscall 1269+ <__sigtramp_siginfo_2+26>: syscall
1272+ */ 1270+ */
1273+ 1271+
1274+ if ( *(unsigned int *) (context->ra + 12) == 0xffc7c748 1272+ if ( *(unsigned int *) (context->ra + 12) == 0xffc7c748
1275+ && *(unsigned int *) (context->ra + 16) == 0x48ffffff 1273+ && *(unsigned int *) (context->ra + 16) == 0x48ffffff
1276+ && *(unsigned int *) (context->ra + 20) == 0x0001c0c7 1274+ && *(unsigned int *) (context->ra + 20) == 0x0001c0c7
1277+ && *(unsigned int *) (context->ra + 24) == 0x050f0000 ) 1275+ && *(unsigned int *) (context->ra + 24) == 0x050f0000 )
1278+ { 1276+ {
1279+ sf = (struct signal_frame *) context->cfa; 1277+ sf = (struct signal_frame *) context->cfa;
1280+ new_cfa = sf->REG_NAME(RSP); 1278+ new_cfa = sf->REG_NAME(RSP);
1281+ fs->regs.cfa_how = CFA_REG_OFFSET; 1279+ fs->regs.cfa_how = CFA_REG_OFFSET;
1282+ fs->regs.cfa_reg = 7; 1280+ fs->regs.cfa_reg = 7;
1283+ fs->regs.cfa_offset = new_cfa - (long) context->cfa; 1281+ fs->regs.cfa_offset = new_cfa - (long) context->cfa;
1284+ } 1282+ }
1285+ else 1283+ else
1286+ { 1284+ {
1287+ return _URC_END_OF_STACK; 1285+ return _URC_END_OF_STACK;
1288+ } 1286+ }
1289+ 1287+
1290+ /* The SVR4 register numbering macros aren't usable in libgcc. */ 1288+ /* The SVR4 register numbering macros aren't usable in libgcc. */
1291+ fs->regs.reg[ 0].how = REG_SAVED_OFFSET; 1289+ fs->regs.reg[ 0].how = REG_SAVED_OFFSET;
1292+ fs->regs.reg[ 0].loc.offset = (long)&sf->REG_NAME(RAX) - new_cfa; 1290+ fs->regs.reg[ 0].loc.offset = (long)&sf->REG_NAME(RAX) - new_cfa;
1293+ fs->regs.reg[ 1].how = REG_SAVED_OFFSET; 1291+ fs->regs.reg[ 1].how = REG_SAVED_OFFSET;
1294+ fs->regs.reg[ 1].loc.offset = (long)&sf->REG_NAME(RDX) - new_cfa; 1292+ fs->regs.reg[ 1].loc.offset = (long)&sf->REG_NAME(RDX) - new_cfa;
1295+ fs->regs.reg[ 2].how = REG_SAVED_OFFSET; 1293+ fs->regs.reg[ 2].how = REG_SAVED_OFFSET;
1296+ fs->regs.reg[ 2].loc.offset = (long)&sf->REG_NAME(RCX) - new_cfa; 1294+ fs->regs.reg[ 2].loc.offset = (long)&sf->REG_NAME(RCX) - new_cfa;
1297+ fs->regs.reg[ 3].how = REG_SAVED_OFFSET; 1295+ fs->regs.reg[ 3].how = REG_SAVED_OFFSET;
1298+ fs->regs.reg[ 3].loc.offset = (long)&sf->REG_NAME(RBX) - new_cfa; 1296+ fs->regs.reg[ 3].loc.offset = (long)&sf->REG_NAME(RBX) - new_cfa;
1299+ fs->regs.reg[ 4].how = REG_SAVED_OFFSET; 1297+ fs->regs.reg[ 4].how = REG_SAVED_OFFSET;
1300+ fs->regs.reg[ 4].loc.offset = (long)&sf->REG_NAME(RSI) - new_cfa; 1298+ fs->regs.reg[ 4].loc.offset = (long)&sf->REG_NAME(RSI) - new_cfa;
1301+ fs->regs.reg[ 5].how = REG_SAVED_OFFSET; 1299+ fs->regs.reg[ 5].how = REG_SAVED_OFFSET;
1302+ fs->regs.reg[ 5].loc.offset = (long)&sf->REG_NAME(RDI) - new_cfa; 1300+ fs->regs.reg[ 5].loc.offset = (long)&sf->REG_NAME(RDI) - new_cfa;
1303+ fs->regs.reg[ 6].how = REG_SAVED_OFFSET; 1301+ fs->regs.reg[ 6].how = REG_SAVED_OFFSET;
1304+ fs->regs.reg[ 6].loc.offset = (long)&sf->REG_NAME(RBP) - new_cfa; 1302+ fs->regs.reg[ 6].loc.offset = (long)&sf->REG_NAME(RBP) - new_cfa;
1305+ fs->regs.reg[ 8].how = REG_SAVED_OFFSET; 1303+ fs->regs.reg[ 8].how = REG_SAVED_OFFSET;
1306+ fs->regs.reg[ 8].loc.offset = (long)&sf->REG_NAME(R8) - new_cfa; 1304+ fs->regs.reg[ 8].loc.offset = (long)&sf->REG_NAME(R8) - new_cfa;
1307+ fs->regs.reg[ 9].how = REG_SAVED_OFFSET; 1305+ fs->regs.reg[ 9].how = REG_SAVED_OFFSET;
1308+ fs->regs.reg[ 9].loc.offset = (long)&sf->REG_NAME(R9) - new_cfa; 1306+ fs->regs.reg[ 9].loc.offset = (long)&sf->REG_NAME(R9) - new_cfa;
1309+ fs->regs.reg[10].how = REG_SAVED_OFFSET; 1307+ fs->regs.reg[10].how = REG_SAVED_OFFSET;
1310+ fs->regs.reg[10].loc.offset = (long)&sf->REG_NAME(R10) - new_cfa; 1308+ fs->regs.reg[10].loc.offset = (long)&sf->REG_NAME(R10) - new_cfa;
1311+ fs->regs.reg[11].how = REG_SAVED_OFFSET; 1309+ fs->regs.reg[11].how = REG_SAVED_OFFSET;
1312+ fs->regs.reg[11].loc.offset = (long)&sf->REG_NAME(R11) - new_cfa; 1310+ fs->regs.reg[11].loc.offset = (long)&sf->REG_NAME(R11) - new_cfa;
1313+ fs->regs.reg[12].how = REG_SAVED_OFFSET; 1311+ fs->regs.reg[12].how = REG_SAVED_OFFSET;
1314+ fs->regs.reg[12].loc.offset = (long)&sf->REG_NAME(R12) - new_cfa; 1312+ fs->regs.reg[12].loc.offset = (long)&sf->REG_NAME(R12) - new_cfa;
1315+ fs->regs.reg[13].how = REG_SAVED_OFFSET; 1313+ fs->regs.reg[13].how = REG_SAVED_OFFSET;
1316+ fs->regs.reg[13].loc.offset = (long)&sf->REG_NAME(R13) - new_cfa; 1314+ fs->regs.reg[13].loc.offset = (long)&sf->REG_NAME(R13) - new_cfa;
1317+ fs->regs.reg[14].how = REG_SAVED_OFFSET; 1315+ fs->regs.reg[14].how = REG_SAVED_OFFSET;
1318+ fs->regs.reg[14].loc.offset = (long)&sf->REG_NAME(R14) - new_cfa; 1316+ fs->regs.reg[14].loc.offset = (long)&sf->REG_NAME(R14) - new_cfa;
1319+ fs->regs.reg[15].how = REG_SAVED_OFFSET; 1317+ fs->regs.reg[15].how = REG_SAVED_OFFSET;
1320+ fs->regs.reg[15].loc.offset = (long)&sf->REG_NAME(R15) - new_cfa; 1318+ fs->regs.reg[15].loc.offset = (long)&sf->REG_NAME(R15) - new_cfa;
1321+ fs->regs.reg[16].how = REG_SAVED_OFFSET; 1319+ fs->regs.reg[16].how = REG_SAVED_OFFSET;
1322+ fs->regs.reg[16].loc.offset = (long)&sf->REG_NAME(RIP) - new_cfa; 1320+ fs->regs.reg[16].loc.offset = (long)&sf->REG_NAME(RIP) - new_cfa;
1323+ fs->retaddr_column = 16; 1321+ fs->retaddr_column = 16;
1324+ fs->signal_frame = 1; 1322+ fs->signal_frame = 1;
1325+ return _URC_NO_REASON; 1323+ return _URC_NO_REASON;
1326+} 1324+}
1327+ 1325+
1328+ 1326+
1329+ 1327+
1330+ 1328+
1331+#else /* Next section is for i386 */ 1329+#else /* Next section is for i386 */
1332+ 1330+
1333+ 1331+
1334+ 1332+
1335+ 1333+
1336+#define MD_FALLBACK_FRAME_STATE_FOR x86_netbsd_fallback_frame_state 1334+#define MD_FALLBACK_FRAME_STATE_FOR x86_netbsd_fallback_frame_state
1337+ 1335+
1338+static _Unwind_Reason_Code 1336+static _Unwind_Reason_Code
1339+x86_netbsd_fallback_frame_state 1337+x86_netbsd_fallback_frame_state
1340+(struct _Unwind_Context *context, _Unwind_FrameState *fs) 1338+(struct _Unwind_Context *context, _Unwind_FrameState *fs)
1341+{ 1339+{
1342+ /* signal_frame is sigframe_siginfo minus sf_ra handler return address */ 1340+ /* signal_frame is sigframe_siginfo minus sf_ra handler return address */
1343+ struct signal_frame { 1341+ struct signal_frame {
1344+ int sf_signum; /* "signum" argument for handler" */ 1342+ int sf_signum; /* "signum" argument for handler" */
1345+ siginfo_t *sf_sip; /* "sip" argument for handler" */ 1343+ siginfo_t *sf_sip; /* "sip" argument for handler" */
1346+ ucontext_t *sf_ucp; /* "ucp" argument for handler" */ 1344+ ucontext_t *sf_ucp; /* "ucp" argument for handler" */
1347+ siginfo_t sf_si; /* actual saved siginfo */ 1345+ siginfo_t sf_si; /* actual saved siginfo */
1348+ ucontext_t sf_uc; /* actual saved ucontext */ 1346+ ucontext_t sf_uc; /* actual saved ucontext */
1349+ }; 1347+ };
1350+ struct signal_frame *sf; 1348+ struct signal_frame *sf;
1351+ long new_cfa; 1349+ long new_cfa;
1352+ 1350+
1353+ /* We are looking for the following signal trampoline pattern. If we don't 1351+ /* We are looking for the following signal trampoline pattern. If we don't
1354+ find it, we are at the end of the stack and can't unwind. 1352+ find it, we are at the end of the stack and can't unwind.
1355+ 1353+
1356+ <__sigtramp_siginfo_2+18>: movl $0xffffffff,0x4(%esp) 1354+ <__sigtramp_siginfo_2+18>: movl $0xffffffff,0x4(%esp)
1357+ <__sigtramp_siginfo_2+26>: mov $0x1,%eax 1355+ <__sigtramp_siginfo_2+26>: mov $0x1,%eax
1358+ <__sigtramp_siginfo_2+31>: int $0x80 1356+ <__sigtramp_siginfo_2+31>: int $0x80
1359+ */ 1357+ */
1360+ 1358+
1361+ if ( *(unsigned int *) (context->ra + 18) == 0x042444c7 1359+ if ( *(unsigned int *) (context->ra + 18) == 0x042444c7
1362+ && *(unsigned int *) (context->ra + 22) == 0xffffffff 1360+ && *(unsigned int *) (context->ra + 22) == 0xffffffff
1363+ && *(unsigned char *) (context->ra + 26) == 0xb8 1361+ && *(unsigned char *) (context->ra + 26) == 0xb8
1364+ && *(unsigned int *) (context->ra + 27) == 0x00000001 1362+ && *(unsigned int *) (context->ra + 27) == 0x00000001
1365+ && *(unsigned short *) (context->ra + 31) == 0x80cd ) 1363+ && *(unsigned short *) (context->ra + 31) == 0x80cd )
1366+ { 1364+ {
1367+ sf = (struct signal_frame *) context->cfa; 1365+ sf = (struct signal_frame *) context->cfa;
1368+ new_cfa = sf->REG_NAME(ESP); 1366+ new_cfa = sf->REG_NAME(ESP);
1369+ fs->regs.cfa_how = CFA_REG_OFFSET; 1367+ fs->regs.cfa_how = CFA_REG_OFFSET;
1370+ fs->regs.cfa_reg = 4; 1368+ fs->regs.cfa_reg = 4;
1371+ fs->regs.cfa_offset = new_cfa - (long) context->cfa; 1369+ fs->regs.cfa_offset = new_cfa - (long) context->cfa;
1372+ } 1370+ }
1373+ else 1371+ else
1374+ { 1372+ {
1375+ return _URC_END_OF_STACK; 1373+ return _URC_END_OF_STACK;
1376+ } 1374+ }
1377+ 1375+
1378+ /* The SVR4 register numbering macros aren't usable in libgcc. */ 1376+ /* The SVR4 register numbering macros aren't usable in libgcc. */
1379+ fs->regs.reg[0].how = REG_SAVED_OFFSET; 1377+ fs->regs.reg[0].how = REG_SAVED_OFFSET;
1380+ fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(EAX) - new_cfa; 1378+ fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(EAX) - new_cfa;
1381+ fs->regs.reg[3].how = REG_SAVED_OFFSET; 1379+ fs->regs.reg[3].how = REG_SAVED_OFFSET;
1382+ fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(EBX) - new_cfa; 1380+ fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(EBX) - new_cfa;
1383+ fs->regs.reg[1].how = REG_SAVED_OFFSET; 1381+ fs->regs.reg[1].how = REG_SAVED_OFFSET;
1384+ fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ECX) - new_cfa; 1382+ fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ECX) - new_cfa;
1385+ fs->regs.reg[2].how = REG_SAVED_OFFSET; 1383+ fs->regs.reg[2].how = REG_SAVED_OFFSET;
1386+ fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(EDX) - new_cfa; 1384+ fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(EDX) - new_cfa;
1387+ fs->regs.reg[6].how = REG_SAVED_OFFSET; 1385+ fs->regs.reg[6].how = REG_SAVED_OFFSET;
1388+ fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(ESI) - new_cfa; 1386+ fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(ESI) - new_cfa;
1389+ fs->regs.reg[7].how = REG_SAVED_OFFSET; 1387+ fs->regs.reg[7].how = REG_SAVED_OFFSET;
1390+ fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(EDI) - new_cfa; 1388+ fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(EDI) - new_cfa;
1391+ fs->regs.reg[5].how = REG_SAVED_OFFSET; 1389+ fs->regs.reg[5].how = REG_SAVED_OFFSET;
1392+ fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(EBP) - new_cfa; 1390+ fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(EBP) - new_cfa;
1393+ fs->regs.reg[8].how = REG_SAVED_OFFSET; 1391+ fs->regs.reg[8].how = REG_SAVED_OFFSET;
1394+ fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(EIP) - new_cfa; 1392+ fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(EIP) - new_cfa;
1395+ fs->retaddr_column = 8; 1393+ fs->retaddr_column = 8;
1396+ fs->signal_frame = 1; 1394+ fs->signal_frame = 1;
1397+ return _URC_NO_REASON; 1395+ return _URC_NO_REASON;
1398+} 1396+}
1399+ 1397+
1400+ 1398+
1401+ 1399+
1402+ 1400+
1403+#endif /* ifdef __x86_64__ */ 1401+#endif /* ifdef __x86_64__ */
1404+ 1402+
1405--- gcc/config/i386/netbsd64.h.orig 1403--- gcc/config/i386/netbsd64.h.orig
1406+++ gcc/config/i386/netbsd64.h 1404+++ gcc/config/i386/netbsd64.h
1407@@ -2,6 +2,7 @@ 1405@@ -2,6 +2,7 @@
1408 for x86-64/ELF NetBSD systems. 1406 for x86-64/ELF NetBSD systems.
1409 Copyright (C) 2002, 2004, 2007 Free Software Foundation, Inc. 1407 Copyright (C) 2002, 2004, 2007 Free Software Foundation, Inc.
1410 Contributed by Wasabi Systems, Inc. 1408 Contributed by Wasabi Systems, Inc.
1411+ Copyright (C) 2010, 2011 John Marino <www.dragonlace.net> 1409+ Copyright (C) 2010, 2011 John Marino <www.dragonlace.net>
1412  1410
1413 This file is part of GCC. 1411 This file is part of GCC.
1414  1412
1415@@ -70,3 +71,13 @@ 1413@@ -70,3 +71,13 @@
1416 #define ENABLE_EXECUTE_STACK NETBSD_ENABLE_EXECUTE_STACK 1414 #define ENABLE_EXECUTE_STACK NETBSD_ENABLE_EXECUTE_STACK
1417  1415
1418 #define TARGET_VERSION fprintf (stderr, " (NetBSD/x86_64 ELF)"); 1416 #define TARGET_VERSION fprintf (stderr, " (NetBSD/x86_64 ELF)");
1419+ 1417+
1420+/* ADDED FOR GNAT AUX SUPPORT */ 1418+/* ADDED FOR GNAT AUX SUPPORT */
1421+/* Define this to be nonzero if static stack checking is supported. */ 1419+/* Define this to be nonzero if static stack checking is supported. */
1422+#define STACK_CHECK_STATIC_BUILTIN 1 1420+#define STACK_CHECK_STATIC_BUILTIN 1
1423+ 1421+
1424+#define MD_UNWIND_SUPPORT "config/i386/netbsd-unwind.h" 1422+#define MD_UNWIND_SUPPORT "config/i386/netbsd-unwind.h"
1425+ 1423+
1426+#if defined(HAVE_LD_EH_FRAME_HDR) 1424+#if defined(HAVE_LD_EH_FRAME_HDR)
1427+#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} " 1425+#define LINK_EH_SPEC "%{!static:--eh-frame-hdr} "
1428+#endif 1426+#endif
1429--- /dev/null 1427--- /dev/null
1430+++ gcc/config/i386/openbsd-unwind32.h 1428+++ gcc/config/i386/openbsd-unwind32.h
1431@@ -0,0 +1,77 @@ 1429@@ -0,0 +1,77 @@
1432+/* DWARF2 EH unwinding support for x86 OpenBSD 1430+/* DWARF2 EH unwinding support for x86 OpenBSD
1433+ Copyright (C) 2010 John Marino (www.dragonlace.net) */ 1431+ Copyright (C) 2010 John Marino (www.dragonlace.net) */
1434+ 1432+
1435+/* Do code reading to identify a signal frame, and set the frame 1433+/* Do code reading to identify a signal frame, and set the frame
1436+ state data appropriately. See unwind-dw2.c for the structs. */ 1434+ state data appropriately. See unwind-dw2.c for the structs. */
1437+ 1435+
1438+#include <sys/param.h> 1436+#include <sys/param.h>
1439+#include <sys/sysctl.h> 1437+#include <sys/sysctl.h>
1440+#include <machine/frame.h> 1438+#include <machine/frame.h>
1441+/* machine/frame.h brings in sys/signal.h 1439+/* machine/frame.h brings in sys/signal.h
1442+ sys/signal.h brings in machine/signal.h (sigcontext) 1440+ sys/signal.h brings in machine/signal.h (sigcontext)
1443+ brings in sys/siginfo.h (siginfo_t) */ 1441+ brings in sys/siginfo.h (siginfo_t) */
1444+ 1442+
1445+ 1443+
1446+#define REG_NAME(reg) sf_sc.sc_## reg 1444+#define REG_NAME(reg) sf_sc.sc_## reg
1447+#define MD_FALLBACK_FRAME_STATE_FOR x86_openbsd_fallback_frame_state 1445+#define MD_FALLBACK_FRAME_STATE_FOR x86_openbsd_fallback_frame_state
1448+ 1446+
1449+ 1447+
1450+static void 1448+static void
1451+x86_sigtramp_range (unsigned char **start, unsigned char **end) 1449+x86_sigtramp_range (unsigned char **start, unsigned char **end)
1452+{ 1450+{
1453+ struct _ps_strings ps_strings; 1451+ struct _ps_strings ps_strings;
1454+ int mib[2]; 1452+ int mib[2];
1455+ size_t len; 1453+ size_t len;
1456+ 1454+
1457+ mib[0] = CTL_VM; 1455+ mib[0] = CTL_VM;
1458+ mib[1] = VM_PSSTRINGS; 1456+ mib[1] = VM_PSSTRINGS;
1459+ len = sizeof (ps_strings); 1457+ len = sizeof (ps_strings);
1460+ sysctl (mib, 2, &ps_strings, &len, NULL, 0); 1458+ sysctl (mib, 2, &ps_strings, &len, NULL, 0);
1461+ 1459+
1462+ *start = (unsigned char *)ps_strings.val - 128; 1460+ *start = (unsigned char *)ps_strings.val - 128;
1463+ *end = (unsigned char *)ps_strings.val; 1461+ *end = (unsigned char *)ps_strings.val;
1464+} 1462+}
1465+ 1463+
1466+ 1464+
1467+static _Unwind_Reason_Code 1465+static _Unwind_Reason_Code
1468+x86_openbsd_fallback_frame_state 1466+x86_openbsd_fallback_frame_state
1469+(struct _Unwind_Context *context, _Unwind_FrameState *fs) 1467+(struct _Unwind_Context *context, _Unwind_FrameState *fs)
1470+{ 1468+{
1471+ unsigned char *pc = context->ra; 1469+ unsigned char *pc = context->ra;
1472+ unsigned char *sigtramp_start, *sigtramp_end; 1470+ unsigned char *sigtramp_start, *sigtramp_end;
1473+ struct sigframe *sf; 1471+ struct sigframe *sf;
1474+ long new_cfa; 1472+ long new_cfa;
1475+ 1473+
1476+ x86_sigtramp_range(&sigtramp_start, &sigtramp_end); 1474+ x86_sigtramp_range(&sigtramp_start, &sigtramp_end);
1477+ 1475+
1478+ if (pc >= sigtramp_end || pc < sigtramp_start) 1476+ if (pc >= sigtramp_end || pc < sigtramp_start)
1479+ return _URC_END_OF_STACK; 1477+ return _URC_END_OF_STACK;
1480+ 1478+
1481+ sf = (struct sigframe *) context->cfa; 1479+ sf = (struct sigframe *) context->cfa;
1482+ new_cfa = sf->REG_NAME(esp); 1480+ new_cfa = sf->REG_NAME(esp);
1483+ 1481+
1484+ fs->regs.cfa_how = CFA_REG_OFFSET; 1482+ fs->regs.cfa_how = CFA_REG_OFFSET;
1485+ fs->regs.cfa_reg = 4; 1483+ fs->regs.cfa_reg = 4;
1486+ fs->regs.cfa_offset = new_cfa - (long) context->cfa; 1484+ fs->regs.cfa_offset = new_cfa - (long) context->cfa;
1487+ 1485+
1488+ /* The SVR4 register numbering macros aren't usable in libgcc. */ 1486+ /* The SVR4 register numbering macros aren't usable in libgcc. */
1489+ fs->regs.reg[0].how = REG_SAVED_OFFSET; 1487+ fs->regs.reg[0].how = REG_SAVED_OFFSET;
1490+ fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(eax) - new_cfa; 1488+ fs->regs.reg[0].loc.offset = (long)&sf->REG_NAME(eax) - new_cfa;
1491+ fs->regs.reg[3].how = REG_SAVED_OFFSET; 1489+ fs->regs.reg[3].how = REG_SAVED_OFFSET;
1492+ fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(ebx) - new_cfa; 1490+ fs->regs.reg[3].loc.offset = (long)&sf->REG_NAME(ebx) - new_cfa;
1493+ fs->regs.reg[1].how = REG_SAVED_OFFSET; 1491+ fs->regs.reg[1].how = REG_SAVED_OFFSET;
1494+ fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ecx) - new_cfa; 1492+ fs->regs.reg[1].loc.offset = (long)&sf->REG_NAME(ecx) - new_cfa;
1495+ fs->regs.reg[2].how = REG_SAVED_OFFSET; 1493+ fs->regs.reg[2].how = REG_SAVED_OFFSET;
1496+ fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(edx) - new_cfa; 1494+ fs->regs.reg[2].loc.offset = (long)&sf->REG_NAME(edx) - new_cfa;
1497+ fs->regs.reg[6].how = REG_SAVED_OFFSET; 1495+ fs->regs.reg[6].how = REG_SAVED_OFFSET;
1498+ fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(esi) - new_cfa; 1496+ fs->regs.reg[6].loc.offset = (long)&sf->REG_NAME(esi) - new_cfa;
1499+ fs->regs.reg[7].how = REG_SAVED_OFFSET; 1497+ fs->regs.reg[7].how = REG_SAVED_OFFSET;
1500+ fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(edi) - new_cfa; 1498+ fs->regs.reg[7].loc.offset = (long)&sf->REG_NAME(edi) - new_cfa;
1501+ fs->regs.reg[5].how = REG_SAVED_OFFSET; 1499+ fs->regs.reg[5].how = REG_SAVED_OFFSET;
1502+ fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(ebp) - new_cfa; 1500+ fs->regs.reg[5].loc.offset = (long)&sf->REG_NAME(ebp) - new_cfa;
1503+ fs->regs.reg[8].how = REG_SAVED_OFFSET; 1501+ fs->regs.reg[8].how = REG_SAVED_OFFSET;
1504+ fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(eip) - new_cfa; 1502+ fs->regs.reg[8].loc.offset = (long)&sf->REG_NAME(eip) - new_cfa;
1505+ fs->retaddr_column = 8; 1503+ fs->retaddr_column = 8;
1506+ fs->signal_frame = 1; 1504+ fs->signal_frame = 1;
1507+ return _URC_NO_REASON; 1505+ return _URC_NO_REASON;
1508+} 1506+}
1509--- /dev/null 1507--- /dev/null
1510+++ gcc/config/i386/openbsd64.h 1508+++ gcc/config/i386/openbsd64.h
1511@@ -0,0 +1,112 @@ 1509@@ -0,0 +1,112 @@
1512+/* Definitions for AMD x86_64 running OpenBSD BSD with ELF Format */ 1510+/* Definitions for AMD x86_64 running OpenBSD BSD with ELF Format */
1513+ 1511+
1514+#undef TARGET_VERSION 1512+#undef TARGET_VERSION
1515+#define TARGET_VERSION fprintf (stderr, " (OpenBSD/x86-64 ELF)") 1513+#define TARGET_VERSION fprintf (stderr, " (OpenBSD/x86-64 ELF)")
1516+ 1514+
1517+/* This gets defined in tm.h->linux.h->svr4.h, and keeps us from using 1515+/* This gets defined in tm.h->linux.h->svr4.h, and keeps us from using
1518+ libraries compiled with the native cc, so undef it. */ 1516+ libraries compiled with the native cc, so undef it. */
1519+#undef NO_DOLLAR_IN_LABEL 1517+#undef NO_DOLLAR_IN_LABEL
1520+ 1518+
1521+/* Override the default comment-starter of "/". */ 1519+/* Override the default comment-starter of "/". */
1522+#undef ASM_COMMENT_START 1520+#undef ASM_COMMENT_START
1523+#define ASM_COMMENT_START "#" 1521+#define ASM_COMMENT_START "#"
1524+ 1522+
1525+/* Run-time target specifications */ 1523+/* Run-time target specifications */
1526+ 1524+
1527+#define TARGET_OS_CPP_BUILTINS() \ 1525+#define TARGET_OS_CPP_BUILTINS() \
1528+ do \ 1526+ do \
1529+ { \ 1527+ { \
1530+ OPENBSD_OS_CPP_BUILTINS_ELF(); \ 1528+ OPENBSD_OS_CPP_BUILTINS_ELF(); \
1531+ if (TARGET_64BIT) \ 1529+ if (TARGET_64BIT) \
1532+ OPENBSD_OS_CPP_BUILTINS_LP64(); \ 1530+ OPENBSD_OS_CPP_BUILTINS_LP64(); \
1533+ } \ 1531+ } \
1534+ while (0) 1532+ while (0)
1535+ 1533+
1536+/* As an elf system, we need crtbegin/crtend stuff. */ 1534+/* As an elf system, we need crtbegin/crtend stuff. */
1537+#undef STARTFILE_SPEC 1535+#undef STARTFILE_SPEC
1538+#define STARTFILE_SPEC "\ 1536+#define STARTFILE_SPEC "\
1539+ %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \ 1537+ %{!shared: %{pg:gcrt0%O%s} %{!pg:%{p:gcrt0%O%s} %{!p:crt0%O%s}} \
1540+ crtbegin%O%s} %{shared:crtbeginS%O%s}" 1538+ crtbegin%O%s} %{shared:crtbeginS%O%s}"
1541+#undef ENDFILE_SPEC 1539+#undef ENDFILE_SPEC
1542+#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}" 1540+#define ENDFILE_SPEC "%{!shared:crtend%O%s} %{shared:crtendS%O%s}"
1543+ 1541+
1544+/* Layout of source language data types. */ 1542+/* Layout of source language data types. */
1545+ 1543+
1546+/* This must agree with <machine/_types.h> */ 1544+/* This must agree with <machine/_types.h> */
1547+#undef SIZE_TYPE 1545+#undef SIZE_TYPE
1548+#define SIZE_TYPE "long unsigned int" 1546+#define SIZE_TYPE "long unsigned int"
1549+ 1547+
1550+#undef PTRDIFF_TYPE 1548+#undef PTRDIFF_TYPE
1551+#define PTRDIFF_TYPE "long int" 1549+#define PTRDIFF_TYPE "long int"
1552+ 1550+
1553+#undef WCHAR_TYPE 1551+#undef WCHAR_TYPE
1554+#define WCHAR_TYPE "int" 1552+#define WCHAR_TYPE "int"
1555+ 1553+
1556+#undef WCHAR_TYPE_SIZE 1554+#undef WCHAR_TYPE_SIZE
1557+#define WCHAR_TYPE_SIZE 32 1555+#define WCHAR_TYPE_SIZE 32
1558+ 1556+
1559+/* Assembler format: overall framework. */ 1557+/* Assembler format: overall framework. */
1560+ 1558+
1561+#undef ASM_APP_ON 1559+#undef ASM_APP_ON
1562+#define ASM_APP_ON "#APP\n" 1560+#define ASM_APP_ON "#APP\n"
1563+ 1561+
1564+#undef ASM_APP_OFF 1562+#undef ASM_APP_OFF
1565+#define ASM_APP_OFF "#NO_APP\n" 1563+#define ASM_APP_OFF "#NO_APP\n"
1566+ 1564+
1567+#undef SET_ASM_OP 1565+#undef SET_ASM_OP
1568+#define SET_ASM_OP "\t.set\t" 1566+#define SET_ASM_OP "\t.set\t"
1569+ 1567+
1570+/* The following macros were originally stolen from i386v4.h. 1568+/* The following macros were originally stolen from i386v4.h.
1571+ These have to be defined to get PIC code correct. */ 1569+ These have to be defined to get PIC code correct. */
1572+ 1570+
1573+/* Assembler format: dispatch tables. */ 1571+/* Assembler format: dispatch tables. */
1574+ 1572+
1575+/* Assembler format: sections. */ 1573+/* Assembler format: sections. */
1576+ 1574+
1577+/* Stack & calling: aggregate returns. */ 1575+/* Stack & calling: aggregate returns. */
1578+ 1576+
1579+/* Don't default to pcc-struct-return, because gcc is the only compiler, and 1577+/* Don't default to pcc-struct-return, because gcc is the only compiler, and
1580+ we want to retain compatibility with older gcc versions. */ 1578+ we want to retain compatibility with older gcc versions. */
1581+#define DEFAULT_PCC_STRUCT_RETURN 0 1579+#define DEFAULT_PCC_STRUCT_RETURN 0
1582+ 1580+
1583+/* Assembler format: alignment output. */ 1581+/* Assembler format: alignment output. */
1584+ 1582+
1585+/* Stack & calling: profiling. */ 1583+/* Stack & calling: profiling. */
1586+ 1584+
1587+/* OpenBSD's profiler recovers all information from the stack pointer. 1585+/* OpenBSD's profiler recovers all information from the stack pointer.
1588+ The icky part is not here, but in machine/profile.h. */ 1586+ The icky part is not here, but in machine/profile.h. */
1589+#undef FUNCTION_PROFILER 1587+#undef FUNCTION_PROFILER
1590+#define FUNCTION_PROFILER(FILE, LABELNO) \ 1588+#define FUNCTION_PROFILER(FILE, LABELNO) \
1591+ fputs (flag_pic ? "\tcall __mcount@PLT\n": "\tcall __mcount\n", FILE); 1589+ fputs (flag_pic ? "\tcall __mcount@PLT\n": "\tcall __mcount\n", FILE);
1592+ 1590+
1593+/* Assembler format: exception region output. */ 1591+/* Assembler format: exception region output. */
1594+ 1592+
1595+/* Assembler format: alignment output. */ 1593+/* Assembler format: alignment output. */
1596+ 1594+
1597+/* Note that we pick up ASM_OUTPUT_MAX_SKIP_ALIGN from i386/gas.h */ 1595+/* Note that we pick up ASM_OUTPUT_MAX_SKIP_ALIGN from i386/gas.h */
1598+ 1596+
1599+/* Note that we pick up ASM_OUTPUT_MI_THUNK from unix.h. */ 1597+/* Note that we pick up ASM_OUTPUT_MI_THUNK from unix.h. */
1600+ 1598+
1601+#undef LINK_SPEC 1599+#undef LINK_SPEC
1602+#define LINK_SPEC \ 1600+#define LINK_SPEC \
1603+ "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start}}}} \ 1601+ "%{!shared:%{!nostdlib:%{!r*:%{!e*:-e __start}}}} \
1604+ %{shared:-shared} %{R*} \ 1602+ %{shared:-shared} %{R*} \
1605+ %{static:-Bstatic} \ 1603+ %{static:-Bstatic} \
1606+ %{!static:-Bdynamic} \ 1604+ %{!static:-Bdynamic} \
1607+ %{assert*} \ 1605+ %{assert*} \
1608+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}" 1606+ %{!dynamic-linker:-dynamic-linker /usr/libexec/ld.so}"
1609+ 1607+
1610+#define OBSD_HAS_CORRECT_SPECS 1608+#define OBSD_HAS_CORRECT_SPECS
1611+ 1609+
1612+#undef JUMP_TABLES_IN_TEXT_SECTION 1610+#undef JUMP_TABLES_IN_TEXT_SECTION
1613+#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic) 1611+#define JUMP_TABLES_IN_TEXT_SECTION (flag_pic)
1614+ 1612+
1615+/* ADDED FOR GNAT AUX SUPPORT */ 1613+/* ADDED FOR GNAT AUX SUPPORT */
1616+/* Define this to be nonzero if static stack checking is supported */ 1614+/* Define this to be nonzero if static stack checking is supported */
1617+#undef STACK_CHECK_STATIC_BUILTIN 1615+#undef STACK_CHECK_STATIC_BUILTIN
1618+#define STACK_CHECK_STATIC_BUILTIN 1 1616+#define STACK_CHECK_STATIC_BUILTIN 1
1619+ 1617+
1620+/* Ensure rounding is left to GNAT (Not required for AMD64) */ 1618+/* Ensure rounding is left to GNAT (Not required for AMD64) */
1621+#undef TARGET_96_ROUND_53_LONG_DOUBLE 1619+#undef TARGET_96_ROUND_53_LONG_DOUBLE
1622+#define TARGET_96_ROUND_53_LONG_DOUBLE 1 1620+#define TARGET_96_ROUND_53_LONG_DOUBLE 1
1623+ 1621+
1624--- gcc/config/i386/openbsdelf.h.orig 1622--- gcc/config/i386/openbsdelf.h.orig
1625+++ gcc/config/i386/openbsdelf.h 1623+++ gcc/config/i386/openbsdelf.h
1626@@ -1,6 +1,7 @@ 1624@@ -1,6 +1,7 @@
1627 /* Configuration for an OpenBSD i386 target. 1625 /* Configuration for an OpenBSD i386 target.
1628-  1626-
1629+ 1627+
1630 Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc. 1628 Copyright (C) 2005, 2007, 2009, 2010 Free Software Foundation, Inc.
1631+ Copyright (C) 2010, 2011 John Marino <www.dragonlace.net> 1629+ Copyright (C) 2010, 2011 John Marino <www.dragonlace.net>
1632  1630
1633 This file is part of GCC. 1631 This file is part of GCC.
1634  1632
1635@@ -82,7 +83,7 @@ 1633@@ -82,7 +83,7 @@
1636  1634
1637 /* The following macros were originally stolen from i386v4.h. 1635 /* The following macros were originally stolen from i386v4.h.
1638 These have to be defined to get PIC code correct. */ 1636 These have to be defined to get PIC code correct. */
1639- 1637-
1640+  1638+
1641 /* Assembler format: dispatch tables. */ 1639 /* Assembler format: dispatch tables. */
1642  1640
1643 /* Assembler format: sections. */ 1641 /* Assembler format: sections. */
1644@@ -132,3 +133,18 @@ 1642@@ -132,3 +133,18 @@
1645 -dynamic-linker /usr/libexec/ld.so" 1643 -dynamic-linker /usr/libexec/ld.so"
1646  1644
1647 #define OBSD_HAS_CORRECT_SPECS 1645 #define OBSD_HAS_CORRECT_SPECS
1648+ 1646+
1649+ 1647+
1650+/* ADDED FOR GNAT AUX SUPPORT */ 1648+/* ADDED FOR GNAT AUX SUPPORT */
1651+/* Define this to be nonzero if static stack checking is supported */ 1649+/* Define this to be nonzero if static stack checking is supported */
1652+#undef STACK_CHECK_STATIC_BUILTIN 1650+#undef STACK_CHECK_STATIC_BUILTIN
1653+#define STACK_CHECK_STATIC_BUILTIN 1 1651+#define STACK_CHECK_STATIC_BUILTIN 1
1654+ 1652+
1655+/* Ensure rounding is left to GNAT (i386 only) */ 1653+/* Ensure rounding is left to GNAT (i386 only) */
1656+#undef TARGET_96_ROUND_53_LONG_DOUBLE 1654+#undef TARGET_96_ROUND_53_LONG_DOUBLE
1657+#define TARGET_96_ROUND_53_LONG_DOUBLE 0 1655+#define TARGET_96_ROUND_53_LONG_DOUBLE 0
1658+ 1656+
1659+/* Define location of OS-specific unwind support configuration.  1657+/* Define location of OS-specific unwind support configuration.
1660+ Not required until OpenBSD changes from SJLJ to ZCX exceptions  1658+ Not required until OpenBSD changes from SJLJ to ZCX exceptions
1661+ When that happens, remove comments from first line and delete second line. */ 1659+ When that happens, remove comments from first line and delete second line. */
1662+/*#define MD_UNWIND_SUPPORT "config/i386/openbsd-unwind32.h" */ 1660+/*#define MD_UNWIND_SUPPORT "config/i386/openbsd-unwind32.h" */
1663--- gcc/ginclude/stddef.h.orig 1661--- gcc/ginclude/stddef.h.orig
1664+++ gcc/ginclude/stddef.h 1662+++ gcc/ginclude/stddef.h
1665@@ -1,5 +1,6 @@ 1663@@ -1,5 +1,6 @@
1666 /* Copyright (C) 1989, 1997, 1998, 1999, 2000, 2002, 2004, 2009 1664 /* Copyright (C) 1989, 1997, 1998, 1999, 2000, 2002, 2004, 2009
1667 Free Software Foundation, Inc. 1665 Free Software Foundation, Inc.
1668+ Copyright (C) 2010 John Marino <draco@marino.st> 1666+ Copyright (C) 2010 John Marino <draco@marino.st>
1669  1667
1670 This file is part of GCC. 1668 This file is part of GCC.
1671  1669
1672@@ -59,6 +60,10 @@ 1670@@ -59,6 +60,10 @@
1673 #include <sys/_types.h> 1671 #include <sys/_types.h>
1674 #endif 1672 #endif
1675  1673
1676+#if defined (__DragonFly__) 1674+#if defined (__DragonFly__)
1677+#include <sys/types.h> 1675+#include <sys/types.h>
1678+#endif 1676+#endif
1679+ 1677+
1680 /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are 1678 /* In 4.3bsd-net2, machine/ansi.h defines these symbols, which are
1681 defined if the corresponding type is *not* defined. 1679 defined if the corresponding type is *not* defined.
1682 FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_. 1680 FreeBSD-2.1 defines _MACHINE_ANSI_H_ instead of _ANSI_H_.
1683@@ -136,6 +141,7 @@ 1681@@ -136,6 +141,7 @@
1684 #ifndef _BSD_PTRDIFF_T_ 1682 #ifndef _BSD_PTRDIFF_T_
1685 #ifndef ___int_ptrdiff_t_h 1683 #ifndef ___int_ptrdiff_t_h
1686 #ifndef _GCC_PTRDIFF_T 1684 #ifndef _GCC_PTRDIFF_T
1687+#ifndef _PTRDIFF_T_DECLARED /* DragonFly BSD */ 1685+#ifndef _PTRDIFF_T_DECLARED /* DragonFly BSD */
1688 #define _PTRDIFF_T 1686 #define _PTRDIFF_T
1689 #define _T_PTRDIFF_ 1687 #define _T_PTRDIFF_
1690 #define _T_PTRDIFF 1688 #define _T_PTRDIFF
1691@@ -144,10 +150,12 @@ 1689@@ -144,10 +150,12 @@
1692 #define _BSD_PTRDIFF_T_ 1690 #define _BSD_PTRDIFF_T_
1693 #define ___int_ptrdiff_t_h 1691 #define ___int_ptrdiff_t_h
1694 #define _GCC_PTRDIFF_T 1692 #define _GCC_PTRDIFF_T
1695+#define _PTRDIFF_T_DECLARED 1693+#define _PTRDIFF_T_DECLARED
1696 #ifndef __PTRDIFF_TYPE__ 1694 #ifndef __PTRDIFF_TYPE__
1697 #define __PTRDIFF_TYPE__ long int 1695 #define __PTRDIFF_TYPE__ long int
1698 #endif 1696 #endif
1699 typedef __PTRDIFF_TYPE__ ptrdiff_t; 1697 typedef __PTRDIFF_TYPE__ ptrdiff_t;
1700+#endif /* _PTRDFF_T_DECLARED */ 1698+#endif /* _PTRDFF_T_DECLARED */
1701 #endif /* _GCC_PTRDIFF_T */ 1699 #endif /* _GCC_PTRDIFF_T */
1702 #endif /* ___int_ptrdiff_t_h */ 1700 #endif /* ___int_ptrdiff_t_h */
1703 #endif /* _BSD_PTRDIFF_T_ */ 1701 #endif /* _BSD_PTRDIFF_T_ */
1704@@ -179,7 +187,7 @@ 1702@@ -179,7 +187,7 @@
1705 #ifndef _SIZE_T_DEFINED_ 1703 #ifndef _SIZE_T_DEFINED_
1706 #ifndef _SIZE_T_DEFINED 1704 #ifndef _SIZE_T_DEFINED
1707 #ifndef _BSD_SIZE_T_DEFINED_ /* Darwin */ 1705 #ifndef _BSD_SIZE_T_DEFINED_ /* Darwin */
1708-#ifndef _SIZE_T_DECLARED /* FreeBSD 5 */ 1706-#ifndef _SIZE_T_DECLARED /* FreeBSD 5 */
1709+#ifndef _SIZE_T_DECLARED /* FreeBSD 5, also DragonFly */ 1707+#ifndef _SIZE_T_DECLARED /* FreeBSD 5, also DragonFly */
1710 #ifndef ___int_size_t_h 1708 #ifndef ___int_size_t_h
1711 #ifndef _GCC_SIZE_T 1709 #ifndef _GCC_SIZE_T
1712 #ifndef _SIZET_ 1710 #ifndef _SIZET_
1713@@ -196,12 +204,13 @@ 1711@@ -196,12 +204,13 @@
1714 #define _SIZE_T_DEFINED_ 1712 #define _SIZE_T_DEFINED_
1715 #define _SIZE_T_DEFINED 1713 #define _SIZE_T_DEFINED
1716 #define _BSD_SIZE_T_DEFINED_ /* Darwin */ 1714 #define _BSD_SIZE_T_DEFINED_ /* Darwin */
1717-#define _SIZE_T_DECLARED /* FreeBSD 5 */ 1715-#define _SIZE_T_DECLARED /* FreeBSD 5 */
1718+#define _SIZE_T_DECLARED /* FreeBSD 5, DragonFly */ 1716+#define _SIZE_T_DECLARED /* FreeBSD 5, DragonFly */
1719 #define ___int_size_t_h 1717 #define ___int_size_t_h
1720 #define _GCC_SIZE_T 1718 #define _GCC_SIZE_T
1721 #define _SIZET_ 1719 #define _SIZET_
1722-#if defined (__FreeBSD__) && (__FreeBSD__ >= 5) 1720-#if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
1723-/* __size_t is a typedef on FreeBSD 5!, must not trash it. */ 1721-/* __size_t is a typedef on FreeBSD 5!, must not trash it. */
1724+#if defined (__DragonFly__) || (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) 1722+#if defined (__DragonFly__) || (defined (__FreeBSD__) && (__FreeBSD__ >= 5))
1725+/* __size_t is a typedef on FreeBSD 5!, must not trash it.  1723+/* __size_t is a typedef on FreeBSD 5!, must not trash it.
1726+ __size_t is also defined in <machine/stdint.h> on DragonFly BSD */ 1724+ __size_t is also defined in <machine/stdint.h> on DragonFly BSD */
1727 #else 1725 #else
1728 #define __size_t 1726 #define __size_t
1729 #endif 1727 #endif
1730@@ -253,7 +262,7 @@ 1728@@ -253,7 +262,7 @@
1731 #ifndef _BSD_WCHAR_T_ 1729 #ifndef _BSD_WCHAR_T_
1732 #ifndef _BSD_WCHAR_T_DEFINED_ /* Darwin */ 1730 #ifndef _BSD_WCHAR_T_DEFINED_ /* Darwin */
1733 #ifndef _BSD_RUNE_T_DEFINED_ /* Darwin */ 1731 #ifndef _BSD_RUNE_T_DEFINED_ /* Darwin */
1734-#ifndef _WCHAR_T_DECLARED /* FreeBSD 5 */ 1732-#ifndef _WCHAR_T_DECLARED /* FreeBSD 5 */
1735+#ifndef _WCHAR_T_DECLARED /* FreeBSD 5, also DragonFly */ 1733+#ifndef _WCHAR_T_DECLARED /* FreeBSD 5, also DragonFly */
1736 #ifndef _WCHAR_T_DEFINED_ 1734 #ifndef _WCHAR_T_DEFINED_
1737 #ifndef _WCHAR_T_DEFINED 1735 #ifndef _WCHAR_T_DEFINED
1738 #ifndef _WCHAR_T_H 1736 #ifndef _WCHAR_T_H
1739@@ -305,8 +314,10 @@ 1737@@ -305,8 +314,10 @@
1740 #endif 1738 #endif
1741 /* FreeBSD 5 can't be handled well using "traditional" logic above 1739 /* FreeBSD 5 can't be handled well using "traditional" logic above
1742 since it no longer defines _BSD_RUNE_T_ yet still desires to export 1740 since it no longer defines _BSD_RUNE_T_ yet still desires to export
1743- rune_t in some cases... */ 1741- rune_t in some cases... */
1744-#if defined (__FreeBSD__) && (__FreeBSD__ >= 5) 1742-#if defined (__FreeBSD__) && (__FreeBSD__ >= 5)
1745+ rune_t in some cases...  1743+ rune_t in some cases...
1746+ DragonFly BSD inherited this quirk from FreeBSD 4.8. 1744+ DragonFly BSD inherited this quirk from FreeBSD 4.8.
1747+*/ 1745+*/
1748+#if defined (__DragonFly__) || (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) 1746+#if defined (__DragonFly__) || (defined (__FreeBSD__) && (__FreeBSD__ >= 5))
1749 #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE) 1747 #if !defined (_ANSI_SOURCE) && !defined (_POSIX_SOURCE)
1750 #if __BSD_VISIBLE 1748 #if __BSD_VISIBLE
1751 #ifndef _RUNE_T_DECLARED 1749 #ifndef _RUNE_T_DECLARED
1752--- include/libiberty.h.orig 1750--- include/libiberty.h.orig
1753+++ include/libiberty.h 1751+++ include/libiberty.h
1754@@ -2,6 +2,7 @@ 1752@@ -2,6 +2,7 @@
1755  1753
1756 Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 1754 Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
1757 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. 1755 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
1758+ Copyright 2010, 2011 John Marino <http://www.dragonlace.net> 1756+ Copyright 2010, 2011 John Marino <http://www.dragonlace.net>
1759  1757
1760 Note - certain prototypes declared in this header file are for 1758 Note - certain prototypes declared in this header file are for
1761 functions whoes implementation copyright does not belong to the 1759 functions whoes implementation copyright does not belong to the
1762@@ -102,7 +103,16 @@ 1760@@ -102,7 +103,16 @@
1763 to find the declaration so provide a fully prototyped one. If it 1761 to find the declaration so provide a fully prototyped one. If it
1764 is 1, we found it so don't provide any declaration at all. */ 1762 is 1, we found it so don't provide any declaration at all. */
1765 #if !HAVE_DECL_BASENAME 1763 #if !HAVE_DECL_BASENAME
1766-#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) || defined (HAVE_DECL_BASENAME) 1764-#if defined (__GNU_LIBRARY__ ) || defined (__linux__) || defined (__FreeBSD__) || defined (__OpenBSD__) || defined(__NetBSD__) || defined (__CYGWIN__) || defined (__CYGWIN32__) || defined (__MINGW32__) || defined (HAVE_DECL_BASENAME)
1767+#if defined (__GNU_LIBRARY__) \ 1765+#if defined (__GNU_LIBRARY__) \
1768+ || defined (__linux__) \ 1766+ || defined (__linux__) \
1769+ || defined (__FreeBSD__) \ 1767+ || defined (__FreeBSD__) \
1770+ || defined (__OpenBSD__) \ 1768+ || defined (__OpenBSD__) \
1771+ || defined (__NetBSD__) \ 1769+ || defined (__NetBSD__) \
1772+ || defined (__DragonFly__) \ 1770+ || defined (__DragonFly__) \
1773+ || defined (__CYGWIN__) \ 1771+ || defined (__CYGWIN__) \
1774+ || defined (__CYGWIN32__) \ 1772+ || defined (__CYGWIN32__) \
1775+ || defined (__MINGW32__) \ 1773+ || defined (__MINGW32__) \
1776+ || defined (HAVE_DECL_BASENAME) 1774+ || defined (HAVE_DECL_BASENAME)
1777 extern char *basename (const char *); 1775 extern char *basename (const char *);
1778 #else 1776 #else
1779 /* Do not allow basename to be used if there is no prototype seen. We 1777 /* Do not allow basename to be used if there is no prototype seen. We
1780--- libgcc/config.host.orig 1778--- libgcc/config.host.orig
1781+++ libgcc/config.host 1779+++ libgcc/config.host
1782@@ -1,6 +1,7 @@ 1780@@ -1,6 +1,7 @@
1783 # libgcc host-specific configuration file. 1781 # libgcc host-specific configuration file.
1784 # Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 1782 # Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
1785 # 2008, 2009, 2010 Free Software Foundation, Inc. 1783 # 2008, 2009, 2010 Free Software Foundation, Inc.
1786+# Copyright 2010-2012 John Marino <http://www.dragonlace.net> 1784+# Copyright 2010-2012 John Marino <http://www.dragonlace.net>
1787  1785
1788 #This file is part of GCC. 1786 #This file is part of GCC.
1789  1787
1790@@ -166,6 +167,8 @@ 1788@@ -157,6 +158,8 @@
1791 ;; 1789 ;;
1792 *-*-openbsd*) 1790 *-*-openbsd*)
1793 ;; 1791 ;;
1794+*-*-dragonfly*) 1792+*-*-dragonfly*)
1795+ ;; 1793+ ;;
1796 *-*-rtems*) 1794 *-*-rtems*)
1797 ;; 1795 ;;
1798 *-*-vxworks*) 1796 *-*-vxworks*)
1799@@ -287,6 +290,14 @@ 1797@@ -278,6 +281,14 @@
1800 x86_64-*-freebsd*) 1798 x86_64-*-freebsd*)
1801 tmake_file="${tmake_file} i386/t-freebsd" 1799 tmake_file="${tmake_file} i386/t-freebsd"
1802 ;; 1800 ;;
1803+i[34567]86-*-dragonfly*) 1801+i[34567]86-*-dragonfly*)
1804+ # define symbol versions (same as FreeBSD) 1802+ # define symbol versions (same as FreeBSD)
1805+ tmake_file="${tmake_file} i386/t-dragonfly" 1803+ tmake_file="${tmake_file} i386/t-dragonfly"
1806+ ;; 1804+ ;;
1807+x86_64-*-dragonfly*) 1805+x86_64-*-dragonfly*)
1808+ # define symbol versions (same as FreeBSD) 1806+ # define symbol versions (same as FreeBSD)
1809+ tmake_file="${tmake_file} i386/t-dragonfly" 1807+ tmake_file="${tmake_file} i386/t-dragonfly"
1810+ ;; 1808+ ;;
1811 i[34567]86-*-netbsdelf*) 1809 i[34567]86-*-netbsdelf*)
1812 ;; 1810 ;;
1813 i[34567]86-*-netbsd*) 1811 i[34567]86-*-netbsd*)
1814@@ -297,6 +308,8 @@ 1812@@ -288,6 +299,8 @@
1815 ;; 1813 ;;
1816 i[34567]86-*-openbsd*) 1814 i[34567]86-*-openbsd*)
1817 ;; 1815 ;;
1818+x86_64-*-openbsd*) 1816+x86_64-*-openbsd*)
1819+ ;; 1817+ ;;
1820 i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu*) 1818 i[34567]86-*-linux* | i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | i[34567]86-*-gnu*)
1821 extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o" 1819 extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o"
1822 tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm" 1820 tmake_file="${tmake_file} i386/t-crtpc i386/t-crtfm"
1823@@ -628,6 +641,9 @@ 1821@@ -619,6 +632,9 @@
1824 tmake_file="${tmake_file} t-softfp i386/${host_address}/t-fprules-softfp" 1822 tmake_file="${tmake_file} t-softfp i386/${host_address}/t-fprules-softfp"
1825 fi 1823 fi
1826 ;; 1824 ;;
1827+i[34567]86-*-dragonfly* | i[34567]86-*-netbsdelf*) 1825+i[34567]86-*-dragonfly* | i[34567]86-*-netbsdelf*)
1828+ tmake_file="${tmake_file} t-softfp i386/32/t-fprules-softfp" 1826+ tmake_file="${tmake_file} t-softfp i386/32/t-fprules-softfp"
1829+ ;; 1827+ ;;
1830 esac 1828 esac
1831  1829
1832 case ${host} in 1830 case ${host} in
1833--- /dev/null 1831--- /dev/null
1834+++ libgcc/config/i386/t-dragonfly 1832+++ libgcc/config/i386/t-dragonfly
1835@@ -0,0 +1,2 @@ 1833@@ -0,0 +1,2 @@
1836+# Add support for the introduction of 128-bit long double. 1834+# Add support for the introduction of 128-bit long double.
1837+SHLIB_MAPFILES += $(srcdir)/config/i386/libgcc-bsd.ver 1835+SHLIB_MAPFILES += $(srcdir)/config/i386/libgcc-bsd.ver
1838--- gcc/configure.orig 1836--- gcc/configure.orig
1839+++ gcc/configure 1837+++ gcc/configure
1840@@ -25843,6 +25843,20 @@ 1838@@ -25833,6 +25833,20 @@
1841 gcc_cv_target_dl_iterate_phdr=no 1839 gcc_cv_target_dl_iterate_phdr=no
1842 fi 1840 fi
1843 ;; 1841 ;;
1844+ *-*-dragonfly* | *-*-freebsd*) 1842+ *-*-dragonfly* | *-*-freebsd*)
1845+ if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h > /dev/null 2>&1; then 1843+ if grep dl_iterate_phdr $target_header_dir/sys/link_elf.h > /dev/null 2>&1; then
1846+ gcc_cv_target_dl_iterate_phdr=yes 1844+ gcc_cv_target_dl_iterate_phdr=yes
1847+ else 1845+ else
1848+ gcc_cv_target_dl_iterate_phdr=no 1846+ gcc_cv_target_dl_iterate_phdr=no
1849+ fi 1847+ fi
1850+ ;; 1848+ ;;
1851+# *-*-netbsd* | *-*-openbsd*) 1849+# *-*-netbsd* | *-*-openbsd*)
1852+# if grep dl_iterate_phdr $target_header_dir/link_elf.h > /dev/null 2>&1; then 1850+# if grep dl_iterate_phdr $target_header_dir/link_elf.h > /dev/null 2>&1; then
1853+# gcc_cv_target_dl_iterate_phdr=yes 1851+# gcc_cv_target_dl_iterate_phdr=yes
1854+# else 1852+# else
1855+# gcc_cv_target_dl_iterate_phdr=no 1853+# gcc_cv_target_dl_iterate_phdr=no
1856+# fi 1854+# fi
1857+# ;; 1855+# ;;
1858 esac 1856 esac
1859  1857
1860 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then 1858 if test x$gcc_cv_target_dl_iterate_phdr = xyes; then
1861--- gcc/Makefile.in.orig 1859--- gcc/Makefile.in.orig
1862+++ gcc/Makefile.in 1860+++ gcc/Makefile.in
1863@@ -4322,7 +4322,7 @@ 1861@@ -4322,7 +4322,7 @@
1864 DESTDIR=$(@D) \ 1862 DESTDIR=$(@D) \
1865 $(SHELL) $(srcdir)/doc/install.texi2html 1863 $(SHELL) $(srcdir)/doc/install.texi2html
1866  1864
1867-MANFILES = doc/gcov.1 doc/cpp.1 doc/gcc.1 doc/gfdl.7 doc/gpl.7 doc/fsf-funding.7 1865-MANFILES = doc/gcov.1 doc/cpp.1 doc/gcc.1 doc/gfdl.7 doc/gpl.7 doc/fsf-funding.7
1868+MANFILES = doc/gcov.1 doc/cpp.1 doc/gcc.1 1866+MANFILES = doc/gcov.1 doc/cpp.1 doc/gcc.1
1869  1867
1870 generated-manpages: man 1868 generated-manpages: man
1871  1869
1872@@ -4474,7 +4474,7 @@ 1870@@ -4474,7 +4474,7 @@
1873 # Install the driver last so that the window when things are 1871 # Install the driver last so that the window when things are
1874 # broken is small. 1872 # broken is small.
1875 install: install-common $(INSTALL_HEADERS) \ 1873 install: install-common $(INSTALL_HEADERS) \
1876- install-cpp install-man install-info install-@POSUB@ \ 1874- install-cpp install-man install-info install-@POSUB@ \
1877+ install-cpp install-man install-@POSUB@ \ 1875+ install-cpp install-man install-@POSUB@ \
1878 install-driver install-lto-wrapper 1876 install-driver install-lto-wrapper
1879  1877
1880 ifeq ($(enable_plugin),yes) 1878 ifeq ($(enable_plugin),yes)
1881@@ -4665,10 +4665,7 @@ 1879@@ -4665,10 +4665,7 @@
1882 install-man: lang.install-man \ 1880 install-man: lang.install-man \
1883 $(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(man1ext) \ 1881 $(DESTDIR)$(man1dir)/$(GCC_INSTALL_NAME)$(man1ext) \
1884 $(DESTDIR)$(man1dir)/$(CPP_INSTALL_NAME)$(man1ext) \ 1882 $(DESTDIR)$(man1dir)/$(CPP_INSTALL_NAME)$(man1ext) \
1885- $(DESTDIR)$(man1dir)/$(GCOV_INSTALL_NAME)$(man1ext) \ 1883- $(DESTDIR)$(man1dir)/$(GCOV_INSTALL_NAME)$(man1ext) \
1886- $(DESTDIR)$(man7dir)/fsf-funding$(man7ext) \ 1884- $(DESTDIR)$(man7dir)/fsf-funding$(man7ext) \
1887- $(DESTDIR)$(man7dir)/gfdl$(man7ext) \ 1885- $(DESTDIR)$(man7dir)/gfdl$(man7ext) \
1888- $(DESTDIR)$(man7dir)/gpl$(man7ext) 1886- $(DESTDIR)$(man7dir)/gpl$(man7ext)
1889+ $(DESTDIR)$(man1dir)/$(GCOV_INSTALL_NAME)$(man1ext) 1887+ $(DESTDIR)$(man1dir)/$(GCOV_INSTALL_NAME)$(man1ext)
1890  1888
1891 $(DESTDIR)$(man7dir)/%$(man7ext): doc/%.7 installdirs 1889 $(DESTDIR)$(man7dir)/%$(man7ext): doc/%.7 installdirs
1892 -rm -f $@ 1890 -rm -f $@
 1891--- libiberty/getpagesize.c.orig
 1892+++ libiberty/getpagesize.c
 1893@@ -20,6 +20,7 @@
 1894
 1895 */
 1896
 1897+#ifndef __ANDROID__
 1898 #ifndef VMS
 1899
 1900 #include "config.h"
 1901@@ -88,3 +89,4 @@
 1902 }
 1903
 1904 #endif /* VMS */
 1905+#endif /* __ANDROID__ */
 1906--- libiberty/setproctitle.c.orig
 1907+++ libiberty/setproctitle.c
 1908@@ -40,9 +40,11 @@
 1909 void
 1910 setproctitle (const char *name ATTRIBUTE_UNUSED, ...)
 1911 {
 1912+#ifndef __ANDROID__
 1913 #ifdef PR_SET_NAME
 1914 /* On Linux this sets the top visible "comm", but not necessarily
 1915 the name visible in ps. */
 1916 prctl (PR_SET_NAME, name);
 1917 #endif
 1918+#endif
 1919 }
1893--- configure.orig 1920--- configure.orig
1894+++ configure 1921+++ configure
1895@@ -14200,7 +14200,7 @@ 1922@@ -14196,7 +14196,7 @@
1896 _ACEOF 1923 _ACEOF
1897 if ac_fn_c_try_compile "$LINENO"; then : 1924 if ac_fn_c_try_compile "$LINENO"; then :
1898 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 1925 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
1899-$as_echo "yes" >&6; }; stage1_cflags="$stage1_cflags -fkeep-inline-functions" 1926-$as_echo "yes" >&6; }; stage1_cflags="$stage1_cflags -fkeep-inline-functions"
1900+$as_echo "yes" >&6; }; 1927+$as_echo "yes" >&6; };
1901 else 1928 else
1902 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 1929 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
1903 $as_echo "no" >&6; } 1930 $as_echo "no" >&6; }