From patchwork Tue Jan 3 22:47:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Li, Pan2 via Gcc-patches" X-Patchwork-Id: 62676 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E7F923858C2C for ; Tue, 3 Jan 2023 22:47:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E7F923858C2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672786049; bh=Fvj1nPmOPzt9828F19Xl49Hjoz3TAyZ+YD1mTpAQe60=; h=Subject:To:Cc:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=IhbxzNApaim7L2iE1aR7QdVOYyJQSptrDo1A8/BGoxv7VbORxtDvclqg+5TKwlwHN 7zKbCrkGEKMUVZFC4s+4eQCgeil9K16qdvvyFvMA3a+eo32GkOyRAwVGfUN3tMQ0jN 9aSdOSnWZsTYL08nwyN9l+B81t+Vxbh0aFxoX6bk= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x231.google.com (mail-lj1-x231.google.com [IPv6:2a00:1450:4864:20::231]) by sourceware.org (Postfix) with ESMTPS id 487C83858D20; Tue, 3 Jan 2023 22:46:35 +0000 (GMT) Received: by mail-lj1-x231.google.com with SMTP id f20so33577792lja.4; Tue, 03 Jan 2023 14:46:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:organization:date:cc:to:reply-to:from :subject:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Fvj1nPmOPzt9828F19Xl49Hjoz3TAyZ+YD1mTpAQe60=; b=jLZYff8m2dzBAJJGQNX5up3nOk/b0xGVrKi0LAD9lBWv0Baz21gWIuqTjmPhlWN9N5 ohpmYP3UgvFFXt7blpECHueHouxYFI6b7mI+6isb10TJbHMd+6rnx6qGW3D1hWCrdLUs tN/Sg5DyZGmWPFBl4be63q4TehWB5mA8lv+RX07fYo19ZEXWqqHbAEMhKKjsYcGpfODn 3EWWQ1Y/VfpgRnkDmHVmfdoPBdGNiYtPsIodw/eoKNvvTtKlzJYWujYHTi+zpXgw1SzG 5jbLCsLtZOJl9rwMkYr425a+oNDs/uyOKNHiLv1mRHtZ6aytna3nOg0x2Z3G8GHxdGyZ 7rsA== X-Gm-Message-State: AFqh2kr7Sv/wI46kTw2VNWTZfh2y5GhOe8IwmNgqc68pUyRl7mnVSgOu 65P+1Y74gqNqvKjBKV5pOFw= X-Google-Smtp-Source: AMrXdXt/j0IvG1z7qUkGs25/dyKdVnJJ1SChQM4IHWCizGh1uJ5K65rHZSja64UZbvj+O8zQNfZZkA== X-Received: by 2002:a2e:9b1a:0:b0:27f:df8f:7c8d with SMTP id u26-20020a2e9b1a000000b0027fdf8f7c8dmr4696337lji.47.1672785993474; Tue, 03 Jan 2023 14:46:33 -0800 (PST) Received: from G3620.lan (178-78-231-178.customers.ownit.se. [178.78.231.178]) by smtp.gmail.com with ESMTPSA id i16-20020a2ea370000000b00279a5b85791sm3661639ljn.88.2023.01.03.14.46.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Jan 2023 14:46:32 -0800 (PST) Message-ID: Subject: gcc-11: FTBFS on hurd-i386 To: Debian Bug Tracking System Cc: gcc-bugs@gcc.gnu.org, gcc-patches Date: Tue, 03 Jan 2023 23:47:20 +0100 Organization: Home User-Agent: Evolution 3.30.5-1.1 MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, URIBL_BLACK autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Svante Signell via Gcc-patches From: "Li, Pan2 via Gcc-patches" Reply-To: svante.signell@gmail.com Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Source: gcc-11 Version: 11.3.0-10 Severity: important Tags: patch User: debian-hurd@lists.debian.org Usertags: hurd Affects: gcc-11, gcc-snapshot X-Debbugs-CC: debian-hurd@lists.debian.org Hi, gcc-11-11.3.0-10 in sid FTBFS on hurd-i386 due to failing linkage of pthread_once (same error already fixed in gcc-12 and gcc-13): /<>/build/i686-gnu/libstdc++-v3/include/i686-gnu/bits/gthr- default.h:700: undefined reference to `pthread_once' and more. The patch at hand is: libstdc++-hurd.diff, attached here for convenience. Thanks! This is notably needed because in glibc 2.34, the move of pthread functions into libc.so happened for Linux only, not GNU/Hurd. The pthread_self() function can also always be used fine as it is on GNU/Hurd. libstdc++-v3/ChangeLog: * config/os/gnu-linux/os_defines.h [!__linux__] (_GLIBCXX_NATIVE_THREAD_ID, _GLIBCXX_GTHREAD_USE_WEAK): Do not define. --- a/libstdc++-v3/config/os/gnu-linux/os_defines.h +++ b/libstdc++-v3/config/os/gnu-linux/os_defines.h @@ -49,22 +49,24 @@ // version dynamically in case it has changed since libstdc++ was configured. #define _GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC __GLIBC_PREREQ(2,23) -#if __GLIBC_PREREQ(2, 27) -// Since glibc 2.27 pthread_self() is usable without linking to libpthread. -# define _GLIBCXX_NATIVE_THREAD_ID pthread_self() -#else +#ifdef __linux__ +# if __GLIBC_PREREQ(2, 27) +// Since glibc 2.27 Linux' pthread_self() is usable without linking to libpthread. +# define _GLIBCXX_NATIVE_THREAD_ID pthread_self() +# else // Before then it was in libc.so.6 but not libc.a, and always returns 0, // which breaks the invariant this_thread::get_id() != thread::id{}. // So only use it if we know the libpthread version is available. // Otherwise use (__gthread_t)1 as the ID of the main (and only) thread. -# define _GLIBCXX_NATIVE_THREAD_ID \ - (__gthread_active_p() ? __gthread_self() : (__gthread_t)1) -#endif +# define _GLIBCXX_NATIVE_THREAD_ID \ + (__gthread_active_p() ? __gthread_self() : (__gthread_t)1) +# endif -#if __GLIBC_PREREQ(2, 34) -// Since glibc 2.34 all pthreads functions are usable without linking to +# if __GLIBC_PREREQ(2, 34) +// Since glibc 2.34 all Linux pthreads functions are usable without linking to // libpthread. -# define _GLIBCXX_GTHREAD_USE_WEAK 0 +# define _GLIBCXX_GTHREAD_USE_WEAK 0 +# endif #endif #endif