From debbugs-submit-bounces@debbugs.gnu.org Sat May 04 18:02:39 2019 Received: (at submit) by debbugs.gnu.org; 4 May 2019 22:02:39 +0000 Received: from localhost ([127.0.0.1]:52542 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hN2jt-0006f5-6Z for submit@debbugs.gnu.org; Sat, 04 May 2019 18:02:39 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38147) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hN2jn-0006ej-Nj for submit@debbugs.gnu.org; Sat, 04 May 2019 18:02:33 -0400 Received: from lists.gnu.org ([209.51.188.17]:37991) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hN2ji-0000zM-7q for submit@debbugs.gnu.org; Sat, 04 May 2019 18:02:26 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hN2jg-0005qd-O4 for guix-patches@gnu.org; Sat, 04 May 2019 18:02:26 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_LOW, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hN2jf-0000xm-9V for guix-patches@gnu.org; Sat, 04 May 2019 18:02:24 -0400 Received: from mail-40132.protonmail.ch ([185.70.40.132]:18960) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hN2je-0000wS-OB for guix-patches@gnu.org; Sat, 04 May 2019 18:02:23 -0400 Date: Sat, 04 May 2019 22:02:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=carldong.me; s=protonmail; t=1557007340; bh=TfqCuorV8SDsBUY1SxiSZL4IvypQrdak5yxSSIZX3Y8=; h=Date:To:From:Reply-To:Subject:Feedback-ID:From; b=kEND20QW5wwT8UcdHilVcG31WCDTR9Y+5fVsNlsFzMF8eIO6AJqwGlSLzqvtQsqxD fmcmTTgVECYLie7829lGXe4It9oHE01tYGx0w1EYjC2SIxvNByEa+2K971r7q3dl8e TgLmHpaz0pjxJ5KrRozkCB1zxOJOITaIpgIXcWMQ= To: "guix-patches@gnu.org" From: Carl Dong Subject: [PATCH] gnu: gcc: Add 9.1.0. Message-ID: Feedback-ID: a8j8tDUaJ4AYuDVBywMTwsJebN4w8TVXadJLsJb8td3t3dZi9RdXFlPaQvoFKnI9KgXySsPXcRkajVyY0cGTcA==:Ext:ProtonMail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 185.70.40.132 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Carl Dong Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) * gnu/packages/gcc.scm (gcc-9): New variable. * gnu/packages/commencement.scm (gcc-toolchain-9): New variable. --- gnu/packages/commencement.scm | 3 + gnu/packages/gcc.scm | 14 +++ .../gcc-9-strmov-store-file-names.patch | 114 ++++++++++++++++++ 3 files changed, 131 insertions(+) create mode 100644 gnu/packages/patches/gcc-9-strmov-store-file-names.patc= h diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index b07630a54d..a8ec677cee 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -1085,4 +1085,7 @@ and binaries, plus debugging symbols in the @code{deb= ug} output), and Binutils." (define-public gcc-toolchain-8 (make-gcc-toolchain gcc-8)) +(define-public gcc-toolchain-9 + (make-gcc-toolchain gcc-9)) + ;;; commencement.scm ends here diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index b9a9583410..eefce2737b 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -519,6 +519,20 @@ It also includes runtime support libraries for these l= anguages."))) (patches (search-patches "gcc-8-strmov-store-file-names.patc= h" "gcc-5.0-libvtv-runpath.patch")))))= ) +(define-public gcc-9 + (package + (inherit gcc-8) + (version "9.1.0") + (source (origin + (method url-fetch) + (uri (string-append "mirror://gnu/gcc/gcc-" + version "/gcc-" version ".tar.xz")) + (sha256 + (base32 + "1817nc2bqdc251k0lpc51cimna7v68xjrnvqzvc50q3ax4s6i9kr")) + (patches (search-patches "gcc-9-strmov-store-file-names.patch" + "gcc-5.0-libvtv-runpath.patch")))))) + ;; Note: When changing the default gcc version, update ;; the gcc-toolchain-* definitions and the gfortran definition ;; accordingly. diff --git a/gnu/packages/patches/gcc-9-strmov-store-file-names.patch b/gnu= /packages/patches/gcc-9-strmov-store-file-names.patch new file mode 100644 index 0000000000..0c5d70491a --- /dev/null +++ b/gnu/packages/patches/gcc-9-strmov-store-file-names.patch @@ -0,0 +1,114 @@ +Make sure that statements such as: + + strcpy (dst, "/gnu/store/=E2=80=A6"); + +or + + static const char str[] =3D "/gnu/store/=E2=80=A6"; + =E2=80=A6 + strcpy (dst, str); + +do not result in chunked /gnu/store strings that are undetectable by +Guix's GC and its grafting code. See +and . + +diff --git a/gcc/builtins.c b/gcc/builtins.c +index d37d73fc4a0..dac33d9d29a 100644 +--- a/gcc/builtins.c ++++ b/gcc/builtins.c +@@ -3282,6 +3282,58 @@ determine_block_size (tree len, rtx len_rtx, + =09=09=09 GET_MODE_MASK (GET_MODE (len_rtx))); + } + ++extern void debug_tree (tree); ++ ++/* Return true if STR contains the string "/gnu/store". */ ++ ++bool ++store_reference_p (tree str) ++{ ++ if (getenv ("GUIX_GCC_DEBUG") !=3D NULL) ++ debug_tree (str); ++ ++ if (TREE_CODE (str) =3D=3D ADDR_EXPR) ++ str =3D TREE_OPERAND (str, 0); ++ ++ if (TREE_CODE (str) =3D=3D VAR_DECL ++ && TREE_STATIC (str) ++ && TREE_READONLY (str)) ++ { ++ /* STR may be a 'static const' variable whose initial value ++ is a string constant. See . */ ++ str =3D DECL_INITIAL (str); ++ if (str =3D=3D NULL_TREE) ++ return false; ++ } ++ ++ if (TREE_CODE (str) !=3D STRING_CST) ++ return false; ++ ++ int len; ++ const char *store; ++ ++ store =3D getenv ("NIX_STORE") ? getenv ("NIX_STORE") : "/gnu/store"; ++ len =3D strlen (store); ++ ++ /* Size of the hash part of store file names, including leading slash a= nd ++ trailing hyphen. */ ++ const int hash_len =3D 34; ++ ++ if (TREE_STRING_LENGTH (str) < len + hash_len) ++ return false; ++ ++ /* We cannot use 'strstr' because 'TREE_STRING_POINTER' returns a strin= g ++ that is not necessarily NUL-terminated. */ ++ ++ for (int i =3D 0; i < TREE_STRING_LENGTH (str) - (len + hash_len); i++) ++ { ++ if (strncmp (TREE_STRING_POINTER (str) + i, store, len) =3D=3D 0) ++=09return true; ++ } ++ ++ return false; ++} ++ + /* Try to verify that the sizes and lengths of the arguments to a string + manipulation function given by EXP are within valid bounds and that + the operation does not lead to buffer overflow or read past the end. +@@ -3839,6 +3891,13 @@ expand_builtin_memory_copy_args (tree dest, tree sr= c, tree len, + unsigned HOST_WIDE_INT max_size; + unsigned HOST_WIDE_INT probable_max_size; + ++ /* Do not emit block moves, which translate to the 'movabs' instruction= on ++ x86_64, when SRC refers to store items. That way, store references ++ remain visible to the Guix GC and grafting code. See ++ . */ ++ if (store_reference_p (src)) ++ return NULL_RTX; ++ + /* If DEST is not a pointer type, call the normal function. */ + if (dest_align =3D=3D 0) + return NULL_RTX; +diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c +index f30818042ee..56b592f9335 100644 +--- a/gcc/gimple-fold.c ++++ b/gcc/gimple-fold.c +@@ -656,6 +656,8 @@ var_decl_component_p (tree var) + =09 && TREE_CODE (TREE_OPERAND (inner, 0)) =3D=3D ADDR_EXPR)); + } + ++extern bool store_reference_p (tree); ++ + /* Return TRUE if the SIZE argument, representing the size of an + object, is in a range of values of which exactly zero is valid. */ + +@@ -748,6 +750,9 @@ gimple_fold_builtin_memory_op (gimple_stmt_iterator *g= si, + off0 =3D build_int_cst (build_pointer_type_for_mode (char_type_node= , + =09=09=09=09=09=09=09 ptr_mode, true), 0); + ++ if (store_reference_p (src)) ++ return false; ++ + /* If we can perform the copy efficiently with first doing all load= s + and then all stores inline it that way. Currently efficiently + =09 means that we can load all the memory into a single integer -- 2.21.0 From debbugs-submit-bounces@debbugs.gnu.org Sun May 05 10:33:12 2019 Received: (at 35568) by debbugs.gnu.org; 5 May 2019 14:33:12 +0000 Received: from localhost ([127.0.0.1]:54618 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hNICW-00067p-1R for submit@debbugs.gnu.org; Sun, 05 May 2019 10:33:12 -0400 Received: from mail1.protonmail.ch ([185.70.40.18]:39509) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hNICT-00067Z-6p for 35568@debbugs.gnu.org; Sun, 05 May 2019 10:33:10 -0400 Date: Sun, 05 May 2019 14:32:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=carldong.me; s=protonmail; t=1557066782; bh=+f8EpQeiFY43in+/0K3RMgRilhjCl6xpUJlGPt5ajYw=; h=Date:To:From:Reply-To:Subject:Feedback-ID:From; b=S4mZRGCImXdOp2zEHZJDkDePqoVtPmFWut9XMCwSLqtbyp7RT4Yq28hI1V6RrJNWx kf5R7bLN4bUe+JeHp1J60dZ1XNmSKttCVwscmTAaKY96Sab0+/RCvYsxucOIAHHbCw iUY05ke1QXNIlIIVSLNZeqxJDVamA4U1btMTWzqQ= To: "35568@debbugs.gnu.org" <35568@debbugs.gnu.org> From: Carl Dong Subject: [PATCH v2 1/3] gnu: gcc: Add 9.1.0. Message-ID: Feedback-ID: a8j8tDUaJ4AYuDVBywMTwsJebN4w8TVXadJLsJb8td3t3dZi9RdXFlPaQvoFKnI9KgXySsPXcRkajVyY0cGTcA==:Ext:ProtonMail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=7.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.protonmail.ch X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 35568 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Carl Dong Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/packages/gcc.scm (gcc-9): New variable. * gnu/packages/commencement.scm (gcc-toolchain-9): New variable. * gnu/packages/patches/gcc-9-strmov-store-file-names.patch: New file. * gnu/local.mk (dist_patch_DATA): Add the patch. --- gnu/local.mk | 1 + gnu/packages/commencement.scm | 3 + gnu/packages/gcc.scm | 14 +++ .../gcc-9-strmov-store-file-names.patch | 114 ++++++++++++++++++ 4 files changed, 132 insertions(+) create mode 100644 gnu/packages/patches/gcc-9-strmov-store-file-names.patc= h diff --git a/gnu/local.mk b/gnu/local.mk index a0f40d13ae..7363655f38 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -814,6 +814,7 @@ dist_patch_DATA =3D=09=09=09=09=09=09\ %D%/packages/patches/gcc-6-source-date-epoch-1.patch=09=09\ %D%/packages/patches/gcc-6-source-date-epoch-2.patch=09=09\ %D%/packages/patches/gcc-8-strmov-store-file-names.patch=09\ + %D%/packages/patches/gcc-9-strmov-store-file-names.patch=09\ %D%/packages/patches/gd-CVE-2018-5711.patch=09=09=09\ %D%/packages/patches/gd-CVE-2018-1000222.patch=09=09\ %D%/packages/patches/gd-CVE-2019-6977.patch=09=09=09\ diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index b07630a54d..a8ec677cee 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -1085,4 +1085,7 @@ and binaries, plus debugging symbols in the @code{deb= ug} output), and Binutils." (define-public gcc-toolchain-8 (make-gcc-toolchain gcc-8)) +(define-public gcc-toolchain-9 + (make-gcc-toolchain gcc-9)) + ;;; commencement.scm ends here diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index b9a9583410..eefce2737b 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -519,6 +519,20 @@ It also includes runtime support libraries for these l= anguages."))) (patches (search-patches "gcc-8-strmov-store-file-names.patc= h" "gcc-5.0-libvtv-runpath.patch")))))= ) +(define-public gcc-9 + (package + (inherit gcc-8) + (version "9.1.0") + (source (origin + (method url-fetch) + (uri (string-append "mirror://gnu/gcc/gcc-" + version "/gcc-" version ".tar.xz")) + (sha256 + (base32 + "1817nc2bqdc251k0lpc51cimna7v68xjrnvqzvc50q3ax4s6i9kr")) + (patches (search-patches "gcc-9-strmov-store-file-names.patch" + "gcc-5.0-libvtv-runpath.patch")))))) + ;; Note: When changing the default gcc version, update ;; the gcc-toolchain-* definitions and the gfortran definition ;; accordingly. diff --git a/gnu/packages/patches/gcc-9-strmov-store-file-names.patch b/gnu= /packages/patches/gcc-9-strmov-store-file-names.patch new file mode 100644 index 0000000000..0c5d70491a --- /dev/null +++ b/gnu/packages/patches/gcc-9-strmov-store-file-names.patch @@ -0,0 +1,114 @@ +Make sure that statements such as: + + strcpy (dst, "/gnu/store/=E2=80=A6"); + +or + + static const char str[] =3D "/gnu/store/=E2=80=A6"; + =E2=80=A6 + strcpy (dst, str); + +do not result in chunked /gnu/store strings that are undetectable by +Guix's GC and its grafting code. See +and . + +diff --git a/gcc/builtins.c b/gcc/builtins.c +index d37d73fc4a0..dac33d9d29a 100644 +--- a/gcc/builtins.c ++++ b/gcc/builtins.c +@@ -3282,6 +3282,58 @@ determine_block_size (tree len, rtx len_rtx, + =09=09=09 GET_MODE_MASK (GET_MODE (len_rtx))); + } + ++extern void debug_tree (tree); ++ ++/* Return true if STR contains the string "/gnu/store". */ ++ ++bool ++store_reference_p (tree str) ++{ ++ if (getenv ("GUIX_GCC_DEBUG") !=3D NULL) ++ debug_tree (str); ++ ++ if (TREE_CODE (str) =3D=3D ADDR_EXPR) ++ str =3D TREE_OPERAND (str, 0); ++ ++ if (TREE_CODE (str) =3D=3D VAR_DECL ++ && TREE_STATIC (str) ++ && TREE_READONLY (str)) ++ { ++ /* STR may be a 'static const' variable whose initial value ++ is a string constant. See . */ ++ str =3D DECL_INITIAL (str); ++ if (str =3D=3D NULL_TREE) ++ return false; ++ } ++ ++ if (TREE_CODE (str) !=3D STRING_CST) ++ return false; ++ ++ int len; ++ const char *store; ++ ++ store =3D getenv ("NIX_STORE") ? getenv ("NIX_STORE") : "/gnu/store"; ++ len =3D strlen (store); ++ ++ /* Size of the hash part of store file names, including leading slash a= nd ++ trailing hyphen. */ ++ const int hash_len =3D 34; ++ ++ if (TREE_STRING_LENGTH (str) < len + hash_len) ++ return false; ++ ++ /* We cannot use 'strstr' because 'TREE_STRING_POINTER' returns a strin= g ++ that is not necessarily NUL-terminated. */ ++ ++ for (int i =3D 0; i < TREE_STRING_LENGTH (str) - (len + hash_len); i++) ++ { ++ if (strncmp (TREE_STRING_POINTER (str) + i, store, len) =3D=3D 0) ++=09return true; ++ } ++ ++ return false; ++} ++ + /* Try to verify that the sizes and lengths of the arguments to a string + manipulation function given by EXP are within valid bounds and that + the operation does not lead to buffer overflow or read past the end. +@@ -3839,6 +3891,13 @@ expand_builtin_memory_copy_args (tree dest, tree sr= c, tree len, + unsigned HOST_WIDE_INT max_size; + unsigned HOST_WIDE_INT probable_max_size; + ++ /* Do not emit block moves, which translate to the 'movabs' instruction= on ++ x86_64, when SRC refers to store items. That way, store references ++ remain visible to the Guix GC and grafting code. See ++ . */ ++ if (store_reference_p (src)) ++ return NULL_RTX; ++ + /* If DEST is not a pointer type, call the normal function. */ + if (dest_align =3D=3D 0) + return NULL_RTX; +diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c +index f30818042ee..56b592f9335 100644 +--- a/gcc/gimple-fold.c ++++ b/gcc/gimple-fold.c +@@ -656,6 +656,8 @@ var_decl_component_p (tree var) + =09 && TREE_CODE (TREE_OPERAND (inner, 0)) =3D=3D ADDR_EXPR)); + } + ++extern bool store_reference_p (tree); ++ + /* Return TRUE if the SIZE argument, representing the size of an + object, is in a range of values of which exactly zero is valid. */ + +@@ -748,6 +750,9 @@ gimple_fold_builtin_memory_op (gimple_stmt_iterator *g= si, + off0 =3D build_int_cst (build_pointer_type_for_mode (char_type_node= , + =09=09=09=09=09=09=09 ptr_mode, true), 0); + ++ if (store_reference_p (src)) ++ return false; ++ + /* If we can perform the copy efficiently with first doing all load= s + and then all stores inline it that way. Currently efficiently + =09 means that we can load all the memory into a single integer -- 2.21.0 From debbugs-submit-bounces@debbugs.gnu.org Sun May 05 10:33:58 2019 Received: (at 35568) by debbugs.gnu.org; 5 May 2019 14:33:58 +0000 Received: from localhost ([127.0.0.1]:54621 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hNIDF-00068t-J6 for submit@debbugs.gnu.org; Sun, 05 May 2019 10:33:57 -0400 Received: from mail2.protonmail.ch ([185.70.40.22]:10612) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hNIDC-00068f-QB for 35568@debbugs.gnu.org; Sun, 05 May 2019 10:33:55 -0400 Date: Sun, 05 May 2019 14:33:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=carldong.me; s=protonmail; t=1557066828; bh=pfuoUIH6Udfw09nv+G3925XERI6yxMq5Zapq5q6HrHQ=; h=Date:To:From:Reply-To:Subject:Feedback-ID:From; b=FSEVSmPtaLDmtxZgLhKAFnCk5qWHLF/osL4re86BRMUNe45whaaV0Qc45kiUjMLTe k1AkpLamD55sy6yJlRCKcbsjiic/YKFQMYcOzTugz1Fm0vM9OFiDDsGCwBkAQpGe6k LFF8IUPatXkDiw4BdpH7CwzvAM+a7SL5gmYkGXls= To: "35568@debbugs.gnu.org" <35568@debbugs.gnu.org> From: Carl Dong Subject: [PATCH v2 2/3] gnu: cross-base: Apply gcc 8 patch to gcc >= 8. Message-ID: <8Pt5zdrxwg_AqFCKLXGQuW0e7ZIJiK1s_2rSJQPTCrbrvZ83d-9WTpYqWs1UAFeB6Gm3JfH9y-qqxbCx2oe4xYKFlZACVvgrrP_LZYn9dyQ=@carldong.me> Feedback-ID: a8j8tDUaJ4AYuDVBywMTwsJebN4w8TVXadJLsJb8td3t3dZi9RdXFlPaQvoFKnI9KgXySsPXcRkajVyY0cGTcA==:Ext:ProtonMail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=7.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.protonmail.ch X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 35568 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Carl Dong Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * gnu/packages/cross-base.scm (cross-gcc): Apply gcc 8 patch to gcc >=3D 8. * gnu/packages/patches/gcc-8-cross-environment-variables.patch: New file. * gnu/local.mk (dist_patch_DATA): Add the patch. --- gnu/local.mk | 1 + gnu/packages/cross-base.scm | 7 +- .../gcc-8-cross-environment-variables.patch | 67 +++++++++++++++++++ 3 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 gnu/packages/patches/gcc-8-cross-environment-variables.= patch diff --git a/gnu/local.mk b/gnu/local.mk index 7363655f38..847ebf677c 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -813,6 +813,7 @@ dist_patch_DATA =3D=09=09=09=09=09=09\ %D%/packages/patches/gcc-6-cross-environment-variables.patch=09\ %D%/packages/patches/gcc-6-source-date-epoch-1.patch=09=09\ %D%/packages/patches/gcc-6-source-date-epoch-2.patch=09=09\ + %D%/packages/patches/gcc-8-cross-environment-variables.patch=09\ %D%/packages/patches/gcc-8-strmov-store-file-names.patch=09\ %D%/packages/patches/gcc-9-strmov-store-file-names.patch=09\ %D%/packages/patches/gd-CVE-2018-5711.patch=09=09=09\ diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index bb3d6d916a..25caacb723 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm @@ -205,9 +205,10 @@ target that libc." (patches (append (origin-patches (package-source xgcc)) - (cons (if (version>=3D? (package-version xgcc) "6.0") - (search-patch "gcc-6-cross-environment-variables= .patch") - (search-patch "gcc-cross-environment-variables.p= atch")) + (cons (cond + ((version>=3D? (package-version xgcc) "8.0") (searc= h-patch "gcc-8-cross-environment-variables.patch")) + ((version>=3D? (package-version xgcc) "6.0") (searc= h-patch "gcc-6-cross-environment-variables.patch")) + (else (search-patch "gcc-cross-environment-variabl= es.patch"))) (cross-gcc-patches target)))) (modules '((guix build utils))) (snippet diff --git a/gnu/packages/patches/gcc-8-cross-environment-variables.patch b= /gnu/packages/patches/gcc-8-cross-environment-variables.patch new file mode 100644 index 0000000000..06309bdf9d --- /dev/null +++ b/gnu/packages/patches/gcc-8-cross-environment-variables.patch @@ -0,0 +1,67 @@ +Search path environment variables for cross-compilers. See the discussion +at . + +Note: Touch 'C_INCLUDE_PATH' et al. rather than 'CPATH', as discussed +at . + +diff --git a/gcc/gcc.c b/gcc/gcc.c +index a716f708259..dc7862f413a 100644 +--- a/gcc/gcc.c ++++ b/gcc/gcc.c +@@ -4342,7 +4342,7 @@ process_command (unsigned int decoded_options_count, + } + + temp =3D env.get (LIBRARY_PATH_ENV); +- if (temp && *cross_compile =3D=3D '0') ++ if (temp) + { + const char *startp, *endp; + char *nstore =3D (char *) alloca (strlen (temp) + 3); +diff --git a/gcc/incpath.c b/gcc/incpath.c +index b11c6a57939..a66a94a04e5 100644 +--- a/gcc/incpath.c ++++ b/gcc/incpath.c +@@ -472,8 +472,8 @@ register_include_chains (cpp_reader *pfile, const char= *sysroot, + =09=09=09 int stdinc, int cxx_stdinc, int verbose) + { + static const char *const lang_env_vars[] =3D +- { "C_INCLUDE_PATH", "CPLUS_INCLUDE_PATH", +- "OBJC_INCLUDE_PATH", "OBJCPLUS_INCLUDE_PATH" }; ++ { "CROSS_C_INCLUDE_PATH", "CROSS_CPLUS_INCLUDE_PATH", ++ "CROSS_OBJC_INCLUDE_PATH", "CROSS_OBJCPLUS_INCLUDE_PATH" }; + cpp_options *cpp_opts =3D cpp_get_options (pfile); + size_t idx =3D (cpp_opts->objc ? 2: 0); + +@@ -484,7 +484,7 @@ register_include_chains (cpp_reader *pfile, const char= *sysroot, + + /* CPATH and language-dependent environment variables may add to the + include chain. */ +- add_env_var_paths ("CPATH", INC_BRACKET); ++ add_env_var_paths ("CROSS_CPATH", INC_BRACKET); + add_env_var_paths (lang_env_vars[idx], INC_SYSTEM); + + target_c_incpath.extra_pre_includes (sysroot, iprefix, stdinc); +diff --git a/gcc/system.h b/gcc/system.h +index 4abc321c71d..d6186476024 100644 +--- a/gcc/system.h ++++ b/gcc/system.h +@@ -1209,4 +1209,6 @@ helper_const_non_const_cast (const char *p) + void qsort_chk (void *, size_t, size_t, int (*)(const void *, const void = *)); + #endif + ++#define LIBRARY_PATH_ENV "CROSS_LIBRARY_PATH" ++ + #endif /* ! GCC_SYSTEM_H */ +diff --git a/gcc/tlink.c b/gcc/tlink.c +index ec20bd2fa0f..cd17bdce004 100644 +--- a/gcc/tlink.c ++++ b/gcc/tlink.c +@@ -456,7 +456,7 @@ recompile_files (void) + file *f; + + putenv (xstrdup ("COMPILER_PATH=3D")); +- putenv (xstrdup ("LIBRARY_PATH=3D")); ++ putenv (xstrdup (LIBRARY_PATH_ENV "=3D")); + + while ((f =3D file_pop ()) !=3D NULL) + { -- 2.21.0 From debbugs-submit-bounces@debbugs.gnu.org Sun May 05 10:35:28 2019 Received: (at 35568) by debbugs.gnu.org; 5 May 2019 14:35:28 +0000 Received: from localhost ([127.0.0.1]:54626 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hNIEi-0006Bs-4A for submit@debbugs.gnu.org; Sun, 05 May 2019 10:35:28 -0400 Received: from mail-40132.protonmail.ch ([185.70.40.132]:11229) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hNIEg-0006Bd-Q2 for 35568@debbugs.gnu.org; Sun, 05 May 2019 10:35:27 -0400 Date: Sun, 05 May 2019 14:35:13 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=carldong.me; s=protonmail; t=1557066920; bh=rzW8kpms9lkqgMf+W0BUJUT1jRea3Tn/CdMz0w880t8=; h=Date:To:From:Reply-To:Subject:Feedback-ID:From; b=W6O3m1e6XwocmuyNwwX3Pk7540Ml5qbTuoWXuVoY4Ho7K6GTgjj3su0+BHaIrUdT1 8qculGaPKbICNSjtp0NDj1Tqefge3LuCfIXOkUEc/klQ6aBKRKDNV0QS05qe4DzX0Z FlkZgha6SOsMBYgjAmsLbI/FVl3+i7ufDj2CmlZk= To: "35568@debbugs.gnu.org" <35568@debbugs.gnu.org> From: Carl Dong Subject: [PATCH v2 3/3] gnu: gcc@9: Fix limits.h include for cross builds. Message-ID: Feedback-ID: a8j8tDUaJ4AYuDVBywMTwsJebN4w8TVXadJLsJb8td3t3dZi9RdXFlPaQvoFKnI9KgXySsPXcRkajVyY0cGTcA==:Ext:ProtonMail MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=7.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mail.protonmail.ch X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 35568 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Carl Dong Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) This allows us to supply gcc-9 as an optional argument to cross-gcc, successfully constructing gcc-9-based cross-compilers. * gnu/packages/gcc.scm (gcc-9)[source](patches): Add "gcc-9-asan-fix-limits-include.patch". * gnu/packages/patches/gcc-9-asan-fix-limits-include.patch: New file. * gnu/local.mk (dist_patch_DATA): Add the patch. --- gnu/local.mk | 1 + gnu/packages/gcc.scm | 1 + .../patches/gcc-9-asan-fix-limits-include.patch | 13 +++++++++++++ 3 files changed, 15 insertions(+) create mode 100644 gnu/packages/patches/gcc-9-asan-fix-limits-include.patc= h diff --git a/gnu/local.mk b/gnu/local.mk index 847ebf677c..f2e10a4e24 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -815,6 +815,7 @@ dist_patch_DATA =3D=09=09=09=09=09=09\ %D%/packages/patches/gcc-6-source-date-epoch-2.patch=09=09\ %D%/packages/patches/gcc-8-cross-environment-variables.patch=09\ %D%/packages/patches/gcc-8-strmov-store-file-names.patch=09\ + %D%/packages/patches/gcc-9-asan-fix-limits-include.patch=09\ %D%/packages/patches/gcc-9-strmov-store-file-names.patch=09\ %D%/packages/patches/gd-CVE-2018-5711.patch=09=09=09\ %D%/packages/patches/gd-CVE-2018-1000222.patch=09=09\ diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm index eefce2737b..50c58c1828 100644 --- a/gnu/packages/gcc.scm +++ b/gnu/packages/gcc.scm @@ -531,6 +531,7 @@ It also includes runtime support libraries for these la= nguages."))) (base32 "1817nc2bqdc251k0lpc51cimna7v68xjrnvqzvc50q3ax4s6i9kr")) (patches (search-patches "gcc-9-strmov-store-file-names.patch" + "gcc-9-asan-fix-limits-include.patch" "gcc-5.0-libvtv-runpath.patch")))))) ;; Note: When changing the default gcc version, update diff --git a/gnu/packages/patches/gcc-9-asan-fix-limits-include.patch b/gnu= /packages/patches/gcc-9-asan-fix-limits-include.patch new file mode 100644 index 0000000000..2f5ce7c697 --- /dev/null +++ b/gnu/packages/patches/gcc-9-asan-fix-limits-include.patch @@ -0,0 +1,13 @@ +diff --git a/libsanitizer/asan/asan_linux.cc b/libsanitizer/asan/asan_linu= x.cc +index d92d0596b7c..7926536a0c3 100644 +--- a/libsanitizer/asan/asan_linux.cc ++++ b/libsanitizer/asan/asan_linux.cc +@@ -30,7 +30,7 @@ + #include + #include + #include +-#include ++#include + #include + #include + #include -- 2.21.0 From debbugs-submit-bounces@debbugs.gnu.org Mon May 06 05:13:37 2019 Received: (at 35568-done) by debbugs.gnu.org; 6 May 2019 09:13:37 +0000 Received: from localhost ([127.0.0.1]:55708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hNZgn-00061R-3i for submit@debbugs.gnu.org; Mon, 06 May 2019 05:13:37 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48150) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hNZgl-00061D-Cu for 35568-done@debbugs.gnu.org; Mon, 06 May 2019 05:13:35 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:35685) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNZgf-0002lb-UV; Mon, 06 May 2019 05:13:29 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=47886 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hNZgf-0003Ct-ES; Mon, 06 May 2019 05:13:29 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Carl Dong Subject: Re: [bug#35568] [PATCH] gnu: gcc: Add 9.1.0. References: Date: Mon, 06 May 2019 11:13:28 +0200 In-Reply-To: (Carl Dong's message of "Sat, 04 May 2019 22:02:14 +0000") Message-ID: <87woj4kksn.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 35568-done Cc: 35568-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi Carl, I applied all 3 patches and just got gcc@9 built for x86_64. \o/ I didn=E2=80=99t build the GCC 9 cross-compilers but I don=E2=80=99t see an= ything fishy and you have enough interest in it that we=E2=80=99ll surely know if someth= ing breaks. ;-) Thank you! Ludo=E2=80=99. From unknown Mon Jun 23 16:45:51 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 03 Jun 2019 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator