From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id 75DC03858D1E for ; Mon, 19 Dec 2022 12:42:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 75DC03858D1E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-x62f.google.com with SMTP id m18so21154364eji.5 for ; Mon, 19 Dec 2022 04:42:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=2U4fTak3AtjFIXpQg68pTSanBvssOuUIgCZj+ApnBtg=; b=QuH8CSCQ/ui0yzZpj3X41ZsNF3fNYEXGFA+yiFF00ldOewJhZYOVVj6fEE+dznAfJU Lm6QQ35f+drTZXkycKM19uo361vlqr6Gr8puR2bwCddkThYioMngNkA0gnpA9971FKdh 2NnDl7KmiC5nnGA/l3pfAekaEVmEmcpcYnXanDLGumgGiGb0EhZnr2HMykc/P0XKgmWd xeuPK0H4yo4h2eAI9Lo1dEwOGd5uG1WwK+ANxWMKk2IlDzbTCsNKkvnEvf9OvLIQbQYy RTeMCm8Unnb3ISqO3OToVrfvaAfF6vyNKy0GueqYFmzJyETRNU4QfRYmkSEoT47UOced RkXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2U4fTak3AtjFIXpQg68pTSanBvssOuUIgCZj+ApnBtg=; b=BhYXrUdkdypKfGJaLvQohuw9bMSFHSsJ7ZqUQxE4qZd6f1zNbaw3y6geE7RhDZhv4X 68rqdX63jKsTX/W2TA6+8t2/u9kE50YWzz3Wb7j5qYZjh6xW9r+/kggjvdO9hJEz7FYX BrzW29Y2/2LrCfQDNgxNCwTZpbx09SGXpUl1bclIs1nWWnQqY6FjlQQ38IQ1QcFNYAHS +vIa7H0q78rju69LH70GUV57pLoYbsHYl9qnOBd3Yd19vCILFnwTOS3Kzo4AmtHhGCPs +qVbj7pV77CGrFcLmTG9h0HIQ26Ap7VR9tMzKZHC/A1W3Xq9WoElgs8ARH/PflgBpTrN 1Mtg== X-Gm-Message-State: ANoB5pl2QwMHmVe4CI1IQnePK2zKbkkQRo4kCuAfT9w1jXBRlHqF7oRU SeTgHLKmYa8M8R4ceV1YcrchjzGCHLqXeEZpgSs= X-Google-Smtp-Source: AA0mqf5nZeE+HIxU2hSzVgKNjo/HhoxzYM50doAwha/anah/ETLwZ80Cw7QbG4CsawybSwboFPB5++ytJVp607AqdI8= X-Received: by 2002:a17:907:77ce:b0:7c0:8225:54d with SMTP id kz14-20020a17090777ce00b007c08225054dmr38210361ejc.286.1671453723258; Mon, 19 Dec 2022 04:42:03 -0800 (PST) MIME-Version: 1.0 References: <1e90020b-ee25-9841-4def-7d6be6d91cb5@embedded-brains.de> In-Reply-To: <1e90020b-ee25-9841-4def-7d6be6d91cb5@embedded-brains.de> From: Jonathan Wakely Date: Mon, 19 Dec 2022 12:41:52 +0000 Message-ID: Subject: Re: Why is there no libatomic default implementation using gthr.h? To: Sebastian Huber Cc: GCC Development Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Mon, 19 Dec 2022 at 11:19, Sebastian Huber wrote: > > Hello, > > I would like to fix the -fprofile-update=atomic implementation so that > it works on all targets. Currently, it works only on targets with 64-bit > atomic operations in hardware (and some special cases). I tried to fix > it like this: > > https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608620.html > > The problem with this patch is that it falls back to use functions > provided by libatomic. The libatomic is currently not supported on all > targets, for example: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77466 > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77378 > > Why is there no libatomic default implementation using gthr.h? > > The C++ library already depends on gthr.h and installs the headers in > "bits/gthr.h" etc. For this the libstdc++-v3 configure/Makefile > duplicates some logic from libgcc. Why is the gthr.h stuff not installed > by libgcc itself? Because libstdc++ installs a modified copy of the libgcc headers. Are those modifications suitable for all users of the libgcc version of the header? > > In libatomic, the POSIX implementation could be easily rewritten to use > the gthr interface. Why would that need gthr.h to be installed? The use of gthreads should be an internal implementation detail, not exposed as part of the libatomic API. > > Any objections to do the following? > > 1. Install gthr.h to "bits/gthr.h" by libgcc (including the other gthr > headers). > > 2. Remove the gthr configure/Makefile support from libstdc++-v3. I would be concerned by these two steps. > 3. Use gthr as the default implementation of libatomic. I have no objection to doing this, but I don't see why you need to touch libstdc++ to do it. Just make libatomic create its own copy of gthr.h (if a fallback gthreads-based implementation is actually needed) and compile that locally in the libatomic build dir. That shouldn't need changes to libgcc or libstdc++, should it?