From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) (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 59AD9270ED9 for ; Wed, 26 Nov 2025 10:07:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764151655; cv=none; b=bFiTcTKhktmqfbqMa6X568B+1vffSExLV3+sXgiLEQIhqbsa34c5qNZMPxLZ0dM7eXocVU2swirZOA0ngNPt6UYEVbP3XeNIbU511FXNO55hu7nE6XRZP3M9c/m5foCactCRFZieFOVDeSdSmPz6KBlTGjZsFIhqeL3uvc2+DWs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764151655; c=relaxed/simple; bh=+GSm3x3hW2Tw2t/2vZZ0mmcc+AEKsuUPgpXZSUxyvy8=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KNEsrqYOulZBamFxddUOPiNIEL0dETxTaYShHkK47RQE9XUM8x/Mitsy5re607xnC6bn21DA4LcI2mxBL5DywgZXHFuGsZiEgnfY8sb71EzBR6l5EiJ+KqxSz5v5tJzp0EaKLaVLnKyv+5PSZgyh8t14d6p3A3b2gw0qHz2ttLM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jHAKnhwU; arc=none smtp.client-ip=209.85.128.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jHAKnhwU" Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4779a637712so39909705e9.1 for ; Wed, 26 Nov 2025 02:07:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764151651; x=1764756451; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=nOi0d4Z3fp4AaNM74TOSnaI6lKTuwgGD7kfDI2Il45k=; b=jHAKnhwUvhxBE9qAAzyEo0O4wPZu6evMhTxl9mcM4y0gyHzJLw47oXJU7w1TrHSNVW URaq0QDRBqeqz6Fd/gs5shDD4nrDHl/UrpAbjLiIFbeDHe22BPnOsgYtno7YrSKa7zBs EmaC+zrcBf+Jh7nPT/VVYJY/eNFIqy7fLLbwQbk8WfLmtlrLKeNHJ9rnja13dsiDw2hW Gf0pVwmeaQSWGWdAIc3y/M2UObFs6fulat8Re79oJjrxcU/FxAz5V9Ws/hbETutJtecD n0ZR4j6Vu/PanKUo+r8CW1Bj4L4FIzdjAsGdKNUBwUZkUiKzQ0y7qfrWebNwylgMVGBR dhRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764151651; x=1764756451; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=nOi0d4Z3fp4AaNM74TOSnaI6lKTuwgGD7kfDI2Il45k=; b=nULyMUs6FKg6N7tDwPorYXBi0rNVBqOYN8B16vzHlh+BgXm7MtW+lBJewVlUX7kk9e LVYkfkZibydolbr1ELcuJTCsXAFsQMsGBiCPER6xwLESy4jOyySwPtJ7O65n1sHFPLtB mN5aw95de9/HcRXiw3CUtxfzxoStskbKX1baZ+sZ+6ORgQzaXwKiqDYl1e4wZx3VWsDt KFQ1wKRPXzU01605XXAJPRW6qDWIa6hKin+wCyCvF7fbMnP/XTwmY/lC0MK1lHEXPIXg BnOfWHH6v2tdnv+LYG+NZ4/1kr59uoHpT0W1wM8IiBcOtX1hb9oB/6oveikrDUP2bIPU 0how== X-Forwarded-Encrypted: i=1; AJvYcCXdXBidVV+TY2b0Y4IAZDBQ5LA/HMDss23ZJ7y5kSXE6lxMxhLsHuXNuplIZPMAy+bN/v8ecF/jORJTddU=@vger.kernel.org X-Gm-Message-State: AOJu0Yymuq+P3rmp5qI1Xhc3kIj7YZg4bqvCyQW7s9y5BB5EXii1UA7D M4miRSxYdFfUtK34yUBfKXel+/LUwjInJi3exfP2H4f2M8NuYvmPl4CzDJ0Z0g== X-Gm-Gg: ASbGncvfJ0jD/pS/fShKEIx+CpUVZQwHOWc3DE0P9t/5qBr1xiyiamn9jInW2czRM01 oCDMiWf0Xm/MGh9Ay6G71+KV4f3MoN5plrOzFTKYueUeNwSJlsD6dXy4L7lrhP86eXXKE3jKpBJ 61pE2c9bJVvl3Yb5VFmDYNpCTir9ceBz7ZkNqZC+sFM+7fjCSP1dYD4C4khKocP/RjMi0L7VLnG ymCm7XZSI6VdfIAL9vgu9uiBdAFAwDCMWPvi1owAkQvjwVWKQgSSQLgofxy+OkN/EsWhYaXhhu+ Wo7LVhS3My9AYMwUPYOSkpd9K798nkTRSaEd9AIawmvwGfo3FsvTB7bbC4+Y4oISDQcSA4GbizC xaNtXnopxz3J/JBJeRXrZDU44L67n8O+10RVcs1+2pBU09+Reshxm1R0lQPUWksYa/i0w+MMQpT LbNBXC1Wd1yQRasyjD8sE9giJ3MEH4rbB+7yIHGYeNbrpsileHH8mI X-Google-Smtp-Source: AGHT+IHhXL5XsSSUCSeqdRTvAbqrrogKB8iney7t/Fid8GNRd2ByWz9tDTYsQV51pipFG7QkW1c7oA== X-Received: by 2002:a05:600c:450f:b0:46d:ba6d:65bb with SMTP id 5b1f17b1804b1-477c01eb9bdmr211736035e9.31.1764151651063; Wed, 26 Nov 2025 02:07:31 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4790adddb4bsm34589215e9.7.2025.11.26.02.07.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Nov 2025 02:07:30 -0800 (PST) Date: Wed, 26 Nov 2025 10:07:29 +0000 From: David Laight To: Alexandre Chartre Cc: Nathan Chancellor , linux-kernel@vger.kernel.org, mingo@kernel.org, jpoimboe@kernel.org, peterz@infradead.org Subject: Re: [PATCH v6 03/30] objtool: Disassemble code with libopcodes instead of running objdump Message-ID: <20251126100729.277f2854@pumpkin> In-Reply-To: <3fa261fd-3b46-4cbe-b48d-7503aabc96cb@oracle.com> References: <20251121095340.464045-1-alexandre.chartre@oracle.com> <20251121095340.464045-4-alexandre.chartre@oracle.com> <20251125181604.GA3595606@ax162> <3fa261fd-3b46-4cbe-b48d-7503aabc96cb@oracle.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 26 Nov 2025 10:00:36 +0100 Alexandre Chartre wrote: > On 11/25/25 19:16, Nathan Chancellor wrote: > > Hi Alexandre, > > > > On Fri, Nov 21, 2025 at 10:53:13AM +0100, Alexandre Chartre wrote: > >> objtool executes the objdump command to disassemble code. Use libopcodes > >> instead to have more control about the disassembly scope and output. > >> If libopcodes is not present then objtool is built without disassembly > >> support. > >> > >> Signed-off-by: Alexandre Chartre > > ... > >> diff --git a/tools/objtool/include/objtool/arch.h b/tools/objtool/include/objtool/arch.h > >> index d89f8b5ec14e3..18c0e69ee6170 100644 > >> --- a/tools/objtool/include/objtool/arch.h > >> +++ b/tools/objtool/include/objtool/arch.h > >> @@ -103,4 +103,13 @@ bool arch_absolute_reloc(struct elf *elf, struct reloc *reloc); > >> unsigned int arch_reloc_size(struct reloc *reloc); > >> unsigned long arch_jump_table_sym_offset(struct reloc *reloc, struct reloc *table); > >> > >> +#ifdef DISAS > >> + > >> +#include > > > > This include of bfd.h breaks the build for me: > > > > $ make -skj"$(nproc)" ARCH=x86_64 CROSS_COMPILE=x86_64-linux- clean defconfig bzImage > > In file included from tools/objtool/include/objtool/arch.h:108, > > from check.c:14: > > /usr/include/bfd.h:35:2: error: #error config.h must be included before this header > > 35 | #error config.h must be included before this header > > | ^~~~~ > > ... > > > > where my bfd.h has: > > > > #ifndef __BFD_H_SEEN__ > > #define __BFD_H_SEEN__ > > > > /* PR 14072: Ensure that config.h is included first. */ > > #if !defined PACKAGE && !defined PACKAGE_VERSION > > #error config.h must be included before this header > > #endif > > This check is effectively present in the bfd.h file generated from the > binutils source code. However it is not present in the bfd.h file provided > by the binutils RPM. I think this explained why we haven't seen this issue > so far. > > For history, this was introduced in 2012 for bug 14072. Then there was > complaints reported in bug 14243 and 15920. But it was decided not to > remove this change, and the suggested fix was to define PACKAGE when > including bfd.h. > > https://sourceware.org/bugzilla/show_bug.cgi?id=14072 > https://sourceware.org/bugzilla/show_bug.cgi?id=14243 > https://sourceware.org/bugzilla/show_bug.cgi?id=15920 > > And Redhat has fixed the issue for the binutils RPM by removing this test: > > https://sourceware.org/bugzilla/show_bug.cgi?id=14243 > > > > Something like this cures it for me but I am not sure if that is a > > proper fix or not since I see config.h in my binutils build folder has > > many other defines. > > > > Cheers, > > Nathan > > > > diff --git a/tools/objtool/Makefile b/tools/objtool/Makefile > > index df793ca6fc1a..96df4a73da23 100644 > > --- a/tools/objtool/Makefile > > +++ b/tools/objtool/Makefile > > @@ -87,7 +87,7 @@ BUILD_DISAS := n > > > > ifeq ($(feature-libbfd),1) > > BUILD_DISAS := y > > - OBJTOOL_CFLAGS += -DDISAS > > + OBJTOOL_CFLAGS += -DDISAS -DPACKAGE="objtool-disas" > > OBJTOOL_LDFLAGS += -lopcodes > > endif > > > > This is the proper fix (as indicated in the binutils bugs), and this is > what the other kernel tools using bfd.h (bpf and perf) do. I will create > a patch with your suggestion. ISTM that defining it just before including bfd.h is cleaner and more obvious. David > > Thanks, > > alex. > >