View | Details | Raw Unified | Return to bug 216707 | Differences between
and this patch

Collapse All | Expand All

(-)Mk/bsd.default-versions.mk (-1 / +1 lines)
Lines 38-44 Link Here
38
# Possible values: 3.0.0
38
# Possible values: 3.0.0
39
FPC_DEFAULT?=		3.0.0
39
FPC_DEFAULT?=		3.0.0
40
# Possible values: 4.7, 4.8, 4.9, 5, 6
40
# Possible values: 4.7, 4.8, 4.9, 5, 6
41
GCC_DEFAULT?=		4.9
41
GCC_DEFAULT?=		5
42
# Possible values: 7, 8, 9, agpl
42
# Possible values: 7, 8, 9, agpl
43
GHOSTSCRIPT_DEFAULT?=	agpl
43
GHOSTSCRIPT_DEFAULT?=	agpl
44
.if defined(ARCH) && ${ARCH} == amd64
44
.if defined(ARCH) && ${ARCH} == amd64
(-)lang/gcc49/Makefile (-1 lines)
Lines 24-30 Link Here
24
BUILD_DEPENDS+=	runtest:misc/dejagnu
24
BUILD_DEPENDS+=	runtest:misc/dejagnu
25
.endif
25
.endif
26
26
27
CONFLICTS=	gcc-4.9.*
28
CPE_VENDOR=	gnu
27
CPE_VENDOR=	gnu
29
CPE_VERSION=	${GCC_VERSION}
28
CPE_VERSION=	${GCC_VERSION}
30
29
(-)lang/gcc5-devel/Makefile (+1 lines)
Lines 23-28 Link Here
23
BUILD_DEPENDS+=	runtest:misc/dejagnu
23
BUILD_DEPENDS+=	runtest:misc/dejagnu
24
.endif
24
.endif
25
25
26
CONFLICTS=	gcc-5.*
26
CPE_VENDOR=	gnu
27
CPE_VENDOR=	gnu
27
CPE_VERSION=	${GCC_VERSION}
28
CPE_VERSION=	${GCC_VERSION}
28
29
(-)lang/gcc5/Makefile (+1 lines)
Lines 23-28 Link Here
23
BUILD_DEPENDS+=	runtest:misc/dejagnu
23
BUILD_DEPENDS+=	runtest:misc/dejagnu
24
.endif
24
.endif
25
25
26
CONFLICTS=	gcc-5.*
26
CPE_VENDOR=	gnu
27
CPE_VENDOR=	gnu
27
CPE_VERSION=	${GCC_VERSION}
28
CPE_VERSION=	${GCC_VERSION}
28
29
(-)lang/gcc/Makefile (-14 / +14 lines)
Lines 2-13 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	gcc
4
PORTNAME=	gcc
5
PORTVERSION=	4.9.4
5
PORTVERSION=	5.4.0
6
CATEGORIES=	lang java
6
CATEGORIES=	lang java
7
MASTER_SITES=	GCC/releases/gcc-${DISTVERSION}
7
MASTER_SITES=	GCC/releases/gcc-${DISTVERSION}
8
8
9
MAINTAINER=	gerald@FreeBSD.org
9
MAINTAINER=	gerald@FreeBSD.org
10
COMMENT=	GNU Compiler Collection 4.9
10
COMMENT=	GNU Compiler Collection 5
11
11
12
LICENSE=	GPLv3 GPLv3RLE
12
LICENSE=	GPLv3 GPLv3RLE
13
LICENSE_COMB=	multi
13
LICENSE_COMB=	multi
Lines 22-50 Link Here
22
BUILD_DEPENDS+=	runtest:misc/dejagnu
22
BUILD_DEPENDS+=	runtest:misc/dejagnu
23
.endif
23
.endif
24
24
25
CONFLICTS=	gcc49*
25
CONFLICTS=	gcc5*
26
CPE_VENDOR=	gnu
26
CPE_VENDOR=	gnu
27
27
28
# DISTVERSION relates to downloads, GCC_VERSION and SUFFIX to names
28
GCC_VERSION=	${PORTVERSION}
29
# of executables and directories once installed.
29
SUFFIX=		${PORTVERSION:C/([0-9]+).*/\1/}
30
DISTVERSION=	${PORTVERSION}
30
ONLY_FOR_ARCHS=	amd64 arm armv6 armv6hf i386 powerpc powerpc64 sparc64
31
GCC_VERSION=	${PORTVERSION:C/(.+)\.[0-9]{8}/\1/}
32
SUFFIX=		${PORTVERSION:C/([0-9]+).([0-9]+).*/\1\2/}
33
ONLY_FOR_ARCHS=	amd64 armv6 armv6hf i386 powerpc powerpc64 sparc64
34
USES=		compiler cpe gmake iconv libtool makeinfo perl5 tar:bzip2
31
USES=		compiler cpe gmake iconv libtool makeinfo perl5 tar:bzip2
35
USE_BINUTILS=	yes
32
USE_BINUTILS=	yes
36
USE_PERL5=	build
33
USE_PERL5=	build
37
SSP_UNSAFE=	yes
34
SSP_UNSAFE=	yes
38
35
39
OPTIONS_DEFINE=		BOOTSTRAP
36
OPTIONS_DEFINE=		BOOTSTRAP GRAPHITE
40
OPTIONS_DEFINE_i386=	JAVA
37
OPTIONS_DEFINE_i386=	JAVA
41
OPTIONS_DEFINE_amd64=	JAVA
38
OPTIONS_DEFINE_amd64=	JAVA
42
OPTIONS_DEFINE_powerpc64=	JAVA
39
OPTIONS_DEFAULT=	BOOTSTRAP
43
OPTIONS_DEFAULT_i386=	JAVA
40
OPTIONS_DEFAULT_i386=	JAVA
44
OPTIONS_DEFAULT_amd64=	JAVA
41
OPTIONS_DEFAULT_amd64=	JAVA
45
OPTIONS_DEFAULT_powerpc64=	BOOTSTRAP
46
OPTIONS_EXCLUDE_DragonFly=	JAVA
42
OPTIONS_EXCLUDE_DragonFly=	JAVA
47
BOOTSTRAP_DESC=		Build using a full bootstrap
43
BOOTSTRAP_DESC=		Build using a full bootstrap
44
GRAPHITE_DESC=		Support for Graphite loop optimizations
48
45
49
.if exists(/usr/lib32/libc.so)
46
.if exists(/usr/lib32/libc.so)
50
OPTIONS_DEFINE_powerpc64+=	MULTILIB
47
OPTIONS_DEFINE_powerpc64+=	MULTILIB
Lines 66-73 Link Here
66
.endif
63
.endif
67
64
68
.if ${ARCH} == "armv6" || ${ARCH} == "armv6hf"
65
.if ${ARCH} == "armv6" || ${ARCH} == "armv6hf"
69
# Override sys.mk including -O in CFLAGS which breaks libgomp building.
70
CFLAGS:=	${CFLAGS:S/-O/-O2/g}
71
. if ${COMPILER_TYPE} == clang
66
. if ${COMPILER_TYPE} == clang
72
.  if empty(PORT_OPTIONS:MBOOTSTRAP)
67
.  if empty(PORT_OPTIONS:MBOOTSTRAP)
73
MAKE_ARGS+=CXXFLAGS=-fbracket-depth=512
68
MAKE_ARGS+=CXXFLAGS=-fbracket-depth=512
Lines 120-125 Link Here
120
SUB_FILES=	pkg-message
115
SUB_FILES=	pkg-message
121
SUB_LIST+=	TARGLIB=${TARGLIB}
116
SUB_LIST+=	TARGLIB=${TARGLIB}
122
117
118
.if ${PORT_OPTIONS:MGRAPHITE}
119
LIB_DEPENDS+=	libisl.so:devel/isl
120
CONFIGURE_ARGS+=--with-isl=${LOCALBASE}
121
.endif
122
123
.if ${PORT_OPTIONS:MJAVA}
123
.if ${PORT_OPTIONS:MJAVA}
124
ECJ_JAR=	${LOCALBASE}/share/java/ecj-4.5.jar
124
ECJ_JAR=	${LOCALBASE}/share/java/ecj-4.5.jar
125
BUILD_DEPENDS+=	${ECJ_JAR}:lang/gcc-ecj45 \
125
BUILD_DEPENDS+=	${ECJ_JAR}:lang/gcc-ecj45 \
(-)lang/gcc/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1478034530
1
TIMESTAMP = 1485986262
2
SHA256 (gcc-4.9.4.tar.bz2) = 6c11d292cd01b294f9f84c9a59c230d80e9e4a47e5c6355f046bb36d4f358092
2
SHA256 (gcc-5.4.0.tar.bz2) = 608df76dec2d34de6558249d8af4cbee21eceddbcb580d666f7a5a583ca3303a
3
SIZE (gcc-4.9.4.tar.bz2) = 90097606
3
SIZE (gcc-5.4.0.tar.bz2) = 95661481
(-)lang/gcc/files/patch-arm-support (-745 lines)
Lines 1-745 Link Here
1
--- UTC
2
Index: configure
3
===================================================================
4
--- configure	(revision 218760)
5
+++ configure	(working copy)
6
@@ -3352,6 +3352,9 @@
7
   alpha*-*-*vms*)
