From patchwork Tue Dec 31 18:26:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 854389 Delivered-To: patch@linaro.org Received: by 2002:a5d:4888:0:b0:385:e875:8a9e with SMTP id g8csp7049178wrq; Tue, 31 Dec 2024 10:29:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXh3l0cjpXqHpK7/62T0SooOmnALmQoj1Baw8GNByTTw6bf5VSXbzg2WsqdIKlxzcDxcbNHLA==@linaro.org X-Google-Smtp-Source: AGHT+IEM7IztbZ9/+lH4vLPgvZvduuRgKWIrJhvRIWLFEeoorcSdEjlXDOKGH1lycZtrjwdOkq4Z X-Received: by 2002:a05:6214:dac:b0:6d8:9124:8799 with SMTP id 6a1803df08f44-6dd2331f006mr773456176d6.5.1735669791497; Tue, 31 Dec 2024 10:29:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1735669791; cv=pass; d=google.com; s=arc-20240605; b=E+Fn4niL8gVxpXT8v+OJ1Z+/4a5FOPdak2Lov/UIBSQH2P0xNyyw4kyl7GIs4QA+v5 ROZEfGwSsVSPJBAADqQWVbVBSHIhJ2sAkWG5Xf2XHz+H/OplsfZM2BT0h4dUmkXERLyY c663gB60+mFiaGY2Vl4pT1BXXZvgagTzUL3yQ/ogfvXTQC6RRB+CnNRiUffdz9S1pYFf P4srHdEeTHpxEb69n98RrdK9kwLReuRYaCHGjp1h+mXk2gbJ+MXoz3Lo+LQ0Yor3ZkQ5 sFY+eWJwLC23NMB3kOYVF6t4cyZ9zDFdypGBycWVCG4lpx5Qkq3InvWGP5z7OugRoFw+ Kkvw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:dkim-filter:arc-filter:dmarc-filter :delivered-to:dkim-filter; bh=5u5sErn1ELgq7PPw2jSPZ+dcJ4iyjQ2p3uj1+tSCIVg=; fh=d7KdQ+eBG5Owb97PZQUBRjccSsV/hB6hMlyGG6W37vA=; b=NaNqaaSFDz9oBYfPm2mW70rSjjD8FZdSvT1GiKKdRtF8DYYJwkoaUHjMW45PNp5eWA OY8UJxZ8zCdingbHrxuuPgo3cTV5A4nENL6pBOMe4GgcZ0xFQAnocJ0sNPjkhhCBsDC9 KaA1VVlpdyyjAr0Wg2rOHlZjQ1P8C/DeVspY8pZCZ4P1plTAo0aLWwAK6KF5AHqdDBju Ona//4PvNuT2PiATAh0lo98uqq5Xn7G+qToFkvYl+6uvCZE8YXGYqxrPT83I1HO8b4Pe R/b9oNer/E8ZCKbdmNwW3ppIxbY0n6AY90qh5r5POh/s1xsciD9usaZHuqcRXVLolQBL C6zQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EnoT41ev; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id 6a1803df08f44-6dd1835a111si304484706d6.424.2024.12.31.10.29.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Dec 2024 10:29:51 -0800 (PST) Received-SPF: pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EnoT41ev; arc=pass (i=1); spf=pass (google.com: domain of libc-alpha-bounces~patch=linaro.org@sourceware.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="libc-alpha-bounces~patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1D49D3858C98 for ; Tue, 31 Dec 2024 18:29:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1D49D3858C98 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=EnoT41ev X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by sourceware.org (Postfix) with ESMTPS id BF84D3858D28 for ; Tue, 31 Dec 2024 18:27:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BF84D3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org BF84D3858D28 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1735669624; cv=none; b=P9xkxa3mOFg9i1EPMFoCLz8jc4wVEeDY9hmyes6ZMq9ubnWkfV5v8HWndRDDp76Vf626OWIgOCrqzu8YJ2d2+ltqBUFiAFePA8rPkwiGn8TzFMwsHLpRQ95FPNxh2sSVlL/jVogreXTW3StrUFGcuuwEJ4U1e0xDebCU72/8VlM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1735669624; c=relaxed/simple; bh=VA2mfZc6LIXv/g0ABcfrwpckZbdc/1aM5Q/mZkrgYnQ=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=henC1ofIGLqfomWAhFUBKPCngbLr4NqtWBX1UPQR5P7iz+ltR5hif+SDf2S111QPyVnx6cf6HiowyupTysxtb6y4jyGMnALhnFEkPv//3UujpLEQ7p1P/GC404bF06+C6yugtLzAVTuImP5Mfp46jnQND5VIlMH7/IjTVH2/2eY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BF84D3858D28 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-21649a7bcdcso133449365ad.1 for ; Tue, 31 Dec 2024 10:27:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735669623; x=1736274423; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5u5sErn1ELgq7PPw2jSPZ+dcJ4iyjQ2p3uj1+tSCIVg=; b=EnoT41evhggwfSjJn62y0iV//SJgvVve9KQqAdGJueuBBFLk8I3KHgXtb3akDdqiSa WpLIpQ7b8rAZbLwCviBO1lzpJKO9t2HnzjVhzL0IRNi53UEb47B4dKJ3yMmpGr9k9zZz 2MJMY1pO8gAYFPpRcvE7h1+M/9NK1XeFo7HjI9gVF1bhwwu+PwO8ofQqX3xOAIrYpgJb BWFf1fkE1NYSLkaGKVHHrnacsS8efR7hkJJRa/cdgAPjqEpc/AtOEAfVu5stvTaZJ1HU GACJwLRD9FYMwr/sHyWdJl9CuUIueZKpwPZdstPdL6u3Mzt/U8SATzJIRAjmel1WF6/d 0c9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735669623; x=1736274423; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5u5sErn1ELgq7PPw2jSPZ+dcJ4iyjQ2p3uj1+tSCIVg=; b=betPKqbXdeGJ5yF2sry0RWXsm7h8CN03Mtw0jq3HVw1Au/55Eb0R55H7bLr0Zj3iD3 QeaPapt0NSdxd5tec3gFCjFriE6sTM2PEtv6j04xL7s+7ptiduwSCnomsncSHWIgC4xj DtDCBfVepns9f6B33g9UH8bXbwXops0haeJrkOSqcvNPG/BFZi54ICLI9ILdJBC3yr8E hVefwVi4J2D7MkoA6rEXPSEAy18mpdlMiN3Gjla5aM22rjl8Kohd4CJKOACi+NOo8Gx1 m2yVQN7XyGOiy0aby1UBQPWZlnSHt4ZukUce0TBe2Ik6no/zXdkJ9StUX5jluE8bEMHO 8aZA== X-Gm-Message-State: AOJu0YyfjCVtVxnx0e0r+4K/1YmKd//7hB5S7WGiE9gu6gFcd64Wgo+v YPPL+P4DOXJoMBPro0JT6EwwCeyfVYGxd/Yd+Sg1zRkYytcGWpPoDpf5ZQvxvurce7+OnDilXbN A X-Gm-Gg: ASbGncvQl65MPXrn6rRHZ63tiGWj93TVMvKDcSNLPVccLguHCQGrqQLhCort/X2CQqp QZss0ILivPwSQw8LvXwmhTixYGjAkq7B9JEFuSqZPvVFe5XxMPCTO7cVjNPqMeTx9Fq/3WjzHsh nCW7zhbfsg2PyxvNDaSApUYIMApGMOwPYht1tCpAdlFMcFgaId7cWZ4iR4uyG4tyADCC1PU1DUV 4eQGxbb7yIkZBwzWWiFOECWgPtpT3wa6cFmo9VC/+W/J54bGSujQvP/53XlCmOo2qjp0S/OgVIr +RACg+lAh7Sbp8HPkM31iDsi4Vmx X-Received: by 2002:a17:903:2345:b0:216:4e8d:4803 with SMTP id d9443c01a7336-219e70bf2e8mr454206455ad.42.1735669623562; Tue, 31 Dec 2024 10:27:03 -0800 (PST) Received: from ubuntu-vm.. (201-92-184-234.dsl.telesp.net.br. [201.92.184.234]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-219dc9f5046sm198693105ad.179.2024.12.31.10.27.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Dec 2024 10:27:03 -0800 (PST) From: Adhemerval Zanella To: libc-alpha@sourceware.org Cc: Sam James , "H . J . Lu" Subject: [PATCH 5/7] elf: Suppress unused function clang for __ifunc_resolver Date: Tue, 31 Dec 2024 15:26:11 -0300 Message-ID: <20241231182649.1811734-6-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241231182649.1811734-1-adhemerval.zanella@linaro.org> References: <20241231182649.1811734-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 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~patch=linaro.org@sourceware.org The __ifunc_resolver macro expands to: extern __typeof (__redirect_name) name __attribute__ ((ifunc ("iname_ifunc"))); static __typeof (__redirect_name) *name_ifunc (void) { [...] }; And although NAME_IFUNC is and alias for NAME, clang still emits an 'unused function 'name_ifunc' [-Werror,-Wunused-function]' warning. The static is used to avoid name pollution on static linkage. --- elf/ifuncmain9.c | 4 ++++ elf/tst-ifunc-fault-lazy.c | 4 ++++ include/libc-symbols.h | 6 +++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/elf/ifuncmain9.c b/elf/ifuncmain9.c index 654beeadfe..f102b140bd 100644 --- a/elf/ifuncmain9.c +++ b/elf/ifuncmain9.c @@ -22,6 +22,7 @@ #include #include +#include #if __GNUC_PREREQ (5, 5) /* Do not use the test framework, so that the process setup is not @@ -41,6 +42,8 @@ implementation (void) return random_constant; } +DIAG_PUSH_NEEDS_COMMENT_CLANG; +DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wunused-function"); static __typeof__ (implementation) * inhibit_stack_protector resolver (void) @@ -50,6 +53,7 @@ resolver (void) } static int magic (void) __attribute__ ((ifunc ("resolver"))); +DIAG_POP_NEEDS_COMMENT_CLANG; int main (void) diff --git a/elf/tst-ifunc-fault-lazy.c b/elf/tst-ifunc-fault-lazy.c index 5157c6cc6c..04448b2b15 100644 --- a/elf/tst-ifunc-fault-lazy.c +++ b/elf/tst-ifunc-fault-lazy.c @@ -21,6 +21,7 @@ relocations. */ #include +#include #ifdef HAVE_GCC_IFUNC @@ -34,6 +35,8 @@ implementation (void) *p = 0; } +DIAG_PUSH_NEEDS_COMMENT_CLANG; +DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wunused-function"); static __typeof__ (implementation) * resolver (void) { @@ -42,6 +45,7 @@ resolver (void) *p = 0; return implementation; } +DIAG_POP_NEEDS_COMMENT_CLANG; static void magic (void) __attribute__ ((ifunc ("resolver"))); diff --git a/include/libc-symbols.h b/include/libc-symbols.h index 56ae61015d..9fe047f4d3 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -86,6 +86,7 @@ /* Obtain the definition of symbol_version_reference. */ #include +#include /* When PIC is defined and SHARED isn't defined, we are building PIE by default. */ @@ -671,7 +672,10 @@ for linking") # define __ifunc_args(type_name, name, expr, init, ...) \ extern __typeof (type_name) name __attribute__ \ ((ifunc (#name "_ifunc"))); \ - __ifunc_resolver (type_name, name, expr, init, static, __VA_ARGS__) + DIAG_PUSH_NEEDS_COMMENT_CLANG; \ + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wunused-function"); \ + __ifunc_resolver (type_name, name, expr, init, static, __VA_ARGS__); \ + DIAG_POP_NEEDS_COMMENT_CLANG; # define __ifunc_args_hidden(type_name, name, expr, init, ...) \ __ifunc_args (type_name, name, expr, init, __VA_ARGS__)