From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by sourceware.org (Postfix) with ESMTPS id EA6E13858D37 for ; Sat, 10 Oct 2020 20:18:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EA6E13858D37 Received: by mail-io1-xd2c.google.com with SMTP id b1so9023948iot.4 for ; Sat, 10 Oct 2020 13:18:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Afyh1zfE3IJTN4PEsbzgFPrrWZdBHK+QUK2R4sNFTvc=; b=j6akmN5HMkQyb/5MRwzbs0dILZzVCeSYQdCOFBndydRb7bx4l/rH/47W0hadUeIfjT M1sNbcQVlrE8LsxOGzhDRi4ZpBgzUzX4zR/51D1VOIMTZrDz45hIJVfRQBYgMY4magRk iwROoF7O8z5Yssj1NTLEQAmXUoclZ438XuQkNVfh2KlW9LUpCD5VH7mFiqNN2C9g7/Dt Y7GTqXMbQ0ba7t6eKHoSJ4058C0gdQMxktbvApOmPvCMWREA1k8JC+4CAk76UiqNg5ma QGJYAY2iBl+nVaXovv2F+3EOLiQ5mIzpVpTeqfvONP+QwsZPVPsxwXy/mWsq2ZOXBJh1 V9Aw== X-Gm-Message-State: AOAM531FHPrhsaR7nrvsgtJ4VPZR4dTXP8zbFXT0Y/NlGox1OUJJ3L4T Vewn39RyEnmAwoBLxlaxxiHCmeoGnUOH2cGtBP8= X-Google-Smtp-Source: ABdhPJwU/FGiUZoQX74a/95zUJ2RjPV7o6QKdqeifgliMDy5ZPk7zplGEm5LBO102g4b171pNaXHDpP7YQUJS4vneJ4= X-Received: by 2002:a5e:9913:: with SMTP id t19mr3182653ioj.95.1602361096470; Sat, 10 Oct 2020 13:18:16 -0700 (PDT) MIME-Version: 1.0 References: <945d5e74-b449-3746-6560-996d0437db76@hesbynett.no> <6cfc20a9-05c5-e2be-d9f0-d10911268b4a@hesbynett.no> In-Reply-To: <6cfc20a9-05c5-e2be-d9f0-d10911268b4a@hesbynett.no> From: Jonathan Wakely Date: Sat, 10 Oct 2020 21:18:05 +0100 Message-ID: Subject: Re: Atomic accesses on ARM microcontrollers To: David Brown Cc: gcc-help Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Oct 2020 20:18:18 -0000 On Sat, 10 Oct 2020 at 20:43, David Brown wrote: > Is this strategy guaranteed to work in gcc, or is it a case of "it works > in a simple test, but might fail in a complicated program or with > different flags" ? I think it works by design. My understanding is that users providing their own implementation of those calls is fully supported. I think that's partly why libatomic.so is a distinct library, and not just part of libgcc_s.so. The docs aren't entirely clear about this, they just say that if the compiler can't emit lock-free instructions for the atomic operation "a call is made to an external routine with the same parameters to be resolved at run time." But I think that "to be resolved at run time" means that you can choose how those calls will be resolved.