8
     noconfigdirs="$noconfigdirs ${libgcj}"
9
     ;;
10
+  arm*-*-freebsd*)
11
+    noconfigdirs="$noconfigdirs ${libgcj}"
12
+    ;;
13
   arm-wince-pe)
14
     noconfigdirs="$noconfigdirs ${libgcj}"
15
     ;;
16
Index: configure.ac
17
===================================================================
18
--- configure.ac	(revision 218760)
19
+++ configure.ac	(working copy)
20
@@ -691,6 +691,9 @@
21
   alpha*-*-*vms*)
22
     noconfigdirs="$noconfigdirs ${libgcj}"
23
     ;;
24
+  arm*-*-freebsd*)
25
+    noconfigdirs="$noconfigdirs ${libgcj}"
26
+    ;;
27
   arm-wince-pe)
28
     noconfigdirs="$noconfigdirs ${libgcj}"
29
     ;;
30
Index: gcc/config/arm/arm.c
31
===================================================================
32
--- gcc/config/arm/arm.c	(revision 218760)
33
+++ gcc/config/arm/arm.c	(working copy)
34
@@ -1239,7 +1239,7 @@
35
 {
36
   /* For Linux, we have access to kernel support for atomic operations.  */
37
   if (arm_abi == ARM_ABI_AAPCS_LINUX)
38
-    init_sync_libfuncs (2 * UNITS_PER_WORD);
39
+    init_sync_libfuncs (MAX_SYNC_LIBFUNC_SIZE);
40
 
41
   /* There are no special library functions unless we are using the
42
      ARM BPABI.  */
43
Index: gcc/config/arm/arm.h
44
===================================================================
45
--- gcc/config/arm/arm.h	(revision 218760)
46
+++ gcc/config/arm/arm.h	(working copy)
47
@@ -720,6 +720,11 @@
48
 #define PCC_BITFIELD_TYPE_MATTERS TARGET_AAPCS_BASED
49
 #endif
50
 
51
+/* The maximum size of the sync library functions supported.  */
52
+#ifndef MAX_SYNC_LIBFUNC_SIZE
53
+#define MAX_SYNC_LIBFUNC_SIZE (2 * UNITS_PER_WORD);
54
+#endif
55
+
56
 
57
 /* Standard register usage.  */
58
 
59
Index: gcc/config/arm/freebsd.h
60
===================================================================
61
--- gcc/config/arm/freebsd.h	(revision 0)
62
+++ gcc/config/arm/freebsd.h	(working copy)
63
@@ -0,0 +1,180 @@
64
+/* Definitions of target machine for GNU compiler, FreeBSD/arm version.
65
+   Copyright (C) 2002-2014 Free Software Foundation, Inc.
66
+   Contributed by Wasabi Systems, Inc.
67
+
68
+   This file is part of GCC.
69
+
70
+   GCC is free software; you can redistribute it and/or modify it
71
+   under the terms of the GNU General Public License as published
72
+   by the Free Software Foundation; either version 3, or (at your
73
+   option) any later version.
74
+
75
+   GCC is distributed in the hope that it will be useful, but WITHOUT
76
+   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
77
+   or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
78
+   License for more details.
79
+
80
+   Under Section 7 of GPL version 3, you are granted additional
81
+   permissions described in the GCC Runtime Library Exception, version
82
+   3.1, as published by the Free Software Foundation.
83
+
84
+   You should have received a copy of the GNU General Public License
85
+   along with GCC; see the file COPYING3.  If not see
86
+   <http://www.gnu.org/licenses/>.  */
87
+
88
+#undef  SUBTARGET_CPP_SPEC
89
+#define SUBTARGET_CPP_SPEC FBSD_CPP_SPEC
90
+
91
+#undef  SUBTARGET_EXTRA_SPECS
92
+#define SUBTARGET_EXTRA_SPECS					\
93
+  { "subtarget_extra_asm_spec",	SUBTARGET_EXTRA_ASM_SPEC },	\
94
+  { "subtarget_asm_float_spec", SUBTARGET_ASM_FLOAT_SPEC }, 	\
95
+  { "fbsd_dynamic_linker", FBSD_DYNAMIC_LINKER }
96
+
97
+#undef SUBTARGET_EXTRA_ASM_SPEC
98
+#define SUBTARGET_EXTRA_ASM_SPEC \
99
+  "%{mabi=apcs-gnu|mabi=atpcs:-meabi=gnu;:-meabi=5} " TARGET_FIX_V4BX_SPEC " \
100
+  %{fpic|fpie:-k} %{fPIC|fPIE:-k}"
101
+
102
+#undef SUBTARGET_ASM_FLOAT_SPEC
103
+#ifdef TARGET_FREEBSD_ARM_HARD_FLOAT
104
+/* Default to full vfp if we build for arm*hf.  */
105
+#define SUBTARGET_ASM_FLOAT_SPEC "%{!mfpu=*:-mfpu=vfp}"
106
+#else
107
+#define SUBTARGET_ASM_FLOAT_SPEC "%{!mfpu=*:-mfpu=softvfp}"
108
+#endif
109
+
110
+#undef	LINK_SPEC
111
+#define LINK_SPEC "							\
112
+  %{p:%nconsider using `-pg' instead of `-p' with gprof (1) }		\
113
+  %{v:-V}								\
114
+  %{assert*} %{R*} %{rpath*} %{defsym*}					\
115
+  %{shared:-Bshareable %{h*} %{soname*}}				\
116
+  %{!shared:								\
117
+    %{!static:								\
118
+      %{rdynamic:-export-dynamic}					\
119
+      %{!dynamic-linker:-dynamic-linker %(fbsd_dynamic_linker) }}	\
120
+    %{static:-Bstatic}}							\
121
+  %{!static:--hash-style=both --enable-new-dtags}			\
122
+  %{symbolic:-Bsymbolic}						\
123
+  -X %{mbig-endian:-EB} %{mlittle-endian:-EL}"
124
+
125
+/* TARGET_BIG_ENDIAN_DEFAULT is set in
126
+   config.gcc for big endian configurations.  */
127
+#if TARGET_BIG_ENDIAN_DEFAULT
128
+#define TARGET_ENDIAN_DEFAULT    MASK_BIG_END
129
+#define TARGET_ENDIAN_OPTION     "mbig-endian"
130
+#define TARGET_LINKER_EMULATION  "armelfb_fbsd"
131
+#else
132
+#define TARGET_ENDIAN_DEFAULT    0
133
+#define TARGET_ENDIAN_OPTION     "mlittle-endian"
134
+#define TARGET_LINKER_EMULATION  "armelf_fbsd"
135
+#endif
136
+
137
+#undef	SUBTARGET_EXTRA_LINK_SPEC
138
+#define SUBTARGET_EXTRA_LINK_SPEC " -m " TARGET_LINKER_EMULATION " -p"
139
+
140
+#undef  TARGET_OS_CPP_BUILTINS
141
+#define TARGET_OS_CPP_BUILTINS() 		\
142
+  do						\
143
+    {						\
144
+	FBSD_TARGET_OS_CPP_BUILTINS ();		\
145
+	TARGET_BPABI_CPP_BUILTINS ();		\
146
+    }						\
147
+  while (false)
148
+
149
+/* We default to a soft-float ABI so that binaries can run on all
150
+   target hardware.  */
151
+#undef TARGET_DEFAULT_FLOAT_ABI
152
+#ifdef TARGET_FREEBSD_ARM_HARD_FLOAT
153
+#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_HARD
154
+#else
155
+#define TARGET_DEFAULT_FLOAT_ABI ARM_FLOAT_ABI_SOFT
156
+#endif
157
+
158
+#undef ARM_DEFAULT_ABI
159
+
160
+/* AACPS_LINUX has access to kernel atomic ops while we don't.
161
+   But AACPS defaults to short_enums.  */
162
+#define ARM_DEFAULT_ABI ARM_ABI_AAPCS_LINUX
163
+
164
+#undef TARGET_DEFAULT
165
+#define TARGET_DEFAULT (MASK_INTERWORK | TARGET_ENDIAN_DEFAULT)
166
+
167
+/* We do not have any MULTILIB_OPTIONS specified, so there are no
168
+   MULTILIB_DEFAULTS.  */
169
+#undef  MULTILIB_DEFAULTS
170
+
171
+/*  Use the AAPCS type for wchar_t, override the one from config/freebsd.h.  */
172
+#undef  WCHAR_TYPE
173
+#define WCHAR_TYPE  "unsigned int"
174
+
175
+#undef  WCHAR_TYPE_SIZE
176
+#define WCHAR_TYPE_SIZE BITS_PER_WORD
177
+
178
+#if defined (TARGET_FREEBSD_ARMv6)
179
+#undef  SUBTARGET_CPU_DEFAULT
180
+#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm1176jzs
181
+#else
182
+#undef  SUBTARGET_CPU_DEFAULT
183
+#define SUBTARGET_CPU_DEFAULT   TARGET_CPU_arm9
184
+#endif
185
+
186
+#define SUBTARGET_OVERRIDE_OPTIONS		\
187
+do {						\
188
+    if (unaligned_access)			\
189
+	unaligned_access = 0;			\
190
+} while (0)
191
+
192
+#undef MAX_SYNC_LIBFUNC_SIZE
193
+#define MAX_SYNC_LIBFUNC_SIZE 4 /* UNITS_PER_WORD not defined yet.  */
194
+
195
+/* FreeBSD does its profiling differently to the Acorn compiler.  We
196
+   don't need a word following the mcount call; and to skip it
197
+   requires either an assembly stub or use of fomit-frame-pointer when
198
+   compiling the profiling functions.  Since we break Acorn CC
199
+   compatibility below a little more won't hurt.  */
200
+
201
+#undef ARM_FUNCTION_PROFILER
202
+#define ARM_FUNCTION_PROFILER(STREAM,LABELNO)		\
203
+{							\
204
+  asm_fprintf (STREAM, "\tmov\t%Rip, %Rlr\n");		\
205
+  asm_fprintf (STREAM, "\tbl\t__mcount%s\n",		\
206
+	       (TARGET_ARM && NEED_PLT_RELOC)		\
207
+	       ? "(PLT)" : "");				\
208
+}
209
+
210
+/* Clear the instruction cache from `BEG' to `END'.  This makes a
211
+   call to the ARM_SYNC_ICACHE architecture specific syscall.  */
212
+#define CLEAR_INSN_CACHE(BEG, END)					\
213
+do									\
214
+  {									\
215
+    extern int sysarch (int number, void *args);			\
216
+    struct								\
217
+      {									\
218
+	unsigned int addr;						\
219
+	int          len;						\
220
+      } s;								\
221
+    s.addr = (unsigned int) (BEG);					\
222
+    s.len = (END) - (BEG);						\
223
+    (void) sysarch (0, &s);						\
224
+  }									\
225
+while (0)
226
+
227
+/* This is how we tell the assembler that two symbols have the same value.  */
228
+#define ASM_OUTPUT_DEF(FILE, NAME1, NAME2) \
229
+  do					   \
230
+    {					   \
231
+     assemble_name (FILE, NAME1); 	   \
232
+     fputs (" = ", FILE);		   \
233
+     assemble_name (FILE, NAME2);	   \
234
+     fputc ('\n', FILE);		   \
235
+    }					   \
236
+  while (0)
237
+
238
+/* Add  .note.GNU-stack.  */
239
+#undef NEED_INDICATE_EXEC_STACK
240
+#define NEED_INDICATE_EXEC_STACK 1
241
+
242
+#define ARM_TARGET2_DWARF_FORMAT (DW_EH_PE_pcrel | DW_EH_PE_indirect)
243
+
244
245
Property changes on: gcc/config/arm/freebsd.h
246
___________________________________________________________________
247
Added: svn:eol-style
248
## -0,0 +1 ##
249
+native
250
\ No newline at end of property
251
Added: svn:keywords
252
## -0,0 +1 ##
253
+FreeBSD=%H
254
\ No newline at end of property
255
Added: svn:mime-type
256
## -0,0 +1 ##
257
+text/plain
258
\ No newline at end of property
259
Index: gcc/config.gcc
260
===================================================================
261
--- gcc/config.gcc	(revision 218760)
262
+++ gcc/config.gcc	(working copy)
263
@@ -267,7 +267,6 @@
264
    arm*-wince-pe*			\
265
  | arm*-*-ecos-elf			\
266
  | arm*-*-elf				\
267
- | arm*-*-freebsd*			\
268
  | arm*-*-linux*			\
269
  | arm*-*-uclinux*			\
270
  | i[34567]86-go32-*			\
271
@@ -865,6 +864,28 @@
272
 	extra_options="${extra_options} arm/vxworks.opt"
273
 	tmake_file="${tmake_file} arm/t-arm arm/t-vxworks"
274
 	;;
275
+arm*-*-freebsd*)                # ARM FreeBSD EABI
276
+	tm_file="dbxelf.h elfos.h ${fbsd_tm_file} arm/elf.h"
277
+	case $target in
278
+	arm*b-*-freebsd*)
279
+	    tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
280
+	    ;;
281
+	esac
282
+	tmake_file="${tmake_file} arm/t-arm arm/t-bpabi"
283
+	tm_file="${tm_file} arm/bpabi.h arm/freebsd.h arm/aout.h arm/arm.h"
284
+	case $target in
285
+	armv6*-*-freebsd*)
286
+	    tm_defines="${tm_defines} TARGET_FREEBSD_ARMv6=1"
287
+	    ;;
288
+	esac
289
+	case $target in
290
+	arm*hf-*-freebsd*)
291
+	    tm_defines="${tm_defines} TARGET_FREEBSD_ARM_HARD_FLOAT=1"
292
+	    ;;
293
+	esac
294
+	need_64bit_hwint=yes
295
+	with_tls=${with_tls:-gnu}
296
+	;;
297
 arm*-*-netbsdelf*)
