summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2023-03-22 10:58:37 +0100
committerEugen Wissner <belka@caraus.de>2023-03-22 10:58:37 +0100
commitc7a527e0106295bb579716922f49c834fb3f9998 (patch)
tree211ed04cfde75f5586684dfe00cbc1a1e67b62a2
parent6b634b40557bd8401093dc67002b355e7de16d44 (diff)
downloadslackbuilder-c7a527e0106295bb579716922f49c834fb3f9998.tar.gz
gcc-latest: Added a patch for immutable structs
-rw-r--r--lib/download.rb6
-rwxr-xr-xprivate/gcc-latest/gcc-latest.SlackBuild15
-rw-r--r--private/gcc-latest/patches/gdc-immutable-struct.patch91
-rwxr-xr-xtest.sh1
4 files changed, 104 insertions, 9 deletions
diff --git a/lib/download.rb b/lib/download.rb
index 5b824f5..913fd86 100644
--- a/lib/download.rb
+++ b/lib/download.rb
@@ -43,11 +43,11 @@ module SlackBuilder
checksum
end
- def hosted_sources(absolute_url)
+ def self.hosted_sources(absolute_url)
CONFIG[:download_url] + absolute_url
end
- def remote_file_exists?(url)
+ def self.remote_file_exists?(url)
uri = URI hosted_sources(url)
request = Net::HTTP.new uri.host, uri.port
@@ -60,7 +60,7 @@ module SlackBuilder
def self.download_and_deploy(uri, tarball)
remote_path = tarball[tarball.index('/')..]
- if SlackBuilder.remote_file_exists?(remote_path)
+ if remote_file_exists?(remote_path)
uri = URI hosted_sources(remote_path)
return download(uri, "slackbuilds/#{tarball}").hexdigest
end
diff --git a/private/gcc-latest/gcc-latest.SlackBuild b/private/gcc-latest/gcc-latest.SlackBuild
index 3f67a91..eaa5fa8 100755
--- a/private/gcc-latest/gcc-latest.SlackBuild
+++ b/private/gcc-latest/gcc-latest.SlackBuild
@@ -30,7 +30,7 @@ cd $(dirname $0) ; CWD=$(pwd)
PRGNAM=gcc-latest
VERSION=${VERSION:-12.2.0}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PKGTYPE=${PKGTYPE:-tgz}
@@ -108,6 +108,7 @@ find -L . \
# Smite the fixincludes:
patch -p1 --verbose -i $CWD/patches/gcc-no_fixincludes.diff
+patch -p1 --verbose -i $CWD/patches/gdc-immutable-struct.patch
mkdir ../objdir
cd ../objdir
@@ -124,7 +125,7 @@ fi
--mandir=/usr/man \
--infodir=/usr/info \
--enable-shared \
- --disable-bootstrap \
+ --enable-bootstrap \
--enable-languages=c,c++,d \
--enable-threads=posix \
--enable-checking=release \
@@ -141,11 +142,14 @@ fi
--disable-install-libiberty \
--disable-werror \
--with-gcc-major-version-only \
+ --with-gnu-ld \
--with-isl \
--program-suffix=-12 \
+ --enable-version-specific-runtime-libs \
--with-arch-directory=$LIB_ARCH \
--disable-gtktest \
--enable-clocale=gnu \
+ --enable-libphobos \
$GCC_ARCHOPTS \
--target=${TARGET} \
--build=${TARGET} \
@@ -156,13 +160,12 @@ make install-strip DESTDIR=$PKG
rm $PKG/usr/lib${LIBDIRSUFFIX}/*.la
-mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/gcc-12
mkdir -p $PKG/usr/share/gdb/auto-load/usr/lib$LIBDIRSUFFIX
-mv $PKG/usr/lib$LIBDIRSUFFIX/*-gdb.py \
+mv $PKG/usr/lib$LIBDIRSUFFIX/gcc/$TARGET/12/*-gdb.py \
$PKG/usr/share/gdb/auto-load/usr/lib$LIBDIRSUFFIX/
-mv $PKG/usr/lib${LIBDIRSUFFIX}/*.{a,o,spec,so*} \
- $PKG/usr/lib${LIBDIRSUFFIX}/gcc-12
+mv $PKG/usr/lib${LIBDIRSUFFIX}/*.so* \
+ $PKG/usr/lib$LIBDIRSUFFIX/gcc/$TARGET/12/
cd ../gcc-$VERSION
diff --git a/private/gcc-latest/patches/gdc-immutable-struct.patch b/private/gcc-latest/patches/gdc-immutable-struct.patch
new file mode 100644
index 0000000..5c47aa7
--- /dev/null
+++ b/private/gcc-latest/patches/gdc-immutable-struct.patch
@@ -0,0 +1,91 @@
+From 2583365912c8700abe1f4a23ed611acb80fac09d Mon Sep 17 00:00:00 2001
+From: Iain Buclaw <ibuclaw@gdcproject.org>
+Date: Mon, 27 Feb 2023 20:46:18 +0100
+Subject: [PATCH] d: Fix ICE on explicit immutable struct import [PR108877]
+
+Const and immutable types are built as variants of the type they are
+derived from, and TYPE_STUB_DECL is not set for these variants.
+
+ PR d/108877
+
+gcc/d/ChangeLog:
+
+ * imports.cc (ImportVisitor::visit (EnumDeclaration *)): Call
+ make_import on TYPE_MAIN_VARIANT.
+ (ImportVisitor::visit (AggregateDeclaration *)): Likewise.
+ (ImportVisitor::visit (ClassDeclaration *)): Likewise.
+
+gcc/testsuite/ChangeLog:
+
+ * gdc.dg/imports/pr108877a.d: New test.
+ * gdc.dg/pr108877.d: New test.
+
+(cherry picked from commit ce1cea3e22f58bbddde017f8a92e59bae8892339)
+---
+ gcc/d/imports.cc | 7 ++++++-
+ gcc/testsuite/gdc.dg/imports/pr108877a.d | 6 ++++++
+ gcc/testsuite/gdc.dg/pr108877.d | 9 +++++++++
+ 3 files changed, 21 insertions(+), 1 deletion(-)
+ create mode 100644 gcc/testsuite/gdc.dg/imports/pr108877a.d
+ create mode 100644 gcc/testsuite/gdc.dg/pr108877.d
+
+diff --git a/gcc/d/imports.cc b/gcc/d/imports.cc
+index dfda2401ee8..6a59ef61b9c 100644
+--- a/gcc/d/imports.cc
++++ b/gcc/d/imports.cc
+@@ -106,12 +106,16 @@ public:
+ tree type = build_ctype (d->type);
+ /* Not all kinds of D enums create a TYPE_DECL. */
+ if (TREE_CODE (type) == ENUMERAL_TYPE)
+- this->result_ = this->make_import (TYPE_STUB_DECL (type));
++ {
++ type = TYPE_MAIN_VARIANT (type);
++ this->result_ = this->make_import (TYPE_STUB_DECL (type));
++ }
+ }
+
+ void visit (AggregateDeclaration *d)
+ {
+ tree type = build_ctype (d->type);
++ type = TYPE_MAIN_VARIANT (type);
+ this->result_ = this->make_import (TYPE_STUB_DECL (type));
+ }
+
+@@ -119,6 +123,7 @@ public:
+ {
+ /* Want the RECORD_TYPE, not POINTER_TYPE. */
+ tree type = TREE_TYPE (build_ctype (d->type));
++ type = TYPE_MAIN_VARIANT (type);
+ this->result_ = this->make_import (TYPE_STUB_DECL (type));
+ }
+
+diff --git a/gcc/testsuite/gdc.dg/imports/pr108877a.d b/gcc/testsuite/gdc.dg/imports/pr108877a.d
+new file mode 100644
+index 00000000000..a23c78ddf84
+--- /dev/null
++++ b/gcc/testsuite/gdc.dg/imports/pr108877a.d
+@@ -0,0 +1,6 @@
++immutable struct ImmutableS { }
++const struct ConstS { }
++immutable class ImmutableC { }
++const class ConstC { }
++immutable enum ImmutableE { _ }
++const enum ConstE { _ }
+diff --git a/gcc/testsuite/gdc.dg/pr108877.d b/gcc/testsuite/gdc.dg/pr108877.d
+new file mode 100644
+index 00000000000..710551f3f9a
+--- /dev/null
++++ b/gcc/testsuite/gdc.dg/pr108877.d
+@@ -0,0 +1,9 @@
++// { dg-options "-I $srcdir/gdc.dg" }
++// { dg-do compile }
++import imports.pr108877a :
++ ImmutableS,
++ ConstS,
++ ImmutableC,
++ ConstC,
++ ImmutableE,
++ ConstE;
+--
+2.31.1
+
diff --git a/test.sh b/test.sh
index 7d35d75..c436583 100755
--- a/test.sh
+++ b/test.sh
@@ -1,3 +1,4 @@
#!/bin/sh
bundle install
+bundle exec rubocop