GNU bug report logs -
#31976
[PATCH] gnu: Add gcc@8.
Previous Next
Reported by: Marius Bakke <mbakke <at> fastmail.com>
Date: Tue, 26 Jun 2018 11:25:01 UTC
Severity: normal
Tags: patch
Done: Marius Bakke <mbakke <at> fastmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 31976 in the body.
You can then email your comments to 31976 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#31976
; Package
guix-patches
.
(Tue, 26 Jun 2018 11:25:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Marius Bakke <mbakke <at> fastmail.com>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Tue, 26 Jun 2018 11:25:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* gnu/packages/patches/gcc-8-strmov-store-file-names.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/gcc.scm (gcc-8): New public variable.
---
gnu/local.mk | 1 +
gnu/packages/gcc.scm | 14 +++
.../gcc-8-strmov-store-file-names.patch | 110 ++++++++++++++++++
3 files changed, 125 insertions(+)
create mode 100644 gnu/packages/patches/gcc-8-strmov-store-file-names.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index 9d8947d55..516576d7f 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -705,6 +705,7 @@ dist_patch_DATA = \
%D%/packages/patches/gcc-6-cross-environment-variables.patch \
%D%/packages/patches/gcc-6-source-date-epoch-1.patch \
%D%/packages/patches/gcc-6-source-date-epoch-2.patch \
+ %D%/packages/patches/gcc-8-strmov-store-file-names.patch \
%D%/packages/patches/gcr-disable-failing-tests.patch \
%D%/packages/patches/gcr-fix-collection-tests-to-work-with-gpg-21.patch \
%D%/packages/patches/gd-CVE-2018-5711.patch \
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 5012d9a91..78ccd4738 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -515,6 +515,20 @@ Go. It also includes runtime support libraries for these languages.")
for several languages, including C, C++, Objective-C, Fortran, Ada, and Go.
It also includes runtime support libraries for these languages.")))
+(define-public gcc-8
+ (package
+ (inherit gcc-7)
+ (version "8.1.0")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://gnu/gcc/gcc-"
+ version "/gcc-" version ".tar.xz"))
+ (sha256
+ (base32
+ "0lxil8x0jjx7zbf90cy1rli650akaa6hpk8wk8s62vk2jbwnc60x"))
+ (patches (search-patches "gcc-8-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-8-strmov-store-file-names.patch b/gnu/packages/patches/gcc-8-strmov-store-file-names.patch
new file mode 100644
index 000000000..f8e6b951b
--- /dev/null
+++ b/gnu/packages/patches/gcc-8-strmov-store-file-names.patch
@@ -0,0 +1,110 @@
+Make sure that statements such as:
+
+ strcpy (dst, "/gnu/store/…");
+
+or
+
+ static const char str[] = "/gnu/store/…";
+ …
+ strcpy (dst, str);
+
+do not result in chunked /gnu/store strings that are undetectable by
+Guix's GC and its grafting code. See <https://bugs.gnu.org/24703>
+and <https://bugs.gnu.org/30395>.
+
+--- gcc-5.3.0/gcc/builtins.c 2016-10-18 10:50:46.080616285 +0200
++++ gcc-5.3.0/gcc/builtins.c 2016-11-09 15:26:43.693042737 +0100
+@@ -3012,6 +3012,58 @@ determine_block_size (tree len, rtx len_rtx,
+ 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") != NULL)
++ debug_tree (str);
++
++ if (TREE_CODE (str) == ADDR_EXPR)
++ str = TREE_OPERAND (str, 0);
++
++ if (TREE_CODE (str) == VAR_DECL
++ && TREE_STATIC (str)
++ && TREE_READONLY (str))
++ {
++ /* STR may be a 'static const' variable whose initial value
++ is a string constant. See <https://bugs.gnu.org/30395>. */
++ str = DECL_INITIAL (str);
++ if (str == NULL_TREE)
++ return false;
++ }
++
++ if (TREE_CODE (str) != STRING_CST)
++ return false;
++
++ int len;
++ const char *store;
++
++ store = getenv ("NIX_STORE") ? getenv ("NIX_STORE") : "/gnu/store";
++ len = strlen (store);
++
++ /* Size of the hash part of store file names, including leading slash and
++ trailing hyphen. */
++ const int hash_len = 34;
++
++ if (TREE_STRING_LENGTH (str) < len + hash_len)
++ return false;
++
++ /* We cannot use 'strstr' because 'TREE_STRING_POINTER' returns a string
++ that is not necessarily NUL-terminated. */
++
++ for (int i = 0; i < TREE_STRING_LENGTH (str) - (len + hash_len); i++)
++ {
++ if (strncmp (TREE_STRING_POINTER (str) + i, store, len) == 0)
++ return 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.
+@@ -3605,6 +3657,13 @@ expand_builtin_memory_copy_args (tree dest, tree src, 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
++ <https://bugs.gnu.org/24703>. */
++ if (store_reference_p (src))
++ return NULL_RTX;
++
+ /* If DEST is not a pointer type, call the normal function. */
+ if (dest_align == 0)
+ return NULL_RTX;
+--- gcc-5.5.0/gcc/gimple-fold.c 2018-03-20 11:36:16.709442004 +0100
++++ gcc-5.5.0/gcc/gimple-fold.c 2018-03-20 11:46:43.838487065 +0100
+@@ -635,6 +635,8 @@ var_decl_component_p (tree var)
+ return SSA_VAR_P (inner);
+ }
+
++extern bool store_reference_p (tree);
++
+ /* If the SIZE argument representing the size of an object is in a range
+ of values of which exactly one is valid (and that is zero), return
+ true, otherwise false. */
+@@ -742,6 +744,9 @@ gimple_fold_builtin_memory_op (gimple_stmt_iterator *gsi,
+ off0 = build_int_cst (build_pointer_type_for_mode (char_type_node,
+ ptr_mode, true), 0);
+
++ if (store_reference_p (src))
++ return false;
++
+ /* If we can perform the copy efficiently with first doing all loads
+ and then all stores inline it that way. Currently efficiently
+ means that we can load all the memory into a single integer
--
2.18.0
Information forwarded
to
guix-patches <at> gnu.org
:
bug#31976
; Package
guix-patches
.
(Tue, 26 Jun 2018 14:06:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 31976 <at> debbugs.gnu.org (full text, mbox):
Marius Bakke <mbakke <at> fastmail.com> skribis:
> * gnu/packages/patches/gcc-8-strmov-store-file-names.patch: New file.
> * gnu/local.mk (dist_patch_DATA): Register it.
> * gnu/packages/gcc.scm (gcc-8): New public variable.
Woohoo! So I suppose ‘gcc-strmov-store-file-names.patch’ didn’t apply
as-is, right?
LGTM.
Thanks,
Ludo’.
Reply sent
to
Marius Bakke <mbakke <at> fastmail.com>
:
You have taken responsibility.
(Tue, 26 Jun 2018 15:29:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Marius Bakke <mbakke <at> fastmail.com>
:
bug acknowledged by developer.
(Tue, 26 Jun 2018 15:29:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 31976-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
ludo <at> gnu.org (Ludovic Courtès) writes:
> Marius Bakke <mbakke <at> fastmail.com> skribis:
>
>> * gnu/packages/patches/gcc-8-strmov-store-file-names.patch: New file.
>> * gnu/local.mk (dist_patch_DATA): Register it.
>> * gnu/packages/gcc.scm (gcc-8): New public variable.
>
> Woohoo! So I suppose ‘gcc-strmov-store-file-names.patch’ didn’t apply
> as-is, right?
Indeed, I had to rebase the patch (and included the fix from
core-updates while at it).
> LGTM.
Applied!
[signature.asc (application/pgp-signature, inline)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 25 Jul 2018 11:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 6 years and 324 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.