298
 	tm_file="dbxelf.h elfos.h netbsd.h netbsd-elf.h arm/elf.h arm/aout.h ${tm_file} arm/netbsd-elf.h"
299
 	extra_options="${extra_options} netbsd.opt netbsd-elf.opt"
300
Index: gcc/config.host
301
===================================================================
302
--- gcc/config.host	(revision 218760)
303
+++ gcc/config.host	(working copy)
304
@@ -99,7 +99,7 @@
305
 esac
306
 
307
 case ${host} in
308
-  arm*-*-linux*)
309
+  arm*-*-freebsd* | arm*-*-linux*)
310
     case ${target} in
311
       arm*-*-*)
312
 	host_extra_gcc_objs="driver-arm.o"
313
Index: gcc/ginclude/unwind-arm-common.h
314
===================================================================
315
--- gcc/ginclude/unwind-arm-common.h	(revision 218760)
316
+++ gcc/ginclude/unwind-arm-common.h	(working copy)
317
@@ -82,7 +82,11 @@
318
 
319
   struct _Unwind_Control_Block
320
     {
321
+#ifdef __FreeBSD__
322
+      unsigned exception_class __attribute__((__mode__(__DI__)));
323
+#else
324
       char exception_class[8];
325
+#endif
326
       void (*exception_cleanup)(_Unwind_Reason_Code, _Unwind_Control_Block *);
327
       /* Unwinder cache, private fields for the unwinder's use */
328
       struct
329
@@ -181,7 +185,11 @@
330
 
331
   /* Support functions for the PR.  */
332
 #define _Unwind_Exception _Unwind_Control_Block
333
+#ifdef __FreeBSD__
334
+  typedef unsigned _Unwind_Exception_Class __attribute__((__mode__(__DI__)));
335
+#else
336
   typedef char _Unwind_Exception_Class[8];
337
+#endif
338
 
339
   void * _Unwind_GetLanguageSpecificData (_Unwind_Context *);
340
   _Unwind_Ptr _Unwind_GetRegionStart (_Unwind_Context *);
341
Index: libatomic/configure.tgt
342
===================================================================
343
--- libatomic/configure.tgt	(revision 218760)
344
+++ libatomic/configure.tgt	(working copy)
345
@@ -33,10 +33,15 @@
346
 
347
   arm*)
