From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f74.google.com (mail-dl1-f74.google.com [74.125.82.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 289953B52F8 for ; Wed, 17 Jun 2026 22:46:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.74 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781736389; cv=none; b=VCOKaBNloN+J/WErGtUxXVqV98YucG9ylIPkf90k6TX5C6lxz5w98yfCOwRwLWtFI/sxOC6TCOSlocVmRDkmXerILM4nQwZg3hyTTQor+mpeKRKMrkX5H3xhSCKu3qCrdJ3gSgig2kAWZ4CY5hV4r3nkMFCx3bOWewlbQuAbaDk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781736389; c=relaxed/simple; bh=+/QKlOIR/Jr67gkgPxhq8MLLwh/htDAN7XbEy7/DgTo=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=QQT9zTKI0bx4lNi4NpS+PJBX6oVkMpjxOo90YsaeEsJBYuMiAzRRY5onCM8O4/tYCQXH8tqrrjV/XweebtlKcQyffQPjdDRzXscpaqXUyPb+juyUmepHXJKym0lT8TImUHGEFK9iAd/kyi9armCaXLoGTc24Eq64Q7Td6VWTpw4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--xur.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Py6dgNMe; arc=none smtp.client-ip=74.125.82.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--xur.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Py6dgNMe" Received: by mail-dl1-f74.google.com with SMTP id a92af1059eb24-137fe4a3640so764874c88.0 for ; Wed, 17 Jun 2026 15:46:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781736386; x=1782341186; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=2vpC34LH3O3p+3l3izwB2YQX2KfU7uT2tc5IZugSQEI=; b=Py6dgNMe8SDUf2JVi4OSkexWg9bD+K71mYO968HYHM7Z2BxTazfbbIz4xZY+r7wdaq 52zr1vJHo0trsPSRD0Nd5fQAOwn1m6rn4ZxfDslfrjNePYSDmq/opilFzAK3DWBh4jb/ QL1MzljFNHBqHyh71eFFJkuakAOHc3U5gM3Ou7ZdricdUBRSGedCq6y95utEWkQ9ImV/ oy8SgLkZjNoOwZNvKYCPu3IiZ/PlmK81sTyHG26az4dsbH+peIMf4WH7HwrClzVYDR7i PmT1yim2NUoM/iYSp/FYlMJJ9bHWxHocIBOgYvfnJ1ptJCOwCOw64+S6C6Y0qHmFTSpi Jg+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781736386; x=1782341186; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=2vpC34LH3O3p+3l3izwB2YQX2KfU7uT2tc5IZugSQEI=; b=guIcOK47JuU+5jpn2SBGGxFUkyq0+2ecQXqfEquV/XYxSG7s4jtTomdv+3owxHVe85 QJH/9AjHpPHQy3qP5ltzxqMNp77YgqmNh6Cs4cgO89Sfi8dKtkq8VQtsT0h6zBrcDSeP e36FSH6oDsBXQrh7iEzkAsRiZ+7cgmQzZXP0wyGDm3Z1Kn1AcIMRihf4f8uoJ8i9OhNr W9Pek5gzURfSn4BUiSr7sPxQRJKztpth51YG8I3IhPMcd6n8Kpzzxt7wxFiD2nQKJuV/ epUwfQtIrc1j+0KtObmjSkU6faSL/MrGlqXIQ7soUlRv7uFidHg/AEku+Nm3UEUDH02J Ahjg== X-Forwarded-Encrypted: i=1; AFNElJ/QKFREEkHqbgDL2IefC4awr65Aik0Ny1QEK9K1/lLhfeJUxjdorKq3nWRELoFOEfkKpM+VHkh/8PeBltg=@vger.kernel.org X-Gm-Message-State: AOJu0Yz3R7E6HiqMfq/khqwcaHrQ07D9wVmMdvj427f+uewnry55U10J XZ9LVSvodSn99WowhTSGYRq3XIpc2vfLax8WdnHQew3OHo732qT+Om62wbYdif4GY4xb6w== X-Received: from dldyr3-n1.prod.google.com ([2002:a05:701b:4503:10b0:138:18c:c8d1]) (user=xur job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:1b18:b0:136:ff02:d00b with SMTP id a92af1059eb24-1398f6de2c7mr2355256c88.25.1781736385698; Wed, 17 Jun 2026 15:46:25 -0700 (PDT) Date: Wed, 17 Jun 2026 15:46:23 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.55.0.rc0.738.g0c8ab3ebcc-goog Message-ID: <20260617224623.1346309-1-xur@google.com> Subject: [PATCH v2] modpost: Ignore Clang LTO suffixes in symbol matching From: xur@google.com To: Nathan Chancellor , Nicolas Schier , Nick Desaulniers , Bill Wendling , Justin Stitt , Sami Tolvanen , Siddharth Nayyar , Petr Pavlu , Josh Poimboeuf , Rong Xu , Eric Dumazet , "=?UTF-8?q?Ren=C3=A9=20Rebe?=" , Alexey Gladkov , Johan Hovold , linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Cc: kernel test robot Content-Type: text/plain; charset="UTF-8" From: Rong Xu When building the kernel with Clang ThinLTO enabled, the compiler can mangle static variable names by appending suffixes such as ".llvm." to prevent naming collisions across translation units. This name mangling breaks the section mismatch whitelisting in modpost. modpost relies on glob patterns (e.g., "*_ops" or "*_probe") to identify safe references between permanent data and initialization code. Because the LTO suffix modifies the end of the symbol name, legitimately whitelisted structures fail the match, resulting in false positive warnings. For example, a static pernet_operations struct triggers the following: WARNING: modpost: vmlinux: section mismatch in reference: \ ping_v4_net_ops.llvm.5641696707737373282 (section: .data) -> \ ping_v4_proc_init_net (section: .init.text) Fix this by ignoring "*_ops.llvm.*" in "from" symbol names (the same as "*_ops"). Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202606111233.kM8oo8Df-lkp@intel.com/ Signed-off-by: Rong Xu --- scripts/mod/modpost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index d592548cbd60..a7b72a81d248 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -969,7 +969,7 @@ static int secref_whitelist(const char *fromsec, const char *fromsym, /* symbols in data sections that may refer to any init/exit sections */ if (match(fromsec, PATTERNS(DATA_SECTIONS)) && match(tosec, PATTERNS(ALL_INIT_SECTIONS, ALL_EXIT_SECTIONS)) && - match(fromsym, PATTERNS("*_ops", "*_console"))) + match(fromsym, PATTERNS("*_ops", "*_ops.llvm.*", "*_console"))) return 0; /* Check for pattern 3 */ base-commit: e771677c937da5808f7b6c1f0e4a97ec1a84f8a8 -- 2.55.0.rc0.738.g0c8ab3ebcc-goog