Download raw body.
lang/gcc/11: fix GDC on amd64; with request for testing
ports@,
here a diff which fixes GDC on amd64.
I've tested it by compiling following code:
import std.stdio;
import std.range;
import std.algorithm;
import std.concurrency;
import core.thread;
void fiberFunction()
{
10.iota.each!(i => yield(i));
}
void threadFunction()
{
auto fiber = cast()receiveOnly!(shared(Generator!int));
writefln("worker: %(%s %)", fiber.take(5));
}
void main()
{
auto numbers = new Generator!int(&fiberFunction);
auto worker = spawn(&threadFunction);
writefln("main : %(%s %)", numbers.take(2));
worker.send(cast(shared)numbers);
thread_joinAll();
writefln("main : %(%s %)", numbers);
}
as:
11 $ egdc test.d && ./a.out
main : 0 1
worker: 2 3 4 5 6
main : 7 8 9
11 $
I interested in help of testing of this:
- on amd64 with IBT;
- on other archs.
I also looking for OK to commit it.
Index: Makefile
===================================================================
RCS file: /home/cvs/ports/lang/gcc/11/Makefile,v
diff -u -p -r1.57 Makefile
--- Makefile 10 Nov 2025 18:28:16 -0000 1.57
+++ Makefile 15 Nov 2025 00:24:00 -0000
@@ -15,7 +15,7 @@ USE_NOEXECONLY = Yes
V = 11.2.0
FULL_VERSION = $V
FULL_PKGVERSION = $V
-REVISION = 20
+REVISION = 21
ADASTRAP-amd64 = adastrap-amd64-$V-5.tar.xz
ADASTRAP-i386 = adastrap-i386-$V-4.tar.xz
Index: patches/patch-libphobos_libdruntime_config_x86_switchcontext_S
===================================================================
RCS file: patches/patch-libphobos_libdruntime_config_x86_switchcontext_S
diff -N patches/patch-libphobos_libdruntime_config_x86_switchcontext_S
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-libphobos_libdruntime_config_x86_switchcontext_S 15 Nov 2025 00:33:07 -0000
@@ -0,0 +1,41 @@
+Index: libphobos/libdruntime/config/x86/switchcontext.S
+--- libphobos/libdruntime/config/x86/switchcontext.S.orig
++++ libphobos/libdruntime/config/x86/switchcontext.S
+@@ -27,10 +27,10 @@ see the files COPYING3 and COPYING.RUNTIME respectivel
+ /* NB: Generate the CET marker for -fcf-protection. */
+ #ifdef __CET__
+ # include <cet.h>
++#else
++# define _CET_ENDBR
+ #endif
+
+-#if !defined(__CET__)
+-
+ # if defined(__ELF__)
+
+ # if defined(__i386__)
+@@ -41,6 +41,7 @@ see the files COPYING3 and COPYING.RUNTIME respectivel
+ .align 16
+ CSYM(fiber_switchContext):
+ .cfi_startproc
++ _CET_ENDBR
+ // save current stack state
+ push %ebp
+ mov %esp, %ebp
+@@ -77,6 +78,7 @@ CSYM(fiber_switchContext):
+ .align 16
+ CSYM(fiber_switchContext):
+ .cfi_startproc
++ _CET_ENDBR
+ // Save current stack state.save current stack state
+ push %rbp
+ mov %rsp, %rbp
+@@ -107,6 +109,8 @@ CSYM(fiber_switchContext):
+ # endif /* defined(__ELF__) && defined(__x86_64__) && !defined(__ILP32__) */
+
+ # endif /* defined(__ELF__) */
++
++#if !defined(__CET__)
+
+ # if defined(__MACH__)
+
Index: patches/patch-libphobos_libdruntime_core_stdc_stdio_d
===================================================================
RCS file: patches/patch-libphobos_libdruntime_core_stdc_stdio_d
diff -N patches/patch-libphobos_libdruntime_core_stdc_stdio_d
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-libphobos_libdruntime_core_stdc_stdio_d 15 Nov 2025 01:04:52 -0000
@@ -0,0 +1,162 @@
+https://github.com/dlang/dmd/commit/bbd2b459ce0ee84b6c29f020d8509aa096f7e405
+
+Index: libphobos/libdruntime/core/stdc/stdio.d
+--- libphobos/libdruntime/core/stdc/stdio.d.orig
++++ libphobos/libdruntime/core/stdc/stdio.d
+@@ -604,31 +605,7 @@ else version (OpenBSD)
+ ///
+ struct __sFILE
+ {
+- ubyte* _p;
+- int _r;
+- int _w;
+- short _flags;
+- short _file;
+- __sbuf _bf;
+- int _lbfsize;
+-
+- void* _cookie;
+- int function(void*) _close;
+- int function(void*, scope char*, int) _read;
+- fpos_t function(void*, fpos_t, int) _seek;
+- int function(void*, scope const char*, int) _write;
+-
+- __sbuf _ext;
+- ubyte* _up;
+- int _ur;
+-
+- ubyte[3] _ubuf;
+- ubyte[1] _nbuf;
+-
+- __sbuf _lb;
+-
+- int _blksize;
+- fpos_t _offset;
++ void* dummy;
+ }
+
+ ///
+@@ -1007,16 +989,22 @@ else version (OpenBSD)
+ _IONBF = 2,
+ }
+
+- private extern __gshared FILE[3] __sF;
+- @property auto __stdin()() { return &__sF[0]; }
+- @property auto __stdout()() { return &__sF[1]; }
+- @property auto __stderr()() { return &__sF[2]; }
++ struct __sFstub { long _stub; }
++
++ private extern shared __sFstub[1] __stdin;
++ private extern shared __sFstub[1] __stdout;
++ private extern shared __sFstub[1] __stderr;
++
++ @property auto __stdin1()() { return cast(FILE*)__stdin; }
++ @property auto __stdout1()() { return cast(FILE*)__stdout; }
++ @property auto __stderr1()() { return cast(FILE*)__stderr; }
++
+ ///
+- alias __stdin stdin;
++ alias __stdin1 stdin;
+ ///
+- alias __stdout stdout;
++ alias __stdout1 stdout;
+ ///
+- alias __stderr stderr;
++ alias __stderr1 stderr;
+ }
+ else version (DragonFlyBSD)
+ {
+@@ -1580,85 +1703,16 @@ else version (OpenBSD)
+ {
+ ///
+ void rewind(FILE*);
++ ///
++ pure void clearerr(FILE*);
++ ///
++ pure int feof(FILE*);
++ ///
++ pure int ferror(FILE*);
++ ///
++ int fileno(FILE*);
+ }
+- @trusted private
+- {
+- ///
+- pragma(mangle, "clearerr")
+- pure void __clearerr(FILE*);
+- ///
+- pragma(mangle, "feof")
+- pure int __feof(FILE*);
+- ///
+- pragma(mangle, "ferror")
+- pure int __ferror(FILE*);
+- ///
+- pragma(mangle, "fileno")
+- int __fileno(FILE*);
+- }
+
+- enum __SLBF = 0x0001;
+- enum __SNBF = 0x0002;
+- enum __SRD = 0x0004;
+- enum __SWR = 0x0008;
+- enum __SRW = 0x0010;
+- enum __SEOF = 0x0020;
+- enum __SERR = 0x0040;
+- enum __SMBF = 0x0080;
+- enum __SAPP = 0x0100;
+- enum __SSTR = 0x0200;
+- enum __SOPT = 0x0400;
+- enum __SNPT = 0x0800;
+- enum __SOFF = 0x1000;
+- enum __SMOD = 0x2000;
+- enum __SALC = 0x4000;
+- enum __SIGN = 0x8000;
+-
+- extern immutable __gshared int __isthreaded;
+-
+- extern (D) @trusted
+- {
+- void __sclearerr()(FILE* p)
+- {
+- p._flags = p._flags & ~(__SERR|__SEOF);
+- }
+-
+- int __sfeof()(FILE* p)
+- {
+- return (p._flags & __SEOF) != 0;
+- }
+-
+- int __sferror()(FILE* p)
+- {
+- return (p._flags & __SERR) != 0;
+- }
+-
+- int __sfileno()(FILE* p)
+- {
+- return p._file;
+- }
+-
+- pure void clearerr()(FILE* file)
+- {
+- !__isthreaded ? __sclearerr(file) : __clearerr(file);
+- }
+-
+- pure int feof()(FILE* file)
+- {
+- return !__isthreaded ? __sfeof(file) : __feof(file);
+- }
+-
+- pure int ferror()(FILE* file)
+- {
+- return !__isthreaded ? __sferror(file) : __ferror(file);
+- }
+-
+- int fileno()(FILE* file)
+- {
+- return !__isthreaded ? __sfileno(file) : __fileno(file);
+- }
+- }
+-
+ ///
+ pragma(printf)
+ int snprintf(scope char* s, size_t n, scope const char* format, scope const ...);
--
wbr, Kirill
lang/gcc/11: fix GDC on amd64; with request for testing