348
 	ARCH=arm
349
-	# ??? Detect when -march=armv7 is already enabled.
350
-	try_ifunc=yes
351
-	;;
352
-
353
+	case "${target}" in
354
+            arm*-*-freebsd*)
355
+                ;;
356
+            *)
357
+                # ??? Detect when -march=armv7 is already enabled.
358
+                try_ifunc=yes
359
+                ;;
360
+        esac
361
+        ;;
362
   sparc)
363
 	case " ${CC} ${CFLAGS} " in
364
 	  *" -m64 "*)
365
Index: libgcc/config/arm/freebsd-atomic.c
366
===================================================================
367
--- libgcc/config/arm/freebsd-atomic.c	(revision 0)
368
+++ libgcc/config/arm/freebsd-atomic.c	(working copy)
369
@@ -0,0 +1,224 @@
370
+/* FreeBSD specific atomic operations for ARM EABI.
371
+   Copyright (C) 2014 Free Software Foundation, Inc.
372
+
373
+This file is part of GCC.
374
+
375
+GCC is free software; you can redistribute it and/or modify it under
376
+the terms of the GNU General Public License as published by the Free
377
+Software Foundation; either version 3, or (at your option) any later
378
+version.
379
+
380
+GCC is distributed in the hope that it will be useful, but WITHOUT ANY
381
+WARRANTY; without even the implied warranty of MERCHANTABILITY or
382
+FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
383
+for more details.
384
+
385
+Under Section 7 of GPL version 3, you are granted additional
386
+permissions described in the GCC Runtime Library Exception, version
387
+3.1, as published by the Free Software Foundation.
388
+
389
+You should have received a copy of the GNU General Public License and
390
+a copy of the GCC Runtime Library Exception along with this program;
391
+see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
392
+<http://www.gnu.org/licenses/>.  */
393
+
394
+#include <sys/types.h>
395
+
396
+#define HIDDEN __attribute__ ((visibility ("hidden")))
397
+
398
+#define ARM_VECTORS_HIGH 0xffff0000U
399
+#define ARM_TP_ADDRESS   (ARM_VECTORS_HIGH + 0x1000)
400
+#define ARM_RAS_START    (ARM_TP_ADDRESS + 4)
401
+
402
+void HIDDEN
403
+__sync_synchronize (void)
404
+{
405
+#if defined (__ARM_ARCH_6__) || defined (__ARM_ARCH_6J__)       \
406
+    || defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6T2__)  \
407
+    || defined (__ARM_ARCH_6Z__) || defined (__ARM_ARCH_6ZK__)  \
408
+    || defined (__ARM_ARCH_7__) || defined (__ARM_ARCH_7A__)
409
+#if defined (__ARM_ARCH_7__) || defined (__ARM_ARCH_7A__)
410
+    __asm __volatile ("dmb" : : : "memory");
411
+#else
412
+    __asm __volatile ("mcr p15, 0, r0, c7, c10, 5" : : : "memory");
413
+#endif
414
+#else
415
+    __asm __volatile ("nop" : : : "memory");
416
+#endif
417
+}
418
+
419
+#if defined (__ARM_ARCH_6__) || defined (__ARM_ARCH_6J__)        \
420
+    || defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6T2__)   \
421
+    || defined (__ARM_ARCH_6Z__) || defined (__ARM_ARCH_6ZK__)   \
422
+    || defined (__ARM_ARCH_7__) || defined (__ARM_ARCH_7A__)
423
+
424
+/* These systems should be supported by the compiler.  */
425
+
426
+#else /* __ARM_ARCH_5__  */
427
+
428
+#define	SYNC_LOCK_TEST_AND_SET_N(N, TYPE, LDR, STR)			\
429
+TYPE HIDDEN    								\
430
+__sync_lock_test_and_set_##N (TYPE *mem, TYPE val)			\
431
+{									\
432
+        unsigned int old, temp, ras_start;                              \
433
+                                                                        \
434
+        ras_start = ARM_RAS_START;					\
435
+        __asm volatile (						\
436
+                /* Set up Restartable Atomic Sequence.  */		\
437
+                "1:"							\
438
+                "\tadr   %2, 1b\n"					\
439
+                "\tstr   %2, [%5]\n"					\
440
+                "\tadr   %2, 2f\n"					\
441
+                "\tstr   %2, [%5, #4]\n"				\
442
+                                                                        \
443
+                "\t"LDR" %0, %4\n"	/* Load old value.  */		\
444
+                "\t"STR" %3, %1\n"	/* Store new value.  */		\
445
+                                                                        \
446
+                /* Tear down Restartable Atomic Sequence.  */		\
447
+                "2:"							\
448
+                "\tmov   %2, #0x00000000\n"				\
449
+                "\tstr   %2, [%5]\n"					\
450
+                "\tmov   %2, #0xffffffff\n"				\
451
+                "\tstr   %2, [%5, #4]\n"				\
452
+                : "=&r" (old), "=m" (*mem), "=&r" (temp)		\
453
+                : "r" (val), "m" (*mem), "r" (ras_start));		\
454
+        return (old);							\
455
+}
456
+
457
+#define SYNC_LOCK_RELEASE_N(N, TYPE)					\
458
+void HIDDEN								\
459
+__sync_lock_release_##N (TYPE *ptr)     				\
460
+{					       				\
461
+    /* All writes before this point must be seen before we release	\
462
+       the lock itself.  */						\
463
+    __sync_synchronize ();     						\
464
+    *ptr = 0;								\
465
+}
466
+
467
+#define	SYNC_VAL_CAS_N(N, TYPE, LDR, STREQ)             		\
468
+TYPE HIDDEN    								\
469
+__sync_val_compare_and_swap_##N (TYPE *mem, TYPE expected,		\
470
+    TYPE desired)							\
471
+{									\
472
+        unsigned int old, temp, ras_start;                              \
473
+                                                                        \
474
+        ras_start = ARM_RAS_START;					\
475
+        __asm volatile (						\
476
+                /* Set up Restartable Atomic Sequence.  */		\
477
+                "1:"							\
478
+                "\tadr   %2, 1b\n"					\
479
+                "\tstr   %2, [%6]\n"					\
480
+                "\tadr   %2, 2f\n"					\
481
+                "\tstr   %2, [%6, #4]\n"				\
482
+                                                                        \
483
+                "\t"LDR" %0, %5\n"     /* Load old value.  */		\
484
+                "\tcmp   %0, %3\n"     /* Compare to expected value.  */\
485
+                "\t"STREQ" %4, %1\n"   /* Store new value.  */		\
486
+                                                                        \
487
+                /* Tear down Restartable Atomic Sequence.  */		\
488
+                "2:"							\
489
+                "\tmov   %2, #0x00000000\n"				\
490
+                "\tstr   %2, [%6]\n"					\
491
+                "\tmov   %2, #0xffffffff\n"				\
492
+                "\tstr   %2, [%6, #4]\n"				\
493
+                : "=&r" (old), "=m" (*mem), "=&r" (temp)		\
494
+                : "r" (expected), "r" (desired), "m" (*mem),		\
495
+                  "r" (ras_start));					\
496
+        return (old);							\
497
+}
498
+
499
+typedef unsigned char bool;
500
+
501
+#define SYNC_BOOL_CAS_N(N, TYPE)                                        \
502
+bool HIDDEN								\
503
+__sync_bool_compare_and_swap_##N (TYPE *ptr, TYPE oldval,		\
504
+                                  TYPE newval)                          \
505
+{									\
506
+    TYPE actual_oldval							\
507
+      = __sync_val_compare_and_swap_##N (ptr, oldval, newval);          \
508
+    return (oldval == actual_oldval);					\
509
+}
510
+
511
+#define	SYNC_FETCH_AND_OP_N(N, TYPE, LDR, STR, NAME, OP)		\
512
+TYPE HIDDEN								\
513
+__sync_fetch_and_##NAME##_##N (TYPE *mem, TYPE val)	       		\
514
+{									\
515
+        unsigned int old, temp, ras_start;                              \
516
+                                                                        \
517
+        ras_start = ARM_RAS_START;					\
518
+        __asm volatile (						\
519
+                /* Set up Restartable Atomic Sequence.  */		\
520
+                "1:"							\
521
+                "\tadr   %2, 1b\n"					\
522
+                "\tstr   %2, [%5]\n"					\
523
+                "\tadr   %2, 2f\n"					\
524
+                "\tstr   %2, [%5, #4]\n"				\
525
+                                                                        \
526
+                "\t"LDR" %0, %4\n"	/* Load old value.  */		\
527
+                "\t"OP"  %2, %0, %3\n"	/* Calculate new value.  */	\
528
+                "\t"STR" %2, %1\n"	/* Store new value.  */		\
529
+                                                                        \
530
+                /* Tear down Restartable Atomic Sequence.  */		\
531
+                "2:"							\
532
+                "\tmov   %2, #0x00000000\n"				\
533
+                "\tstr   %2, [%5]\n"					\
534
+                "\tmov   %2, #0xffffffff\n"				\
535
+                "\tstr   %2, [%5, #4]\n"				\
536
+                : "=&r" (old), "=m" (*mem), "=&r" (temp)		\
537
+                : "r" (val), "m" (*mem), "r" (ras_start));		\
538
+        return (old);							\
539
+}
540
+
541
+#define	SYNC_OP_AND_FETCH_N(N, TYPE, LDR, STR, NAME, OP)		\
542
+TYPE HIDDEN   								\
543
+__sync_##NAME##_and_fetch_##N (TYPE *mem, TYPE val)	       		\
544
+{									\
545
+        unsigned int old, temp, ras_start;                              \
546
+                                                                        \
547
+        ras_start = ARM_RAS_START;					\
548
+        __asm volatile (						\
549
+                /* Set up Restartable Atomic Sequence.  */		\
550
+                "1:"							\
551
+                "\tadr   %2, 1b\n"					\
552
+                "\tstr   %2, [%5]\n"					\
553
+                "\tadr   %2, 2f\n"					\
554
+                "\tstr   %2, [%5, #4]\n"				\
555
+                                                                        \
556
+                "\t"LDR" %0, %4\n"	/* Load old value.  */		\
557
+                "\t"OP"  %2, %0, %3\n"	/* Calculate new value.  */	\
558
+                "\t"STR" %2, %1\n"	/* Store new value.  */		\
559
+                                                                        \
560
+                /* Tear down Restartable Atomic Sequence.  */		\
561
+                "2:"							\
562
+                "\tmov   %2, #0x00000000\n"				\
563
+                "\tstr   %2, [%5]\n"					\
564
+                "\tmov   %2, #0xffffffff\n"				\
565
+                "\tstr   %2, [%5, #4]\n"				\
566
+                : "=&r" (old), "=m" (*mem), "=&r" (temp)		\
567
+                : "r" (val), "m" (*mem), "r" (ras_start));		\
568
+        return (old);							\
569
+}
570
+
571
+#define	EMIT_ALL_OPS_N(N, TYPE, LDR, STR, STREQ)			\
572
+SYNC_LOCK_TEST_AND_SET_N (N, TYPE, LDR, STR)				\
573
+SYNC_LOCK_RELEASE_N (N, TYPE)                                           \
574
+SYNC_VAL_CAS_N (N, TYPE, LDR, STREQ)	                		\
575
+SYNC_BOOL_CAS_N (N, TYPE)                                               \
576
+SYNC_FETCH_AND_OP_N (N, TYPE, LDR, STR, add, "add")		        \
577
+SYNC_FETCH_AND_OP_N (N, TYPE, LDR, STR, and, "and")		        \
578
+SYNC_FETCH_AND_OP_N (N, TYPE, LDR, STR, or, "orr")		        \
579
+SYNC_FETCH_AND_OP_N (N, TYPE, LDR, STR, sub, "sub")		        \
580
+SYNC_FETCH_AND_OP_N (N, TYPE, LDR, STR, xor, "eor")                     \
581
+SYNC_OP_AND_FETCH_N (N, TYPE, LDR, STR, add, "add")		        \
582
+SYNC_OP_AND_FETCH_N (N, TYPE, LDR, STR, and, "and")		        \
583
+SYNC_OP_AND_FETCH_N (N, TYPE, LDR, STR, or, "orr")		        \
584
+SYNC_OP_AND_FETCH_N (N, TYPE, LDR, STR, sub, "sub")		        \
585
+SYNC_OP_AND_FETCH_N (N, TYPE, LDR, STR, xor, "eor")
586
+
587
+
588
+
589
+EMIT_ALL_OPS_N (1, unsigned char, "ldrb", "strb", "streqb")
590
+EMIT_ALL_OPS_N (2, unsigned short, "ldrh", "strh", "streqh")
591
+EMIT_ALL_OPS_N (4, unsigned int, "ldr", "str", "streq")
592
+
593
+#endif
594
595
Property changes on: libgcc/config/arm/freebsd-atomic.c
596
___________________________________________________________________
597
Added: svn:eol-style
598
## -0,0 +1 ##
599
+native
600
\ No newline at end of property
601
Added: svn:keywords
602
## -0,0 +1 ##
603
+FreeBSD=%H
604
\ No newline at end of property
605
Added: svn:mime-type
606
## -0,0 +1 ##
607
+text/plain
608
\ No newline at end of property
609
Index: libgcc/config/arm/t-freebsd
610
===================================================================
611
--- libgcc/config/arm/t-freebsd	(revision 0)
612
+++ libgcc/config/arm/t-freebsd	(working copy)
613
@@ -0,0 +1,9 @@
614
+# Just for these, we omit the frame pointer since it makes such a big
615
+# difference.  It is then pointless adding debugging.
616
+HOST_LIBGCC2_CFLAGS += -fomit-frame-pointer
617
+
618
+LIB2ADD_ST += $(srcdir)/config/arm/freebsd-atomic.c
619
+
620
+# Use a version of div0 which raises SIGFPE.
621
+LIB1ASMFUNCS := $(filter-out _dvmd_tls,$(LIB1ASMFUNCS)) _dvmd_lnx
622
+
623
Index: libgcc/config/arm/unwind-arm.h
624
===================================================================
625
--- libgcc/config/arm/unwind-arm.h	(revision 218760)
626
+++ libgcc/config/arm/unwind-arm.h	(working copy)
627
@@ -48,7 +48,8 @@
628
       if (!tmp)
