From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A43973858D38; Wed, 27 Dec 2023 23:20:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A43973858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1703719258; bh=LVVCY6+bBaV9a/G/t4qNjyAe0oueuv0MhPzmhUblBiM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wlzzImtJKlhNsOx/MjWiEf41BJyw+VSLZh+U489pfq3NbABnT0W7pMUrRSnosgoQ/ FoC5NnRcVHihJxSV9b9XOzwRyAXyyC6irqPLZJl+zGKmBQ3MJ1wMJt1ao7HGJPIam9 Lq0UA8rjVuPGV52Bg193txoM/ot01bQyvqersDmg= From: "ian at airs dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug go/113143] Remove usage of ucontext.h Date: Wed, 27 Dec 2023 23:20:57 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: go X-Bugzilla-Version: 13.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ian at airs dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ian at airs dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D113143 --- Comment #10 from Ian Lance Taylor --- The makecontext/getcontext/setcontext functions are called by libgo on GNU/Linux for all targets other than x86_64. It is not the case that they = are used only on *BSD systems. The default gc implementation does not require these functions because it provides assembler code. This of course limits the gc implementation to on= ly support a limited number of targets: those for which the assembler code exi= sts. libgo is intended to be more portable. To be clear I am fine with removing or guarding references to ucontext.h wh= ere that makes sense. I'm just pointing out that the code can't in general wor= k if the *context functions are not available. It's unfortunate that POSIX remo= ved them without providing adequate replacements. Saying that they "can be replaced using POSIX threads functions" is simply false. They provide a portable mechanism for a userspace threads mechanism on top of POSIX thread= s.=20 Without them there is no way for libgo to implement goroutines efficiently.=