From 48320542ec96600fb08b572216c96607ce1ebc4c Mon Sep 17 00:00:00 2001 From: "Koenig, Joerg" Date: Tue, 19 May 2020 23:42:42 +0200 Subject: Updated to gcc 10.1.0 and patches Change-Id: I253657a009f03489aced8dde0ee4ab213221c107 --- Makefile | 2 +- PATCHES/0010-Fix-using-large-PCH.gcc10.patch | 121 +++++++++++++++++++++++++++ versions.mk.inc | 2 +- 3 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 PATCHES/0010-Fix-using-large-PCH.gcc10.patch diff --git a/Makefile b/Makefile index d4e76de..9a7c59d 100644 --- a/Makefile +++ b/Makefile @@ -160,7 +160,7 @@ prepare: patch -p1 < $(PATCHES_DIR)/0004-Windows-Use-not-in-progpath-and-leave-case-as-is.patch && \ patch -p1 < $(PATCHES_DIR)/0006-Windows-New-feature-to-allow-overriding.patch && \ patch -p1 < $(PATCHES_DIR)/0008-Prettify-linking-no-undefined.patch && \ - patch -p1 < $(PATCHES_DIR)/0010-Fix-using-large-PCH.patch + patch -p1 < $(PATCHES_DIR)/0010-Fix-using-large-PCH.gcc10.patch tar -zxf $(SOURCE_DIR)/gdb-$(VERSION_GDB).tar.gz -C $(UNPACK_DIR)/ cd $(UNPACK_DIR)/gdb-$(VERSION_GDB) && \ patch -p1 < $(PATCHES_DIR)/0004-Windows-Use-not-in-progpath-and-leave-case-as-is.patch diff --git a/PATCHES/0010-Fix-using-large-PCH.gcc10.patch b/PATCHES/0010-Fix-using-large-PCH.gcc10.patch new file mode 100644 index 0000000..0143af3 --- /dev/null +++ b/PATCHES/0010-Fix-using-large-PCH.gcc10.patch @@ -0,0 +1,121 @@ +diff -ruNb gcc-10.1.0.orig/gcc/config/i386/host-mingw32.c gcc-10.1.0/gcc/config/i386/host-mingw32.c +--- gcc-10.1.0.orig/gcc/config/i386/host-mingw32.c 2020-05-07 12:49:59.000000000 +0200 ++++ gcc-10.1.0/gcc/config/i386/host-mingw32.c 2020-05-19 23:31:44.749865244 +0200 +@@ -44,9 +44,6 @@ + + static inline void w32_error(const char*, const char*, int, const char*); + +-/* FIXME: Is this big enough? */ +-static const size_t pch_VA_max_size = 128 * 1024 * 1024; +- + /* Granularity for reserving address space. */ + static size_t va_granularity = 0x10000; + +@@ -88,9 +85,6 @@ + mingw32_gt_pch_get_address (size_t size, int) + { + void* res; +- size = (size + va_granularity - 1) & ~(va_granularity - 1); +- if (size > pch_VA_max_size) +- return NULL; + + /* FIXME: We let system determine base by setting first arg to NULL. + Allocating at top of available address space avoids unnecessary +@@ -100,7 +94,7 @@ + If we allocate at bottom we need to reserve the address as early + as possible and at the same point in each invocation. */ + +- res = VirtualAlloc (NULL, pch_VA_max_size, ++ res = VirtualAlloc (NULL, size, + MEM_RESERVE | MEM_TOP_DOWN, + PAGE_NOACCESS); + if (!res) +@@ -150,7 +144,7 @@ + + /* Offset must be also be a multiple of allocation granularity for + this to work. We can't change the offset. */ +- if ((offset & (va_granularity - 1)) != 0 || size > pch_VA_max_size) ++ if ((offset & (va_granularity - 1)) != 0) + return -1; + + +diff -ruNb gcc-10.1.0.orig/gcc/ggc-common.c gcc-10.1.0/gcc/ggc-common.c +--- gcc-10.1.0.orig/gcc/ggc-common.c 2020-05-07 12:49:59.000000000 +0200 ++++ gcc-10.1.0/gcc/ggc-common.c 2020-05-19 23:39:22.033605708 +0200 +@@ -591,6 +591,8 @@ + size_t i; + struct mmap_info mmi; + int result; ++ long pch_tabs_off; ++ long pch_data_off; + + /* Delete any deletable objects. This makes ggc_pch_read much + faster, as it can be sure that no GCable objects remain other +@@ -600,19 +602,25 @@ + memset (rti->base, 0, rti->stride); + + /* Read in all the scalar variables. */ ++ /* We need to read tables after mapping, or fatal_error will ++ segfault when gt_pch_use_address returns -1. Skip them for now. */ ++ pch_tabs_off = ftell(f); ++ ++ /* Skip all the scalar variables. */ + for (rt = gt_pch_scalar_rtab; *rt; rt++) + for (rti = *rt; rti->base != NULL; rti++) +- if (fread (rti->base, rti->stride, 1, f) != 1) +- fatal_error (input_location, "cannot read PCH file: %m"); ++ if (fseek (f, rti->stride, SEEK_CUR) != 0) ++ fatal_error (input_location, "can%'t read PCH file: %m"); + + /* Read in all the global pointers, in 6 easy loops. */ ++ /* Skip all the global pointers. */ + for (rt = gt_ggc_rtab; *rt; rt++) + for (rti = *rt; rti->base != NULL; rti++) + for (i = 0; i < rti->nelt; i++) +- if (fread ((char *)rti->base + rti->stride * i, +- sizeof (void *), 1, f) != 1) +- fatal_error (input_location, "cannot read PCH file: %m"); ++ if (fseek (f, sizeof (void *), SEEK_CUR) != 0) ++ fatal_error (input_location, "can%'t read PCH file: %m"); + ++ /* mmi still has to be read now. */ + if (fread (&mmi, sizeof (mmi), 1, f) != 1) + fatal_error (input_location, "cannot read PCH file: %m"); + +@@ -624,11 +632,35 @@ + { + if (fseek (f, mmi.offset, SEEK_SET) != 0 + || fread (mmi.preferred_base, mmi.size, 1, f) != 1) +- fatal_error (input_location, "cannot read PCH file: %m"); ++ fatal_error (input_location, "can%'t read PCH file: %m"); ++ + } + else if (fseek (f, mmi.offset + mmi.size, SEEK_SET) != 0) + fatal_error (input_location, "cannot read PCH file: %m"); + ++ /* File mapping done, read tables now. */ ++ pch_data_off = ftell(f); ++ ++ if (fseek (f, pch_tabs_off, SEEK_SET) != 0) ++ fatal_error (input_location, "can%'t read PCH file: %m"); ++ ++ /* Read in all the scalar variables. */ ++ for (rt = gt_pch_scalar_rtab; *rt; rt++) ++ for (rti = *rt; rti->base != NULL; rti++) ++ if (fread (rti->base, rti->stride, 1, f) != 1) ++ fatal_error (input_location, "can%'t read PCH file: %m"); ++ ++ /* Read in all the global pointers, in 6 easy loops. */ ++ for (rt = gt_ggc_rtab; *rt; rt++) ++ for (rti = *rt; rti->base != NULL; rti++) ++ for (i = 0; i < rti->nelt; i++) ++ if (fread ((char *)rti->base + rti->stride * i, ++ sizeof (void *), 1, f) != 1) ++ fatal_error (input_location, "can%'t read PCH file: %m"); ++ ++ if (fseek (f, pch_data_off, SEEK_SET) != 0) ++ fatal_error (input_location, "can%'t read PCH file: %m"); ++ + ggc_pch_read (f, mmi.preferred_base); + + gt_pch_restore_stringpool (); diff --git a/versions.mk.inc b/versions.mk.inc index 6081f70..7c56751 100644 --- a/versions.mk.inc +++ b/versions.mk.inc @@ -1,7 +1,7 @@ SUITE = 1.6.0 VERSION_BINUTILS = 2.34 -VERSION_GCC = 9.3.0 +VERSION_GCC = 10.1.0 VERSION_MINGW = 7.0.0 VERSION_GMP = 6.2.0 VERSION_MPC = 1.1.0 -- cgit v0.12