629
 	return 0;
630
 
631
-#if (defined(linux) && !defined(__uClinux__)) || defined(__NetBSD__)
632
+#if (defined(linux) && !defined(__uClinux__)) || defined(__NetBSD__) \
633
+    || defined(__FreeBSD__)
634
       /* Pc-relative indirect.  */
635
 #define _GLIBCXX_OVERRIDE_TTYPE_ENCODING (DW_EH_PE_pcrel | DW_EH_PE_indirect)
636
       tmp += ptr;
637
Index: libgcc/config.host
638
===================================================================
639
--- libgcc/config.host	(revision 218760)
640
+++ libgcc/config.host	(working copy)
641
@@ -319,6 +319,13 @@
642
 	tmake_file="$tmake_file arm/t-arm arm/t-vxworks t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
643
 	extra_parts="$extra_parts crti.o crtn.o"
644
 	;;
645
+arm*-*-freebsd*)                # ARM FreeBSD EABI
646
+	tmake_file="${tmake_file} arm/t-arm t-fixedpoint-gnu-prefix arm/t-elf"
647
+	tmake_file="${tmake_file} arm/t-bpabi arm/t-freebsd t-slibgcc-libgcc"
648
+	tm_file="${tm_file} arm/bpabi-lib.h"
649
+	unwind_header=config/arm/unwind-arm.h
650
+	tmake_file="${tmake_file} t-softfp-sfdf t-softfp-excl arm/t-softfp t-softfp"
651
+	;;
652
 arm*-*-netbsdelf*)
