[2.45 PATCH 1/3] strip: Don't check target_defaulted in input BFD

Sam James sam@gentoo.org
Sun Aug 31 10:01:22 GMT 2025


"H.J. Lu" <hjl.tools@gmail.com> writes:

> On Sat, Aug 30, 2025 at 3:16 PM Sam James <sam@gentoo.org> wrote:
>>
>> From: "H.J. Lu" <hjl.tools@gmail.com>
>>
>> The target_defaulted field in BFD is set to true if the target isn't
>> specified.  After
>>
>> commit 717a38e9a02109fcbcb18bb2ec3aa251e2ad0a0d
>> Author: H.J. Lu <hjl.tools@gmail.com>
>> Date:   Sun May 4 05:12:46 2025 +0800
>>
>>     strip: Add GCC LTO IR support
>>
>> the target is set to "plugin" if BFD supports plugin when the target
>> isn't specified nor default.  Update strip to check the input target,
>> instead of the target_defaulted field in input BFD.
>>
>>         PR binutils/33230
>>         * objcopy.c (copy_object): Add a bool argument, target_defaulted,
>>         to indicate if the input target isn't specified nor default.
>>         Check it instead of ibfd->target_defaulted.
>>         (copy_archive): Add a bool argument, target_defaulted, and pass
>>         it to copy_object.
>>         (copy_file): Set target_defaulted to true if the input target
>>         isn't specified and pass it to copy_archive and copy_object.
>>         * testsuite/binutils-all/x86-64/pr33230.obj.bz2: New file.
>>         * testsuite/binutils-all/x86-64/x86-64.exp: Run PR binutils/33230
>>         tests.
>>
>> Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
>> (cherry picked from commit 8e885fece150ee97e5b0e78363e7fe9888ae9c29)
>
> Should we backport Alan's cleanup patches?


We can't do all of them because at least one of them changes validation.

But it might be OK if we do up-to-and-including
46cd7e0dc8439b3f3bab1be553a9bea9a1bb5fe9.

sam


More information about the Binutils mailing list