From patchwork Fri Jul 26 08:41:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noah Goldstein X-Patchwork-Id: 1965211 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=HxITLRWX; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WVh7S0s13z1ybY for ; Fri, 26 Jul 2024 18:41:40 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1951A3870922 for ; Fri, 26 Jul 2024 08:41:38 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by sourceware.org (Postfix) with ESMTPS id C95E4384403E for ; Fri, 26 Jul 2024 08:41:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C95E4384403E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org C95E4384403E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1031 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721983269; cv=none; b=QTtNpVrFrS/Dxq2qziBtC1olQztenWEKfk3FByZUGlZJP3WmenIRIQalJ89iK5nCDOoGm2t5Njp8m6ue6udwb4v/x5hZwnP0lGx9FWGS+MpqBuKLP/hXuKBdbZOnE6MhC9sx5E31oGFHbuR7wXNrGo4mpqLUdi44q38qhAV38Cw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1721983269; c=relaxed/simple; bh=9rOZchu4U5sj9jtWRaHBBOQTfff2R8JkAFIdHkZ66x4=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=BwmgS/lBHqVsPaBff28zpU7zO3agvqcYrWgx0RA7EpjEKYo3exsFef+vaMjNBeg1JP+8JVFAeSYtrLb/M1/q8rrG5eqHWqT5CI8A9dBfmiJ+ceQqy1yLjuO9KLOZtIH55V8v3n+E2hZPMOctRJq+aufIpuGDHIDJKv/E/kbjbDI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pj1-x1031.google.com with SMTP id 98e67ed59e1d1-2cb682fb0cdso524715a91.3 for ; Fri, 26 Jul 2024 01:41:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721983266; x=1722588066; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=NQjVjtVgugOOpG7QGCOYDpK5wk1/M5LjthgHoaD6Utc=; b=HxITLRWXW1yGBHXgMitB3AVJ28RfEf55RsweVBXgJL0wZ6SVLdb7dyJGQ3IvtjMd/r d8P4NJQs2uPVRF7KV6sJRK1Adai+aphCdwTYeaLRS1AEnK44+bAAENoU7AhznUCqavwT intNSZWNYegevxSgXhdnqsvyy6IoSSDVEtlpKAQsjIOHG7MW+chUbZaDl+CgErMurYAp jg8IcUkiruw8DKniJsEk23LrbRa0LMoULhu0wOhvkGC/TTJp2btLq+icrk8MUtggRC7x rithJ37rwLKiiuYJotx99cYBinSK/wISpk87/NE5USV/RRRtaEp9kbs0dcpeJniSLNxN +fww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721983266; x=1722588066; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NQjVjtVgugOOpG7QGCOYDpK5wk1/M5LjthgHoaD6Utc=; b=P1TYWODXmWixTa1xPtM8Mova/DFAqBZXIq8/J6u5LLHlvK5wX+J+C6MMHrDvzquv/I IV9rYEK91P7YtFAUWgft7jxki1hJ5ujDnJUyeA4U1R9l1Y+tNmWFrdVxbBvn3GKc75Sg RABTWyF2whVQKc9BuOXCjqBppw2uPzH3Ylu2T/p0t3IA4U7tqBJ9v7BtZwfWPVny1+kI pVQj1OiRwHyY7nfVAvnXdcRUXpcwHTm09MJX0lViI1XgtNH4avYOmqi1EjiB468ZTP6N N12Qw4yxQ6KyfMR0cl18CXRVivlItz1N6Kd3Th8S6psIHCDu5TOdP9UP6U4EORW5duNY isXQ== X-Gm-Message-State: AOJu0YyPDMQCd54wrRZkRWFiqT3LArwER2CVLhQaP0i/HjcdacHwuW5E Nk7hXhwJjjdUVuEVMVybAiDsh41kpASvtphyI5737TdQNXXqO4Vdll1sovUEnZA= X-Google-Smtp-Source: AGHT+IHRT3tR1vPybKnqstGwgv43cSStWdYMgCBzSBVLC65ChWt5E+cmQlVgCj8+vS593HNdnlZy/g== X-Received: by 2002:a17:90a:6585:b0:2c8:da73:af82 with SMTP id 98e67ed59e1d1-2cf2379f7aemr6191843a91.10.1721983266382; Fri, 26 Jul 2024 01:41:06 -0700 (PDT) Received: from noahgold-desk.sh.intel.com ([192.102.204.43]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2cf28c7e8fbsm2900672a91.17.2024.07.26.01.41.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jul 2024 01:41:06 -0700 (PDT) From: Noah Goldstein To: libc-alpha@sourceware.org Cc: goldstein.w.n@gmail.com, hjl.tools@gmail.com Subject: assert: Mark `__assert_fail` as `cold` Date: Fri, 26 Jul 2024 16:41:00 +0800 Message-Id: <20240726084100.2582635-1-goldstein.w.n@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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 X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces~incoming=patchwork.ozlabs.org@sourceware.org This helps compilers split the codegen for setting up the arguments (`__expression`, `__filename`, etc...) from the potentially hot cold where the `assert` is to a presumably cold region on the assertion failure path. Reviewed-by: Florian Weimer Reviewed-by: Sam James --- assert/assert.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assert/assert.h b/assert/assert.h index 266a41df06..3261eb4202 100644 --- a/assert/assert.h +++ b/assert/assert.h @@ -71,13 +71,13 @@ extern void __assert_fail (const char *__assertion, const char *__file, /* Likewise, but prints the error text for ERRNUM. */ extern void __assert_perror_fail (int __errnum, const char *__file, unsigned int __line, const char *__function) - __THROW __attribute__ ((__noreturn__)); + __THROW __attribute__ ((__noreturn__)) __COLD; /* The following is not at all used here but needed for standard compliance. */ extern void __assert (const char *__assertion, const char *__file, int __line) - __THROW __attribute__ ((__noreturn__)); + __THROW __attribute__ ((__noreturn__)) __COLD; __END_DECLS