[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c6cec208-8166-4535-ad03-24f053f468ad@roeck-us.net>
Date: Mon, 15 Dec 2025 08:46:49 -0800
From: Guenter Roeck <linux@...ck-us.net>
To: Alexandre Chartre <alexandre.chartre@...cle.com>,
"Maciej W. Rozycki" <macro@...am.me.uk>
Cc: linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...nel.org>,
jpoimboe@...nel.org, peterz@...radead.org, david.laight.linux@...il.com
Subject: Re: [PATCH v6 03/30] objtool: Disassemble code with libopcodes
instead of running objdump
On 12/15/25 08:00, Alexandre Chartre wrote:
>
> On 12/10/25 22:54, Guenter Roeck wrote:
>> On 12/10/25 10:42, Guenter Roeck wrote:
>> ...
>>>> That's weird because the "clean" rule in tools/objtool/Makefile should remove the
>>>> entire tools/objtool/feature directory:
>>>>
>>>> $ cat tools/objtool/Makefile
>>>> ...
>>>> clean: $(LIBSUBCMD)-clean
>>>> $(call QUIET_CLEAN, objtool) $(RM) $(OBJTOOL)
>>>> $(Q)find $(OUTPUT) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
>>>> $(Q)$(RM) $(OUTPUT)arch/x86/lib/cpu-feature-names.c $(OUTPUT)fixdep
>>>> $(Q)$(RM) $(OUTPUT)arch/x86/lib/inat-tables.c $(OUTPUT)fixdep
>>>> $(Q)$(RM) -- $(OUTPUT)FEATURE-DUMP.objtool
>>>> $(Q)$(RM) -r -- $(OUTPUT)feature
>>>>
>>>> see $(Q)$(RM) -r -- $(OUTPUT)feature
>>>>
>>>
>>> $ find . -name test-disassembler-init-styled*
>>> ./tools/build/feature/test-disassembler-init-styled.c
>>> ./tools/objtool/feature/test-disassembler-init-styled.make.output
>>> ./tools/objtool/feature/test-disassembler-init-styled.d
>>> $ make clean
>>> CLEAN arch/x86/lib
>>> CLEAN certs
>>> CLEAN arch/x86/entry/vdso
>>> CLEAN init
>>> CLEAN lib/crc
>>> CLEAN arch/x86/tools
>>> CLEAN arch/x86/realmode/rm
>>> CLEAN security/selinux
>>> CLEAN usr
>>> CLEAN .
>>> $ find . -name test-disassembler-init-styled*
>>> ./tools/build/feature/test-disassembler-init-styled.c
>>> ./tools/objtool/feature/test-disassembler-init-styled.make.output
>>> ./tools/objtool/feature/test-disassembler-init-styled.d
>>> $
>>>
>>> "make clean" does not execute the cleanup in tools/objtool. I have to run
>>> "make -C tools/objtool clean". "make mrproper" doesn't clean tools either.
>>>
>>> I guess that is on purpose ?
>>>
>>> Anyway, even "make -C tools/objtool clean" doesn't solve my problem if I build with
>>> an out-of-tree toolchain. Turns out that, in this case, test-disassembler-init-styled
>>> is build with binutils from the toolchain (which succeeds because its binutils
>>> version is more recent). Later on, the actual build of disas.c fails because it uses
>>> the system toolchain.
>>>
>>
>> This is actually even worse than I thought.
>>
>> $ git clean -d -x -f -q
>> $ make defconfig
>> $ make -j40
>> $ find . -name test-disassembler-init-styled*
>> ./tools/build/feature/test-disassembler-init-styled.c
>> ./tools/objtool/feature/test-disassembler-init-styled.make.output
>> ./tools/objtool/feature/test-disassembler-init-styled.d
>> $ make -C tools/objtool/ clean
>> $ find . -name test-disassembler-init-styled*
>> ./tools/build/feature/test-disassembler-init-styled.make.output
>> ./tools/build/feature/test-disassembler-init-styled.c
>> ./tools/build/feature/test-disassembler-init-styled.d
>> $ rm -f ./tools/build/feature/test-disassembler-init-styled.make.output ./tools/build/feature/test-disassembler-init-styled.d
>> $ find . -name test-disassembler-init-styled*
>> ./tools/build/feature/test-disassembler-init-styled.c
>> $ make -C tools/objtool/ clean
>> $ find . -name test-disassembler-init-styled*
>> ./tools/build/feature/test-disassembler-init-styled.make.output
>> ./tools/build/feature/test-disassembler-init-styled.c
>> ./tools/build/feature/test-disassembler-init-styled.d
>>
>> Repeated with local toolchain:
>> $ git clean -d -x -f -q
>> $ make-x86 defconfig
>> $ make-x86 -j40
>> (fails)
>> $ make-x86 -C tools/objtool clean
>> $ find . -name test-disassembler-init-styled*
>> ./tools/build/feature/test-disassembler-init-styled.c
>> ./tools/objtool/feature/test-disassembler-init-styled.make.output
>> ./tools/objtool/feature/test-disassembler-init-styled.bin
>> ./tools/objtool/feature/test-disassembler-init-styled.d
>>
>> So the "make clean" command actually (re-)creates the .bin file. Worse,
>> if I now run
>>
>> $ make -C tools/objtool clean
>>
>> with the system toolchain, the .bin file is not removed.
>>
>> $ find . -name test-disassembler-init-styled*
>> ./tools/build/feature/test-disassembler-init-styled.make.output
>> ./tools/build/feature/test-disassembler-init-styled.bin
>> ./tools/build/feature/test-disassembler-init-styled.c
>> ./tools/build/feature/test-disassembler-init-styled.d
>>
>> The local toolchain used in this example is gcc 13.3.0 with binutils 2.42.
>>
>
> I think I've found the issue. The problem is that the feature check for objtool
> is also run for the "clean" target, and this creates the
> tools/build/feature/test-disassembler-init-styled.* files.
>
> The change below should fix this problem. I will prepare a patch. Note that
> you will still need to run "make -C tools/objtool clean" (I don't know the
> reason for "make clean" not to cleanup tools/objtool).
>
My workaround was to install Ubuntu 24.04 instead of 22.04 on all affected
systems, so I won't see the problem anymore (and obviously that also means
that I am unable to test potential fixes).
Guenter
Powered by blists - more mailing lists