653
 	tmake_file="$tmake_file arm/t-arm arm/t-netbsd t-slibgcc-gld-nover"
654
 	;;
655
Index: libstdc++-v3/configure.host
656
===================================================================
657
--- libstdc++-v3/configure.host	(revision 218760)
658
+++ libstdc++-v3/configure.host	(working copy)
659
@@ -352,6 +352,9 @@
660
 	;;
661
     esac
662
     ;;
663
+  arm*-*-freebsd*)
664
+     port_specific_symbol_files="\$(srcdir)/../config/os/gnu-linux/arm-eabi-extra.ver"
665
+     ;;
666
   powerpc*-*-darwin*)
667
     port_specific_symbol_files="\$(srcdir)/../config/os/bsd/darwin/ppc-extra.ver"
668
     ;;
669
Index: libstdc++-v3/libsupc++/unwind-cxx.h
670
===================================================================
671
--- libstdc++-v3/libsupc++/unwind-cxx.h	(revision 218760)
672
+++ libstdc++-v3/libsupc++/unwind-cxx.h	(working copy)
673
@@ -230,7 +230,7 @@
674
   return reinterpret_cast<__cxa_dependent_exception *>(exc + 1) - 1;
675
 }
676
 
677
-#ifdef __ARM_EABI_UNWINDER__
678
+#if defined(__ARM_EABI_UNWINDER__) && !defined(__FreeBSD__)
679
 static inline bool
