From nobody Wed Dec 17 05:47:41 2025 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (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 71BA923DE82 for ; Mon, 13 Jan 2025 14:05:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736777123; cv=none; b=YBbAZju7mIEbI4OKBqvHvUqpjv9eoQTqulYA8ovY0yHH+GXWLAEsB/+sN85tV+e97sFcZhJ5jZpSjmBv7cMCkapChECGGa9SIx7YulF1kjAq0Se9kWXLHIvZ8fnF/4vRN9lcl2IjkaoCTC4OmDh7LjqMyYg/ORCjQGQghPhC+Aw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736777123; c=relaxed/simple; bh=iWwaIcsDZ4Sr3b4S/577j90zLHdoeIMa/iamDlPNBwA=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ipJ96Z+SWGfrUPQm9NpORpeLKH+aTvRFcV6mkauuyGoxJH7/PYd7AaBtR4l/szkF/TfLqGLM7Pu0corSG+T3Knh/Nvt88kvRclrZpnHbCyin+IEL/f/SbQul5GucvcwzLXKpx2GCaCMadngRY5lv76op/6k8D/pKpVIgFmw6Z6o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--jackmanb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=010+OfKi; arc=none smtp.client-ip=209.85.128.73 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--jackmanb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="010+OfKi" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-436328fcfeeso35856055e9.1 for ; Mon, 13 Jan 2025 06:05:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736777120; x=1737381920; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=xf7YP3IkAsRQQJxEEobRB3kyQUwCz1GCIfo0L/Ujnio=; b=010+OfKi2PDi6GWJmLdf2Fb8T5kupeQm3PGu2IQPKwBeU296lW9UJR1QutqjuWYhEo tYl4yeR0961UrPm5wbRWNjR5VoEVoS7vwdE/f6/Hf2lfZSH07odWbE3vFHQhRo8zTlUT 5vI/yiCX/4G/aWM8P4WK5uzKFO6N+yapGy+G40z1mheK0wf0KZKKOJCuDLD6RDgTkC/M K9lCVIsgfDwrKdKLCdeSsXxxLgkxoHco/YXoDoJJ0jbinFxheCeaSlCRRSmW6Aqjk0oI voXZn3F9dhSxN30d1DN+Ak97X1aKsYX5kE+HuUHm63DrWFsBjNFE5eH7bJQEMWNaQ1d/ OUog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736777120; x=1737381920; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=xf7YP3IkAsRQQJxEEobRB3kyQUwCz1GCIfo0L/Ujnio=; b=BTFNpND5sobKTvx8TiOzi0Rz55Eax3K5XJNfVn4fRXNvOSj947nk3U3YsOMVqz2b+L vDjeO8WUVStlSa7+Qp+EJE/itd/Rakt1jdaly66+ewt3I7mO8U+9zE5aBaQRFB2ISpVE fbEKIb4cALLhofdSrLhLiXXdICFNl8Qn4qfUk5G04nr4aZQH5Edd5NSWKMHcO/oKcmHR QYfSOa44w5iAVmZJ512+2l8HDKjOBjfdAwbtf5yHP4pi/39r5FAsLOk6uO6hm+aNmUgM cyWTX0C9CSC0mQVg5RMM2JT3cM1LI/mp3w+m2+Gr5quMSNulqcjgVfO8bnL6viFVQg/D 3axg== X-Gm-Message-State: AOJu0YyZUXeCQEnQzkLhOjyXPA54m6Gjg3lpjlNDufkAcUyMD8bnMm1H 1coxmL2KrIXDaKa/ZP4e9YqJG/vNJCua6wBwKiQW8mx0S0PsOB4PoWcaaj331r/1VO+i1qF82VV ioo6xQm8CIA== X-Google-Smtp-Source: AGHT+IHnIaAjS6kBqmfKE63dAzuPWGyY5MpgyWZmqfJgPPlsZjSHP5Qbhww3cRWn0ef6rWZdDf/BMeBb6tlkEw== X-Received: from wmrn32.prod.google.com ([2002:a05:600c:5020:b0:434:a7ee:3c40]) (user=jackmanb job=prod-delivery.src-stubby-dispatcher) by 2002:a05:600c:4f47:b0:431:5632:448b with SMTP id 5b1f17b1804b1-436e26e23f8mr165897915e9.25.1736777119969; Mon, 13 Jan 2025 06:05:19 -0800 (PST) Date: Mon, 13 Jan 2025 14:05:15 +0000 In-Reply-To: <20250113-objtool-strict-v3-0-8b51f94957fb@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250113-objtool-strict-v3-0-8b51f94957fb@google.com> X-Mailer: b4 0.15-dev Message-ID: <20250113-objtool-strict-v3-1-8b51f94957fb@google.com> Subject: [PATCH v3 1/2] objtool: Add --Werror From: Brendan Jackman To: Josh Poimboeuf , Peter Zijlstra , Andrew Morton , Masahiro Yamada , Nathan Chancellor , Nicolas Schier Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org, Brendan Jackman Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable At present objtool only prints to the terminal when observing "fatal warnings". This option lets you have it produce an error instead. The use case for this is noinstr validation; so far I've never seen any false warnings here, but it quite often detects real bugs. It would be useful for the build to fail when I have those bugs. Signed-off-by: Brendan Jackman Suggested-by: Nathan Chancellor --- tools/objtool/builtin-check.c | 6 ++++++ tools/objtool/check.c | 7 ++----- tools/objtool/include/objtool/builtin.h | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c index 387d56a7f5fb8da8435d0a3f5c05eeee66932c9b..0b28082df90710ff7127327deb8= 57c0548f378c7 100644 --- a/tools/objtool/builtin-check.c +++ b/tools/objtool/builtin-check.c @@ -94,6 +94,12 @@ static const struct option check_options[] =3D { OPT_BOOLEAN(0, "sec-address", &opts.sec_address, "print section addresses= in warnings"), OPT_BOOLEAN(0, "stats", &opts.stats, "print statistics"), OPT_BOOLEAN('v', "verbose", &opts.verbose, "verbose warnings"), + /* + * For now, don't fail the kernel build on fatal warnings by default. + * These errors are still fairly common due to the growing matrix of + * supported toolchains and their recent pace of change. + */ + OPT_BOOLEAN(0, "Werror", &opts.werror, "fail on fatal warnings"), =20 OPT_END(), }; diff --git a/tools/objtool/check.c b/tools/objtool/check.c index 76060da755b5c51cda3a669d8245d7d004e25f22..e44135293eb45f908e00359d84d= 954cfeddd266f 100644 --- a/tools/objtool/check.c +++ b/tools/objtool/check.c @@ -4944,10 +4944,7 @@ int check(struct objtool_file *file) } =20 out: - /* - * For now, don't fail the kernel build on fatal warnings. These - * errors are still fairly common due to the growing matrix of - * supported toolchains and their recent pace of change. - */ + if (opts.werror && warnings) + return 1; return 0; } diff --git a/tools/objtool/include/objtool/builtin.h b/tools/objtool/includ= e/objtool/builtin.h index fcca6662c8b4b5e0048e54fada8694cc2e6ebc34..97d668010efadfa05bb6e25e196= 7a7d72bf77815 100644 --- a/tools/objtool/include/objtool/builtin.h +++ b/tools/objtool/include/objtool/builtin.h @@ -38,6 +38,7 @@ struct opts { bool sec_address; bool stats; bool verbose; + bool werror; }; =20 extern struct opts opts; --=20 2.47.1.613.gc27f4b7a9f-goog