summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2014-07-24 21:44:16 +0400
committerIgor Pashev <pashev.igor@gmail.com>2014-07-24 21:44:16 +0400
commit2518a2bbe88a263e0aa4be65b6989b069a5c1e66 (patch)
tree2829aabf3bb17ac4b1c13db94079293e73628bc9
parentfd1dbcc10165e96b9fc38d2331fb8725c072bb61 (diff)
parentbbde2922876429c15713c07e90a35e0e71c34bc0 (diff)
downloadgcc-49-2518a2bbe88a263e0aa4be65b6989b069a5c1e66.tar.gz
Merge gcc-48
Conflicts: debian/NEWS.gcc debian/NEWS.html debian/README.gnat debian/changelog debian/control debian/control.m4 debian/copyright debian/copyright.in debian/gij-hppa debian/lib32stdc++6.symbols.amd64 debian/lib64stdc++6.symbols.i386 debian/libatomic1.symbols.common debian/libgcc1.symbols.sh4 debian/libgcj-doc.doc-base debian/libgomp1.symbols.common debian/libstdc++6.symbols.amd64 debian/libstdc++6.symbols.armel debian/libstdc++6.symbols.armhf debian/libstdc++6.symbols.common debian/libstdc++6.symbols.i386 debian/patches/ada-default-project-path.diff debian/patches/ada-driver-check.diff debian/patches/ada-gcc-name.diff debian/patches/ada-kfreebsd.diff debian/patches/ada-libgnatprj.diff debian/patches/ada-libgnatvsn.diff debian/patches/ada-link-lib.diff debian/patches/ada-link-shlib.diff debian/patches/ada-mips.diff debian/patches/ada-ppc64.diff debian/patches/ada-sjlj.diff debian/patches/ada-symbolic-tracebacks.diff debian/patches/alpha-no-ev4-directive.diff debian/patches/arm-multilib-defaults.diff debian/patches/arm-multilib-soft.diff debian/patches/config-ml.diff debian/patches/cross-install-location.diff debian/patches/cross-ma-install-location.diff debian/patches/g++-multiarch-incdir.diff debian/patches/gcc-as-needed.diff debian/patches/gcc-auto-build.diff debian/patches/gcc-base-version.diff debian/patches/gcc-default-format-security.diff debian/patches/gcc-default-fortify-source.diff debian/patches/gcc-default-relro.diff debian/patches/gcc-default-ssp.diff debian/patches/gcc-driver-extra-langs.diff debian/patches/gcc-gfdl-build.diff debian/patches/gcc-hash-style-gnu.diff debian/patches/gcc-ice-apport.diff debian/patches/gcc-ice-hack.diff debian/patches/gcc-linaro-doc.diff debian/patches/gcc-linaro.diff debian/patches/gcc-multiarch.diff debian/patches/gcc-multilib-multiarch.diff debian/patches/gcc-setmultilib-fix.diff debian/patches/gcc-sysroot.diff debian/patches/gcc-target-include-asm.diff debian/patches/gcc-textdomain.diff debian/patches/gccgo-version.diff debian/patches/gdc-driver-nophobos.diff debian/patches/gdc-frontend-posix.diff debian/patches/gdc-libphobos-build.diff debian/patches/gdc-texinfo.diff debian/patches/gdc-versym-cpu.diff debian/patches/gdc-versym-os.diff debian/patches/go-testsuite.diff debian/patches/go-use-gold.diff debian/patches/kfreebsd-unwind.diff debian/patches/libffi-ro-eh_frame_sect.diff debian/patches/libgo-setcontext-config.diff debian/patches/libgo-testsuite.diff debian/patches/libjava-fixed-symlinks.diff debian/patches/libjava-jnipath.diff debian/patches/libjava-multiarch.diff debian/patches/libjava-nobiarch-check.diff debian/patches/libstdc++-man-3cxx.diff debian/patches/libstdc++-no-testsuite.diff debian/patches/libstdc++-pic.diff debian/patches/libstdc++-python3.diff debian/patches/libstdc++-test-installed.diff debian/patches/mips-fix-loongson2f-nop.diff debian/patches/note-gnu-stack.diff debian/patches/powerpc_remove_many.diff debian/patches/pr47818.diff debian/patches/pr49944.diff debian/patches/pr52306.diff debian/patches/pr57653.diff debian/patches/pr61046.diff debian/patches/pr61126.diff debian/patches/rename-info-files.diff debian/patches/sparc-force-cpu.diff debian/patches/svn-doc-updates.diff debian/patches/svn-updates.diff debian/patches/sys-auxv-header.diff debian/patches/testsuite-hardening-format.diff debian/patches/testsuite-hardening-printf-types.diff debian/patches/testsuite-hardening-updates.diff debian/rules.conf debian/rules.d/binary-ada.mk debian/rules.d/binary-cxx.mk debian/rules.d/binary-gcc.mk debian/rules.d/binary-go.mk debian/rules.d/binary-libgcc.mk debian/rules.d/binary-libstdcxx.mk debian/rules.defs debian/rules.patch debian/rules.sonames debian/rules.unpack debian/rules2 debian/source.lintian-overrides
-rw-r--r--debian/control.m44
-rw-r--r--debian/lib32gomp1.symbols.illumos-amd64140
-rw-r--r--debian/libasan0.symbols4
-rw-r--r--debian/libasan0.symbols.324
-rw-r--r--debian/libasan0.symbols.644
-rw-r--r--debian/libasan0.symbols.common206
-rw-r--r--debian/libgomp1.symbols.illumos-amd64140
-rw-r--r--debian/patches/aarch64-abi-fix.diff16
-rw-r--r--debian/patches/aarch64-call-frame-info.diff33
-rw-r--r--debian/patches/ada-s-osinte-gnu.adb.diff113
-rw-r--r--debian/patches/ada-s-taprop-gnu.adb.diff1339
-rw-r--r--debian/patches/arm-sanitizer.diff280
-rw-r--r--debian/patches/gcc-dfsg-linaro-doc.diff6
-rw-r--r--debian/patches/gcc-linaro-no-local.diff189
-rw-r--r--debian/patches/gcc-ppc64-O3.diff59
-rw-r--r--debian/patches/gcc_ada_gcc-interface_Makefile.in.diff35
-rw-r--r--debian/patches/gdc-4.8-doc.diff96
-rw-r--r--debian/patches/gdc-4.8.diff42
-rw-r--r--debian/patches/goarch-aarch64.diff94
-rw-r--r--debian/patches/gold-and-ld.diff482
-rw-r--r--debian/patches/illumos-fclone-functions.diff80
-rw-r--r--debian/patches/illumos-multiarch.diff15
-rw-r--r--debian/patches/illumos-pragma-align.diff46
-rw-r--r--debian/patches/illumos-rdynamic.diff29
-rw-r--r--debian/patches/illumos-spec.diff51
-rw-r--r--debian/patches/illumos-strict-calling-conventions.diff110
-rw-r--r--debian/patches/illumos-use_libgcj_bc.diff13
-rw-r--r--debian/patches/libgcc-no-limits-h.diff67
-rw-r--r--debian/patches/libgo-explicit-reservation.diff150
-rw-r--r--debian/patches/libjava-testsuite.diff6
-rw-r--r--debian/patches/m68k-picflag.diff15
-rw-r--r--debian/patches/pr49847.diff29
-rw-r--r--debian/patches/pr57211.diff69
-rw-r--r--debian/patches/pr57363.diff48
-rw-r--r--debian/patches/pr59744.diff146
-rw-r--r--debian/patches/pr60034.diff42
-rw-r--r--debian/patches/pr61208-linaro.diff30
-rw-r--r--debian/patches/pr61208-revert.diff21
-rw-r--r--debian/rules.conf16
-rw-r--r--debian/rules.defs10
-rw-r--r--debian/rules.patch10
-rw-r--r--debian/rules213
42 files changed, 4295 insertions, 7 deletions
diff --git a/debian/control.m4 b/debian/control.m4
index 68ea5b5..9f041fc 100644
--- a/debian/control.m4
+++ b/debian/control.m4
@@ -62,7 +62,7 @@ Build-Depends: debhelper (>= 5.0.62),
SOURCE_BUILD_DEP CROSS_BUILD_DEP
CLOOG_BUILD_DEP MPC_BUILD_DEP MPFR_BUILD_DEP GMP_BUILD_DEP,
autogen, zlib1g-dev, gawk, lzma, xz-utils, patchutils,
- bison (>= 1:2.3), flex, realpath (>= 1.9.12), lsb-release, quilt
+ bison (>= 1:2.3), flex, realpath (>= 1.9.12) | coreutils (>= 8.15), lsb-release, quilt
',`dnl native
Build-Depends: debhelper (>= 5.0.62), GCC_MULTILIB_BUILD_DEP
LIBC_BUILD_DEP, LIBC_BIARCH_BUILD_DEP LIBC_DBG_DEP
@@ -77,7 +77,7 @@ Build-Depends: debhelper (>= 5.0.62), GCC_MULTILIB_BUILD_DEP
texinfo (>= 4.3), locales, sharutils,
procps, FORTRAN_BUILD_DEP JAVA_BUILD_DEP GNAT_BUILD_DEP GO_BUILD_DEP GDC_BUILD_DEP
CLOOG_BUILD_DEP MPC_BUILD_DEP MPFR_BUILD_DEP GMP_BUILD_DEP
- CHECK_BUILD_DEP realpath (>= 1.9.12), chrpath, lsb-release, quilt
+ CHECK_BUILD_DEP realpath (>= 1.9.12) | coreutils (>= 8.15), chrpath, lsb-release, quilt
Build-Depends-Indep: LIBSTDCXX_BUILD_INDEP JAVA_BUILD_INDEP
')dnl
ifelse(regexp(SRCNAME, `gnat'),0,`dnl
diff --git a/debian/lib32gomp1.symbols.illumos-amd64 b/debian/lib32gomp1.symbols.illumos-amd64
new file mode 100644
index 0000000..7d833ab
--- /dev/null
+++ b/debian/lib32gomp1.symbols.illumos-amd64
@@ -0,0 +1,140 @@
+libgomp.so.1 lib32gomp1 #MINVER#
+ GOMP_1.0@GOMP_1.0 4.2.1
+ GOMP_2.0@GOMP_2.0 4.4
+ GOMP_3.0@GOMP_3.0 4.7
+ GOMP_atomic_end@GOMP_1.0 4.2.1
+ GOMP_atomic_start@GOMP_1.0 4.2.1
+ GOMP_barrier@GOMP_1.0 4.2.1
+ GOMP_critical_end@GOMP_1.0 4.2.1
+ GOMP_critical_name_end@GOMP_1.0 4.2.1
+ GOMP_critical_name_start@GOMP_1.0 4.2.1
+ GOMP_critical_start@GOMP_1.0 4.2.1
+ GOMP_loop_dynamic_next@GOMP_1.0 4.2.1
+ GOMP_loop_dynamic_start@GOMP_1.0 4.2.1
+ GOMP_loop_end@GOMP_1.0 4.2.1
+ GOMP_loop_end_nowait@GOMP_1.0 4.2.1
+ GOMP_loop_guided_next@GOMP_1.0 4.2.1
+ GOMP_loop_guided_start@GOMP_1.0 4.2.1
+ GOMP_loop_ordered_dynamic_next@GOMP_1.0 4.2.1
+ GOMP_loop_ordered_dynamic_start@GOMP_1.0 4.2.1
+ GOMP_loop_ordered_guided_next@GOMP_1.0 4.2.1
+ GOMP_loop_ordered_guided_start@GOMP_1.0 4.2.1
+ GOMP_loop_ordered_runtime_next@GOMP_1.0 4.2.1
+ GOMP_loop_ordered_runtime_start@GOMP_1.0 4.2.1
+ GOMP_loop_ordered_static_next@GOMP_1.0 4.2.1
+ GOMP_loop_ordered_static_start@GOMP_1.0 4.2.1
+ GOMP_loop_runtime_next@GOMP_1.0 4.2.1
+ GOMP_loop_runtime_start@GOMP_1.0 4.2.1
+ GOMP_loop_static_next@GOMP_1.0 4.2.1
+ GOMP_loop_static_start@GOMP_1.0 4.2.1
+ GOMP_loop_ull_dynamic_next@GOMP_2.0 4.4
+ GOMP_loop_ull_dynamic_start@GOMP_2.0 4.4
+ GOMP_loop_ull_guided_next@GOMP_2.0 4.4
+ GOMP_loop_ull_guided_start@GOMP_2.0 4.4
+ GOMP_loop_ull_ordered_dynamic_next@GOMP_2.0 4.4
+ GOMP_loop_ull_ordered_dynamic_start@GOMP_2.0 4.4
+ GOMP_loop_ull_ordered_guided_next@GOMP_2.0 4.4
+ GOMP_loop_ull_ordered_guided_start@GOMP_2.0 4.4
+ GOMP_loop_ull_ordered_runtime_next@GOMP_2.0 4.4
+ GOMP_loop_ull_ordered_runtime_start@GOMP_2.0 4.4
+ GOMP_loop_ull_ordered_static_next@GOMP_2.0 4.4
+ GOMP_loop_ull_ordered_static_start@GOMP_2.0 4.4
+ GOMP_loop_ull_runtime_next@GOMP_2.0 4.4
+ GOMP_loop_ull_runtime_start@GOMP_2.0 4.4
+ GOMP_loop_ull_static_next@GOMP_2.0 4.4
+ GOMP_loop_ull_static_start@GOMP_2.0 4.4
+ GOMP_ordered_end@GOMP_1.0 4.2.1
+ GOMP_ordered_start@GOMP_1.0 4.2.1
+ GOMP_parallel_end@GOMP_1.0 4.2.1
+ GOMP_parallel_loop_dynamic_start@GOMP_1.0 4.2.1
+ GOMP_parallel_loop_guided_start@GOMP_1.0 4.2.1
+ GOMP_parallel_loop_runtime_start@GOMP_1.0 4.2.1
+ GOMP_parallel_loop_static_start@GOMP_1.0 4.2.1
+ GOMP_parallel_sections_start@GOMP_1.0 4.2.1
+ GOMP_parallel_start@GOMP_1.0 4.2.1
+ GOMP_sections_end@GOMP_1.0 4.2.1
+ GOMP_sections_end_nowait@GOMP_1.0 4.2.1
+ GOMP_sections_next@GOMP_1.0 4.2.1
+ GOMP_sections_start@GOMP_1.0 4.2.1
+ GOMP_single_copy_end@GOMP_1.0 4.2.1
+ GOMP_single_copy_start@GOMP_1.0 4.2.1
+ GOMP_single_start@GOMP_1.0 4.2.1
+ GOMP_task@GOMP_2.0 4.4
+ GOMP_taskwait@GOMP_2.0 4.4
+ GOMP_taskyield@GOMP_3.0 4.7
+ OMP_1.0@OMP_1.0 4.2.1
+ OMP_2.0@OMP_2.0 4.2.1
+ OMP_3.0@OMP_3.0 4.4
+ OMP_3.1@OMP_3.1 4.7
+ omp_destroy_lock@OMP_3.0 4.4
+ omp_destroy_lock_@OMP_3.0 4.4
+ omp_destroy_nest_lock@OMP_3.0 4.4
+ omp_destroy_nest_lock_@OMP_3.0 4.4
+ omp_get_active_level@OMP_3.0 4.4
+ omp_get_active_level_@OMP_3.0 4.4
+ omp_get_ancestor_thread_num@OMP_3.0 4.4
+ omp_get_ancestor_thread_num_8_@OMP_3.0 4.4
+ omp_get_ancestor_thread_num_@OMP_3.0 4.4
+ omp_get_dynamic@OMP_1.0 4.2.1
+ omp_get_dynamic_@OMP_1.0 4.2.1
+ omp_get_level@OMP_3.0 4.4
+ omp_get_level_@OMP_3.0 4.4
+ omp_get_max_active_levels@OMP_3.0 4.4
+ omp_get_max_active_levels_@OMP_3.0 4.4
+ omp_get_max_threads@OMP_1.0 4.2.1
+ omp_get_max_threads_@OMP_1.0 4.2.1
+ omp_get_nested@OMP_1.0 4.2.1
+ omp_get_nested_@OMP_1.0 4.2.1
+ omp_get_num_procs@OMP_1.0 4.2.1
+ omp_get_num_procs_@OMP_1.0 4.2.1
+ omp_get_num_threads@OMP_1.0 4.2.1
+ omp_get_num_threads_@OMP_1.0 4.2.1
+ omp_get_schedule@OMP_3.0 4.4
+ omp_get_schedule_8_@OMP_3.0 4.4
+ omp_get_schedule_@OMP_3.0 4.4
+ omp_get_team_size@OMP_3.0 4.4
+ omp_get_team_size_8_@OMP_3.0 4.4
+ omp_get_team_size_@OMP_3.0 4.4
+ omp_get_thread_limit@OMP_3.0 4.4
+ omp_get_thread_limit_@OMP_3.0 4.4
+ omp_get_thread_num@OMP_1.0 4.2.1
+ omp_get_thread_num_@OMP_1.0 4.2.1
+ omp_get_wtick@OMP_2.0 4.2.1
+ omp_get_wtick_@OMP_2.0 4.2.1
+ omp_get_wtime@OMP_2.0 4.2.1
+ omp_get_wtime_@OMP_2.0 4.2.1
+ omp_in_final@OMP_3.1 4.7
+ omp_in_final_@OMP_3.1 4.7
+ omp_in_parallel@OMP_1.0 4.2.1
+ omp_in_parallel_@OMP_1.0 4.2.1
+ omp_init_lock@OMP_3.0 4.4
+ omp_init_lock_@OMP_3.0 4.4
+ omp_init_nest_lock@OMP_3.0 4.4
+ omp_init_nest_lock_@OMP_3.0 4.4
+ omp_set_dynamic@OMP_1.0 4.2.1
+ omp_set_dynamic_8_@OMP_1.0 4.2.1
+ omp_set_dynamic_@OMP_1.0 4.2.1
+ omp_set_lock@OMP_3.0 4.4
+ omp_set_lock_@OMP_3.0 4.4
+ omp_set_max_active_levels@OMP_3.0 4.4
+ omp_set_max_active_levels_8_@OMP_3.0 4.4
+ omp_set_max_active_levels_@OMP_3.0 4.4
+ omp_set_nest_lock@OMP_3.0 4.4
+ omp_set_nest_lock_@OMP_3.0 4.4
+ omp_set_nested@OMP_1.0 4.2.1
+ omp_set_nested_8_@OMP_1.0 4.2.1
+ omp_set_nested_@OMP_1.0 4.2.1
+ omp_set_num_threads@OMP_1.0 4.2.1
+ omp_set_num_threads_8_@OMP_1.0 4.2.1
+ omp_set_num_threads_@OMP_1.0 4.2.1
+ omp_set_schedule@OMP_3.0 4.4
+ omp_set_schedule_8_@OMP_3.0 4.4
+ omp_set_schedule_@OMP_3.0 4.4
+ omp_test_lock@OMP_3.0 4.4
+ omp_test_lock_@OMP_3.0 4.4
+ omp_test_nest_lock@OMP_3.0 4.4
+ omp_test_nest_lock_@OMP_3.0 4.4
+ omp_unset_lock@OMP_3.0 4.4
+ omp_unset_lock_@OMP_3.0 4.4
+ omp_unset_nest_lock@OMP_3.0 4.4
+ omp_unset_nest_lock_@OMP_3.0 4.4
diff --git a/debian/libasan0.symbols b/debian/libasan0.symbols
new file mode 100644
index 0000000..aa5e818
--- /dev/null
+++ b/debian/libasan0.symbols
@@ -0,0 +1,4 @@
+libasan.so.0 libasan0 #MINVER#
+#include "libasan0.symbols.common"
+(arch=!aarch64 !alpha !amd64 !ia64 !ppc64 !s390x !sparc64 !kfreebsd-amd64)#include "libasan0.symbols.32"
+(arch=aarch64 alpha amd64 ia64 ppc64 s390x sparc64 kfreebsd-amd64)#include "libasan0.symbols.64"
diff --git a/debian/libasan0.symbols.32 b/debian/libasan0.symbols.32
new file mode 100644
index 0000000..e80dd72
--- /dev/null
+++ b/debian/libasan0.symbols.32
@@ -0,0 +1,4 @@
+ _Znaj@Base 4.8
+ _ZnajRKSt9nothrow_t@Base 4.8
+ _Znwj@Base 4.8
+ _ZnwjRKSt9nothrow_t@Base 4.8
diff --git a/debian/libasan0.symbols.64 b/debian/libasan0.symbols.64
new file mode 100644
index 0000000..c6604c3
--- /dev/null
+++ b/debian/libasan0.symbols.64
@@ -0,0 +1,4 @@
+ _Znam@Base 4.8
+ _ZnamRKSt9nothrow_t@Base 4.8
+ _Znwm@Base 4.8
+ _ZnwmRKSt9nothrow_t@Base 4.8
diff --git a/debian/libasan0.symbols.common b/debian/libasan0.symbols.common
new file mode 100644
index 0000000..6e1f02d
--- /dev/null
+++ b/debian/libasan0.symbols.common
@@ -0,0 +1,206 @@
+ _ZN11__sanitizer10StackTrace13CompressStackEPS0_Pjm@Base 4.8
+ _ZN11__sanitizer10StackTrace15UncompressStackEPS0_Pjm@Base 4.8
+ _ZN11__sanitizer11CheckFailedEPKciS1_yy@Base 4.8
+ _ZN6__asan10kMidMemBegE@Base 4.8
+ _ZN6__asan10kMidMemEndE@Base 4.8
+ _ZN6__asan11asan_mallocEmPN11__sanitizer10StackTraceE@Base 4.8
+ _ZN6__asan11kHighMemEndE@Base 4.8
+ _ZN6__asan13asan_memalignEmmPN11__sanitizer10StackTraceENS_9AllocTypeE@Base 4.8
+ _ZN6__asan9asan_freeEPvPN11__sanitizer10StackTraceENS_9AllocTypeE@Base 4.8
+ _ZdaPv@Base 4.8
+ _ZdaPvRKSt9nothrow_t@Base 4.8
+ _ZdlPv@Base 4.8
+ _ZdlPvRKSt9nothrow_t@Base 4.8
+ __asan_address_is_poisoned@Base 4.8
+ __asan_after_dynamic_init@Base 4.8
+ __asan_before_dynamic_init@Base 4.8
+ __asan_describe_address@Base 4.8
+ __asan_get_allocated_size@Base 4.8
+ __asan_get_current_allocated_bytes@Base 4.8
+ __asan_get_estimated_allocated_size@Base 4.8
+ __asan_get_free_bytes@Base 4.8
+ __asan_get_heap_size@Base 4.8
+ __asan_get_ownership@Base 4.8
+ __asan_get_unmapped_bytes@Base 4.8
+ __asan_handle_no_return@Base 4.8
+ __asan_init_v1@Base 4.8
+ __asan_poison_memory_region@Base 4.8
+ __asan_poison_stack_memory@Base 4.8
+ __asan_print_accumulated_stats@Base 4.8
+ __asan_region_is_poisoned@Base 4.8
+ __asan_register_globals@Base 4.8
+ __asan_report_error@Base 4.8
+ __asan_report_load16@Base 4.8
+ __asan_report_load1@Base 4.8
+ __asan_report_load2@Base 4.8
+ __asan_report_load4@Base 4.8
+ __asan_report_load8@Base 4.8
+ __asan_report_load_n@Base 4.8
+ __asan_report_store16@Base 4.8
+ __asan_report_store1@Base 4.8
+ __asan_report_store2@Base 4.8
+ __asan_report_store4@Base 4.8
+ __asan_report_store8@Base 4.8
+ __asan_report_store_n@Base 4.8
+ __asan_set_death_callback@Base 4.8
+ __asan_set_error_exit_code@Base 4.8
+ __asan_set_error_report_callback@Base 4.8
+ __asan_stack_free@Base 4.8
+ __asan_stack_malloc@Base 4.8
+ __asan_unpoison_memory_region@Base 4.8
+ __asan_unpoison_stack_memory@Base 4.8
+ __asan_unregister_globals@Base 4.8
+ __cxa_throw@Base 4.8
+ __interceptor___cxa_throw@Base 4.8
+ __interceptor___isoc99_fscanf@Base 4.8
+ __interceptor___isoc99_scanf@Base 4.8
+ __interceptor___isoc99_sscanf@Base 4.8
+ __interceptor___isoc99_vfscanf@Base 4.8
+ __interceptor___isoc99_vscanf@Base 4.8
+ __interceptor___isoc99_vsscanf@Base 4.8
+ __interceptor___libc_memalign@Base 4.8
+ __interceptor__longjmp@Base 4.8
+ __interceptor_asctime@Base 4.8
+ __interceptor_asctime_r@Base 4.8
+ __interceptor_atoi@Base 4.8
+ __interceptor_atol@Base 4.8
+ __interceptor_atoll@Base 4.8
+ __interceptor_calloc@Base 4.8
+ __interceptor_cfree@Base 4.8
+ __interceptor_ctime@Base 4.8
+ __interceptor_ctime_r@Base 4.8
+ __interceptor_free@Base 4.8
+ __interceptor_fscanf@Base 4.8
+ __interceptor_gmtime@Base 4.8
+ __interceptor_gmtime_r@Base 4.8
+ __interceptor_index@Base 4.8
+ __interceptor_localtime@Base 4.8
+ __interceptor_localtime_r@Base 4.8
+ __interceptor_longjmp@Base 4.8
+ __interceptor_mallinfo@Base 4.8
+ __interceptor_malloc@Base 4.8
+ __interceptor_malloc_stats@Base 4.8
+ __interceptor_malloc_usable_size@Base 4.8
+ __interceptor_mallopt@Base 4.8
+ __interceptor_memalign@Base 4.8
+ __interceptor_memcmp@Base 4.8
+ __interceptor_memcpy@Base 4.8
+ __interceptor_memmove@Base 4.8
+ __interceptor_memset@Base 4.8
+ __interceptor_mlock@Base 4.8
+ __interceptor_mlockall@Base 4.8
+ __interceptor_munlock@Base 4.8
+ __interceptor_munlockall@Base 4.8
+ __interceptor_posix_memalign@Base 4.8
+ __interceptor_prctl@Base 4.8
+ __interceptor_pread64@Base 4.8
+ __interceptor_pread@Base 4.8
+ __interceptor_pthread_create@Base 4.8
+ __interceptor_pvalloc@Base 4.8
+ __interceptor_pwrite64@Base 4.8
+ __interceptor_pwrite@Base 4.8
+ __interceptor_read@Base 4.8
+ __interceptor_realloc@Base 4.8
+ __interceptor_scanf@Base 4.8
+ __interceptor_sigaction@Base 4.8
+ __interceptor_siglongjmp@Base 4.8
+ __interceptor_signal@Base 4.8
+ __interceptor_sscanf@Base 4.8
+ __interceptor_strcasecmp@Base 4.8
+ __interceptor_strcat@Base 4.8
+ __interceptor_strchr@Base 4.8
+ __interceptor_strcmp@Base 4.8
+ __interceptor_strcpy@Base 4.8
+ __interceptor_strdup@Base 4.8
+ __interceptor_strlen@Base 4.8
+ __interceptor_strncasecmp@Base 4.8
+ __interceptor_strncat@Base 4.8
+ __interceptor_strncmp@Base 4.8
+ __interceptor_strncpy@Base 4.8
+ __interceptor_strnlen@Base 4.8
+ __interceptor_strtol@Base 4.8
+ __interceptor_strtoll@Base 4.8
+ __interceptor_swapcontext@Base 4.8
+ __interceptor_valloc@Base 4.8
+ __interceptor_vfscanf@Base 4.8
+ __interceptor_vscanf@Base 4.8
+ __interceptor_vsscanf@Base 4.8
+ __interceptor_write@Base 4.8
+ __isoc99_fscanf@Base 4.8
+ __isoc99_scanf@Base 4.8
+ __isoc99_sscanf@Base 4.8
+ __isoc99_vfscanf@Base 4.8
+ __isoc99_vscanf@Base 4.8
+ __isoc99_vsscanf@Base 4.8
+ __libc_memalign@Base 4.8
+ __sanitizer_report_error_summary@Base 4.8
+ __sanitizer_sandbox_on_notify@Base 4.8
+ __sanitizer_set_report_fd@Base 4.8
+ __sanitizer_set_report_path@Base 4.8
+ _longjmp@Base 4.8
+ asctime@Base 4.8
+ asctime_r@Base 4.8
+ atoi@Base 4.8
+ atol@Base 4.8
+ atoll@Base 4.8
+ calloc@Base 4.8
+ cfree@Base 4.8
+ ctime@Base 4.8
+ ctime_r@Base 4.8
+ free@Base 4.8
+ fscanf@Base 4.8
+ gmtime@Base 4.8
+ gmtime_r@Base 4.8
+ index@Base 4.8
+ localtime@Base 4.8
+ localtime_r@Base 4.8
+ longjmp@Base 4.8
+ mallinfo@Base 4.8
+ malloc@Base 4.8
+ malloc_stats@Base 4.8
+ malloc_usable_size@Base 4.8
+ mallopt@Base 4.8
+ memalign@Base 4.8
+ memcmp@Base 4.8
+ memcpy@Base 4.8
+ memmove@Base 4.8
+ memset@Base 4.8
+ mlock@Base 4.8
+ mlockall@Base 4.8
+ munlock@Base 4.8
+ munlockall@Base 4.8
+ posix_memalign@Base 4.8
+ prctl@Base 4.8
+ pread64@Base 4.8
+ pread@Base 4.8
+ pthread_create@Base 4.8
+ pvalloc@Base 4.8
+ pwrite64@Base 4.8
+ pwrite@Base 4.8
+ read@Base 4.8
+ realloc@Base 4.8
+ scanf@Base 4.8
+ sigaction@Base 4.8
+ siglongjmp@Base 4.8
+ signal@Base 4.8
+ sscanf@Base 4.8
+ strcasecmp@Base 4.8
+ strcat@Base 4.8
+ strchr@Base 4.8
+ strcmp@Base 4.8
+ strcpy@Base 4.8
+ strdup@Base 4.8
+ strlen@Base 4.8
+ strncasecmp@Base 4.8
+ strncat@Base 4.8
+ strncmp@Base 4.8
+ strncpy@Base 4.8
+ strnlen@Base 4.8
+ strtol@Base 4.8
+ strtoll@Base 4.8
+ valloc@Base 4.8
+ vfscanf@Base 4.8
+ vscanf@Base 4.8
+ vsscanf@Base 4.8
+ swapcontext@Base 4.8
+ write@Base 4.8
diff --git a/debian/libgomp1.symbols.illumos-amd64 b/debian/libgomp1.symbols.illumos-amd64
new file mode 100644
index 0000000..a1be9eb
--- /dev/null
+++ b/debian/libgomp1.symbols.illumos-amd64
@@ -0,0 +1,140 @@
+libgomp.so.1 libgomp1 #MINVER#
+ GOMP_1.0@GOMP_1.0 4.2.1
+ GOMP_2.0@GOMP_2.0 4.4
+ GOMP_3.0@GOMP_3.0 4.7
+ GOMP_atomic_end@GOMP_1.0 4.2.1
+ GOMP_atomic_start@GOMP_1.0 4.2.1
+ GOMP_barrier@GOMP_1.0 4.2.1
+ GOMP_critical_end@GOMP_1.0 4.2.1
+ GOMP_critical_name_end@GOMP_1.0 4.2.1
+ GOMP_critical_name_start@GOMP_1.0 4.2.1
+ GOMP_critical_start@GOMP_1.0 4.2.1
+ GOMP_loop_dynamic_next@GOMP_1.0 4.2.1
+ GOMP_loop_dynamic_start@GOMP_1.0 4.2.1
+ GOMP_loop_end@GOMP_1.0 4.2.1
+ GOMP_loop_end_nowait@GOMP_1.0 4.2.1
+ GOMP_loop_guided_next@GOMP_1.0 4.2.1
+ GOMP_loop_guided_start@GOMP_1.0 4.2.1
+ GOMP_loop_ordered_dynamic_next@GOMP_1.0 4.2.1
+ GOMP_loop_ordered_dynamic_start@GOMP_1.0 4.2.1
+ GOMP_loop_ordered_guided_next@GOMP_1.0 4.2.1
+ GOMP_loop_ordered_guided_start@GOMP_1.0 4.2.1
+ GOMP_loop_ordered_runtime_next@GOMP_1.0 4.2.1
+ GOMP_loop_ordered_runtime_start@GOMP_1.0 4.2.1
+ GOMP_loop_ordered_static_next@GOMP_1.0 4.2.1
+ GOMP_loop_ordered_static_start@GOMP_1.0 4.2.1
+ GOMP_loop_runtime_next@GOMP_1.0 4.2.1
+ GOMP_loop_runtime_start@GOMP_1.0 4.2.1
+ GOMP_loop_static_next@GOMP_1.0 4.2.1
+ GOMP_loop_static_start@GOMP_1.0 4.2.1
+ GOMP_loop_ull_dynamic_next@GOMP_2.0 4.4
+ GOMP_loop_ull_dynamic_start@GOMP_2.0 4.4
+ GOMP_loop_ull_guided_next@GOMP_2.0 4.4
+ GOMP_loop_ull_guided_start@GOMP_2.0 4.4
+ GOMP_loop_ull_ordered_dynamic_next@GOMP_2.0 4.4
+ GOMP_loop_ull_ordered_dynamic_start@GOMP_2.0 4.4
+ GOMP_loop_ull_ordered_guided_next@GOMP_2.0 4.4
+ GOMP_loop_ull_ordered_guided_start@GOMP_2.0 4.4
+ GOMP_loop_ull_ordered_runtime_next@GOMP_2.0 4.4
+ GOMP_loop_ull_ordered_runtime_start@GOMP_2.0 4.4
+ GOMP_loop_ull_ordered_static_next@GOMP_2.0 4.4
+ GOMP_loop_ull_ordered_static_start@GOMP_2.0 4.4
+ GOMP_loop_ull_runtime_next@GOMP_2.0 4.4
+ GOMP_loop_ull_runtime_start@GOMP_2.0 4.4
+ GOMP_loop_ull_static_next@GOMP_2.0 4.4
+ GOMP_loop_ull_static_start@GOMP_2.0 4.4
+ GOMP_ordered_end@GOMP_1.0 4.2.1
+ GOMP_ordered_start@GOMP_1.0 4.2.1
+ GOMP_parallel_end@GOMP_1.0 4.2.1
+ GOMP_parallel_loop_dynamic_start@GOMP_1.0 4.2.1
+ GOMP_parallel_loop_guided_start@GOMP_1.0 4.2.1
+ GOMP_parallel_loop_runtime_start@GOMP_1.0 4.2.1
+ GOMP_parallel_loop_static_start@GOMP_1.0 4.2.1
+ GOMP_parallel_sections_start@GOMP_1.0 4.2.1
+ GOMP_parallel_start@GOMP_1.0 4.2.1
+ GOMP_sections_end@GOMP_1.0 4.2.1
+ GOMP_sections_end_nowait@GOMP_1.0 4.2.1
+ GOMP_sections_next@GOMP_1.0 4.2.1
+ GOMP_sections_start@GOMP_1.0 4.2.1
+ GOMP_single_copy_end@GOMP_1.0 4.2.1
+ GOMP_single_copy_start@GOMP_1.0 4.2.1
+ GOMP_single_start@GOMP_1.0 4.2.1
+ GOMP_task@GOMP_2.0 4.4
+ GOMP_taskwait@GOMP_2.0 4.4
+ GOMP_taskyield@GOMP_3.0 4.7
+ OMP_1.0@OMP_1.0 4.2.1
+ OMP_2.0@OMP_2.0 4.2.1
+ OMP_3.0@OMP_3.0 4.4
+ OMP_3.1@OMP_3.1 4.7
+ omp_destroy_lock@OMP_3.0 4.4
+ omp_destroy_lock_@OMP_3.0 4.4
+ omp_destroy_nest_lock@OMP_3.0 4.4
+ omp_destroy_nest_lock_@OMP_3.0 4.4
+ omp_get_active_level@OMP_3.0 4.4
+ omp_get_active_level_@OMP_3.0 4.4
+ omp_get_ancestor_thread_num@OMP_3.0 4.4
+ omp_get_ancestor_thread_num_8_@OMP_3.0 4.4
+ omp_get_ancestor_thread_num_@OMP_3.0 4.4
+ omp_get_dynamic@OMP_1.0 4.2.1
+ omp_get_dynamic_@OMP_1.0 4.2.1
+ omp_get_level@OMP_3.0 4.4
+ omp_get_level_@OMP_3.0 4.4
+ omp_get_max_active_levels@OMP_3.0 4.4
+ omp_get_max_active_levels_@OMP_3.0 4.4
+ omp_get_max_threads@OMP_1.0 4.2.1
+ omp_get_max_threads_@OMP_1.0 4.2.1
+ omp_get_nested@OMP_1.0 4.2.1
+ omp_get_nested_@OMP_1.0 4.2.1
+ omp_get_num_procs@OMP_1.0 4.2.1
+ omp_get_num_procs_@OMP_1.0 4.2.1
+ omp_get_num_threads@OMP_1.0 4.2.1
+ omp_get_num_threads_@OMP_1.0 4.2.1
+ omp_get_schedule@OMP_3.0 4.4
+ omp_get_schedule_8_@OMP_3.0 4.4
+ omp_get_schedule_@OMP_3.0 4.4
+ omp_get_team_size@OMP_3.0 4.4
+ omp_get_team_size_8_@OMP_3.0 4.4
+ omp_get_team_size_@OMP_3.0 4.4
+ omp_get_thread_limit@OMP_3.0 4.4
+ omp_get_thread_limit_@OMP_3.0 4.4
+ omp_get_thread_num@OMP_1.0 4.2.1
+ omp_get_thread_num_@OMP_1.0 4.2.1
+ omp_get_wtick@OMP_2.0 4.2.1
+ omp_get_wtick_@OMP_2.0 4.2.1
+ omp_get_wtime@OMP_2.0 4.2.1
+ omp_get_wtime_@OMP_2.0 4.2.1
+ omp_in_final@OMP_3.1 4.7
+ omp_in_final_@OMP_3.1 4.7
+ omp_in_parallel@OMP_1.0 4.2.1
+ omp_in_parallel_@OMP_1.0 4.2.1
+ omp_init_lock@OMP_3.0 4.4
+ omp_init_lock_@OMP_3.0 4.4
+ omp_init_nest_lock@OMP_3.0 4.4
+ omp_init_nest_lock_@OMP_3.0 4.4
+ omp_set_dynamic@OMP_1.0 4.2.1
+ omp_set_dynamic_8_@OMP_1.0 4.2.1
+ omp_set_dynamic_@OMP_1.0 4.2.1
+ omp_set_lock@OMP_3.0 4.4
+ omp_set_lock_@OMP_3.0 4.4
+ omp_set_max_active_levels@OMP_3.0 4.4
+ omp_set_max_active_levels_8_@OMP_3.0 4.4
+ omp_set_max_active_levels_@OMP_3.0 4.4
+ omp_set_nest_lock@OMP_3.0 4.4
+ omp_set_nest_lock_@OMP_3.0 4.4
+ omp_set_nested@OMP_1.0 4.2.1
+ omp_set_nested_8_@OMP_1.0 4.2.1
+ omp_set_nested_@OMP_1.0 4.2.1
+ omp_set_num_threads@OMP_1.0 4.2.1
+ omp_set_num_threads_8_@OMP_1.0 4.2.1
+ omp_set_num_threads_@OMP_1.0 4.2.1
+ omp_set_schedule@OMP_3.0 4.4
+ omp_set_schedule_8_@OMP_3.0 4.4
+ omp_set_schedule_@OMP_3.0 4.4
+ omp_test_lock@OMP_3.0 4.4
+ omp_test_lock_@OMP_3.0 4.4
+ omp_test_nest_lock@OMP_3.0 4.4
+ omp_test_nest_lock_@OMP_3.0 4.4
+ omp_unset_lock@OMP_3.0 4.4
+ omp_unset_lock_@OMP_3.0 4.4
+ omp_unset_nest_lock@OMP_3.0 4.4
+ omp_unset_nest_lock_@OMP_3.0 4.4
diff --git a/debian/patches/aarch64-abi-fix.diff b/debian/patches/aarch64-abi-fix.diff
new file mode 100644
index 0000000..f8e66e9
--- /dev/null
+++ b/debian/patches/aarch64-abi-fix.diff
@@ -0,0 +1,16 @@
+# DP: Proposed patch for PR /59799, allow passing arrays in registers on AArch64.
+
+--- a/src/gcc/config/aarch64/aarch64.c
++++ b/src/gcc/config/aarch64/aarch64.c
+@@ -987,10 +987,7 @@ aarch64_pass_by_reference (cumulative_args_t pcum ATTRIBUTE_UNUSED,
+
+ if (type)
+ {
+- /* Arrays always passed by reference. */
+- if (TREE_CODE (type) == ARRAY_TYPE)
+- return true;
+- /* Other aggregates based on their size. */
++ /* Aggregates based on their size. */
+ if (AGGREGATE_TYPE_P (type))
+ size = int_size_in_bytes (type);
+ }
diff --git a/debian/patches/aarch64-call-frame-info.diff b/debian/patches/aarch64-call-frame-info.diff
new file mode 100644
index 0000000..6765147
--- /dev/null
+++ b/debian/patches/aarch64-call-frame-info.diff
@@ -0,0 +1,33 @@
+# DP: Fix call frame information in ffi_closure_SYSV on AArch64.
+
+diff --git a/src/aarch64/sysv.S b/src/aarch64/sysv.S
+index 1022454..ecf6371 100644
+--- a/src/libffi/src/aarch64/sysv.S
++++ b/src/libffi/src/aarch64/sysv.S
+@@ -231,13 +231,13 @@ ffi_closure_SYSV:
+ cfi_rel_offset (x30, 8)
+
+ mov x29, sp
++ cfi_def_cfa_register (x29)
+
+ sub sp, sp, #ffi_closure_SYSV_FS
+- cfi_adjust_cfa_offset (ffi_closure_SYSV_FS)
+
+ stp x21, x22, [x29, #-16]
+- cfi_rel_offset (x21, 0)
+- cfi_rel_offset (x22, 8)
++ cfi_rel_offset (x21, -16)
++ cfi_rel_offset (x22, -8)
+
+ /* Load x21 with &call_context. */
+ mov x21, sp
+@@ -295,7 +295,7 @@ ffi_closure_SYSV:
+ cfi_restore (x22)
+
+ mov sp, x29
+- cfi_adjust_cfa_offset (-ffi_closure_SYSV_FS)
++ cfi_def_cfa_register (sp)
+
+ ldp x29, x30, [sp], #16
+ cfi_adjust_cfa_offset (-16)
+
diff --git a/debian/patches/ada-s-osinte-gnu.adb.diff b/debian/patches/ada-s-osinte-gnu.adb.diff
new file mode 100644
index 0000000..4b2d4d6
--- /dev/null
+++ b/debian/patches/ada-s-osinte-gnu.adb.diff
@@ -0,0 +1,113 @@
+--- /dev/null 2012-01-30 20:41:15.189616186 +0100
++++ b/src/gcc/ada/s-osinte-gnu.adb 2012-04-11 22:56:06.000000000 +0200
+@@ -0,0 +1,110 @@
++------------------------------------------------------------------------------
++-- --
++-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
++-- --
++-- S Y S T E M . O S _ I N T E R F A C E --
++-- --
++-- B o d y --
++-- --
++-- Copyright (C) 1991-1994, Florida State University --
++-- Copyright (C) 1995-2006, AdaCore --
++-- --
++-- GNARL is free software; you can redistribute it and/or modify it under --
++-- terms of the GNU General Public License as published by the Free Soft- --
++-- ware Foundation; either version 2, or (at your option) any later ver- --
++-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
++-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
++-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
++-- for more details. You should have received a copy of the GNU General --
++-- Public License distributed with GNARL; see file COPYING. If not, write --
++-- to the Free Software Foundation, 51 Franklin Street, Fifth Floor, --
++-- Boston, MA 02110-1301, USA. --
++-- --
++-- As a special exception, if other files instantiate generics from this --
++-- unit, or you link this unit with other files to produce an executable, --
++-- this unit does not by itself cause the resulting executable to be --
++-- covered by the GNU General Public License. This exception does not --
++-- however invalidate any other reasons why the executable file might be --
++-- covered by the GNU Public License. --
++-- --
++-- GNARL was developed by the GNARL team at Florida State University. --
++-- Extensive contributions were provided by Ada Core Technologies, Inc. --
++-- --
++------------------------------------------------------------------------------
++
++-- This is the GNU/Hurd version of this package.
++
++pragma Polling (Off);
++-- Turn off polling, we do not want ATC polling to take place during
++-- tasking operations. It causes infinite loops and other problems.
++
++-- This package encapsulates all direct interfaces to OS services
++-- that are needed by children of System.
++
++package body System.OS_Interface is
++
++ --------------------
++ -- Get_Stack_Base --
++ --------------------
++
++ function Get_Stack_Base (thread : pthread_t) return Address is
++ pragma Warnings (Off, thread);
++
++ begin
++ return Null_Address;
++ end Get_Stack_Base;
++
++ ------------------
++ -- pthread_init --
++ ------------------
++
++ procedure pthread_init is
++ begin
++ null;
++ end pthread_init;
++
++ -----------------
++ -- To_Duration --
++ -----------------
++
++ function To_Duration (TS : timespec) return Duration is
++ begin
++ return Duration (TS.tv_sec) + Duration (TS.tv_nsec) / 10#1#E9;
++ end To_Duration;
++
++ ------------------------
++ -- To_Target_Priority --
++ ------------------------
++
++ function To_Target_Priority
++ (Prio : System.Any_Priority) return Interfaces.C.int
++ is
++ begin
++ return Interfaces.C.int (Prio);
++ end To_Target_Priority;
++
++ -----------------
++ -- To_Timespec --
++ -----------------
++
++ function To_Timespec (D : Duration) return timespec is
++ S : time_t;
++ F : Duration;
++
++ begin
++ S := time_t (Long_Long_Integer (D));
++ F := D - Duration (S);
++
++ -- If F has negative value due to a round-up, adjust for positive F
++ -- value.
++
++ if F < 0.0 then
++ S := S - 1;
++ F := F + 1.0;
++ end if;
++
++ return timespec'(tv_sec => S,
++ tv_nsec => long (Long_Long_Integer (F * 10#1#E9)));
++ end To_Timespec;
++
++end System.OS_Interface;
diff --git a/debian/patches/ada-s-taprop-gnu.adb.diff b/debian/patches/ada-s-taprop-gnu.adb.diff
new file mode 100644
index 0000000..c47b71d
--- /dev/null
+++ b/debian/patches/ada-s-taprop-gnu.adb.diff
@@ -0,0 +1,1339 @@
+--- /dev/null 2012-01-30 20:41:15.189616186 +0100
++++ b/src/gcc/ada/s-taprop-gnu.adb 2012-04-11 19:17:52.000000000 +0200
+@@ -0,0 +1,1336 @@
++------------------------------------------------------------------------------
++-- --
++-- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS --
++-- --
++-- S Y S T E M . T A S K _ P R I M I T I V E S . O P E R A T I O N S --
++-- --
++-- B o d y --
++-- --
++-- Copyright (C) 1992-2009, Free Software Foundation, Inc. --
++-- --
++-- GNARL is free software; you can redistribute it and/or modify it under --
++-- terms of the GNU General Public License as published by the Free Soft- --
++-- ware Foundation; either version 3, or (at your option) any later ver- --
++-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
++-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
++-- or FITNESS FOR A PARTICULAR PURPOSE. --
++-- --
++-- As a special exception under Section 7 of GPL version 3, you are granted --
++-- additional permissions described in the GCC Runtime Library Exception, --
++-- version 3.1, as published by the Free Software Foundation. --
++-- --
++-- You should have received a copy of the GNU General Public License and --
++-- a copy of the GCC Runtime Library Exception along with this program; --
++-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
++-- <http://www.gnu.org/licenses/>. --
++-- --
++-- GNARL was developed by the GNARL team at Florida State University. --
++-- Extensive contributions were provided by Ada Core Technologies, Inc. --
++-- --
++------------------------------------------------------------------------------
++
++-- This is a GNU/Hurd version of this package
++-- Note: Removed the SCHED_FIFO and Ceiling Locking from the posix version
++-- since these functions are not (yet) supported on GNU/Hurd
++
++-- This package contains all the GNULL primitives that interface directly with
++-- the underlying OS.
++
++pragma Polling (Off);
++-- Turn off polling, we do not want ATC polling to take place during tasking
++-- operations. It causes infinite loops and other problems.
++
++with Ada.Unchecked_Conversion;
++with Ada.Unchecked_Deallocation;
++
++with Interfaces.C;
++
++with System.Tasking.Debug;
++with System.Interrupt_Management;
++with System.OS_Primitives;
++with System.Task_Info;
++
++with System.Soft_Links;
++-- We use System.Soft_Links instead of System.Tasking.Initialization
++-- because the later is a higher level package that we shouldn't depend on.
++-- For example when using the restricted run time, it is replaced by
++-- System.Tasking.Restricted.Stages.
++
++package body System.Task_Primitives.Operations is
++
++ package SSL renames System.Soft_Links;
++
++ use System.Tasking.Debug;
++ use System.Tasking;
++ use Interfaces.C;
++ use System.OS_Interface;
++ use System.Parameters;
++ use System.OS_Primitives;
++
++ ----------------
++ -- Local Data --
++ ----------------
++
++ -- The followings are logically constants, but need to be initialized
++ -- at run time.
++
++ Single_RTS_Lock : aliased RTS_Lock;
++ -- This is a lock to allow only one thread of control in the RTS at
++ -- a time; it is used to execute in mutual exclusion from all other tasks.
++ -- Used mainly in Single_Lock mode, but also to protect All_Tasks_List
++
++ ATCB_Key : aliased pthread_key_t;
++ -- Key used to find the Ada Task_Id associated with a thread
++
++ Environment_Task_Id : Task_Id;
++ -- A variable to hold Task_Id for the environment task
++
++ Unblocked_Signal_Mask : aliased sigset_t;
++ -- The set of signals that should unblocked in all tasks
++
++ -- The followings are internal configuration constants needed
++
++ Next_Serial_Number : Task_Serial_Number := 100;
++ -- We start at 100, to reserve some special values for
++ -- using in error checking.
++
++ Foreign_Task_Elaborated : aliased Boolean := True;
++ -- Used to identified fake tasks (i.e., non-Ada Threads)
++
++ Use_Alternate_Stack : constant Boolean := Alternate_Stack_Size /= 0;
++ -- Whether to use an alternate signal stack for stack overflows
++
++ Abort_Handler_Installed : Boolean := False;
++ -- True if a handler for the abort signal is installed
++
++ --------------------
++ -- Local Packages --
++ --------------------
++
++ package Specific is
++
++ procedure Initialize (Environment_Task : Task_Id);
++ pragma Inline (Initialize);
++ -- Initialize various data needed by this package
++
++ function Is_Valid_Task return Boolean;
++ pragma Inline (Is_Valid_Task);
++ -- Does executing thread have a TCB?
++
++ procedure Set (Self_Id : Task_Id);
++ pragma Inline (Set);
++ -- Set the self id for the current task
++
++ function Self return Task_Id;
++ pragma Inline (Self);
++ -- Return a pointer to the Ada Task Control Block of the calling task
++
++ end Specific;
++
++ package body Specific is separate;
++ -- The body of this package is target specific
++
++ ---------------------------------
++ -- Support for foreign threads --
++ ---------------------------------
++
++ function Register_Foreign_Thread (Thread : Thread_Id) return Task_Id;
++ -- Allocate and Initialize a new ATCB for the current Thread
++
++ function Register_Foreign_Thread
++ (Thread : Thread_Id) return Task_Id is separate;
++
++ -----------------------
++ -- Local Subprograms --
++ -----------------------
++
++ procedure Abort_Handler (Sig : Signal);
++ -- Signal handler used to implement asynchronous abort.
++ -- See also comment before body, below.
++
++ function To_Address is
++ new Ada.Unchecked_Conversion (Task_Id, System.Address);
++
++ -------------------
++ -- Abort_Handler --
++ -------------------
++
++ -- Target-dependent binding of inter-thread Abort signal to the raising of
++ -- the Abort_Signal exception.
++
++ -- The technical issues and alternatives here are essentially the
++ -- same as for raising exceptions in response to other signals
++ -- (e.g. Storage_Error). See code and comments in the package body
++ -- System.Interrupt_Management.
++
++ -- Some implementations may not allow an exception to be propagated out of
++ -- a handler, and others might leave the signal or interrupt that invoked
++ -- this handler masked after the exceptional return to the application
++ -- code.
++
++ -- GNAT exceptions are originally implemented using setjmp()/longjmp(). On
++ -- most UNIX systems, this will allow transfer out of a signal handler,
++ -- which is usually the only mechanism available for implementing
++ -- asynchronous handlers of this kind. However, some systems do not
++ -- restore the signal mask on longjmp(), leaving the abort signal masked.
++
++ procedure Abort_Handler (Sig : Signal) is
++ pragma Unreferenced (Sig);
++
++ T : constant Task_Id := Self;
++ Old_Set : aliased sigset_t;
++
++ Result : Interfaces.C.int;
++ pragma Warnings (Off, Result);
++
++ begin
++ -- It's not safe to raise an exception when using GCC ZCX mechanism.
++ -- Note that we still need to install a signal handler, since in some
++ -- cases (e.g. shutdown of the Server_Task in System.Interrupts) we
++ -- need to send the Abort signal to a task.
++
++ if ZCX_By_Default and then GCC_ZCX_Support then
++ return;
++ end if;
++
++ if T.Deferral_Level = 0
++ and then T.Pending_ATC_Level < T.ATC_Nesting_Level and then
++ not T.Aborting
++ then
++ T.Aborting := True;
++
++ -- Make sure signals used for RTS internal purpose are unmasked
++
++ Result := pthread_sigmask (SIG_UNBLOCK,
++ Unblocked_Signal_Mask'Access, Old_Set'Access);
++ pragma Assert (Result = 0);
++
++ raise Standard'Abort_Signal;
++ end if;
++ end Abort_Handler;
++
++ -----------------
++ -- Stack_Guard --
++ -----------------
++
++ procedure Stack_Guard (T : ST.Task_Id; On : Boolean) is
++ Stack_Base : constant Address := Get_Stack_Base (T.Common.LL.Thread);
++ Guard_Page_Address : Address;
++
++ Res : Interfaces.C.int;
++
++ begin
++ if Stack_Base_Available then
++
++ -- Compute the guard page address
++
++ Guard_Page_Address :=
++ Stack_Base - (Stack_Base mod Get_Page_Size) + Get_Page_Size;
++
++ Res :=
++ mprotect (Guard_Page_Address, Get_Page_Size,
++ prot => (if On then PROT_ON else PROT_OFF));
++ pragma Assert (Res = 0);
++ end if;
++ end Stack_Guard;
++
++ --------------------
++ -- Get_Thread_Id --
++ --------------------
++
++ function Get_Thread_Id (T : ST.Task_Id) return OSI.Thread_Id is
++ begin
++ return T.Common.LL.Thread;
++ end Get_Thread_Id;
++
++ ----------
++ -- Self --
++ ----------
++
++ function Self return Task_Id renames Specific.Self;
++
++ ---------------------
++ -- Initialize_Lock --
++ ---------------------
++
++ -- Note: mutexes and cond_variables needed per-task basis are
++ -- initialized in Initialize_TCB and the Storage_Error is
++ -- handled. Other mutexes (such as RTS_Lock, Memory_Lock...)
++ -- used in RTS is initialized before any status change of RTS.
++ -- Therefore raising Storage_Error in the following routines
++ -- should be able to be handled safely.
++
++ procedure Initialize_Lock
++ (Prio : System.Any_Priority;
++ L : not null access Lock)
++ is
++ pragma Unreferenced (Prio);
++
++ Attributes : aliased pthread_mutexattr_t;
++ Result : Interfaces.C.int;
++
++ begin
++ Result := pthread_mutexattr_init (Attributes'Access);
++ pragma Assert (Result = 0 or else Result = ENOMEM);
++
++ if Result = ENOMEM then
++ raise Storage_Error with "Failed to allocate a lock";
++ end if;
++
++ Result := pthread_mutex_init (L, Attributes'Access);
++ pragma Assert (Result = 0 or else Result = ENOMEM);
++
++ if Result = ENOMEM then
++ Result := pthread_mutexattr_destroy (Attributes'Access);
++ raise Storage_Error;
++ end if;
++
++ Result := pthread_mutexattr_destroy (Attributes'Access);
++ pragma Assert (Result = 0);
++ end Initialize_Lock;
++
++ procedure Initialize_Lock
++ (L : not null access RTS_Lock; Level : Lock_Level)
++ is
++ pragma Unreferenced (Level);
++
++ Attributes : aliased pthread_mutexattr_t;
++ Result : Interfaces.C.int;
++
++ begin
++ Result := pthread_mutexattr_init (Attributes'Access);
++ pragma Assert (Result = 0 or else Result = ENOMEM);
++
++ if Result = ENOMEM then
++ raise Storage_Error with "Failed to allocate a lock";
++ end if;
++
++ Result := pthread_mutex_init (L, Attributes'Access);
++ pragma Assert (Result = 0 or else Result = ENOMEM);
++
++ if Result = ENOMEM then
++ Result := pthread_mutexattr_destroy (Attributes'Access);
++ raise Storage_Error;
++ end if;
++
++ Result := pthread_mutexattr_destroy (Attributes'Access);
++ pragma Assert (Result = 0);
++ end Initialize_Lock;
++
++ -------------------
++ -- Finalize_Lock --
++ -------------------
++
++ procedure Finalize_Lock (L : not null access Lock) is
++ Result : Interfaces.C.int;
++ begin
++ Result := pthread_mutex_destroy (L);
++ pragma Assert (Result = 0);
++ end Finalize_Lock;
++
++ procedure Finalize_Lock (L : not null access RTS_Lock) is
++ Result : Interfaces.C.int;
++ begin
++ Result := pthread_mutex_destroy (L);
++ pragma Assert (Result = 0);
++ end Finalize_Lock;
++
++ ----------------
++ -- Write_Lock --
++ ----------------
++
++ procedure Write_Lock
++ (L : not null access Lock; Ceiling_Violation : out Boolean)
++ is
++ Result : Interfaces.C.int;
++
++ begin
++ Result := pthread_mutex_lock (L);
++
++ -- Assume that the cause of EINVAL is a priority ceiling violation
++
++ Ceiling_Violation := (Result = EINVAL);
++ pragma Assert (Result = 0 or else Result = EINVAL);
++ end Write_Lock;
++
++ procedure Write_Lock
++ (L : not null access RTS_Lock;
++ Global_Lock : Boolean := False)
++ is
++ Result : Interfaces.C.int;
++ begin
++ if not Single_Lock or else Global_Lock then
++ Result := pthread_mutex_lock (L);
++ pragma Assert (Result = 0);
++ end if;
++ end Write_Lock;
++
++ procedure Write_Lock (T : Task_Id) is
++ Result : Interfaces.C.int;
++ begin
++ if not Single_Lock then
++ Result := pthread_mutex_lock (T.Common.LL.L'Access);
++ pragma Assert (Result = 0);
++ end if;
++ end Write_Lock;
++
++ ---------------
++ -- Read_Lock --
++ ---------------
++
++ procedure Read_Lock
++ (L : not null access Lock; Ceiling_Violation : out Boolean) is
++ begin
++ Write_Lock (L, Ceiling_Violation);
++ end Read_Lock;
++
++ ------------
++ -- Unlock --
++ ------------
++
++ procedure Unlock (L : not null access Lock) is
++ Result : Interfaces.C.int;
++ begin
++ Result := pthread_mutex_unlock (L);
++ pragma Assert (Result = 0);
++ end Unlock;
++
++ procedure Unlock
++ (L : not null access RTS_Lock; Global_Lock : Boolean := False)
++ is
++ Result : Interfaces.C.int;
++ begin
++ if not Single_Lock or else Global_Lock then
++ Result := pthread_mutex_unlock (L);
++ pragma Assert (Result = 0);
++ end if;
++ end Unlock;
++
++ procedure Unlock (T : Task_Id) is
++ Result : Interfaces.C.int;
++ begin
++ if not Single_Lock then
++ Result := pthread_mutex_unlock (T.Common.LL.L'Access);
++ pragma Assert (Result = 0);
++ end if;
++ end Unlock;
++
++ -----------------
++ -- Set_Ceiling --
++ -----------------
++
++ -- Dynamic priority ceilings are not supported by the underlying system
++
++ procedure Set_Ceiling
++ (L : not null access Lock;
++ Prio : System.Any_Priority)
++ is
++ pragma Unreferenced (L, Prio);
++ begin
++ null;
++ end Set_Ceiling;
++
++ -----------
++ -- Sleep --
++ -----------
++
++ procedure Sleep
++ (Self_ID : Task_Id;
++ Reason : System.Tasking.Task_States)
++ is
++ pragma Unreferenced (Reason);
++
++ Result : Interfaces.C.int;
++
++ begin
++ Result :=
++ pthread_cond_wait
++ (cond => Self_ID.Common.LL.CV'Access,
++ mutex => (if Single_Lock
++ then Single_RTS_Lock'Access
++ else Self_ID.Common.LL.L'Access));
++
++ -- EINTR is not considered a failure
++
++ pragma Assert (Result = 0 or else Result = EINTR);
++ end Sleep;
++
++ -----------------
++ -- Timed_Sleep --
++ -----------------
++
++ -- This is for use within the run-time system, so abort is
++ -- assumed to be already deferred, and the caller should be
++ -- holding its own ATCB lock.
++
++ procedure Timed_Sleep
++ (Self_ID : Task_Id;
++ Time : Duration;
++ Mode : ST.Delay_Modes;
++ Reason : Task_States;
++ Timedout : out Boolean;
++ Yielded : out Boolean)
++ is
++ pragma Unreferenced (Reason);
++
++ Base_Time : constant Duration := Monotonic_Clock;
++ Check_Time : Duration := Base_Time;
++ Rel_Time : Duration;
++ Abs_Time : Duration;
++ Request : aliased timespec;
++ Result : Interfaces.C.int;
++
++ begin
++ Timedout := True;
++ Yielded := False;
++
++ if Mode = Relative then
++ Abs_Time := Duration'Min (Time, Max_Sensible_Delay) + Check_Time;
++
++ if Relative_Timed_Wait then
++ Rel_Time := Duration'Min (Max_Sensible_Delay, Time);
++ end if;
++
++ else
++ Abs_Time := Duration'Min (Check_Time + Max_Sensible_Delay, Time);
++
++ if Relative_Timed_Wait then
++ Rel_Time := Duration'Min (Max_Sensible_Delay, Time - Check_Time);
++ end if;
++ end if;
++
++ if Abs_Time > Check_Time then
++ Request :=
++ To_Timespec (if Relative_Timed_Wait then Rel_Time else Abs_Time);
++
++ loop
++ exit when Self_ID.Pending_ATC_Level < Self_ID.ATC_Nesting_Level;
++
++ Result :=
++ pthread_cond_timedwait
++ (cond => Self_ID.Common.LL.CV'Access,
++ mutex => (if Single_Lock
++ then Single_RTS_Lock'Access
++ else Self_ID.Common.LL.L'Access),
++ abstime => Request'Access);
++
++ Check_Time := Monotonic_Clock;
++ exit when Abs_Time <= Check_Time or else Check_Time < Base_Time;
++
++ if Result = 0 or Result = EINTR then
++
++ -- Somebody may have called Wakeup for us
++
++ Timedout := False;
++ exit;
++ end if;
++
++ pragma Assert (Result = ETIMEDOUT);
++ end loop;
++ end if;
++ end Timed_Sleep;
++
++ -----------------
++ -- Timed_Delay --
++ -----------------
++
++ -- This is for use in implementing delay statements, so we assume the
++ -- caller is abort-deferred but is holding no locks.
++
++ procedure Timed_Delay
++ (Self_ID : Task_Id;
++ Time : Duration;
++ Mode : ST.Delay_Modes)
++ is
++ Base_Time : constant Duration := Monotonic_Clock;
++ Check_Time : Duration := Base_Time;
++ Abs_Time : Duration;
++ Rel_Time : Duration;
++ Request : aliased timespec;
++
++ Result : Interfaces.C.int;
++ pragma Warnings (Off, Result);
++
++ begin
++ if Single_Lock then
++ Lock_RTS;
++ end if;
++
++ Write_Lock (Self_ID);
++
++ if Mode = Relative then
++ Abs_Time := Duration'Min (Time, Max_Sensible_Delay) + Check_Time;
++
++ if Relative_Timed_Wait then
++ Rel_Time := Duration'Min (Max_Sensible_Delay, Time);
++ end if;
++
++ else
++ Abs_Time := Duration'Min (Check_Time + Max_Sensible_Delay, Time);
++
++ if Relative_Timed_Wait then
++ Rel_Time := Duration'Min (Max_Sensible_Delay, Time - Check_Time);
++ end if;
++ end if;
++
++ if Abs_Time > Check_Time then
++ Request :=
++ To_Timespec (if Relative_Timed_Wait then Rel_Time else Abs_Time);
++ Self_ID.Common.State := Delay_Sleep;
++
++ loop
++ exit when Self_ID.Pending_ATC_Level < Self_ID.ATC_Nesting_Level;
++
++ Result :=
++ pthread_cond_timedwait
++ (cond => Self_ID.Common.LL.CV'Access,
++ mutex => (if Single_Lock
++ then Single_RTS_Lock'Access
++ else Self_ID.Common.LL.L'Access),
++ abstime => Request'Access);
++
++ Check_Time := Monotonic_Clock;
++ exit when Abs_Time <= Check_Time or else Check_Time < Base_Time;
++
++ pragma Assert (Result = 0
++ or else Result = ETIMEDOUT
++ or else Result = EINTR);
++ end loop;
++
++ Self_ID.Common.State := Runnable;
++ end if;
++
++ Unlock (Self_ID);
++
++ if Single_Lock then
++ Unlock_RTS;
++ end if;
++
++ Result := sched_yield;
++ end Timed_Delay;
++
++ ---------------------
++ -- Monotonic_Clock --
++ ---------------------
++
++ function Monotonic_Clock return Duration is
++ TS : aliased timespec;
++ Result : Interfaces.C.int;
++ begin
++ Result := clock_gettime
++ (clock_id => CLOCK_REALTIME, tp => TS'Unchecked_Access);
++ pragma Assert (Result = 0);
++ return To_Duration (TS);
++ end Monotonic_Clock;
++
++ -------------------
++ -- RT_Resolution --
++ -------------------
++
++ function RT_Resolution return Duration is
++ begin
++ return 10#1.0#E-6;
++ end RT_Resolution;
++
++ ------------
++ -- Wakeup --
++ ------------
++
++ procedure Wakeup (T : Task_Id; Reason : System.Tasking.Task_States) is
++ pragma Unreferenced (Reason);
++ Result : Interfaces.C.int;
++ begin
++ Result := pthread_cond_signal (T.Common.LL.CV'Access);
++ pragma Assert (Result = 0);
++ end Wakeup;
++
++ -----------
++ -- Yield --
++ -----------
++
++ procedure Yield (Do_Yield : Boolean := True) is
++ Result : Interfaces.C.int;
++ pragma Unreferenced (Result);
++ begin
++ if Do_Yield then
++ Result := sched_yield;
++ end if;
++ end Yield;
++
++ ------------------
++ -- Set_Priority --
++ ------------------
++
++ procedure Set_Priority
++ (T : Task_Id;
++ Prio : System.Any_Priority;
++ Loss_Of_Inheritance : Boolean := False)
++ is
++ pragma Unreferenced (Loss_Of_Inheritance);
++
++ begin
++ null;
++ end Set_Priority;
++
++ ------------------
++ -- Get_Priority --
++ ------------------
++
++ function Get_Priority (T : Task_Id) return System.Any_Priority is
++ begin
++ return T.Common.Current_Priority;
++ end Get_Priority;
++
++ ----------------
++ -- Enter_Task --
++ ----------------
++
++ procedure Enter_Task (Self_ID : Task_Id) is
++ begin
++ Self_ID.Common.LL.Thread := pthread_self;
++ Self_ID.Common.LL.LWP := lwp_self;
++
++ Specific.Set (Self_ID);
++
++ if Use_Alternate_Stack then
++ declare
++ Stack : aliased stack_t;
++ Result : Interfaces.C.int;
++ begin
++ Stack.ss_sp := Self_ID.Common.Task_Alternate_Stack;
++ Stack.ss_size := Alternate_Stack_Size;
++ Stack.ss_flags := 0;
++ Result := sigaltstack (Stack'Access, null);
++ pragma Assert (Result = 0);
++ end;
++ end if;
++ end Enter_Task;
++
++ --------------
++ -- New_ATCB --
++ --------------
++
++ function New_ATCB (Entry_Num : Task_Entry_Index) return Task_Id is
++ begin
++ return new Ada_Task_Control_Block (Entry_Num);
++ end New_ATCB;
++
++ -------------------
++ -- Is_Valid_Task --
++ -------------------
++
++ function Is_Valid_Task return Boolean renames Specific.Is_Valid_Task;
++
++ -----------------------------
++ -- Register_Foreign_Thread --
++ -----------------------------
++
++ function Register_Foreign_Thread return Task_Id is
++ begin
++ if Is_Valid_Task then
++ return Self;
++ else
++ return Register_Foreign_Thread (pthread_self);
++ end if;
++ end Register_Foreign_Thread;
++
++ --------------------
++ -- Initialize_TCB --
++ --------------------
++
++ procedure Initialize_TCB (Self_ID : Task_Id; Succeeded : out Boolean) is
++ Mutex_Attr : aliased pthread_mutexattr_t;
++ Result : Interfaces.C.int;
++ Cond_Attr : aliased pthread_condattr_t;
++
++ begin
++ -- Give the task a unique serial number
++
++ Self_ID.Serial_Number := Next_Serial_Number;
++ Next_Serial_Number := Next_Serial_Number + 1;
++ pragma Assert (Next_Serial_Number /= 0);
++
++ if not Single_Lock then
++ Result := pthread_mutexattr_init (Mutex_Attr'Access);
++ pragma Assert (Result = 0 or else Result = ENOMEM);
++
++ if Result = 0 then
++ Result :=
++ pthread_mutex_init
++ (Self_ID.Common.LL.L'Access,
++ Mutex_Attr'Access);
++ pragma Assert (Result = 0 or else Result = ENOMEM);
++ end if;
++
++ if Result /= 0 then
++ Succeeded := False;
++ return;
++ end if;
++
++ Result := pthread_mutexattr_destroy (Mutex_Attr'Access);
++ pragma Assert (Result = 0);
++ end if;
++
++ Result := pthread_condattr_init (Cond_Attr'Access);
++ pragma Assert (Result = 0 or else Result = ENOMEM);
++
++ if Result = 0 then
++ Result :=
++ pthread_cond_init
++ (Self_ID.Common.LL.CV'Access, Cond_Attr'Access);
++ pragma Assert (Result = 0 or else Result = ENOMEM);
++ end if;
++
++ if Result = 0 then
++ Succeeded := True;
++ else
++ if not Single_Lock then
++ Result := pthread_mutex_destroy (Self_ID.Common.LL.L'Access);
++ pragma Assert (Result = 0);
++ end if;
++
++ Succeeded := False;
++ end if;
++
++ Result := pthread_condattr_destroy (Cond_Attr'Access);
++ pragma Assert (Result = 0);
++ end Initialize_TCB;
++
++ -----------------
++ -- Create_Task --
++ -----------------
++
++ procedure Create_Task
++ (T : Task_Id;
++ Wrapper : System.Address;
++ Stack_Size : System.Parameters.Size_Type;
++ Priority : System.Any_Priority;
++ Succeeded : out Boolean)
++ is
++ Attributes : aliased pthread_attr_t;
++ Adjusted_Stack_Size : Interfaces.C.size_t;
++ Page_Size : constant Interfaces.C.size_t := Get_Page_Size;
++ Result : Interfaces.C.int;
++
++ function Thread_Body_Access is new
++ Ada.Unchecked_Conversion (System.Address, Thread_Body);
++
++ use System.Task_Info;
++
++ begin
++ Adjusted_Stack_Size :=
++ Interfaces.C.size_t (Stack_Size + Alternate_Stack_Size);
++
++ if Stack_Base_Available then
++
++ -- If Stack Checking is supported then allocate 2 additional pages:
++
++ -- In the worst case, stack is allocated at something like
++ -- N * Get_Page_Size - epsilon, we need to add the size for 2 pages
++ -- to be sure the effective stack size is greater than what
++ -- has been asked.
++
++ Adjusted_Stack_Size := Adjusted_Stack_Size + 2 * Page_Size;
++ end if;
++
++ -- Round stack size as this is required by some OSes (Darwin)
++
++ Adjusted_Stack_Size := Adjusted_Stack_Size + Page_Size - 1;
++ Adjusted_Stack_Size :=
++ Adjusted_Stack_Size - Adjusted_Stack_Size mod Page_Size;
++
++ Result := pthread_attr_init (Attributes'Access);
++ pragma Assert (Result = 0 or else Result = ENOMEM);
++
++ if Result /= 0 then
++ Succeeded := False;
++ return;
++ end if;
++
++ Result :=
++ pthread_attr_setdetachstate
++ (Attributes'Access, PTHREAD_CREATE_DETACHED);
++ pragma Assert (Result = 0);
++
++ Result :=
++ pthread_attr_setstacksize
++ (Attributes'Access, Adjusted_Stack_Size);
++ pragma Assert (Result = 0);
++
++ -- Since the initial signal mask of a thread is inherited from the
++ -- creator, and the Environment task has all its signals masked, we
++ -- do not need to manipulate caller's signal mask at this point.
++ -- All tasks in RTS will have All_Tasks_Mask initially.
++
++ Result := pthread_create
++ (T.Common.LL.Thread'Access,
++ Attributes'Access,
++ Thread_Body_Access (Wrapper),
++ To_Address (T));
++ pragma Assert (Result = 0 or else Result = EAGAIN);
++
++ Succeeded := Result = 0;
++
++ Result := pthread_attr_destroy (Attributes'Access);
++ pragma Assert (Result = 0);
++
++ if Succeeded then
++ Set_Priority (T, Priority);
++ end if;
++ end Create_Task;
++
++ ------------------
++ -- Finalize_TCB --
++ ------------------
++
++ procedure Finalize_TCB (T : Task_Id) is
++ Result : Interfaces.C.int;
++ Tmp : Task_Id := T;
++ Is_Self : constant Boolean := T = Self;
++
++ procedure Free is new
++ Ada.Unchecked_Deallocation (Ada_Task_Control_Block, Task_Id);
++
++ begin
++ if not Single_Lock then
++ Result := pthread_mutex_destroy (T.Common.LL.L'Access);
++ pragma Assert (Result = 0);
++ end if;
++
++ Result := pthread_cond_destroy (T.Common.LL.CV'Access);
++ pragma Assert (Result = 0);
++
++ if T.Known_Tasks_Index /= -1 then
++ Known_Tasks (T.Known_Tasks_Index) := null;
++ end if;
++
++ Free (Tmp);
++
++ if Is_Self then
++ Specific.Set (null);
++ end if;
++ end Finalize_TCB;
++
++ ---------------
++ -- Exit_Task --
++ ---------------
++
++ procedure Exit_Task is
++ begin
++ -- Mark this task as unknown, so that if Self is called, it won't
++ -- return a dangling pointer.
++
++ Specific.Set (null);
++ end Exit_Task;
++
++ ----------------
++ -- Abort_Task --
++ ----------------
++
++ procedure Abort_Task (T : Task_Id) is
++ Result : Interfaces.C.int;
++ begin
++ if Abort_Handler_Installed then
++ Result :=
++ pthread_kill
++ (T.Common.LL.Thread,
++ Signal (System.Interrupt_Management.Abort_Task_Interrupt));
++ pragma Assert (Result = 0);
++ end if;
++ end Abort_Task;
++
++ ----------------
++ -- Initialize --
++ ----------------
++
++ procedure Initialize (S : in out Suspension_Object) is
++ Mutex_Attr : aliased pthread_mutexattr_t;
++ Cond_Attr : aliased pthread_condattr_t;
++ Result : Interfaces.C.int;
++
++ begin
++ -- Initialize internal state (always to False (RM D.10 (6)))
++
++ S.State := False;
++ S.Waiting := False;
++
++ -- Initialize internal mutex
++
++ Result := pthread_mutexattr_init (Mutex_Attr'Access);
++ pragma Assert (Result = 0 or else Result = ENOMEM);
++
++ if Result = ENOMEM then
++ raise Storage_Error;
++ end if;
++
++ Result := pthread_mutex_init (S.L'Access, Mutex_Attr'Access);
++ pragma Assert (Result = 0 or else Result = ENOMEM);
++
++ if Result = ENOMEM then
++ Result := pthread_mutexattr_destroy (Mutex_Attr'Access);
++ pragma Assert (Result = 0);
++
++ raise Storage_Error;
++ end if;
++
++ Result := pthread_mutexattr_destroy (Mutex_Attr'Access);
++ pragma Assert (Result = 0);
++
++ -- Initialize internal condition variable
++
++ Result := pthread_condattr_init (Cond_Attr'Access);
++ pragma Assert (Result = 0 or else Result = ENOMEM);
++
++ if Result /= 0 then
++ Result := pthread_mutex_destroy (S.L'Access);
++ pragma Assert (Result = 0);
++
++ if Result = ENOMEM then
++ raise Storage_Error;
++ end if;
++ end if;
++
++ Result := pthread_cond_init (S.CV'Access, Cond_Attr'Access);
++ pragma Assert (Result = 0 or else Result = ENOMEM);
++
++ if Result /= 0 then
++ Result := pthread_mutex_destroy (S.L'Access);
++ pragma Assert (Result = 0);
++
++ if Result = ENOMEM then
++ Result := pthread_condattr_destroy (Cond_Attr'Access);
++ pragma Assert (Result = 0);
++ raise Storage_Error;
++ end if;
++ end if;
++
++ Result := pthread_condattr_destroy (Cond_Attr'Access);
++ pragma Assert (Result = 0);
++ end Initialize;
++
++ --------------
++ -- Finalize --
++ --------------
++
++ procedure Finalize (S : in out Suspension_Object) is
++ Result : Interfaces.C.int;
++
++ begin
++ -- Destroy internal mutex
++
++ Result := pthread_mutex_destroy (S.L'Access);
++ pragma Assert (Result = 0);
++
++ -- Destroy internal condition variable
++
++ Result := pthread_cond_destroy (S.CV'Access);
++ pragma Assert (Result = 0);
++ end Finalize;
++
++ -------------------
++ -- Current_State --
++ -------------------
++
++ function Current_State (S : Suspension_Object) return Boolean is
++ begin
++ -- We do not want to use lock on this read operation. State is marked
++ -- as Atomic so that we ensure that the value retrieved is correct.
++
++ return S.State;
++ end Current_State;
++
++ ---------------
++ -- Set_False --
++ ---------------
++
++ procedure Set_False (S : in out Suspension_Object) is
++ Result : Interfaces.C.int;
++
++ begin
++ SSL.Abort_Defer.all;
++
++ Result := pthread_mutex_lock (S.L'Access);
++ pragma Assert (Result = 0);
++
++ S.State := False;
++
++ Result := pthread_mutex_unlock (S.L'Access);
++ pragma Assert (Result = 0);
++
++ SSL.Abort_Undefer.all;
++ end Set_False;
++
++ --------------
++ -- Set_True --
++ --------------
++
++ procedure Set_True (S : in out Suspension_Object) is
++ Result : Interfaces.C.int;
++
++ begin
++ SSL.Abort_Defer.all;
++
++ Result := pthread_mutex_lock (S.L'Access);
++ pragma Assert (Result = 0);
++
++ -- If there is already a task waiting on this suspension object then
++ -- we resume it, leaving the state of the suspension object to False,
++ -- as it is specified in (RM D.10(9)). Otherwise, it just leaves
++ -- the state to True.
++
++ if S.Waiting then
++ S.Waiting := False;
++ S.State := False;
++
++ Result := pthread_cond_signal (S.CV'Access);
++ pragma Assert (Result = 0);
++
++ else
++ S.State := True;
++ end if;
++
++ Result := pthread_mutex_unlock (S.L'Access);
++ pragma Assert (Result = 0);
++
++ SSL.Abort_Undefer.all;
++ end Set_True;
++
++ ------------------------
++ -- Suspend_Until_True --
++ ------------------------
++
++ procedure Suspend_Until_True (S : in out Suspension_Object) is
++ Result : Interfaces.C.int;
++
++ begin
++ SSL.Abort_Defer.all;
++
++ Result := pthread_mutex_lock (S.L'Access);
++ pragma Assert (Result = 0);
++
++ if S.Waiting then
++
++ -- Program_Error must be raised upon calling Suspend_Until_True
++ -- if another task is already waiting on that suspension object
++ -- (RM D.10(10)).
++
++ Result := pthread_mutex_unlock (S.L'Access);
++ pragma Assert (Result = 0);
++
++ SSL.Abort_Undefer.all;
++
++ raise Program_Error;
++
++ else
++ -- Suspend the task if the state is False. Otherwise, the task
++ -- continues its execution, and the state of the suspension object
++ -- is set to False (ARM D.10 par. 9).
++
++ if S.State then
++ S.State := False;
++ else
++ S.Waiting := True;
++
++ loop
++ -- Loop in case pthread_cond_wait returns earlier than expected
++ -- (e.g. in case of EINTR caused by a signal).
++
++ Result := pthread_cond_wait (S.CV'Access, S.L'Access);
++ pragma Assert (Result = 0 or else Result = EINTR);
++
++ exit when not S.Waiting;
++ end loop;
++ end if;
++
++ Result := pthread_mutex_unlock (S.L'Access);
++ pragma Assert (Result = 0);
++
++ SSL.Abort_Undefer.all;
++ end if;
++ end Suspend_Until_True;
++
++ ----------------
++ -- Check_Exit --
++ ----------------
++
++ -- Dummy version
++
++ function Check_Exit (Self_ID : ST.Task_Id) return Boolean is
++ pragma Unreferenced (Self_ID);
++ begin
++ return True;
++ end Check_Exit;
++
++ --------------------
++ -- Check_No_Locks --
++ --------------------
++
++ function Check_No_Locks (Self_ID : ST.Task_Id) return Boolean is
++ pragma Unreferenced (Self_ID);
++ begin
++ return True;
++ end Check_No_Locks;
++
++ ----------------------
++ -- Environment_Task --
++ ----------------------
++
++ function Environment_Task return Task_Id is
++ begin
++ return Environment_Task_Id;
++ end Environment_Task;
++
++ --------------
++ -- Lock_RTS --
++ --------------
++
++ procedure Lock_RTS is
++ begin
++ Write_Lock (Single_RTS_Lock'Access, Global_Lock => True);
++ end Lock_RTS;
++
++ ----------------
++ -- Unlock_RTS --
++ ----------------
++
++ procedure Unlock_RTS is
++ begin
++ Unlock (Single_RTS_Lock'Access, Global_Lock => True);
++ end Unlock_RTS;
++
++ ------------------
++ -- Suspend_Task --
++ ------------------
++
++ function Suspend_Task
++ (T : ST.Task_Id;
++ Thread_Self : Thread_Id) return Boolean
++ is
++ pragma Unreferenced (T, Thread_Self);
++ begin
++ return False;
++ end Suspend_Task;
++
++ -----------------
++ -- Resume_Task --
++ -----------------
++
++ function Resume_Task
++ (T : ST.Task_Id;
++ Thread_Self : Thread_Id) return Boolean
++ is
++ pragma Unreferenced (T, Thread_Self);
++ begin
++ return False;
++ end Resume_Task;
++
++ --------------------
++ -- Stop_All_Tasks --
++ --------------------
++
++ procedure Stop_All_Tasks is
++ begin
++ null;
++ end Stop_All_Tasks;
++
++ ---------------
++ -- Stop_Task --
++ ---------------
++
++ function Stop_Task (T : ST.Task_Id) return Boolean is
++ pragma Unreferenced (T);
++ begin
++ return False;
++ end Stop_Task;
++
++ -------------------
++ -- Continue_Task --
++ -------------------
++
++ function Continue_Task (T : ST.Task_Id) return Boolean is
++ pragma Unreferenced (T);
++ begin
++ return False;
++ end Continue_Task;
++
++ ----------------
++ -- Initialize --
++ ----------------
++
++ procedure Initialize (Environment_Task : Task_Id) is
++ act : aliased struct_sigaction;
++ old_act : aliased struct_sigaction;
++ Tmp_Set : aliased sigset_t;
++ Result : Interfaces.C.int;
++
++ function State
++ (Int : System.Interrupt_Management.Interrupt_ID) return Character;
++ pragma Import (C, State, "__gnat_get_interrupt_state");
++ -- Get interrupt state. Defined in a-init.c
++ -- The input argument is the interrupt number,
++ -- and the result is one of the following:
++
++ Default : constant Character := 's';
++ -- 'n' this interrupt not set by any Interrupt_State pragma
++ -- 'u' Interrupt_State pragma set state to User
++ -- 'r' Interrupt_State pragma set state to Runtime
++ -- 's' Interrupt_State pragma set state to System (use "default"
++ -- system handler)
++
++ begin
++ Environment_Task_Id := Environment_Task;
++
++ Interrupt_Management.Initialize;
++
++ -- Prepare the set of signals that should unblocked in all tasks
++
++ Result := sigemptyset (Unblocked_Signal_Mask'Access);
++ pragma Assert (Result = 0);
++
++ for J in Interrupt_Management.Interrupt_ID loop
++ if System.Interrupt_Management.Keep_Unmasked (J) then
++ Result := sigaddset (Unblocked_Signal_Mask'Access, Signal (J));
++ pragma Assert (Result = 0);
++ end if;
++ end loop;
++
++ -- Initialize the lock used to synchronize chain of all ATCBs
++
++ Initialize_Lock (Single_RTS_Lock'Access, RTS_Lock_Level);
++
++ Specific.Initialize (Environment_Task);
++
++ if Use_Alternate_Stack then
++ Environment_Task.Common.Task_Alternate_Stack :=
++ Alternate_Stack'Address;
++ end if;
++
++ -- Make environment task known here because it doesn't go through
++ -- Activate_Tasks, which does it for all other tasks.
++
++ Known_Tasks (Known_Tasks'First) := Environment_Task;
++ Environment_Task.Known_Tasks_Index := Known_Tasks'First;
++
++ Enter_Task (Environment_Task);
++
++ if State
++ (System.Interrupt_Management.Abort_Task_Interrupt) /= Default
++ then
++ act.sa_flags := 0;
++ act.sa_handler := Abort_Handler'Address;
++
++ Result := sigemptyset (Tmp_Set'Access);
++ pragma Assert (Result = 0);
++ act.sa_mask := Tmp_Set;
++
++ Result :=
++ sigaction
++ (Signal (System.Interrupt_Management.Abort_Task_Interrupt),
++ act'Unchecked_Access,
++ old_act'Unchecked_Access);
++ pragma Assert (Result = 0);
++ Abort_Handler_Installed := True;
++ end if;
++ end Initialize;
++
++end System.Task_Primitives.Operations;
diff --git a/debian/patches/arm-sanitizer.diff b/debian/patches/arm-sanitizer.diff
new file mode 100644
index 0000000..7bd8593
--- /dev/null
+++ b/debian/patches/arm-sanitizer.diff
@@ -0,0 +1,280 @@
+# DP: Enable libsanitizer on ARM.
+
+libsanitizer/
+
+2013-06-20 Christophe Lyon <christophe.lyon@linaro.org>
+
+ Backport from trunk r198683.
+ 2013-05-07 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * configure.tgt: Add ARM pattern.
+
+gcc/
+
+2013-06-20 Christophe Lyon <christophe.lyon@linaro.org>
+
+ Backport from trunk r198683.
+ 2013-05-07 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * config/arm/arm.c (arm_asan_shadow_offset): New function.
+ (TARGET_ASAN_SHADOW_OFFSET): Define.
+ * config/arm/linux-eabi.h (ASAN_CC1_SPEC): Define.
+ (LINUX_OR_ANDROID_CC): Add ASAN_CC1_SPEC.
+
+gcc/testsuite/
+
+2013-06-20 Christophe Lyon <christophe.lyon@linaro.org>
+
+ Backport from trunk r198683.
+ 2013-05-07 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * lib/target-supports.exp (check_effective_target_hw): New
+ function.
+ * c-c++-common/asan/clone-test-1.c: Call
+ check_effective_target_hw.
+ * c-c++-common/asan/rlimit-mmap-test-1.c: Likewise.
+ * c-c++-common/asan/heap-overflow-1.c: Update regexps to accept
+ possible decorations.
+ * c-c++-common/asan/null-deref-1.c: Likewise.
+ * c-c++-common/asan/stack-overflow-1.c: Likewise.
+ * c-c++-common/asan/strncpy-overflow-1.c: Likewise.
+ * c-c++-common/asan/use-after-free-1.c: Likewise.
+ * g++.dg/asan/deep-thread-stack-1.C: Likewise.
+ * g++.dg/asan/large-func-test-1.C: Likewise.
+
+Index: b/src/libsanitizer/configure.tgt
+===================================================================
+--- a/src/libsanitizer/configure.tgt
++++ b/src/libsanitizer/configure.tgt
+@@ -32,6 +32,8 @@ case "${target}" in
+ ;;
+ sparc*-*-linux*)
+ ;;
++ arm*-*-linux*)
++ ;;
+ x86_64-*-darwin[1]* | i?86-*-darwin[1]*)
+ TSAN_SUPPORTED=no
+ ;;
+Index: b/src/gcc/testsuite/lib/target-supports.exp
+===================================================================
+--- a/src/gcc/testsuite/lib/target-supports.exp
++++ b/src/gcc/testsuite/lib/target-supports.exp
+@@ -4711,6 +4711,33 @@ proc check_effective_target_simulator {
+ return 0
+ }
+
++# Return 1 if programs are intended to be run on hardware rather than
++# on a simulator
++
++proc check_effective_target_hw { } {
++
++ # All "src/sim" simulators set this one.
++ if [board_info target exists is_simulator] {
++ if [board_info target is_simulator] {
++ return 0
++ } else {
++ return 1
++ }
++ }
++
++ # The "sid" simulators don't set that one, but at least they set
++ # this one.
++ if [board_info target exists slow_simulator] {
++ if [board_info target slow_simulator] {
++ return 0
++ } else {
++ return 1
++ }
++ }
++
++ return 1
++}
++
+ # Return 1 if the target is a VxWorks kernel.
+
+ proc check_effective_target_vxworks_kernel { } {
+Index: b/src/gcc/testsuite/g++.dg/asan/large-func-test-1.C
+===================================================================
+--- a/src/gcc/testsuite/g++.dg/asan/large-func-test-1.C
++++ b/src/gcc/testsuite/g++.dg/asan/large-func-test-1.C
+@@ -37,9 +37,9 @@ int main() {
+
+ // { dg-output "ERROR: AddressSanitizer:? heap-buffer-overflow on address\[^\n\r]*" }
+ // { dg-output "0x\[0-9a-f\]+ at pc 0x\[0-9a-f\]+ bp 0x\[0-9a-f\]+ sp 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" }
+-// { dg-output "READ of size 4 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" }
++// { dg-output "\[^\n\r]*READ of size 4 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" }
+ // { dg-output " #0 0x\[0-9a-f\]+ (in \[^\n\r]*LargeFunction\[^\n\r]*(large-func-test-1.C:18|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" }
+-// { dg-output "0x\[0-9a-f\]+ is located 44 bytes to the right of 400-byte region.*(\n|\r\n|\r)" }
+-// { dg-output "allocated by thread T0 here:\[^\n\r]*(\n|\r\n|\r)" }
++// { dg-output "\[^\n\r]*0x\[0-9a-f\]+ is located 44 bytes to the right of 400-byte region.*(\n|\r\n|\r)" }
++// { dg-output "\[^\n\r]*allocated by thread T0 here:\[^\n\r]*(\n|\r\n|\r)" }
+ // { dg-output " #0( 0x\[0-9a-f\]+ (in _*(interceptor_|)malloc|\[(\])\[^\n\r]*(\n|\r\n|\r)" }
+ // { dg-output " #1|) 0x\[0-9a-f\]+ (in (operator new|_*_Zn\[aw\]\[mj\])|\[(\])\[^\n\r]*(\n|\r\n|\r)" }
+Index: b/src/gcc/testsuite/g++.dg/asan/deep-thread-stack-1.C
+===================================================================
+--- a/src/gcc/testsuite/g++.dg/asan/deep-thread-stack-1.C
++++ b/src/gcc/testsuite/g++.dg/asan/deep-thread-stack-1.C
+@@ -45,9 +45,9 @@ int main(int argc, char *argv[]) {
+ }
+
+ // { dg-output "ERROR: AddressSanitizer: heap-use-after-free.*(\n|\r\n|\r)" }
+-// { dg-output "WRITE of size 4 at 0x\[0-9a-f\]+ thread T(\[0-9\]+).*(\n|\r\n|\r)" }
+-// { dg-output "freed by thread T(\[0-9\]+) here:.*(\n|\r\n|\r)" }
+-// { dg-output "previously allocated by thread T(\[0-9\]+) here:.*(\n|\r\n|\r)" }
++// { dg-output "\[^\n\r]*WRITE of size 4 at 0x\[0-9a-f\]+ thread T(\[0-9\]+).*(\n|\r\n|\r)" }
++// { dg-output "\[^\n\r]*freed by thread T(\[0-9\]+) here:.*(\n|\r\n|\r)" }
++// { dg-output "\[^\n\r]*previously allocated by thread T(\[0-9\]+) here:.*(\n|\r\n|\r)" }
+ // { dg-output "Thread T\\2 created by T(\[0-9\]+) here:.*(\n|\r\n|\r)" }
+ // { dg-output "Thread T\\8 created by T0 here:.*(\n|\r\n|\r)" }
+ // { dg-output "Thread T\\4 created by T(\[0-9\]+) here:.*(\n|\r\n|\r)" }
+Index: b/src/gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c
+===================================================================
+--- a/src/gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c
++++ b/src/gcc/testsuite/c-c++-common/asan/strncpy-overflow-1.c
+@@ -15,7 +15,7 @@ int main(int argc, char **argv) {
+ /* { dg-output "WRITE of size \[0-9\]* at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */
+ /* { dg-output " #0 0x\[0-9a-f\]+ (in _*(interceptor_|)strncpy|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+ /* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*strncpy-overflow-1.c:11|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
+-/* { dg-output "0x\[0-9a-f\]+ is located 0 bytes to the right of 9-byte region\[^\n\r]*(\n|\r\n|\r)" } */
+-/* { dg-output "allocated by thread T0 here:\[^\n\r]*(\n|\r\n|\r)" } */
++/* { dg-output "\[^\n\r]*0x\[0-9a-f\]+ is located 0 bytes to the right of 9-byte region\[^\n\r]*(\n|\r\n|\r)" } */
++/* { dg-output "\[^\n\r]*allocated by thread T0 here:\[^\n\r]*(\n|\r\n|\r)" } */
+ /* { dg-output " #0 0x\[0-9a-f\]+ (in _*(interceptor_|)malloc|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+ /* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*strncpy-overflow-1.c:10|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+Index: b/src/gcc/testsuite/c-c++-common/asan/rlimit-mmap-test-1.c
+===================================================================
+--- a/src/gcc/testsuite/c-c++-common/asan/rlimit-mmap-test-1.c
++++ b/src/gcc/testsuite/c-c++-common/asan/rlimit-mmap-test-1.c
+@@ -2,6 +2,7 @@
+
+ /* { dg-do run { target setrlimit } } */
+ /* { dg-skip-if "" { *-*-* } { "*" } { "-O0" } } */
++/* { dg-require-effective-target hw } */
+ /* { dg-shouldfail "asan" } */
+
+ #include <stdlib.h>
+Index: b/src/gcc/testsuite/c-c++-common/asan/stack-overflow-1.c
+===================================================================
+--- a/src/gcc/testsuite/c-c++-common/asan/stack-overflow-1.c
++++ b/src/gcc/testsuite/c-c++-common/asan/stack-overflow-1.c
+@@ -19,4 +19,4 @@ int main() {
+
+ /* { dg-output "READ of size 1 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */
+ /* { dg-output " #0 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*stack-overflow-1.c:16|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
+-/* { dg-output "Address 0x\[0-9a-f\]+ is\[^\n\r]*frame <main>" } */
++/* { dg-output "\[^\n\r]*Address 0x\[0-9a-f\]+ is\[^\n\r]*frame <main>" } */
+Index: b/src/gcc/testsuite/c-c++-common/asan/use-after-free-1.c
+===================================================================
+--- a/src/gcc/testsuite/c-c++-common/asan/use-after-free-1.c
++++ b/src/gcc/testsuite/c-c++-common/asan/use-after-free-1.c
+@@ -11,12 +11,12 @@ int main() {
+
+ /* { dg-output "ERROR: AddressSanitizer:? heap-use-after-free on address\[^\n\r]*" } */
+ /* { dg-output "0x\[0-9a-f\]+ at pc 0x\[0-9a-f\]+ bp 0x\[0-9a-f\]+ sp 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */
+-/* { dg-output "READ of size 1 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */
++/* { dg-output "\[^\n\r]*READ of size 1 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */
+ /* { dg-output " #0 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*use-after-free-1.c:9|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
+-/* { dg-output "0x\[0-9a-f\]+ is located 5 bytes inside of 10-byte region .0x\[0-9a-f\]+,0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */
+-/* { dg-output "freed by thread T0 here:\[^\n\r]*(\n|\r\n|\r)" } */
++/* { dg-output "\[^\n\r]*0x\[0-9a-f\]+ is located 5 bytes inside of 10-byte region .0x\[0-9a-f\]+,0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */
++/* { dg-output "\[^\n\r]*freed by thread T0 here:\[^\n\r]*(\n|\r\n|\r)" } */
+ /* { dg-output " #0 0x\[0-9a-f\]+ (in _*(interceptor_|)free|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+ /* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*use-after-free-1.c:8|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
+-/* { dg-output "previously allocated by thread T0 here:\[^\n\r]*(\n|\r\n|\r)" } */
++/* { dg-output "\[^\n\r]*previously allocated by thread T0 here:\[^\n\r]*(\n|\r\n|\r)" } */
+ /* { dg-output " #0 0x\[0-9a-f\]+ (in _*(interceptor_|)malloc|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+ /* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*use-after-free-1.c:7|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+Index: b/src/gcc/testsuite/c-c++-common/asan/clone-test-1.c
+===================================================================
+--- a/src/gcc/testsuite/c-c++-common/asan/clone-test-1.c
++++ b/src/gcc/testsuite/c-c++-common/asan/clone-test-1.c
+@@ -3,6 +3,7 @@
+
+ /* { dg-do run { target { *-*-linux* } } } */
+ /* { dg-require-effective-target clone } */
++/* { dg-require-effective-target hw } */
+ /* { dg-options "-D_GNU_SOURCE" } */
+
+ #include <stdio.h>
+Index: b/src/gcc/testsuite/c-c++-common/asan/heap-overflow-1.c
+===================================================================
+--- a/src/gcc/testsuite/c-c++-common/asan/heap-overflow-1.c
++++ b/src/gcc/testsuite/c-c++-common/asan/heap-overflow-1.c
+@@ -25,7 +25,7 @@ int main(int argc, char **argv) {
+
+ /* { dg-output "READ of size 1 at 0x\[0-9a-f\]+ thread T0.*(\n|\r\n|\r)" } */
+ /* { dg-output " #0 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*heap-overflow-1.c:21|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */
+-/* { dg-output "0x\[0-9a-f\]+ is located 0 bytes to the right of 10-byte region\[^\n\r]*(\n|\r\n|\r)" } */
+-/* { dg-output "allocated by thread T0 here:\[^\n\r]*(\n|\r\n|\r)" } */
++/* { dg-output "\[^\n\r]*0x\[0-9a-f\]+ is located 0 bytes to the right of 10-byte region\[^\n\r]*(\n|\r\n|\r)" } */
++/* { dg-output "\[^\n\r]*allocated by thread T0 here:\[^\n\r]*(\n|\r\n|\r)" } */
+ /* { dg-output " #0 0x\[0-9a-f\]+ (in _*(interceptor_|)malloc|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+ /* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*heap-overflow-1.c:19|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+Index: b/src/gcc/testsuite/c-c++-common/asan/null-deref-1.c
+===================================================================
+--- a/src/gcc/testsuite/c-c++-common/asan/null-deref-1.c
++++ b/src/gcc/testsuite/c-c++-common/asan/null-deref-1.c
+@@ -18,6 +18,6 @@ int main()
+
+ /* { dg-output "ERROR: AddressSanitizer:? SEGV on unknown address\[^\n\r]*" } */
+ /* { dg-output "0x\[0-9a-f\]+ \[^\n\r]*pc 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */
+-/* { dg-output "AddressSanitizer can not provide additional info.*(\n|\r\n|\r)" } */
++/* { dg-output "\[^\n\r]*AddressSanitizer can not provide additional info.*(\n|\r\n|\r)" } */
+ /* { dg-output " #0 0x\[0-9a-f\]+ (in \[^\n\r]*NullDeref\[^\n\r]* (\[^\n\r]*null-deref-1.c:10|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+ /* { dg-output " #1 0x\[0-9a-f\]+ (in _*main (\[^\n\r]*null-deref-1.c:15|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
+Index: b/src/gcc/config/arm/arm.c
+===================================================================
+--- a/src/gcc/config/arm/arm.c
++++ b/src/gcc/config/arm/arm.c
+@@ -279,6 +279,7 @@ static unsigned arm_add_stmt_cost (void
+
+ static void arm_canonicalize_comparison (int *code, rtx *op0, rtx *op1,
+ bool op0_preserve_value);
++static unsigned HOST_WIDE_INT arm_asan_shadow_offset (void);
+
+ /* Table of machine attributes. */
+ static const struct attribute_spec arm_attribute_table[] =
+@@ -648,6 +649,9 @@ static const struct attribute_spec arm_a
+ #define TARGET_CANONICALIZE_COMPARISON \
+ arm_canonicalize_comparison
+
++#undef TARGET_ASAN_SHADOW_OFFSET
++#define TARGET_ASAN_SHADOW_OFFSET arm_asan_shadow_offset
++
+ struct gcc_target targetm = TARGET_INITIALIZER;
+
+ /* Obstack for minipool constant handling. */
+@@ -27462,4 +27466,12 @@ arm_validize_comparison (rtx *comparison
+
+ }
+
++/* Implement the TARGET_ASAN_SHADOW_OFFSET hook. */
++
++static unsigned HOST_WIDE_INT
++arm_asan_shadow_offset (void)
++{
++ return (unsigned HOST_WIDE_INT) 1 << 29;
++}
++
+ #include "gt-arm.h"
+Index: b/src/gcc/config/arm/linux-eabi.h
+===================================================================
+--- a/src/gcc/config/arm/linux-eabi.h
++++ b/src/gcc/config/arm/linux-eabi.h
+@@ -84,10 +84,14 @@
+ LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC, \
+ LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
+
++#undef ASAN_CC1_SPEC
++#define ASAN_CC1_SPEC "%{fsanitize=*:-funwind-tables}"
++
+ #undef CC1_SPEC
+ #define CC1_SPEC \
+- LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC, \
+- GNU_USER_TARGET_CC1_SPEC " " ANDROID_CC1_SPEC)
++ LINUX_OR_ANDROID_CC (GNU_USER_TARGET_CC1_SPEC " " ASAN_CC1_SPEC, \
++ GNU_USER_TARGET_CC1_SPEC " " ASAN_CC1_SPEC " " \
++ ANDROID_CC1_SPEC)
+
+ #define CC1PLUS_SPEC \
+ LINUX_OR_ANDROID_CC ("", ANDROID_CC1PLUS_SPEC)
diff --git a/debian/patches/gcc-dfsg-linaro-doc.diff b/debian/patches/gcc-dfsg-linaro-doc.diff
new file mode 100644
index 0000000..b81d7af
--- /dev/null
+++ b/debian/patches/gcc-dfsg-linaro-doc.diff
@@ -0,0 +1,6 @@
+Index: gcc-4.8-4.8.2/src/gcc/doc/arm-acle-intrinsics.texi
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gcc-4.8-4.8.2/src/gcc/doc/arm-acle-intrinsics.texi 2014-03-18 18:42:11.027303768 +0000
+@@ -0,0 +1 @@
++@c This file is empty because the original one has a non DFSG free license (GFDL)
diff --git a/debian/patches/gcc-linaro-no-local.diff b/debian/patches/gcc-linaro-no-local.diff
new file mode 100644
index 0000000..51cda71
--- /dev/null
+++ b/debian/patches/gcc-linaro-no-local.diff
@@ -0,0 +1,189 @@
+# DP: Revert Linaro local patch to build armv4t multilibs.
+
+Index: b/src/gcc/incpath.c
+===================================================================
+--- a/src/gcc/incpath.c
++++ b/src/gcc/incpath.c
+@@ -148,22 +148,20 @@
+ if (!filename_ncmp (p->fname, cpp_GCC_INCLUDE_DIR, len))
+ {
+ char *str = concat (iprefix, p->fname + len, NULL);
+- if (p->multilib && imultilib)
+- {
+- str = reconcat (str, str, dir_separator_str,
+- imultilib, NULL);
+- add_path (str, SYSTEM, p->cxx_aware, false);
+- }
+- else
+- add_path (str, SYSTEM, p->cxx_aware, false);
+-
+- if (p->multilib && imultiarch)
++ if (p->multilib == 1 && imultilib)
++ str = reconcat (str, str, dir_separator_str,
++ imultilib, NULL);
++ else if (p->multilib == 2)
+ {
+- char *str = concat (iprefix, p->fname + len, NULL);
++ if (!imultiarch)
++ {
++ free (str);
++ continue;
++ }
+ str = reconcat (str, str, dir_separator_str,
+ imultiarch, NULL);
+- add_path (str, SYSTEM, p->cxx_aware, false);
+ }
++ add_path (str, SYSTEM, p->cxx_aware, false);
+ }
+ }
+ }
+@@ -173,7 +171,7 @@
+ {
+ if (!p->cplusplus || cxx_stdinc)
+ {
+- char *str, *str2;
++ char *str;
+
+ /* Should this directory start with the sysroot? */
+ if (sysroot && p->add_sysroot)
+@@ -217,20 +215,19 @@
+ else
+ str = update_path (p->fname, p->component);
+
+- str2 = xstrdup(str);
+- if (p->multilib && imultilib)
++ if (p->multilib == 1 && imultilib)
++ str = reconcat (str, str, dir_separator_str, imultilib, NULL);
++ else if (p->multilib == 2)
+ {
+- str = reconcat (str, str, dir_separator_str, imultilib, NULL);
+- add_path (str, SYSTEM, p->cxx_aware, false);
++ if (!imultiarch)
++ {
++ free (str);
++ continue;
++ }
++ str = reconcat (str, str, dir_separator_str, imultiarch, NULL);
+ }
+- else
+- add_path (str, SYSTEM, p->cxx_aware, false);
+
+- if (p->multilib && imultiarch)
+- {
+- str2 = reconcat (str2, str2, dir_separator_str, imultiarch, NULL);
+- add_path (str2, SYSTEM, p->cxx_aware, false);
+- }
++ add_path (str, SYSTEM, p->cxx_aware, false);
+ }
+ }
+ }
+Index: b/src/gcc/gcc.c
+===================================================================
+--- a/src/gcc/gcc.c
++++ b/src/gcc/gcc.c
+@@ -2227,7 +2227,7 @@
+ }
+
+ /* Now try the multiarch path. */
+- if (!skip_multi_dir && !multi_dir
++ if (!skip_multi_dir
+ && !pl->require_machine_suffix && multiarch_dir)
+ {
+ memcpy (path + len, multiarch_suffix, multiarch_len + 1);
+@@ -2263,16 +2263,6 @@
+ if (ret)
+ break;
+ }
+-
+- /* Now try the multiarch path. */
+- if (!skip_multi_dir
+- && !pl->require_machine_suffix && multiarch_dir)
+- {
+- memcpy (path + len, multiarch_suffix, multiarch_len + 1);
+- ret = callback (path, callback_info);
+- if (ret)
+- break;
+- }
+ }
+ if (pl)
+ break;
+@@ -7672,21 +7662,6 @@
+ ++p;
+ }
+
+- if (first)
+- {
+- if (this_path_len > 3
+- && this_path[0] == '.'
+- && this_path[1] == ':'
+- && this_path[2] == ':')
+- {
+- char *new_multiarch_dir = XNEWVEC (char, this_path_len + 1);
+-
+- strncpy (new_multiarch_dir, this_path, this_path_len);
+- new_multiarch_dir[this_path_len] = '\0';
+- multiarch_dir = &new_multiarch_dir[3];
+- }
+- }
+-
+ if (ok && first)
+ {
+ if (this_path_len != 1
+Index: b/src/gcc/ChangeLog.linaro
+===================================================================
+--- a/src/gcc/ChangeLog.linaro
++++ b/src/gcc/ChangeLog.linaro
+@@ -312,14 +312,6 @@
+ GCC Linaro 4.8-2014.01 released.
+ * LINARO-VERSION: Update.
+
+-2014-01-16 Zhenqiang Chen <zhenqiang.chen@linaro.org>
+-
+- Linaro local patch for armv4t multilib support.
+- * gcc/config/arm/t-mlibs: New file.
+- * config.gcc: Add t-mlibs.
+- * incpath.c (add_standard_paths): Try multilib path first.
+- * gcc.c (for_each_path): Likewise.
+-
+ 2013-12-21 Christophe Lyon <christophe.lyon@linaro.org>
+
+ * LINARO-VERSION: Bump version.
+Index: b/src/gcc/config.gcc
+===================================================================
+--- a/src/gcc/config.gcc
++++ b/src/gcc/config.gcc
+@@ -878,7 +878,7 @@
+ tm_defines="${tm_defines} TARGET_BIG_ENDIAN_DEFAULT=1"
+ ;;
+ esac
+- tmake_file="${tmake_file} arm/t-arm arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi arm/t-mlibs"
++ tmake_file="${tmake_file} arm/t-arm arm/t-arm-elf arm/t-bpabi arm/t-linux-eabi"
+ tm_file="$tm_file arm/bpabi.h arm/linux-eabi.h arm/aout.h vxworks-dummy.h arm/arm.h"
+ # Define multilib configuration for arm-linux-androideabi.
+ case ${target} in
+Index: b/src/gcc/config/arm/t-mlibs
+===================================================================
+--- a/src/gcc/config/arm/t-mlibs
++++ /dev/null
+@@ -1,21 +0,0 @@
+-# A set of predefined MULTILIB for different ARM targets.
+-# Through the configure option --with-multilib-list, user can customize the
+-# final MULTILIB implementation.
+-
+-comma := ,
+-space :=
+-space +=
+-
+-MULTILIB_OPTIONS = marm
+-MULTILIB_DIRNAMES = arm
+-MULTILIB_OPTIONS += march=armv4t
+-MULTILIB_DIRNAMES += armv4t
+-MULTILIB_OPTIONS += mfloat-abi=soft
+-MULTILIB_DIRNAMES += soft
+-
+-MULTILIB_EXCEPTIONS =
+-
+-MULTILIB_REQUIRED = marm/march=armv4t/mfloat-abi=soft
+-
+-MULTILIB_OSDIRNAMES = marm/march.armv4t/mfloat-abi.soft=!arm-linux-gnueabi
+-
diff --git a/debian/patches/gcc-ppc64-O3.diff b/debian/patches/gcc-ppc64-O3.diff
new file mode 100644
index 0000000..c73eafb
--- /dev/null
+++ b/debian/patches/gcc-ppc64-O3.diff
@@ -0,0 +1,59 @@
+# DP: Replace -O1 and -O2 with -O3, unless the env var DEB_GCC_NO_O3 is set
+
+--- a/src/gcc/gcc.c
++++ b/src/gcc/gcc.c
+@@ -413,6 +413,7 @@
+ static const char *find_file_spec_function (int, const char **);
+ static const char *find_plugindir_spec_function (int, const char **);
+ static const char *print_asm_header_spec_function (int, const char **);
++static const char *if_env_unset_spec_function (int, const char **);
+ static const char *compare_debug_dump_opt_spec_function (int, const char **);
+ static const char *compare_debug_self_opt_spec_function (int, const char **);
+ static const char *compare_debug_auxbase_opt_spec_function (int, const char **);
+@@ -895,6 +896,7 @@
+ static const char *cpp_options =
+ "%(cpp_unique_options) %1 %{m*} %{std*&ansi&trigraphs} %{W*&pedantic*} %{w}\
+ %{f*} %{g*:%{!g0:%{g*} %{!fno-working-directory:-fworking-directory}}} %{O*}\
++ %{O1:%:if-env-unset(DEB_GCC_NO_O3 -O3)} %{O2:%:if-env-unset(DEB_GCC_NO_O3 -O3)}\
+ %{undef} %{save-temps*:-fpch-preprocess}";
+
+ /* This contains cpp options which are not passed when the preprocessor
+@@ -908,7 +910,8 @@
+ %1 %{!Q:-quiet} %{!dumpbase:-dumpbase %B} %{d*} %{m*} %{a*}\
+ %{fcompare-debug-second:%:compare-debug-auxbase-opt(%b)} \
+ %{!fcompare-debug-second:%{c|S:%{o*:-auxbase-strip %*}%{!o*:-auxbase %b}}}%{!c:%{!S:-auxbase %b}} \
+- %{g*} %{O*} %{W*&pedantic*} %{w} %{std*&ansi&trigraphs}\
++ %{g*} %{O*} %{O1:%:if-env-unset(DEB_GCC_NO_O3 -O3)} %{O2:%:if-env-unset(DEB_GCC_NO_O3 -O3)}\
++ %{W*&pedantic*} %{w} %{std*&ansi&trigraphs}\
+ %{v:-version} %{pg:-p} %{p} %{f*} %{undef}\
+ %{Qn:-fno-ident} %{--help:--help}\
+ %{--target-help:--target-help}\
+@@ -1736,6 +1739,7 @@
+ { "if-exists-else", if_exists_else_spec_function },
+ { "replace-outfile", replace_outfile_spec_function },
+ { "version-compare", version_compare_spec_function },
++ { "if-env-unset", if_env_unset_spec_function },
+ { "include", include_spec_function },
+ { "find-file", find_file_spec_function },
+ { "find-plugindir", find_plugindir_spec_function },
+@@ -9105,6 +9109,20 @@
+ }
+
+
++/* %:if-env-unset spec function. Add the second argument, if
++ if the environment variable (first argument) is not set. */
++static const char *
++if_env_unset_spec_function (int argc, const char**argv)
++{
++ if (argc != 2)
++ abort ();
++ if (getenv (argv[0]) != NULL)
++ return NULL;
++ else
++ return argv[1];
++}
++
++
+ /* %:print-asm-header spec function. Print a banner to say that the
+ following output is from the assembler. */
+
diff --git a/debian/patches/gcc_ada_gcc-interface_Makefile.in.diff b/debian/patches/gcc_ada_gcc-interface_Makefile.in.diff
new file mode 100644
index 0000000..065fef4
--- /dev/null
+++ b/debian/patches/gcc_ada_gcc-interface_Makefile.in.diff
@@ -0,0 +1,35 @@
+--- a/src/gcc/ada/gcc-interface/Makefile.in 2011-11-18 12:46:58.000000000 +0100
++++ b/src/gcc/ada/gcc-interface/Makefile.in 2012-03-28 11:28:09.000000000 +0200
+@@ -1143,6 +1116,32 @@
+ LIBRARY_VERSION := $(LIB_VERSION)
+ endif
+
++ifeq ($(strip $(filter-out %86 gnu%,$(arch) $(osys))),)
++ LIBGNAT_TARGET_PAIRS = \
++ a-intnam.ads<a-intnam-freebsd.ads \
++ a-numaux.adb<a-numaux-x86.adb \
++ a-numaux.ads<a-numaux-x86.ads \
++ s-inmaop.adb<s-inmaop-posix.adb \
++ s-intman.adb<s-intman-posix.adb \
++ s-osinte.adb<s-osinte-gnu.adb \
++ s-osinte.ads<s-osinte-gnu.ads \
++ s-osprim.adb<s-osprim-posix.adb \
++ s-taprop.adb<s-taprop-gnu.adb \
++ s-taspri.ads<s-taspri-posix.ads \
++ s-tpopsp.adb<s-tpopsp-posix-foreign.adb \
++ system.ads<system-freebsd-x86.ads
++
++ TOOLS_TARGET_PAIRS = \
++ mlib-tgt-specific.adb<mlib-tgt-specific-linux.adb \
++ indepsw.adb<indepsw-gnu.adb
++
++ EH_MECHANISM=-gcc
++ THREADSLIB = -lpthread
++ GNATLIB_SHARED = gnatlib-shared-dual
++ GMEM_LIB = gmemlib
++ LIBRARY_VERSION := $(LIB_VERSION)
++endif
++
+ ifeq ($(strip $(filter-out x86_64 kfreebsd%,$(arch) $(osys))),)
+ LIBGNAT_TARGET_PAIRS = \
+ a-intnam.ads<a-intnam-freebsd.ads \
diff --git a/debian/patches/gdc-4.8-doc.diff b/debian/patches/gdc-4.8-doc.diff
new file mode 100644
index 0000000..79e37ed
--- /dev/null
+++ b/debian/patches/gdc-4.8-doc.diff
@@ -0,0 +1,96 @@
+# DP: This implements D language support in the GCC back end, and adds
+# DP: relevant documentation about the GDC front end (documentation part).
+
+--- a/src/gcc/doc/frontends.texi
++++ b/src/gcc/doc/frontends.texi
+@@ -9,6 +9,7 @@
+ @cindex GNU Compiler Collection
+ @cindex GNU C Compiler
+ @cindex Ada
++@cindex D
+ @cindex Fortran
+ @cindex Go
+ @cindex Java
+@@ -17,7 +18,7 @@
+ GCC stands for ``GNU Compiler Collection''. GCC is an integrated
+ distribution of compilers for several major programming languages. These
+ languages currently include C, C++, Objective-C, Objective-C++, Java,
+-Fortran, Ada, and Go.
++Fortran, Ada, D and Go.
+
+ The abbreviation @dfn{GCC} has multiple meanings in common use. The
+ current official meaning is ``GNU Compiler Collection'', which refers
+--- a/src/gcc/doc/install.texi
++++ b/src/gcc/doc/install.texi
+@@ -1350,12 +1350,12 @@ their runtime libraries should be built.
+ grep language= */config-lang.in
+ @end smallexample
+ Currently, you can use any of the following:
+-@code{all}, @code{ada}, @code{c}, @code{c++}, @code{fortran},
++@code{all}, @code{ada}, @code{c}, @code{c++}, @code{d}, @code{fortran},
+ @code{go}, @code{java}, @code{objc}, @code{obj-c++}.
+ Building the Ada compiler has special requirements, see below.
+ If you do not pass this flag, or specify the option @code{all}, then all
+ default languages available in the @file{gcc} sub-tree will be configured.
+-Ada, Go and Objective-C++ are not default languages; the rest are.
++Ada, D, Go and Objective-C++ are not default languages; the rest are.
+
+ @item --enable-stage1-languages=@var{lang1},@var{lang2},@dots{}
+ Specify that a particular subset of compilers and their runtime
+--- a/src/gcc/doc/invoke.texi
++++ b/src/gcc/doc/invoke.texi
+@@ -1164,6 +1164,15 @@ called @dfn{specs}.
+ Ada source code file containing a library unit body (a subprogram or
+ package body). Such files are also called @dfn{bodies}.
+
++@item @var{file}.d
++D source code file.
++
++@item @var{file}.di
++D interface code file.
++
++@item @var{file}.dd
++D documentation code file.
++
+ @c GCC also knows about some suffixes for languages not yet included:
+ @c Pascal:
+ @c @var{file}.p
+@@ -1199,6 +1208,7 @@ objective-c objective-c-header objecti
+ objective-c++ objective-c++-header objective-c++-cpp-output
+ assembler assembler-with-cpp
+ ada
++d
+ f77 f77-cpp-input f95 f95-cpp-input
+ go
+ java
+--- a/src/gcc/doc/sourcebuild.texi
++++ b/src/gcc/doc/sourcebuild.texi
+@@ -113,6 +113,9 @@ The Objective-C and Objective-C++ runtim
+ @item libquadmath
+ The runtime support library for quad-precision math operations.
+
++@item libphobos
++The D standard runtime library.
++
+ @item libssp
+ The Stack protector runtime library.
+
+--- a/src/gcc/doc/standards.texi
++++ b/src/gcc/doc/standards.texi
+@@ -288,6 +288,16 @@ a specific version. In general GCC trac
+ closely, and any given release will support the language as of the
+ date that the release was frozen.
+
++@section D language
++
++The D language is under development as of this writing; see the
++@uref{http://dlang.org/@/language-reference.html, current language
++reference}. At present the current major version of D is 2.0, and
++there is no way to describe the language supported by GCC in terms of
++a specific minor version. In general GCC follows the D frontend
++releases closely, and any given GCC release will support the current
++language as of the date that the release was frozen.
++
+ @section References for other languages
+
+ @xref{Top, GNAT Reference Manual, About This Guide, gnat_rm,
diff --git a/debian/patches/gdc-4.8.diff b/debian/patches/gdc-4.8.diff
new file mode 100644
index 0000000..833c09c
--- /dev/null
+++ b/debian/patches/gdc-4.8.diff
@@ -0,0 +1,42 @@
+# DP: This implements D language support in the GCC back end, and adds
+# DP: relevant documentation about the GDC front end (code part).
+
+Index: b/src/gcc/config/rs6000/rs6000.c
+===================================================================
+--- a/src/gcc/config/rs6000/rs6000.c
++++ b/src/gcc/config/rs6000/rs6000.c
+@@ -24977,7 +24977,8 @@ rs6000_output_function_epilogue (FILE *f
+ either, so for now use 0. */
+ if (! strcmp (language_string, "GNU C")
+ || ! strcmp (language_string, "GNU GIMPLE")
+- || ! strcmp (language_string, "GNU Go"))
++ || ! strcmp (language_string, "GNU Go")
++ || ! strcmp (language_string, "GNU D"))
+ i = 0;
+ else if (! strcmp (language_string, "GNU F77")
+ || ! strcmp (language_string, "GNU Fortran"))
+Index: b/src/gcc/dwarf2out.c
+===================================================================
+--- a/src/gcc/dwarf2out.c
++++ b/src/gcc/dwarf2out.c
+@@ -18909,6 +18909,8 @@ gen_compile_unit_die (const char *filena
+ language = DW_LANG_C89;
+ if (strcmp (language_string, "GNU C++") == 0)
+ language = DW_LANG_C_plus_plus;
++ else if (strcmp (language_string, "GNU D") == 0)
++ language = DW_LANG_D;
+ else if (strcmp (language_string, "GNU F77") == 0)
+ language = DW_LANG_Fortran77;
+ else if (strcmp (language_string, "GNU Pascal") == 0)
+Index: b/src/gcc/gcc.c
+===================================================================
+--- a/src/gcc/gcc.c
++++ b/src/gcc/gcc.c
+@@ -1003,6 +1003,7 @@ static const struct compiler default_com
+ {".java", "#Java", 0, 0, 0}, {".class", "#Java", 0, 0, 0},
+ {".zip", "#Java", 0, 0, 0}, {".jar", "#Java", 0, 0, 0},
+ {".go", "#Go", 0, 1, 0},
++ {".d", "#D", 0, 1, 0}, {".dd", "#D", 0, 1, 0}, {".di", "#D", 0, 1, 0},
+ /* Next come the entries for C. */
+ {".c", "@c", 0, 0, 1},
+ {"@c",
diff --git a/debian/patches/goarch-aarch64.diff b/debian/patches/goarch-aarch64.diff
new file mode 100644
index 0000000..ab46374
--- /dev/null
+++ b/debian/patches/goarch-aarch64.diff
@@ -0,0 +1,94 @@
+# DP: Introduce the arm64 goarch.
+
+Index: b/src/gcc/testsuite/go.test/go-test.exp
+===================================================================
+--- a/src/gcc/testsuite/go.test/go-test.exp
++++ b/src/gcc/testsuite/go.test/go-test.exp
+@@ -172,6 +172,9 @@ proc go-set-goarch { } {
+ global target_triplet
+
+ switch -glob $target_triplet {
++ "aarch64*-*-*" {
++ set goarch "arm64"
++ }
+ "alpha*-*-*" {
+ set goarch "alpha"
+ }
+Index: b/src/libgo/configure.ac
+===================================================================
+--- a/src/libgo/configure.ac
++++ b/src/libgo/configure.ac
+@@ -171,6 +171,7 @@ dnl N.B. Keep in sync with gcc/testsuite
+ is_386=no
+ is_alpha=no
+ is_arm=no
++is_arm64=no
+ is_m68k=no
+ mips_abi=unknown
+ is_ppc=no
+@@ -184,6 +185,10 @@ case ${host} in
+ is_alpha=yes
+ GOARCH=alpha
+ ;;
++ aarch64-*-*)
++ is_arm64=yes
++ GOARCH=arm64
++ ;;
+ arm*-*-* | strongarm*-*-* | ep9312*-*-* | xscale-*-*)
+ is_arm=yes
+ GOARCH=arm
+@@ -264,6 +269,7 @@ esac
+ AM_CONDITIONAL(LIBGO_IS_386, test $is_386 = yes)
+ AM_CONDITIONAL(LIBGO_IS_ALPHA, test $is_alpha = yes)
+ AM_CONDITIONAL(LIBGO_IS_ARM, test $is_arm = yes)
++AM_CONDITIONAL(LIBGO_IS_ARM64, test $is_arm64 = yes)
+ AM_CONDITIONAL(LIBGO_IS_M68K, test $is_m68k = yes)
+ AM_CONDITIONAL(LIBGO_IS_MIPS, test $mips_abi != unknown)
+ AM_CONDITIONAL(LIBGO_IS_MIPSO32, test $mips_abi = o32)
+Index: b/src/libgo/go/go/build/build.go
+===================================================================
+--- a/src/libgo/go/go/build/build.go
++++ b/src/libgo/go/go/build/build.go
+@@ -1118,6 +1118,8 @@ func ArchChar(goarch string) (string, er
+ return "6", nil
+ case "arm":
+ return "5", nil
++ case "arm64":
++ return "7", nil
+ }
+ return "", errors.New("unsupported GOARCH " + goarch)
+ }
+Index: b/src/libgo/go/go/build/deps_test.go
+===================================================================
+--- a/src/libgo/go/go/build/deps_test.go
++++ b/src/libgo/go/go/build/deps_test.go
+@@ -360,7 +360,7 @@ func allowed(pkg string) map[string]bool
+
+ var bools = []bool{false, true}
+ var geese = []string{"darwin", "freebsd", "linux", "netbsd", "openbsd", "plan9", "windows"}
+-var goarches = []string{"386", "amd64", "arm"}
++var goarches = []string{"386", "amd64", "arm", "arm64"}
+
+ type osPkg struct {
+ goos, pkg string
+Index: b/src/libgo/go/go/build/syslist.go
+===================================================================
+--- a/src/libgo/go/go/build/syslist.go
++++ b/src/libgo/go/go/build/syslist.go
+@@ -5,4 +5,4 @@
+ package build
+
+ const goosList = "darwin dragonfly freebsd linux netbsd openbsd plan9 windows solaris "
+-const goarchList = "386 amd64 arm alpha m68k mipso32 mipsn32 mipsn64 mipso64 ppc ppc64 sparc sparc64 "
++const goarchList = "386 amd64 arm arm64 alpha m68k mipso32 mipsn32 mipsn64 mipso64 ppc ppc64 sparc sparc64 "
+Index: b/src/libgo/go/runtime/extern.go
+===================================================================
+--- a/src/libgo/go/runtime/extern.go
++++ b/src/libgo/go/runtime/extern.go
+@@ -170,5 +170,5 @@ func Version() string {
+ const GOOS string = theGoos
+
+ // GOARCH is the running program's architecture target:
+-// 386, amd64, or arm.
++// 386, amd64, arm or arm64.
+ const GOARCH string = theGoarch
diff --git a/debian/patches/gold-and-ld.diff b/debian/patches/gold-and-ld.diff
new file mode 100644
index 0000000..1fb8f0e
--- /dev/null
+++ b/debian/patches/gold-and-ld.diff
@@ -0,0 +1,482 @@
+# DP: Enable both gold and ld in a single toolchain.
+# DP: New option -fuse-ld=ld.bfd, -fuse-ld=gold.
+
+--- a/src/gcc/doc/invoke.texi
++++ b/srcgcc/doc/invoke.texi
+@@ -399,7 +399,7 @@
+ -funit-at-a-time -funroll-all-loops -funroll-loops @gol
+ -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
+ -fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol
+--fwhole-program -fwpa -fuse-linker-plugin @gol
++-fwhole-program -fwpa -fuse-ld -fuse-linker-plugin @gol
+ --param @var{name}=@var{value}
+ -O -O0 -O1 -O2 -O3 -Os -Ofast}
+
+@@ -7689,6 +7689,16 @@
+ Enabled by default when LTO support in GCC is enabled and GCC was compiled
+ with linker supporting plugins (GNU ld or @code{gold}).
+
++@item -fuse-ld=gold
++Use the @command{gold} linker instead of the default linker.
++This option is only necessary if GCC has been configured with
++@option{--enable-gold} and @option{--enable-ld=default}.
++
++@item -fuse-ld=bfd
++Use the @command{ld.bfd} linker instead of the default linker.
++This option is only necessary if GCC has been configured with
++@option{--enable-gold} and @option{--enable-ld}.
++
+ @item -fcprop-registers
+ @opindex fcprop-registers
+ After register allocation and post-register allocation instruction splitting,
+--- a/src/gcc/gcc.c
++++ b/srcgcc/gcc.c
+@@ -656,6 +656,9 @@
+ }"PLUGIN_COND_CLOSE" \
+ %{flto|flto=*:%<fcompare-debug*} \
+ %{flto} %{flto=*} %l " LINK_PIE_SPEC \
++ "%{fuse-ld=gold:%{fuse-ld=bfd:%e-fuse-ld=gold and -fuse-ld=bfd may not be used together}} \
++ %{fuse-ld=gold:-use-gold} \
++ %{fuse-ld=bfd:-use-ld}" \
+ "%X %{o*} %{e*} %{N} %{n} %{r}\
+ %{s} %{t} %{u*} %{z} %{Z} %{!nostdlib:%{!nostartfiles:%S}}\
+ %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\
+--- a/src/gcc/opts.c
++++ b/srcgcc/opts.c
+@@ -1691,8 +1691,9 @@
+ dc->max_errors = value;
+ break;
+
++ case OPT_fuse_ld_:
+ case OPT_fuse_linker_plugin:
+- /* No-op. Used by the driver and passed to us because it starts with f.*/
++ /* No-op. Used by the driver and passed to us because it starts with f. */
+ break;
+
+ default:
+--- a/src/gcc/configure.ac
++++ b/srcgcc/configure.ac
+@@ -1937,6 +1937,17 @@
+ AC_PATH_PROG(gcc_cv_ld, $LD_FOR_TARGET)
+ fi])
+
++gcc_cv_ld_gold_srcdir=`echo $srcdir | sed -e 's,/gcc$,,'`/gold
++
++AS_VAR_SET_IF(gcc_cv_gold,, [
++if test -f $gcc_cv_ld_gold_srcdir/configure.ac \
++ && test -f ../gold/Makefile \
++ && test x$build = x$host; then
++ gcc_cv_gold=../gold/ld-new$build_exeext
++else
++ gcc_cv_gold=''
++fi])
++
+ ORIGINAL_PLUGIN_LD_FOR_TARGET=$gcc_cv_ld
+ PLUGIN_LD=`basename $gcc_cv_ld`
+ AC_ARG_WITH(plugin-ld,
+@@ -1966,6 +1977,9 @@
+ *) AC_CONFIG_FILES(collect-ld:exec-tool.in, [chmod +x collect-ld]) ;;
+ esac
+
++ORIGINAL_GOLD_FOR_TARGET=$gcc_cv_gold
++AC_SUBST(ORIGINAL_GOLD_FOR_TARGET)
++
+ AC_MSG_CHECKING(what linker to use)
+ if test "$gcc_cv_ld" = ../ld/ld-new$build_exeext; then
+ # Single tree build which includes ld. We want to prefer it
+--- a/src/gcc/exec-tool.in
++++ b/srcgcc/exec-tool.in
+@@ -1,6 +1,6 @@
+ #! /bin/sh
+
+-# Copyright (C) 2007, 2008, 2010 Free Software Foundation, Inc.
++# Copyright (C) 2007, 2008, 2010, 2011 Free Software Foundation, Inc.
+ # This file is part of GCC.
+
+ # GCC is free software; you can redistribute it and/or modify
+@@ -21,11 +21,13 @@
+
+ ORIGINAL_AS_FOR_TARGET="@ORIGINAL_AS_FOR_TARGET@"
+ ORIGINAL_LD_FOR_TARGET="@ORIGINAL_LD_FOR_TARGET@"
++ORIGINAL_GOLD_FOR_TARGET="@ORIGINAL_GOLD_FOR_TARGET@"
+ ORIGINAL_PLUGIN_LD_FOR_TARGET="@ORIGINAL_PLUGIN_LD_FOR_TARGET@"
+ ORIGINAL_NM_FOR_TARGET="@ORIGINAL_NM_FOR_TARGET@"
+ exeext=@host_exeext@
+ fast_install=@enable_fast_install@
+ objdir=@objdir@
++version="1.1"
+
+ invoked=`basename "$0"`
+ id=$invoked
+@@ -36,15 +38,44 @@
+ dir=gas
+ ;;
+ collect-ld)
+- # when using a linker plugin, gcc will always pass '-plugin' as the
+- # first or second option to the linker.
+- if test x"$1" = "x-plugin" || test x"$2" = "x-plugin"; then
+- original=$ORIGINAL_PLUGIN_LD_FOR_TARGET
+- else
+- original=$ORIGINAL_LD_FOR_TARGET
++ prog=ld-new$exeext
++ # Look for the a command line option
++ # specifying the linker to be used.
++ case " $* " in
++ *\ -use-gold\ *)
++ original=$ORIGINAL_GOLD_FOR_TARGET
++ dir=gold
++ ;;
++ *\ -use-ld\ * | *\ -use-ld.bfd\ *)
++ original=$ORIGINAL_LD_FOR_TARGET
++ dir=ld
++ ;;
++ *\ -plugin\ *)
++ original=$ORIGINAL_PLUGIN_LD_FOR_TARGET
++ dir=ld
++ ;;
++ *)
++ original=$ORIGINAL_LD_FOR_TARGET
++ dir=ld
++ ;;
++ esac
++
++ # If the selected linker has not been configured then
++ # try using the others, in the order PLUGIN-LD, LD, GOLD.
++ if test x"$original" = x; then
++ if test x"$ORIGINAL_PLUGIN_LD_FOR_TARGET" != x; then
++ original=$ORIGINAL_PLUGIN_LD_FOR_TARGET
++ dir=ld
++ elif test x"$ORIGINAL_LD_FOR_TARGET" != x; then
++ original=$ORIGINAL_LD_FOR_TARGET
++ dir=ld
++ elif test x"$ORIGINAL_GOLD_FOR_TARGET" != x; then
++ original=$ORIGINAL_GOLD_FOR_TARGET
++ dir=gold
++ # Otherwise do nothing - the case statement below
++ # will issue an error message for us.
++ fi
+ fi
+- prog=ld-new$exeext
+- dir=ld
+ id=ld
+ ;;
+ nm)
+@@ -61,29 +92,58 @@
+ scriptdir=`cd "$tdir" && pwd`
+
+ if test -x $scriptdir/../$dir/$prog; then
+- test "$fast_install" = yes || exec $scriptdir/../$dir/$prog ${1+"$@"}
++ if test "$fast_install" = yes; then
++ # If libtool did everything it needs to do, there's a fast path.
++ lt_prog=$scriptdir/../$dir/$objdir/lt-$prog
+
+- # if libtool did everything it needs to do, there's a fast path
+- lt_prog=$scriptdir/../$dir/$objdir/lt-$prog
+- test -x $lt_prog && exec $lt_prog ${1+"$@"}
+-
+- # libtool has not relinked ld-new yet, but we cannot just use the
+- # previous stage (because then the relinking would just never happen!).
+- # So we take extra care to use prev-ld/ld-new *on recursive calls*.
+- eval LT_RCU="\${LT_RCU_$id}"
+- test x"$LT_RCU" = x"1" && exec $scriptdir/../prev-$dir/$prog ${1+"$@"}
+-
+- eval LT_RCU_$id=1
+- export LT_RCU_$id
+- $scriptdir/../$dir/$prog ${1+"$@"}
+- result=$?
+- exit $result
+-
++ if test -x $lt_prog; then
++ original=$lt_prog
++ else
++ # Libtool has not relinked ld-new yet, but we cannot just use the
++ # previous stage (because then the relinking would just never happen!).
++ # So we take extra care to use prev-ld/ld-new *on recursive calls*.
++ eval LT_RCU="\${LT_RCU_$id}"
++ if test x"$LT_RCU" = x"1"; then
++ original=$scriptdir/../prev-$dir/$prog
++ else
++ eval LT_RCU_$id=1
++ export LT_RCU_$id
++ case " $* " in
++ *\ -v\ *)
++ echo "$invoked $version"
++ echo $scriptdir/../$dir/$prog $*
++ ;;
++ esac
++ $scriptdir/../$dir/$prog ${1+"$@"}
++ result=$?
++ exit $result
++ fi
++ fi
++ else
++ original=$scriptdir/../$dir/$prog
++ fi
+ else
+- exec $scriptdir/../prev-$dir/$prog ${1+"$@"}
++ original=$scriptdir/../prev-$dir/$prog
+ fi
+ ;;
+- *)
+- exec $original ${1+"$@"}
++ "")
++ echo "$invoked: executable not configured"
++ exit 1
+ ;;
+ esac
++
++# If -v has been used then display our version number
++# and then echo the command we are about to invoke.
++case " $* " in
++ *\ -v\ *)
++ echo "$invoked $version"
++ echo $original $*
++ ;;
++esac
++
++if test -x $original; then
++ exec "$original" ${1+"$@"}
++else
++ echo "$invoked: unable to locate executable: $original"
++ exit 1
++fi
+--- a/src/gcc/common.opt
++++ b/srcgcc/common.opt
+@@ -1998,6 +1998,9 @@
+ Common Report Var(flag_unwind_tables) Optimization
+ Just generate unwind tables for exception handling
+
++fuse-ld=
++Common Joined Undocumented
++
+ fuse-linker-plugin
+ Common Undocumented
+
+--- a/src/gcc/collect2.c
++++ b/srcgcc/collect2.c
+@@ -1075,17 +1075,19 @@
+ int
+ main (int argc, char **argv)
+ {
+- static const char *const ld_suffix = "ld";
+- static const char *const plugin_ld_suffix = PLUGIN_LD;
+- static const char *const real_ld_suffix = "real-ld";
++ static const char *const ld_suffix = "ld";
++ static const char *const gold_suffix = "gold";
++ static const char *const bfd_ld_suffix = "ld.bfd";
++ static const char *const plugin_ld_suffix = PLUGIN_LD;
++ static const char *const real_ld_suffix = "real-ld";
+ static const char *const collect_ld_suffix = "collect-ld";
+- static const char *const nm_suffix = "nm";
+- static const char *const gnm_suffix = "gnm";
++ static const char *const nm_suffix = "nm";
++ static const char *const gnm_suffix = "gnm";
+ #ifdef LDD_SUFFIX
+- static const char *const ldd_suffix = LDD_SUFFIX;
++ static const char *const ldd_suffix = LDD_SUFFIX;
+ #endif
+- static const char *const strip_suffix = "strip";
+- static const char *const gstrip_suffix = "gstrip";
++ static const char *const strip_suffix = "strip";
++ static const char *const gstrip_suffix = "gstrip";
+
+ #ifdef CROSS_DIRECTORY_STRUCTURE
+ /* If we look for a program in the compiler directories, we just use
+@@ -1095,6 +1097,10 @@
+
+ const char *const full_ld_suffix =
+ concat(target_machine, "-", ld_suffix, NULL);
++ const char *const full_gold_suffix =
++ concat (target_machine, "-", gold_suffix, NULL);
++ const char *const full_bfd_ld_suffix =
++ concat (target_machine, "-", bfd_ld_suffix, NULL);
+ const char *const full_plugin_ld_suffix =
+ concat(target_machine, "-", plugin_ld_suffix, NULL);
+ const char *const full_nm_suffix =
+@@ -1110,15 +1116,17 @@
+ const char *const full_gstrip_suffix =
+ concat (target_machine, "-", gstrip_suffix, NULL);
+ #else
+- const char *const full_ld_suffix = ld_suffix;
++ const char *const full_ld_suffix = ld_suffix;
++ const char *const full_gold_suffix = gold_suffix;
++ const char *const full_bfd_ld_suffix = bfd_ld_suffix;
+ const char *const full_plugin_ld_suffix = plugin_ld_suffix;
+- const char *const full_nm_suffix = nm_suffix;
+- const char *const full_gnm_suffix = gnm_suffix;
++ const char *const full_nm_suffix = nm_suffix;
++ const char *const full_gnm_suffix = gnm_suffix;
+ #ifdef LDD_SUFFIX
+- const char *const full_ldd_suffix = ldd_suffix;
++ const char *const full_ldd_suffix = ldd_suffix;
+ #endif
+- const char *const full_strip_suffix = strip_suffix;
+- const char *const full_gstrip_suffix = gstrip_suffix;
++ const char *const full_strip_suffix = strip_suffix;
++ const char *const full_gstrip_suffix = gstrip_suffix;
+ #endif /* CROSS_DIRECTORY_STRUCTURE */
+
+ const char *arg;
+@@ -1132,7 +1140,13 @@
+ const char **c_ptr;
+ char **ld1_argv;
+ const char **ld1;
+- bool use_plugin = false;
++ enum linker_select
++ {
++ DFLT_LINKER,
++ PLUGIN_LINKER,
++ GOLD_LINKER,
++ BFD_LINKER
++ } selected_linker = DFLT_LINKER;
+
+ /* The kinds of symbols we will have to consider when scanning the
+ outcome of a first pass link. This is ALL to start with, then might
+@@ -1209,15 +1223,21 @@
+ else if (! strcmp (argv[i], "-flto-partition=none"))
+ no_partition = true;
+ else if ((! strncmp (argv[i], "-flto=", 6)
+- || ! strcmp (argv[i], "-flto")) && ! use_plugin)
++ || ! strcmp (argv[i], "-flto"))
++ && selected_linker != PLUGIN_LINKER)
+ lto_mode = LTO_MODE_WHOPR;
+ else if (!strncmp (argv[i], "-fno-lto", 8))
+ lto_mode = LTO_MODE_NONE;
+ else if (! strcmp (argv[i], "-plugin"))
+ {
+- use_plugin = true;
++ selected_linker = PLUGIN_LINKER;
+ lto_mode = LTO_MODE_NONE;
+ }
++ else if (! strcmp (argv[i], "-use-gold"))
++ selected_linker = GOLD_LINKER;
++ else if (! strcmp (argv[i], "-use-ld"))
++ selected_linker = BFD_LINKER;
++
+ #ifdef COLLECT_EXPORT_LIST
+ /* since -brtl, -bexport, -b64 are not position dependent
+ also check for them here */
+@@ -1299,36 +1319,109 @@
+ /* Try to discover a valid linker/nm/strip to use. */
+
+ /* Maybe we know the right file to use (if not cross). */
+- ld_file_name = 0;
++ ld_file_name = NULL;
+ #ifdef DEFAULT_LINKER
+ if (access (DEFAULT_LINKER, X_OK) == 0)
+ ld_file_name = DEFAULT_LINKER;
+- if (ld_file_name == 0)
++ if (ld_file_name == NULL)
+ #endif
+ #ifdef REAL_LD_FILE_NAME
+ ld_file_name = find_a_file (&path, REAL_LD_FILE_NAME);
+- if (ld_file_name == 0)
++ if (ld_file_name == NULL)
+ #endif
+ /* Search the (target-specific) compiler dirs for ld'. */
+ ld_file_name = find_a_file (&cpath, real_ld_suffix);
+ /* Likewise for `collect-ld'. */
+- if (ld_file_name == 0)
++ if (ld_file_name == NULL)
+ ld_file_name = find_a_file (&cpath, collect_ld_suffix);
+ /* Search the compiler directories for `ld'. We have protection against
+ recursive calls in find_a_file. */
+- if (ld_file_name == 0)
+- ld_file_name = find_a_file (&cpath,
+- use_plugin
+- ? plugin_ld_suffix
+- : ld_suffix);
++ if (ld_file_name == NULL)
++ switch (selected_linker)
++ {
++ default:
++ case DFLT_LINKER:
++ ld_file_name = find_a_file (&cpath, ld_suffix);
++ break;
++ case PLUGIN_LINKER:
++ ld_file_name = find_a_file (&cpath, plugin_ld_suffix);
++ break;
++ case GOLD_LINKER:
++ ld_file_name = find_a_file (&cpath, gold_suffix);
++ break;
++ case BFD_LINKER:
++ ld_file_name = find_a_file (&cpath, bfd_ld_suffix);
++ break;
++ }
+ /* Search the ordinary system bin directories
+ for `ld' (if native linking) or `TARGET-ld' (if cross). */
+- if (ld_file_name == 0)
+- ld_file_name = find_a_file (&path,
+- use_plugin
+- ? full_plugin_ld_suffix
+- : full_ld_suffix);
++ if (ld_file_name == NULL)
++ switch (selected_linker)
++ {
++ default:
++ case DFLT_LINKER:
++ ld_file_name = find_a_file (&path, full_ld_suffix);
++ break;
++ case PLUGIN_LINKER:
++ ld_file_name = find_a_file (&path, full_plugin_ld_suffix);
++ break;
++ case GOLD_LINKER:
++ ld_file_name = find_a_file (&path, full_gold_suffix);
++ break;
++ case BFD_LINKER:
++ ld_file_name = find_a_file (&path, full_bfd_ld_suffix);
++ break;
++ }
++ /* If we failed to find a plugin-capable linker, try the ordinary one. */
++ if (ld_file_name == NULL && selected_linker == PLUGIN_LINKER)
++ ld_file_name = find_a_file (&cpath, ld_suffix);
+
++ if ((vflag || debug) && ld_file_name == NULL)
++ {
++ struct prefix_list * p;
++ const char * s;
++
++ notice ("collect2: warning: unable to find linker.\n");
++
++#ifdef DEFAULT_LINKER
++ notice (" Searched for this absolute executable:\n");
++ notice (" %s\n", DEFAULT_LINKER);
++#endif
++
++ notice (" Searched in these paths:\n");
++ for (p = cpath.plist; p != NULL; p = p->next)
++ notice (" %s\n", p->prefix);
++ notice (" For these executables:\n");
++ notice (" %s\n", real_ld_suffix);
++ notice (" %s\n", collect_ld_suffix);
++ switch (selected_linker)
++ {
++ default:
++ case DFLT_LINKER: s = ld_suffix; break;
++ case PLUGIN_LINKER: s = plugin_ld_suffix; break;
++ case GOLD_LINKER: s = gold_suffix; break;
++ case BFD_LINKER: s = bfd_ld_suffix; break;
++ }
++ notice (" %s\n", s);
++
++ notice (" And searched in these paths:\n");
++ for (p = path.plist; p != NULL; p = p->next)
++ notice (" %s\n", p->prefix);
++ notice (" For these executables:\n");
++#ifdef REAL_LD_FILE_NAME
++ notice (" %s\n", REAL_LD_FILE_NAME);
++#endif
++ switch (selected_linker)
++ {
++ default:
++ case DFLT_LINKER: s = full_ld_suffix; break;
++ case PLUGIN_LINKER: s = full_plugin_ld_suffix; break;
++ case GOLD_LINKER: s = full_gold_suffix; break;
++ case BFD_LINKER: s = full_bfd_ld_suffix; break;
++ }
++ notice (" %s\n", s);
++ }
++
+ #ifdef REAL_NM_FILE_NAME
+ nm_file_name = find_a_file (&path, REAL_NM_FILE_NAME);
+ if (nm_file_name == 0)
diff --git a/debian/patches/illumos-fclone-functions.diff b/debian/patches/illumos-fclone-functions.diff
new file mode 100644
index 0000000..a3d3c04
--- /dev/null
+++ b/debian/patches/illumos-fclone-functions.diff
@@ -0,0 +1,80 @@
+From 30f4861499309bd81f1d59b41b1091fef0152680 Mon Sep 17 00:00:00 2001
+From: Richard Lowe <richlowe@richlowe.net>
+Date: Sun, 30 Sep 2012 16:44:14 -0400
+Subject: [PATCH] allow the global disabling of function cloning
+
+Optimizations which clone functions to create call-specific implementations
+which may be better optimized also dissociate these functions from their
+symbol names in ways harmful to tracing and debugging (since there are now
+several implementations of a single source symbol, quite possibly none of them
+having the actual source symbol name).
+
+This allows any function cloning to be disabled, and makes any such
+optimization ineffective, and our source safe for debuggers everywhere.
+
+See http://wiki.illumos.org/display/illumos/GCC+Modifications
+---
+ gcc/common.opt | 5 +++++
+ gcc/doc/invoke.texi | 11 ++++++++++-
+ gcc/tree-inline.c | 3 ++-
+ 3 files changed, 17 insertions(+), 2 deletions(-)
+
+Index: gcc-48/src/gcc/common.opt
+===================================================================
+--- gcc-48.orig/src/gcc/common.opt 2013-03-14 13:13:36.000000000 +0400
++++ gcc-48/src/gcc/common.opt 2013-11-07 13:09:27.760550425 +0400
+@@ -908,6 +908,11 @@
+ Common Report Var(flag_check_data_deps)
+ Compare the results of several data dependence analyzers.
+
++fclone-functions
++Common Report Var(flag_clone_functions) Init(1)
++Allow the compiler to clone functions to facilitate certain optimizations.
++Enabled by default.
++
+ fcombine-stack-adjustments
+ Common Report Var(flag_combine_stack_adjustments) Optimization
+ Looks for opportunities to reduce stack adjustments and stack references.
+Index: gcc-48/src/gcc/doc/invoke.texi
+===================================================================
+--- gcc-48.orig/src/gcc/doc/invoke.texi 2013-06-19 23:55:50.000000000 +0400
++++ gcc-48/src/gcc/doc/invoke.texi 2013-11-07 13:10:28.439356714 +0400
+@@ -357,7 +357,7 @@
+ -fbranch-target-load-optimize -fbranch-target-load-optimize2 @gol
+ -fbtr-bb-exclusive -fcaller-saves @gol
+ -fcheck-data-deps -fcombine-stack-adjustments -fconserve-stack @gol
+--fcompare-elim -fcprop-registers -fcrossjumping @gol
++-fcompare-elim -fclone-functions -fcprop-registers -fcrossjumping @gol
+ -fcse-follow-jumps -fcse-skip-blocks -fcx-fortran-rules @gol
+ -fcx-limited-range @gol
+ -fdata-sections -fdce -fdelayed-branch @gol
+@@ -8418,6 +8418,15 @@
+ change in future releases when linker plugin enabled environments become more
+ common.
+
++@item -fno-clone-functions
++@opindex fno-clone-functions
++Forbid the implicit cloning of functions implicit in certain
++optimizations. This also effectively will disable any optimization
++which wishes to clone functions, equivalent to each function having
++the ``noclone'' attribute. This allows the prevention of the
++dissociation of a piece of text from an intelligible and expected
++symbol name, which may hamper debugging and tracing.
++
+ @item -fcompare-elim
+ @opindex fcompare-elim
+ After register allocation and post-register allocation instruction splitting,
+Index: gcc-48/src/gcc/tree-inline.c
+===================================================================
+--- gcc-48.orig/src/gcc/tree-inline.c 2013-03-08 15:29:06.000000000 +0400
++++ gcc-48/src/gcc/tree-inline.c 2013-11-07 13:09:27.798801595 +0400
+@@ -4977,7 +4977,8 @@
+ tree_versionable_function_p (tree fndecl)
+ {
+ return (!lookup_attribute ("noclone", DECL_ATTRIBUTES (fndecl))
+- && copy_forbidden (DECL_STRUCT_FUNCTION (fndecl), fndecl) == NULL);
++ && (copy_forbidden (DECL_STRUCT_FUNCTION (fndecl), fndecl) == NULL)
++ && flag_clone_functions);
+ }
+
+ /* Delete all unreachable basic blocks and update callgraph.
diff --git a/debian/patches/illumos-multiarch.diff b/debian/patches/illumos-multiarch.diff
new file mode 100644
index 0000000..00fa9fc
--- /dev/null
+++ b/debian/patches/illumos-multiarch.diff
@@ -0,0 +1,15 @@
+Index: gcc-47/src/gcc/config/i386/t-sol2-64
+===================================================================
+--- gcc-47.orig/src/gcc/config/i386/t-sol2-64 2012-06-10 18:07:40.302980669 +0000
++++ gcc-47/src/gcc/config/i386/t-sol2-64 2012-06-10 18:12:10.873078450 +0000
+@@ -16,6 +16,7 @@
+ # along with GCC; see the file COPYING3. If not see
+ # <http://www.gnu.org/licenses/>.
+
+-MULTILIB_OPTIONS = m32/m64
+-MULTILIB_DIRNAMES = 32 amd64
+-MULTILIB_OSDIRNAMES = . amd64
++MULTILIB_OPTIONS = m64/m32
++MULTILIB_DIRNAMES = 64 32
++MULTILIB_OSDIRNAMES = m64=../lib$(call if_multiarch,:x86_64-illumos)
++MULTILIB_OSDIRNAMES+= m32=$(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)$(call if_multiarch,:i386-illumos)
diff --git a/debian/patches/illumos-pragma-align.diff b/debian/patches/illumos-pragma-align.diff
new file mode 100644
index 0000000..0c7873a
--- /dev/null
+++ b/debian/patches/illumos-pragma-align.diff
@@ -0,0 +1,46 @@
+Description: Allow #pragma align to be used after a variable is declared
+ GCC mandates that #pragma align precede any declaration, Sun C does not.
+ See http://wiki.illumos.org/display/illumos/GCC+Modifications
+
+Index: gcc-48/src/gcc/config/sol2-c.c
+===================================================================
+--- gcc-48.orig/src/gcc/config/sol2-c.c 2013-01-11 00:38:27.000000000 +0400
++++ gcc-48/src/gcc/config/sol2-c.c 2013-11-07 13:15:05.497438976 +0400
+@@ -113,8 +113,9 @@
+ {
+ tree decl = identifier_global_value (t);
+ if (decl && DECL_P (decl))
+- warning (0, "%<#pragma align%> must appear before the declaration of "
+- "%D, ignoring", decl);
++ decl_attributes (&decl, build_tree_list (get_identifier ("aligned"),
++ build_tree_list (NULL, x)),
++ 0);
+ else
+ solaris_pending_aligns = tree_cons (t, build_tree_list (NULL, x),
+ solaris_pending_aligns);
+Index: gcc-48/src/gcc/testsuite/gcc.dg/pragma-align-2.c
+===================================================================
+--- gcc-48.orig/src/gcc/testsuite/gcc.dg/pragma-align-2.c 2011-11-08 01:02:57.000000000 +0400
++++ gcc-48/src/gcc/testsuite/gcc.dg/pragma-align-2.c 2013-11-07 13:15:05.499487945 +0400
+@@ -26,9 +26,9 @@
+ #pragma align bad_align /* { dg-warning "malformed" } */
+ #pragma align 1(bad_align /* { dg-warning "malformed" } */
+
+-int x, x1, x2, x4, x8, y8, z8, x16, x32, x64, x128, y128, z128;
++int x1, x2, x4, x8, y8, z8, x16, y16, x32, x64, x128, y128, z128
+
+-#pragma align 16(x) /* { dg-warning "must appear before" } */
++#pragma align 16(y16)
+
+ int
+ main ()
+@@ -48,6 +48,9 @@
+ if (__alignof__ (x16) < 16)
+ abort ();
+
++ if (__alignof__ (y16) < 16)
++ abort ();
++
+ if (__alignof__ (x32) < 32)
+ abort ();
+
diff --git a/debian/patches/illumos-rdynamic.diff b/debian/patches/illumos-rdynamic.diff
new file mode 100644
index 0000000..2e3b83c
--- /dev/null
+++ b/debian/patches/illumos-rdynamic.diff
@@ -0,0 +1,29 @@
+Index: gcc-48/src/gcc/configure.ac
+===================================================================
+--- gcc-48.orig/src/gcc/configure.ac 2014-04-18 19:40:11.321832341 +0400
++++ gcc-48/src/gcc/configure.ac 2014-04-18 19:51:39.967711188 +0400
+@@ -5230,15 +5230,21 @@
+ : # No need to use a flag
+ AC_MSG_RESULT([yes])
+ else
+- AC_MSG_RESULT([yes])
+ AC_MSG_CHECKING([for -rdynamic])
+ ${CC} ${CFLAGS} ${LDFLAGS} -rdynamic conftest.c -o conftest$ac_exeext > /dev/null 2>&1
+ if $export_sym_check conftest$ac_exeext | grep -q foobar > /dev/null; then
+ plugin_rdynamic=yes
+ pluginlibs="-rdynamic"
+ else
+- plugin_rdynamic=no
+- enable_plugin=no
++ AC_MSG_CHECKING([for -Wl,-export-dynamic])
++ ${CC} ${CFLAGS} ${LDFLAGS} -Wl,-export-dynamic conftest.c -o conftest > /dev/null 2>&1
++ if $export_sym_check conftest | grep foobar > /dev/null; then
++ plugin_rdynamic=yes
++ pluginlibs="-Wl,-export-dynamic"
++ else
++ plugin_rdynamic=no
++ enable_plugin=no
++ fi
+ fi
+ AC_MSG_RESULT([$plugin_rdynamic])
+ fi
diff --git a/debian/patches/illumos-spec.diff b/debian/patches/illumos-spec.diff
new file mode 100644
index 0000000..0a4c076
--- /dev/null
+++ b/debian/patches/illumos-spec.diff
@@ -0,0 +1,51 @@
+Index: gcc-48/src/gcc/config/sol2.h
+===================================================================
+--- gcc-48.orig/src/gcc/config/sol2.h 2013-01-11 00:38:27.000000000 +0400
++++ gcc-48/src/gcc/config/sol2.h 2013-11-07 13:13:00.257045588 +0400
+@@ -114,16 +114,16 @@
+ #undef LIB_SPEC
+ #define LIB_SPEC \
+ "%{!symbolic:\
+- %{pthreads|pthread:-lpthread} \
++ %{pthreads|pthread:} \
+ %{pthreads|pthread|fprofile-generate*:" LIB_TLS_SPEC "} \
+- %{p|pg:-ldl} -lc}"
++ %{p|pg:} -lc}"
+
+ #ifndef CROSS_DIRECTORY_STRUCTURE
+ #undef MD_EXEC_PREFIX
+-#define MD_EXEC_PREFIX "/usr/ccs/bin/"
++#define MD_EXEC_PREFIX "/usr/bin/"
+
+ #undef MD_STARTFILE_PREFIX
+-#define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
++#define MD_STARTFILE_PREFIX "/usr/lib/"
+ #endif
+
+ #undef STARTFILE_ARCH32_SPEC
+@@ -153,9 +153,7 @@
+ #define LINK_ARCH32_SPEC_BASE \
+ "%{G:-G} \
+ %{YP,*} \
+- %{R*} \
+- %{!YP,*:%{p|pg:-Y P,%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/lib:%R/usr/lib} \
+- %{!p:%{!pg:-Y P,%R/usr/ccs/lib:%R/lib:%R/usr/lib}}}"
++ %{R*}"
+
+ #undef LINK_ARCH32_SPEC
+ #define LINK_ARCH32_SPEC LINK_ARCH32_SPEC_BASE
+Index: gcc-48/src/gcc/config/sol2-bi.h
+===================================================================
+--- gcc-48.orig/src/gcc/config/sol2-bi.h 2013-01-11 00:38:27.000000000 +0400
++++ gcc-48/src/gcc/config/sol2-bi.h 2013-11-07 13:13:00.258902250 +0400
+@@ -73,9 +73,7 @@
+ #define LINK_ARCH64_SPEC_BASE \
+ "%{G:-G} \
+ %{YP,*} \
+- %{R*} \
+- %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp/" ARCH64_SUBDIR ":%R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR "} \
+- %{!p:%{!pg:-Y P,%R/lib/" ARCH64_SUBDIR ":%R/usr/lib/" ARCH64_SUBDIR "}}}"
++ %{R*}"
+
+ #undef LINK_ARCH64_SPEC
+ #ifndef USE_GLD
diff --git a/debian/patches/illumos-strict-calling-conventions.diff b/debian/patches/illumos-strict-calling-conventions.diff
new file mode 100644
index 0000000..342f91f
--- /dev/null
+++ b/debian/patches/illumos-strict-calling-conventions.diff
@@ -0,0 +1,110 @@
+From: Richard Lowe <richlowe@richlowe.net>
+Date: Sat, 27 Oct 2012 02:44:09 +0100
+Subject: [PATCH] Implement -fstrict-calling-conventions
+
+Stock GCC is overly willing to violate the ABI when calling local functions,
+such that it passes arguments in registers on i386. This hampers debugging
+with anything other than a fully-aware DWARF debugger, and is generally not
+something we desire.
+
+Implement a flag which disables this behaviour, enabled by default. The flag is
+global, though only effective on i386, to more easily allow its globalization
+later which, given the odds, is likely to be necessary.
+
+See http://wiki.illumos.org/display/illumos/GCC+Modifications
+
+Index: gcc-48/src/gcc/common.opt
+===================================================================
+--- gcc-48.orig/src/gcc/common.opt 2014-04-18 19:51:49.854293922 +0400
++++ gcc-48/src/gcc/common.opt 2014-04-19 13:25:33.566648986 +0400
+@@ -1930,6 +1930,10 @@
+ Common Report Var(flag_strict_aliasing) Optimization
+ Assume strict aliasing rules apply
+
++fstrict-calling-conventions
++Common Report Var(flag_strict_calling_conventions) Init(1)
++Use strict ABI calling conventions even for static functions
++
+ fstrict-overflow
+ Common Report Var(flag_strict_overflow)
+ Treat signed overflow as undefined
+Index: gcc-48/src/gcc/config/i386/i386.c
+===================================================================
+--- gcc-48.orig/src/gcc/config/i386/i386.c 2014-04-18 19:39:46.504594693 +0400
++++ gcc-48/src/gcc/config/i386/i386.c 2014-04-19 13:28:34.056953493 +0400
+@@ -5176,6 +5176,7 @@
+ /* Use register calling convention for local functions when possible. */
+ if (decl
+ && TREE_CODE (decl) == FUNCTION_DECL
++ && (TARGET_64BIT || !flag_strict_calling_conventions)
+ /* Caller and callee must agree on the calling convention, so
+ checking here just optimize means that with
+ __attribute__((optimize (...))) caller could use regparm convention
+@@ -5258,8 +5259,9 @@
+
+ /* For local functions, pass up to SSE_REGPARM_MAX SFmode
+ (and DFmode for SSE2) arguments in SSE registers. */
+- if (decl && TARGET_SSE_MATH && optimize
+- && !(profile_flag && !flag_fentry))
++ if (decl && TARGET_SSE_MATH && optimize &&
++ (TARGET_64BIT || !flag_strict_calling_conventions) &&
++ !(profile_flag && !flag_fentry))
+ {
+ /* FIXME: remove this CONST_CAST when cgraph.[ch] is constified. */
+ struct cgraph_local_info *i = cgraph_local_info (CONST_CAST_TREE(decl));
+Index: gcc-48/src/gcc/doc/invoke.texi
+===================================================================
+--- gcc-48.orig/src/gcc/doc/invoke.texi 2014-04-18 19:51:49.889319972 +0400
++++ gcc-48/src/gcc/doc/invoke.texi 2014-04-19 13:25:33.904408477 +0400
+@@ -8034,6 +8034,12 @@
+ The @option{-fstrict-aliasing} option is enabled at levels
+ @option{-O2}, @option{-O3}, @option{-Os}.
+
++@item -fstrict-calling-conventions
++@opindex fstrict-calling-conventions
++Use strict ABI calling conventions even with local functions.
++This disable certain optimizations that may cause GCC to call local
++functions in a manner other than that described by the ABI.
++
+ @item -fstrict-overflow
+ @opindex fstrict-overflow
+ Allow the compiler to assume strict signed overflow rules, depending
+Index: gcc-48/src/gcc/testsuite/gcc.target/i386/local.c
+===================================================================
+--- gcc-48.orig/src/gcc/testsuite/gcc.target/i386/local.c 2012-02-27 23:18:23.000000000 +0400
++++ gcc-48/src/gcc/testsuite/gcc.target/i386/local.c 2014-04-19 13:25:33.941693684 +0400
+@@ -1,5 +1,6 @@
+ /* { dg-do compile } */
+-/* { dg-options "-O2 -funit-at-a-time" } */
++/* { dg-options "-O2 -funit-at-a-time -fno-strict-calling-conventions" { target ilp32 } } */
++/* { dg-options "-O2 -funit-at-a-time" { target lp64 } } */
+ /* { dg-final { scan-assembler "magic\[^\\n\]*eax" { target ia32 } } } */
+ /* { dg-final { scan-assembler "magic\[^\\n\]*(edi|ecx)" { target { ! { ia32 } } } } } */
+
+Index: gcc-48/src/gcc/testsuite/gcc.target/i386/strict-cc.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ gcc-48/src/gcc/testsuite/gcc.target/i386/strict-cc.c 2014-04-19 13:25:33.944559397 +0400
+@@ -0,0 +1,22 @@
++/* { dg-do compile { target { ilp32 } } } */
++/* { dg-options "-O2 -funit-at-a-time -fstrict-calling-conventions" } */
++/* { dg-final { scan-assembler "pushl.*\\\$1" } } */
++/* { dg-final { scan-assembler "pushl.*\\\$2" } } */
++/* { dg-final { scan-assembler "pushl.*\\\$3" } } */
++/* { dg-final { scan-assembler "pushl.*\\\$4" } } */
++/* { dg-final { scan-assembler "pushl.*\\\$5" } } */
++
++#include <stdio.h>
++
++/* Verify that local calling convention is not used if strict conventions. */
++static t(int, int, int, int, int) __attribute__ ((noinline));
++
++m()
++{
++ t(1, 2, 3, 4, 5);
++}
++
++static t(int a, int b, int c, int d, int e)
++{
++ printf("%d\n", a, b, c, d, e);
++}
diff --git a/debian/patches/illumos-use_libgcj_bc.diff b/debian/patches/illumos-use_libgcj_bc.diff
new file mode 100644
index 0000000..38fe1c7
--- /dev/null
+++ b/debian/patches/illumos-use_libgcj_bc.diff
@@ -0,0 +1,13 @@
+Index: gcc-48/src/libjava/configure.host
+===================================================================
+--- gcc-48.orig/src/libjava/configure.host 2012-03-14 20:33:37.000000000 +0400
++++ gcc-48/src/libjava/configure.host 2013-11-07 13:12:28.303282197 +0400
+@@ -393,7 +393,7 @@
+ esac
+
+ case "${host}" in
+- *linux*|*-kfreebsd*-gnu|*-gnu*)
++ *linux*|*-kfreebsd*-gnu|*-gnu*|*solaris*)
+ use_libgcj_bc=yes
+ ;;
+ *)
diff --git a/debian/patches/libgcc-no-limits-h.diff b/debian/patches/libgcc-no-limits-h.diff
new file mode 100644
index 0000000..8b6f04a
--- /dev/null
+++ b/debian/patches/libgcc-no-limits-h.diff
@@ -0,0 +1,67 @@
+# DP: Don't include <limits.h> in libgcc/libgcc2.c.
+
+2013-07-15 Matthias Klose <doko@ubuntu.com>
+
+ * libgcc2.c: Don't include <limits.h>.
+
+Index: libgcc/libgcc2.c
+===================================================================
+--- a/src/libgcc/libgcc2.c (revision 198927)
++++ b/src/libgcc/libgcc2.c (working copy)
+@@ -1674,18 +1674,6 @@
+ #endif
+
+ #if defined(L_fixunsxfsi) && LIBGCC2_HAS_XF_MODE
+-/* Reenable the normal types, in case limits.h needs them. */
+-#undef char
+-#undef short
+-#undef int
+-#undef long
+-#undef unsigned
+-#undef float
+-#undef double
+-#undef MIN
+-#undef MAX
+-#include <limits.h>
+-
+ UWtype
+ __fixunsxfSI (XFtype a)
+ {
+@@ -1696,18 +1684,6 @@
+ #endif
+
+ #if defined(L_fixunsdfsi) && LIBGCC2_HAS_DF_MODE
+-/* Reenable the normal types, in case limits.h needs them. */
+-#undef char
+-#undef short
+-#undef int
+-#undef long
+-#undef unsigned
+-#undef float
+-#undef double
+-#undef MIN
+-#undef MAX
+-#include <limits.h>
+-
+ UWtype
+ __fixunsdfSI (DFtype a)
+ {
+@@ -1718,18 +1694,6 @@
+ #endif
+
+ #if defined(L_fixunssfsi) && LIBGCC2_HAS_SF_MODE
+-/* Reenable the normal types, in case limits.h needs them. */
+-#undef char
+-#undef short
+-#undef int
+-#undef long
+-#undef unsigned
+-#undef float
+-#undef double
+-#undef MIN
+-#undef MAX
+-#include <limits.h>
+-
+ UWtype
+ __fixunssfSI (SFtype a)
+ {
diff --git a/debian/patches/libgo-explicit-reservation.diff b/debian/patches/libgo-explicit-reservation.diff
new file mode 100644
index 0000000..6fd761d
--- /dev/null
+++ b/debian/patches/libgo-explicit-reservation.diff
@@ -0,0 +1,150 @@
+# DP: Fix statically linked gccgo binaries on AArch64.
+
+Index: b/src/libgo/runtime/malloc.goc
+===================================================================
+--- a/src/libgo/runtime/malloc.goc
++++ b/src/libgo/runtime/malloc.goc
+@@ -339,12 +339,14 @@ runtime_mallocinit(void)
+ extern byte _end[];
+ byte *want;
+ uintptr limit;
++ bool is_reserved;
+
+ runtime_sizeof_C_MStats = sizeof(MStats);
+
+ p = nil;
+ arena_size = 0;
+ bitmap_size = 0;
++ is_reserved = false;
+
+ // for 64-bit build
+ USED(p);
+@@ -389,7 +391,8 @@ runtime_mallocinit(void)
+ // If this fails we fall back to the 32 bit memory mechanism
+ arena_size = MaxMem;
+ bitmap_size = arena_size / (sizeof(void*)*8/4);
+- p = runtime_SysReserve((void*)(0x00c0ULL<<32), bitmap_size + arena_size);
++ p = runtime_SysReserve((void*)(0x00c0ULL<<32), bitmap_size + arena_size, false);
++ is_reserved = false;
+ }
+ if (p == nil) {
+ // On a 32-bit machine, we can't typically get away
+@@ -428,7 +431,8 @@ runtime_mallocinit(void)
+ want = (byte*)(((uintptr)_end + (1<<18) + (1<<20) - 1)&~((1<<20)-1));
+ if(0xffffffff - (uintptr)want <= bitmap_size + arena_size)
+ want = 0;
+- p = runtime_SysReserve(want, bitmap_size + arena_size);
++ p = runtime_SysReserve(want, bitmap_size + arena_size, true);
++ is_reserved = true;
+ if(p == nil)
+ runtime_throw("runtime: cannot reserve arena virtual address space");
+ if((uintptr)p & (((uintptr)1<<PageShift)-1))
+@@ -441,6 +445,7 @@ runtime_mallocinit(void)
+ runtime_mheap->arena_start = p + bitmap_size;
+ runtime_mheap->arena_used = runtime_mheap->arena_start;
+ runtime_mheap->arena_end = runtime_mheap->arena_start + arena_size;
++ runtime_mheap->is_reserved = is_reserved;
+
+ // Initialize the rest of the allocator.
+ runtime_MHeap_Init(runtime_mheap, runtime_SysAlloc);
+@@ -462,12 +467,15 @@ runtime_MHeap_SysAlloc(MHeap *h, uintptr
+ byte *new_end;
+ uintptr needed;
+
++ if (!h->is_reserved) {
++ runtime_throw("runtime: cannot allocate memory");
++ }
+ needed = (uintptr)h->arena_used + n - (uintptr)h->arena_end;
+ // Round wanted arena size to a multiple of 256MB.
+ needed = (needed + (256<<20) - 1) & ~((256<<20)-1);
+ new_end = h->arena_end + needed;
+ if(new_end <= h->arena_start + MaxArena32) {
+- p = runtime_SysReserve(h->arena_end, new_end - h->arena_end);
++ p = runtime_SysReserve(h->arena_end, new_end - h->arena_end, true);
+ if(p == h->arena_end)
+ h->arena_end = new_end;
+ }
+@@ -475,7 +483,7 @@ runtime_MHeap_SysAlloc(MHeap *h, uintptr
+ if(n <= (uintptr)(h->arena_end - h->arena_used)) {
+ // Keep taking from our reservation.
+ p = h->arena_used;
+- runtime_SysMap(p, n);
++ runtime_SysMap(p, n, h->is_reserved);
+ h->arena_used += n;
+ runtime_MHeap_MapBits(h);
+ if(raceenabled)
+Index: b/src/libgo/runtime/malloc.h
+===================================================================
+--- a/src/libgo/runtime/malloc.h
++++ b/src/libgo/runtime/malloc.h
+@@ -177,8 +177,8 @@ struct MLink
+ void* runtime_SysAlloc(uintptr nbytes);
+ void runtime_SysFree(void *v, uintptr nbytes);
+ void runtime_SysUnused(void *v, uintptr nbytes);
+-void runtime_SysMap(void *v, uintptr nbytes);
+-void* runtime_SysReserve(void *v, uintptr nbytes);
++void runtime_SysMap(void *v, uintptr nbytes, bool do_reserve);
++void* runtime_SysReserve(void *v, uintptr nbytes, bool is_reserved);
+
+ // FixAlloc is a simple free-list allocator for fixed size objects.
+ // Malloc uses a FixAlloc wrapped around SysAlloc to manages its
+@@ -434,6 +434,7 @@ struct MHeap
+
+ FixAlloc spanalloc; // allocator for Span*
+ FixAlloc cachealloc; // allocator for MCache*
++ bool is_reserved; // is the all the address space for this heap actually reserved by us?
+ };
+ extern MHeap *runtime_mheap;
+
+Index: b/src/libgo/runtime/mem.c
+===================================================================
+--- a/src/libgo/runtime/mem.c
++++ b/src/libgo/runtime/mem.c
+@@ -110,7 +110,7 @@ runtime_SysFree(void *v, uintptr n)
+ }
+
+ void*
+-runtime_SysReserve(void *v, uintptr n)
++runtime_SysReserve(void *v, uintptr n, bool do_reserve)
+ {
+ int fd = -1;
+ void *p;
+@@ -130,7 +130,7 @@ runtime_SysReserve(void *v, uintptr n)
+ // much address space. Instead, assume that the reservation is okay
+ // if we can reserve at least 64K and check the assumption in SysMap.
+ // Only user-mode Linux (UML) rejects these requests.
+- if(sizeof(void*) == 8 && (uintptr)v >= 0xffffffffU) {
++ if(!do_reserve) {
+ p = mmap_fixed(v, 64<<10, PROT_NONE, MAP_ANON|MAP_PRIVATE, fd, 0);
+ if (p != v)
+ return nil;
+@@ -149,7 +149,7 @@ runtime_SysReserve(void *v, uintptr n)
+ }
+
+ void
+-runtime_SysMap(void *v, uintptr n)
++runtime_SysMap(void *v, uintptr n, bool is_reserved)
+ {
+ void *p;
+ int fd = -1;
+@@ -168,7 +168,7 @@ runtime_SysMap(void *v, uintptr n)
+ #endif
+
+ // On 64-bit, we don't actually have v reserved, so tread carefully.
+- if(sizeof(void*) == 8 && (uintptr)v >= 0xffffffffU) {
++ if(!is_reserved) {
+ p = mmap_fixed(v, n, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, fd, 0);
+ if(p == MAP_FAILED && errno == ENOMEM)
+ runtime_throw("runtime: out of memory");
+Index: b/src/libgo/runtime/mgc0.c
+===================================================================
+--- a/src/libgo/runtime/mgc0.c
++++ b/src/libgo/runtime/mgc0.c
+@@ -2479,6 +2479,6 @@ runtime_MHeap_MapBits(MHeap *h)
+ page_size = getpagesize();
+ n = (n+page_size-1) & ~(page_size-1);
+
+- runtime_SysMap(h->arena_start - n, n - h->bitmap_mapped);
++ runtime_SysMap(h->arena_start - n, n - h->bitmap_mapped, h->is_reserved);
+ h->bitmap_mapped = n;
+ }
diff --git a/debian/patches/libjava-testsuite.diff b/debian/patches/libjava-testsuite.diff
new file mode 100644
index 0000000..1f158e1
--- /dev/null
+++ b/debian/patches/libjava-testsuite.diff
@@ -0,0 +1,6 @@
+# DP: Mark libjava sourcelocation test as failing. PR libjava/55637
+
+--- a/src/libjava/testsuite/libjava.lang/sourcelocation.xfail
++++ b/src/libjava/testsuite/libjava.lang/sourcelocation.xfail
+@@ -0,0 +1 @@
++xfail-output
diff --git a/debian/patches/m68k-picflag.diff b/debian/patches/m68k-picflag.diff
new file mode 100644
index 0000000..841a9bd
--- /dev/null
+++ b/debian/patches/m68k-picflag.diff
@@ -0,0 +1,15 @@
+# DP: backport of trunk r204854
+# DP: fixes relocation errors when linking large libs (smokeqt, python-qt4)
+
+--- a/src/config/picflag.m4
++++ b/src/config/picflag.m4
+@@ -48,9 +48,6 @@ case "${$2}" in
+ i[[34567]]86-*-* | x86_64-*-*)
+ $1=-fpic
+ ;;
+- m68k-*-*)
+- $1=-fpic
+- ;;
+ # FIXME: Override -fPIC default in libgcc only?
+ sh-*-linux* | sh[[2346lbe]]*-*-linux*)
+ $1=-fpic
diff --git a/debian/patches/pr49847.diff b/debian/patches/pr49847.diff
new file mode 100644
index 0000000..eb33ab9
--- /dev/null
+++ b/debian/patches/pr49847.diff
@@ -0,0 +1,29 @@
+# DP: Proposed patch for PR rtl-optimization/49847 (cc0 targets).
+gcc/
+
+2012-02-26 Mikael Pettersson <mikpe@it.uu.se>
+
+ PR rtl-optimization/49847
+ * cse.c (fold_rtx) <case CC0>: If prev_insn_cc0 is zero
+ don't call equiv_constant on it.
+
+--- a/src/gcc/cse.c
++++ b/src/gcc/cse.c
+@@ -3194,9 +3194,14 @@ fold_rtx (rtx x, rtx insn)
+
+ #ifdef HAVE_cc0
+ case CC0:
+- folded_arg = prev_insn_cc0;
+- mode_arg = prev_insn_cc0_mode;
+- const_arg = equiv_constant (folded_arg);
++ if (!prev_insn_cc0)
++ const_arg = 0;
++ else
++ {
++ folded_arg = prev_insn_cc0;
++ mode_arg = prev_insn_cc0_mode;
++ const_arg = equiv_constant (folded_arg);
++ }
+ break;
+ #endif
+
diff --git a/debian/patches/pr57211.diff b/debian/patches/pr57211.diff
new file mode 100644
index 0000000..2d17310
--- /dev/null
+++ b/debian/patches/pr57211.diff
@@ -0,0 +1,69 @@
+# DP: Fix PR c++/57211, don't warn about unused parameters of defaulted functions.
+
+/cp
+2013-05-22 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/57211
+ * method.c (defaultable_fn_check): Avoid do_warn_unused_parameter
+ warnings about defaulted functions.
+
+/testsuite
+2013-05-22 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/57211
+ * g++.dg/cpp0x/Wunused-parm.C: New.
+
+Index: b/src/gcc/cp/method.c
+===================================================================
+--- a/src/gcc/cp/method.c
++++ b/src/gcc/cp/method.c
+@@ -1841,13 +1841,19 @@
+ }
+ else
+ {
+- tree t = FUNCTION_FIRST_USER_PARMTYPE (fn);
+- for (; t && t != void_list_node; t = TREE_CHAIN (t))
++ for (tree t = FUNCTION_FIRST_USER_PARMTYPE (fn);
++ t && t != void_list_node; t = TREE_CHAIN (t))
+ if (TREE_PURPOSE (t))
+ {
+ error ("defaulted function %q+D with default argument", fn);
+ break;
+ }
++
++ /* Avoid do_warn_unused_parameter warnings. */
++ for (tree p = FUNCTION_FIRST_USER_PARM (fn); p; p = DECL_CHAIN (p))
++ if (DECL_NAME (p))
++ TREE_NO_WARNING (p) = 1;
++
+ if (TYPE_BEING_DEFINED (DECL_CONTEXT (fn)))
+ /* Defer checking. */;
+ else if (!processing_template_decl)
+Index: b/src/gcc/testsuite/g++.dg/cpp0x/Wunused-parm.C
+===================================================================
+--- /dev/null
++++ b/src/gcc/testsuite/g++.dg/cpp0x/Wunused-parm.C
+@@ -0,0 +1,23 @@
++// PR c++/57211
++// { dg-options "-std=c++11 -Wunused-parameter" }
++
++template <class T> T&& move(T&);
++
++struct A
++{
++ struct B
++ {
++ B& operator=(B&&);
++ };
++
++ B f;
++
++ A& operator=(A&& p) = default;
++};
++
++int main()
++{
++ A a;
++ A b;
++ b = move(a);
++}
diff --git a/debian/patches/pr57363.diff b/debian/patches/pr57363.diff
new file mode 100644
index 0000000..32cb5e0
--- /dev/null
+++ b/debian/patches/pr57363.diff
@@ -0,0 +1,48 @@
+# DP: Fix PR libgcc/57363, taken from the trunk.
+
+libgcc/
+
+2013-12-03 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
+
+ * config/rs6000/ibm-ldouble.c (__gcc_qadd): Fix add
+ of normal number and qNaN to not raise an inexact exception.
+
+gcc/testsuite/
+
+2013-12-03 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
+
+ * gcc.target/powerpc/pr57363.c: New test.
+
+--- a/src/libgcc/config/rs6000/ibm-ldouble.c
++++ a/src/libgcc/config/rs6000/ibm-ldouble.c
+@@ -104,6 +104,8 @@
+
+ if (nonfinite (z))
+ {
++ if (fabs (z) != inf())
++ return z;
+ z = cc + aa + c + a;
+ if (nonfinite (z))
+ return z;
+--- a/src/gcc/testsuite/gcc.target/powerpc/pr57363.c
++++ a/src/gcc/testsuite/gcc.target/powerpc/pr57363.c
+@@ -0,0 +1,19 @@
++/* { dg-do run { target { powerpc*-*-linux* } } } */
++/* { dg-options "-mlong-double-128" } */
++
++/* Check if adding a qNAN and a normal long double does not generate a
++ inexact exception. */
++
++#define _GNU_SOURCE
++#include <fenv.h>
++
++int main(void)
++{
++ double x = __builtin_nan ("");
++ long double y = 1.1L;
++
++ feenableexcept (FE_INEXACT);
++ feclearexcept (FE_ALL_EXCEPT);
++ x = x + y;
++ return fetestexcept(FE_INEXACT);
++}
diff --git a/debian/patches/pr59744.diff b/debian/patches/pr59744.diff
new file mode 100644
index 0000000..4f9aedb
--- /dev/null
+++ b/debian/patches/pr59744.diff
@@ -0,0 +1,146 @@
+# DP: Fix PR target/59744 (AArch64), taken from the trunk.
+
+gcc/
+2014-01-10 Richard Earnshaw <rearnsha@arm.com>
+
+ PR target/59744
+ * aarch64-modes.def (CC_Zmode): New flags mode.
+ * aarch64.c (aarch64_select_cc_mode): Only allow NEG when the condition
+ represents an equality.
+ (aarch64_get_condition_code): Handle CC_Zmode.
+ * aarch64.md (compare_neg<mode>): Restrict to equality operations.
+
+gcc/testsuite/
+
+2014-01-10 Richard Earnshaw <rearnsha@arm.com>
+
+ PR target/59744
+ * gcc.target/aarch64/cmn-neg.c: Use equality comparisons.
+ * gcc.target/aarch64/cmn-neg2.c: New test.
+
+--- a/src/gcc/testsuite/gcc.target/aarch64/cmn-neg.c (revision 206528)
++++ b/src/gcc/testsuite/gcc.target/aarch64/cmn-neg.c (revision 206530)
+@@ -6,7 +6,7 @@
+ void __attribute__ ((noinline))
+ foo_s32 (int a, int b)
+ {
+- if (a < -b)
++ if (a == -b)
+ abort ();
+ }
+ /* { dg-final { scan-assembler "cmn\tw\[0-9\]" } } */
+@@ -14,7 +14,7 @@
+ void __attribute__ ((noinline))
+ foo_s64 (long long a, long long b)
+ {
+- if (a < -b)
++ if (a == -b)
+ abort ();
+ }
+ /* { dg-final { scan-assembler "cmn\tx\[0-9\]" } } */
+--- a/src/gcc/testsuite/gcc.target/aarch64/cmn-neg2.c (revision 0)
++++ b/src/gcc/testsuite/gcc.target/aarch64/cmn-neg2.c (revision 206530)
+@@ -0,0 +1,34 @@
++/* { dg-do run } */
++/* { dg-options "-O2 --save-temps" } */
++
++extern void abort (void);
++
++/* It's unsafe to use CMN in these comparisons. */
++
++void __attribute__ ((noinline))
++foo_s32 (int a, int b)
++{
++ if (a < -b)
++ abort ();
++}
++
++void __attribute__ ((noinline))
++foo_s64 (unsigned long long a, unsigned long long b)
++{
++ if (a > -b)
++ abort ();
++}
++
++
++int
++main (void)
++{
++ int a = 30;
++ int b = 42;
++ foo_s32 (a, b);
++ foo_s64 (a, b);
++ return 0;
++}
++/* { dg-final { scan-assembler-not "cmn\t" } } */
++
++/* { dg-final { cleanup-saved-temps } } */
+--- a/src/gcc/config/aarch64/aarch64.md (revision 206528)
++++ b/src/gcc/config/aarch64/aarch64.md (revision 206530)
+@@ -1250,8 +1250,8 @@
+ )
+
+ (define_insn "*compare_neg<mode>"
+- [(set (reg:CC_SWP CC_REGNUM)
+- (compare:CC_SWP
++ [(set (reg:CC_Z CC_REGNUM)
++ (compare:CC_Z
+ (neg:GPI (match_operand:GPI 0 "register_operand" "r"))
+ (match_operand:GPI 1 "register_operand" "r")))]
+ ""
+--- a/src/gcc/config/aarch64/aarch64-modes.def (revision 206528)
++++ b/src/gcc/config/aarch64/aarch64-modes.def (revision 206530)
+@@ -24,6 +24,7 @@
+ CC_MODE (CC_ZESWP); /* zero-extend LHS (but swap to make it RHS). */
+ CC_MODE (CC_SESWP); /* sign-extend LHS (but swap to make it RHS). */
+ CC_MODE (CC_NZ); /* Only N and Z bits of condition flags are valid. */
++CC_MODE (CC_Z); /* Only Z bit of condition flags is valid. */
+
+ /* Vector modes. */
+ VECTOR_MODES (INT, 8); /* V8QI V4HI V2SI. */
+--- a/src/gcc/config/aarch64/aarch64.c (revision 206528)
++++ b/src/gcc/config/aarch64/aarch64.c (revision 206530)
+@@ -3326,17 +3326,24 @@
+ || GET_CODE (x) == NEG))
+ return CC_NZmode;
+
+- /* A compare with a shifted or negated operand. Because of canonicalization,
++ /* A compare with a shifted operand. Because of canonicalization,
+ the comparison will have to be swapped when we emit the assembly
+ code. */
+ if ((GET_MODE (x) == SImode || GET_MODE (x) == DImode)
+ && (GET_CODE (y) == REG || GET_CODE (y) == SUBREG)
+ && (GET_CODE (x) == ASHIFT || GET_CODE (x) == ASHIFTRT
+ || GET_CODE (x) == LSHIFTRT
+- || GET_CODE (x) == ZERO_EXTEND || GET_CODE (x) == SIGN_EXTEND
+- || GET_CODE (x) == NEG))
++ || GET_CODE (x) == ZERO_EXTEND || GET_CODE (x) == SIGN_EXTEND))
+ return CC_SWPmode;
+
++ /* Similarly for a negated operand, but we can only do this for
++ equalities. */
++ if ((GET_MODE (x) == SImode || GET_MODE (x) == DImode)
++ && (GET_CODE (y) == REG || GET_CODE (y) == SUBREG)
++ && (code == EQ || code == NE)
++ && GET_CODE (x) == NEG)
++ return CC_Zmode;
++
+ /* A compare of a mode narrower than SI mode against zero can be done
+ by extending the value in the comparison. */
+ if ((GET_MODE (x) == QImode || GET_MODE (x) == HImode)
+@@ -3427,6 +3434,15 @@
+ }
+ break;
+
++ case CC_Zmode:
++ switch (comp_code)
++ {
++ case NE: return AARCH64_NE;
++ case EQ: return AARCH64_EQ;
++ default: gcc_unreachable ();
++ }
++ break;
++
+ default:
+ gcc_unreachable ();
+ break;
diff --git a/debian/patches/pr60034.diff b/debian/patches/pr60034.diff
new file mode 100644
index 0000000..86ba3b2
--- /dev/null
+++ b/debian/patches/pr60034.diff
@@ -0,0 +1,42 @@
+# DP: Fix PR target/60034 (AArch64), taken from the trunk.
+
+gcc/
+
+2014-03-31 Kugan Vivekanandarajah <kuganv@linaro.org>
+
+ PR target/60034
+ * aarch64/aarch64.c (aarch64_classify_address): Fix alignment for
+ section anchor.
+
+gcc/testsuite/
+
+2014-03-31 Kugan Vivekanandarajah <kuganv@linaro.org>
+
+ PR target/60034
+ * gcc.target/aarch64/pr60034.c: New file.
+
+--- a/src/gcc/testsuite/gcc.target/aarch64/pr60034.c
++++ b/src/gcc/testsuite/gcc.target/aarch64/pr60034.c
+@@ -0,0 +1,10 @@
++/* { dg-do compile } */
++/* { dg-options "-std=gnu99 -O" } */
++
++static unsigned long global_max_fast;
++
++void __libc_mallopt (int param_number, int value)
++{
++ __asm__ __volatile__ ("# %[_SDT_A21]" :: [_SDT_A21] "nor" ((global_max_fast)));
++ global_max_fast = 1;
++}
+--- a/src/gcc/config/aarch64/aarch64.c
++++ b/src/gcc/config/aarch64/aarch64.c
+@@ -3196,6 +3196,9 @@
+ }
+ else if (SYMBOL_REF_DECL (sym))
+ align = DECL_ALIGN (SYMBOL_REF_DECL (sym));
++ else if (SYMBOL_REF_HAS_BLOCK_INFO_P (sym)
++ && SYMBOL_REF_BLOCK (sym) != NULL)
++ align = SYMBOL_REF_BLOCK (sym)->alignment;
+ else
+ align = BITS_PER_UNIT;
+
diff --git a/debian/patches/pr61208-linaro.diff b/debian/patches/pr61208-linaro.diff
new file mode 100644
index 0000000..fd47ae9
--- /dev/null
+++ b/debian/patches/pr61208-linaro.diff
@@ -0,0 +1,30 @@
+# DP: Fix PR target/61208 (ARM) for the Linaro branch, taken from the trunk.
+
+Index: b/src/gcc/config/arm/arm.md
+===================================================================
+--- a/src/gcc/config/arm/arm.md
++++ b/src/gcc/config/arm/arm.md
+@@ -8480,8 +8480,8 @@
+
+ (define_insn_and_split "*arm_cmpdi_unsigned"
+ [(set (reg:CC_CZ CC_REGNUM)
+- (compare:CC_CZ (match_operand:DI 0 "s_register_operand" "l,r,r")
+- (match_operand:DI 1 "arm_di_operand" "Py,r,rDi")))]
++ (compare:CC_CZ (match_operand:DI 0 "s_register_operand" "l,r,r,r")
++ (match_operand:DI 1 "arm_di_operand" "Py,r,Di,rDi")))]
+
+ "TARGET_32BIT"
+ "#" ; "cmp\\t%R0, %R1\;it eq\;cmpeq\\t%Q0, %Q1"
+@@ -8501,9 +8501,9 @@
+ operands[1] = gen_lowpart (SImode, operands[1]);
+ }
+ [(set_attr "conds" "set")
+- (set_attr "enabled_for_depr_it" "yes,yes,no")
+- (set_attr "arch" "t2,t2,*")
+- (set_attr "length" "6,6,8")]
++ (set_attr "enabled_for_depr_it" "yes,yes,no,*")
++ (set_attr "arch" "t2,t2,t2,a")
++ (set_attr "length" "6,6,10,8")
+ )
+
+ (define_insn "*arm_cmpdi_zero"
diff --git a/debian/patches/pr61208-revert.diff b/debian/patches/pr61208-revert.diff
new file mode 100644
index 0000000..dc4d1da
--- /dev/null
+++ b/debian/patches/pr61208-revert.diff
@@ -0,0 +1,21 @@
+# DP: Revert the 4.8 version of the PR target/61208 (ARM) fix.
+
+--- a/src/gcc/config/arm/arm.md
++++ b/src/gcc/config/arm/arm.md
+@@ -7630,13 +7630,12 @@
+
+ (define_insn "*arm_cmpdi_unsigned"
+ [(set (reg:CC_CZ CC_REGNUM)
+- (compare:CC_CZ (match_operand:DI 0 "s_register_operand" "r,r")
+- (match_operand:DI 1 "arm_di_operand" "rDi,rDi")))]
++ (compare:CC_CZ (match_operand:DI 0 "s_register_operand" "r")
++ (match_operand:DI 1 "arm_di_operand" "rDi")))]
+ "TARGET_32BIT"
+ "cmp\\t%R0, %R1\;it eq\;cmpeq\\t%Q0, %Q1"
+ [(set_attr "conds" "set")
+- (set_attr "arch" "a,t2")
+- (set_attr "length" "8,10")]
++ (set_attr "length" "8")]
+ )
+
+ (define_insn "*arm_cmpdi_zero"
diff --git a/debian/rules.conf b/debian/rules.conf
index 1962574..6c77bf3 100644
--- a/debian/rules.conf
+++ b/debian/rules.conf
@@ -132,7 +132,7 @@ endef
base_deb_cpus := amd64 i386 alpha
base_deb_systems :=
$(foreach x,ada java java_plugin fortran libphobos libgc check locale,$(eval $(call gen_no_archs,$(x),$(base_deb_cpus),$(base_deb_systems))))
-linux_no_archs := !hurd-any !kfreebsd-any
+linux_no_archs := !hurd-any !kfreebsd-any !illumos-any
GCC_VERSION := $(strip $(shell cat $(firstword $(wildcard $(srcdir)/gcc/FULL-VER $(srcdir)/gcc/BASE-VER))))
NEXT_GCC_VERSION := $(shell echo $(GCC_VERSION) | \
@@ -248,6 +248,12 @@ else
LIBC_DEP ?= libuclibc
LIBC_DEV_DEP ?= libuclibc-dev
endif
+ ifeq ($(DEB_TARGET_ARCH_OS),illumos)
+ LIBC_DEP = libc1
+ libc_ver := 2.10+6
+ libc_dev_ver := 2.10+6
+ libc_dev := 2.10+6
+ endif
endif
LIBC_DEV_DEP = $(LIBC_DEP)-dev
# for cross
@@ -255,7 +261,7 @@ ifeq ($(DEB_CROSS),yes)
LIBC_DEP ?= $(LIBC_DEP)$(LS)$(AQ)
LIBC_DEV_DEP ?= $(LIBC_DEV_DEP)$(LS)$(AQ)
else
- LIBC_DBG_DEP = libc6.1-dbg [alpha ia64] | libc0.3-dbg [hurd-i386] | libc0.1-dbg [kfreebsd-i386 kfreebsd-amd64] | libc6-dbg,
+ LIBC_DBG_DEP = libc6.1-dbg [alpha ia64] | libc0.3-dbg [hurd-i386] | libc0.1-dbg [kfreebsd-i386 kfreebsd-amd64] | libc6-dbg [!illumos-any],
endif
# this is about Debian archs name, *NOT* GNU target triplet
@@ -266,6 +272,7 @@ biarch_deb_map := \
sparc=sparc64 sparc64=sparc\
s390=s390x s390x=s390 \
kfreebsd-amd64=i386 \
+ illumos-amd64=illumos-i386 \
armel=armhf \
armhf=armel
biarch_deb_arch := $(patsubst $(DEB_TARGET_ARCH)=%,%, \
@@ -320,10 +327,12 @@ LIBC_DEV_DEP := $(LIBC_DEV_DEP)$(LS)$(AQ) (>= $(libc_dev_ver))
# TODO: make this automatic, there must be a better way to define LIBC_DEP.
ifneq ($(DEB_CROSS),yes)
LIBC_BUILD_DEP = libc6.1-dev (>= $(libc_dev_ver)) [alpha ia64] | libc0.3-dev (>= $(libc_dev_ver)) [hurd-i386] | libc0.1-dev (>= $(libc_dev_ver)) [kfreebsd-i386 kfreebsd-amd64] | libc6-dev (>= $(libc_dev_ver))
+ LIBC_BUILD_DEP += | libc1-dev (>= $(libc_dev_ver)) [illumos-amd64]
ifeq (,$(filter $(distrelease),lenny etch squeeze dapper hardy jaunty karmic lucid maverick natty oneiric))
LIBC_BUILD_DEP += , libc6-dev (>= 2.13-31) [armel armhf]
endif
LIBC_BIARCH_BUILD_DEP = libc6-dev-amd64 [i386 x32], libc6-dev-sparc64 [sparc], libc6-dev-sparc [sparc64], libc6-dev-s390 [s390x], libc6-dev-s390x [s390], libc6-dev-i386 [amd64 x32], libc6-dev-powerpc [ppc64], libc6-dev-ppc64 [powerpc], libc0.1-dev-i386 [kfreebsd-amd64], lib32gcc1 [amd64 ppc64 kfreebsd-amd64 mipsn32 mipsn32el mips64 mips64el s390x sparc64 x32], libn32gcc1 [mips mipsel mips64 mips64el], lib64gcc1 [i386 mips mipsel mipsn32 mipsn32el powerpc sparc s390 x32], libc6-dev-mips64 [mips mipsel mipsn32 mipsn32el], libc6-dev-mipsn32 [mips mipsel mips64 mips64el], libc6-dev-mips32 [mipsn32 mipsn32el mips64 mips64el],
+ LIBC_BIARCH_BUILD_DEP += libc1-dev-illumos-i386 (>= $(libc_dev_ver)) [illumos-amd64],
ifneq (,$(findstring amd64,$(biarchx32archs)))
LIBC_BIARCH_BUILD_DEP += libc6-dev-x32 [amd64 i386], libx32gcc1 [amd64 i386],
endif
@@ -702,6 +711,9 @@ ifeq ($(with_libgomp),yes)
addons += $(if $(findstring armel,$(biarchhfarchs)),libhfgomp)
addons += $(if $(findstring armhf,$(biarchsfarchs)),libsfgomp)
endif
+ifeq ($(with_ssp),yes)
+ addons += libssp lib32ssp lib64ssp
+endif
ifeq ($(with_libitm),yes)
addons += libitm lib32itm lib64itm libn32itm
addons += $(if $(findstring amd64,$(biarchx32archs)),libx32itm)
diff --git a/debian/rules.defs b/debian/rules.defs
index 2d6d27f..639baac 100644
--- a/debian/rules.defs
+++ b/debian/rules.defs
@@ -639,6 +639,7 @@ ifeq ($(java_no_cross)-$(DEB_CROSS),yes-yes)
with_java := disabled for cross compiler package
endif
with_java := $(call envfilt, java, , c++, $(with_java))
+#with_java := disabled for a while on Dyson (FTBFS, due to Boehm GC)
ifeq ($(with_java)-$(with_separate_libgcj),yes-yes)
ifneq (,$(findstring gcj, $(PKGSOURCE)))
@@ -795,6 +796,10 @@ ifeq ($(with_base_only),yes)
with_d := no
endif
+ifeq ($(DEB_HOST_ARCH),illumos-amd64)
+ with_d := no
+endif
+
ifeq ($(with_d)-$(with_separate_gdc),yes-yes)
ifneq (,$(findstring gdc,$(PKGSOURCE)))
languages := c c++
@@ -1069,6 +1074,9 @@ GFDL_INVARIANT_FREE := yes
ifeq ($(derivative),Ubuntu)
GFDL_INVARIANT_FREE := no
endif
+ifeq ($(DEB_TARGET_ARCH_OS),illumos)
+ GFDL_INVARIANT_FREE := no
+endif
# -------------------------------------------------------------------
# non-extra config
@@ -1421,7 +1429,7 @@ define gen_biarch
export TARGET64_MACHINE
endif
endef
-biarch32archs := /amd64/ppc64/kfreebsd-amd64/s390x/sparc64/x32/mipsn32/mipsn32el/mips64/mips64el/
+biarch32archs := /amd64/ppc64/kfreebsd-amd64/s390x/sparc64/x32/mipsn32/mipsn32el/mips64/mips64el/illumos-amd64/
biarch64archs := /i386/powerpc/sparc/s390/mips/mipsel/mipsn32/mipsn32el/x32/
biarchn32archs := /mips/mipsel/mips64/mips64el/
ifeq ($(derivative),Ubuntu)
diff --git a/debian/rules.patch b/debian/rules.patch
index 8630d06..d6a83dc 100644
--- a/debian/rules.patch
+++ b/debian/rules.patch
@@ -310,6 +310,16 @@ debian_patches += fix-ffi_call_VFP-with-no-VFP-argument
# Ada patches needed for both the stable package and snapshot builds
debian_patches += ada-ppc64
+ifeq ($(DEB_TARGET_ARCH_OS), illumos)
+ debian_patches += illumos-multiarch
+ debian_patches += illumos-rdynamic
+ debian_patches += illumos-spec
+ debian_patches += illumos-use_libgcj_bc
+ debian_patches += illumos-pragma-align
+ debian_patches += illumos-fclone-functions
+ debian_patches += illumos-strict-calling-conventions
+endif
+
series_stamp = $(stampdir)/02-series-stamp
series: $(series_stamp)
$(series_stamp):
diff --git a/debian/rules2 b/debian/rules2
index f2f435f..649abf7 100644
--- a/debian/rules2
+++ b/debian/rules2
@@ -196,6 +196,15 @@ else
--enable-shared \
--enable-linker-build-id \
+ ifeq (illumos,$(DEB_TARGET_ARCH_OS))
+ CONFARGS += \
+ --enable-tls \
+ --enable-threads=posix \
+ --enable-libmudflap \
+ --with-gnu-as \
+ --with-gnu-ld
+ endif
+
ifneq ($(single_package),yes)
CONFARGS += \
--libexecdir=/$(libexecdir) \
@@ -494,7 +503,7 @@ ifeq ($(DEB_TARGET_ARCH_OS),linux)
endif
endif
-ifneq (,$(filter $(DEB_TARGET_ARCH), amd64 i386 kfreebsd-i386 kfreebsd-amd64))
+ifneq (,$(filter $(DEB_TARGET_ARCH), amd64 i386 kfreebsd-i386 kfreebsd-amd64 illumos-amd64))
ifneq (,$(filter $(derivative),Ubuntu))
ifneq (,$(filter $(distrelease),dapper hardy))
CONFARGS += --with-arch-32=i486
@@ -535,7 +544,7 @@ ifeq ($(DEB_TARGET_ARCH),lpia)
CONFARGS += --with-arch=pentium-m --with-tune=i586
endif
-ifneq (,$(filter $(DEB_TARGET_ARCH), amd64 i386 hurd-i386 kfreebsd-i386 kfreebsd-amd64))
+ifneq (,$(filter $(DEB_TARGET_ARCH), amd64 i386 hurd-i386 kfreebsd-i386 kfreebsd-amd64 illumos-amd64))
CONFARGS += --with-tune=generic
endif