680
 __is_gxx_exception_class(_Unwind_Exception_Class c)
681
 {
682
@@ -304,13 +304,7 @@
683
   c[6] = 'R';
684
   c[7] = '\0';
685
 }
686
-
687
-static inline void*
688
-__gxx_caught_object(_Unwind_Exception* eo)
689
-{
690
-  return (void*)eo->barrier_cache.bitpattern[0];
691
-}
692
-#else // !__ARM_EABI_UNWINDER__
693
+#else // !__ARM_EABI_UNWINDER__ || __FreeBSD__
694
 // This is the primary exception class we report -- "GNUCC++\0".
695
 const _Unwind_Exception_Class __gxx_primary_exception_class
696
 = ((((((((_Unwind_Exception_Class) 'G' 
697
@@ -334,6 +328,16 @@
698
     << 8 | (_Unwind_Exception_Class) '+')
699
    << 8 | (_Unwind_Exception_Class) '\x01');
700
 
701
+const _Unwind_Exception_Class __gxx_forced_unwind_class
702
+= ((((((((_Unwind_Exception_Class) 'G'
703
+        << 8 | (_Unwind_Exception_Class) 'N')
704
+       << 8 | (_Unwind_Exception_Class) 'U')
705
+      << 8 | (_Unwind_Exception_Class) 'C')
706
+     << 8 | (_Unwind_Exception_Class) 'F')
707
+    << 8 | (_Unwind_Exception_Class) 'O')
708
+   << 8 | (_Unwind_Exception_Class) 'R')
709
+  << 8 | (_Unwind_Exception_Class) '\0');
710
+
711
 static inline bool
712
 __is_gxx_exception_class(_Unwind_Exception_Class c)
713
 {
714
@@ -341,6 +345,12 @@
715
       || c == __gxx_dependent_exception_class;
716
 }
717
 
718
+static inline bool
719
+__is_gxx_forced_unwind_class(_Unwind_Exception_Class c)
720
+{
721
+  return c ==  __gxx_forced_unwind_class;
722
+}
723
+
724
 // Only checks for primary or dependent, but not that it is a C++ exception at
725
 // all.
726
 static inline bool
727
@@ -352,7 +362,18 @@
728
 #define __GXX_INIT_PRIMARY_EXCEPTION_CLASS(c) c = __gxx_primary_exception_class
729
 #define __GXX_INIT_DEPENDENT_EXCEPTION_CLASS(c) \
730
   c = __gxx_dependent_exception_class
731
+#define __GXX_INIT_FORCED_UNWIND_CLASS(c) c = __gxx_forced_unwind_class 
732
+#endif // __ARM_EABI_UNWINDER__ && !__FreeBSD__
733
 
734
+#ifdef __ARM_EABI_UNWINDER__
735
+static inline void*
736
+__gxx_caught_object(_Unwind_Exception* eo)
737
+{
738
+    return (void*)eo->barrier_cache.bitpattern[0];
739
+}
740
+
741
+#else // !__ARM_EABI_UNWINDER__
742
+
743
 // GNU C++ personality routine, Version 0.
744
 extern "C" _Unwind_Reason_Code __gxx_personality_v0
745
      (int, _Unwind_Action, _Unwind_Exception_Class,
(-)lang/gcc/files/patch-gcc_system.h (-10 lines)
Lines 1-10 Link Here
1
--- gcc/system.h.orig	2014-01-02 22:23:26 UTC
2
+++ gcc/system.h
3
@@ -203,6 +203,7 @@ extern int errno;
4
 
5
 #ifdef __cplusplus
6
 # include <cstring>
7
+# include <new>
8
 #endif
9
 
10
 /* Some of glibc's string inlines cause warnings.  Plus we'd rather
(-)lang/gcc/pkg-plist (-1 / +3 lines)
Lines 16-21 Link Here
16
bin/gcc-nm%%SUFFIX%%
16
bin/gcc-nm%%SUFFIX%%
17
bin/gcc-ranlib%%SUFFIX%%
17
bin/gcc-ranlib%%SUFFIX%%
18
bin/gcov%%SUFFIX%%
18
bin/gcov%%SUFFIX%%
19
bin/gcov-tool%%SUFFIX%%
19
bin/gfortran
20
bin/gfortran
20
bin/gfortran%%SUFFIX%%
21
bin/gfortran%%SUFFIX%%
21
@comment info/gcc%%SUFFIX%%/dir
22
@comment info/gcc%%SUFFIX%%/dir
Lines 29-34 Link Here
29
share/gcc-%%GCC_VERSION%%/python/libstdcxx/__init__.py
30
share/gcc-%%GCC_VERSION%%/python/libstdcxx/__init__.py
30
share/gcc-%%GCC_VERSION%%/python/libstdcxx/v6/__init__.py
31
share/gcc-%%GCC_VERSION%%/python/libstdcxx/v6/__init__.py
31
share/gcc-%%GCC_VERSION%%/python/libstdcxx/v6/printers.py
32
share/gcc-%%GCC_VERSION%%/python/libstdcxx/v6/printers.py
33
share/gcc-%%GCC_VERSION%%/python/libstdcxx/v6/xmethods.py
32
%%JAVA%%bin/%%GNU_HOST%%-gcj%%SUFFIX%%
34
%%JAVA%%bin/%%GNU_HOST%%-gcj%%SUFFIX%%
33
%%JAVA%%bin/aot-compile%%SUFFIX%%
35
%%JAVA%%bin/aot-compile%%SUFFIX%%
34
%%JAVA%%bin/gappletviewer%%SUFFIX%%
36
%%JAVA%%bin/gappletviewer%%SUFFIX%%
Lines 50-56 Link Here
50
%%JAVA%%bin/gtnameserv%%SUFFIX%%
52
%%JAVA%%bin/gtnameserv%%SUFFIX%%
51
%%JAVA%%bin/jcf-dump%%SUFFIX%%
53
%%JAVA%%bin/jcf-dump%%SUFFIX%%
52
%%JAVA%%bin/jv-convert%%SUFFIX%%
54
%%JAVA%%bin/jv-convert%%SUFFIX%%
53
%%JAVA%%libdata/pkgconfig/libgcj-4.9.pc
55
%%JAVA%%libdata/pkgconfig/libgcj-5.pc
54
%%JAVA%%man/man1/aot-compile%%SUFFIX%%.1.gz
56
%%JAVA%%man/man1/aot-compile%%SUFFIX%%.1.gz
55
%%JAVA%%man/man1/gappletviewer%%SUFFIX%%.1.gz
57
%%JAVA%%man/man1/gappletviewer%%SUFFIX%%.1.gz
56
%%JAVA%%man/man1/gc-analyze%%SUFFIX%%.1.gz
58
%%JAVA%%man/man1/gc-analyze%%SUFFIX%%.1.gz

Return to bug 216707