[PATCH] ld: Add --encoded-package-metadata

Jan Beulich jbeulich@suse.com
Thu Jul 18 08:55:23 GMT 2024


On 18.07.2024 10:17, Matthias Klose wrote:
> On 16.07.24 10:57, Jan Beulich wrote:
>> On 16.07.2024 10:32, Benjamin Drung wrote:
>>> On Tue, 2024-07-16 at 08:19 +0200, Jan Beulich wrote:
>>>> On 15.07.2024 20:43, Benjamin Drung wrote:
>>>>> Specifying the compiler flag `-Wl,--package-metadata=<JSON>` might not
>>>>> work, because the shells might eat the quotation marks and the compiler
>>>>> splits the JSON at the commas.
>>>>>
>>>>> Ubuntu tried to using a specs file to set `--package-metadata` but that
>>>>> turned out to be too fragile. autopkgtests might use the compiler flags
>>>>> but the needed environment variables are not set in the test
>>>>> environment. Debugging a crash of an application build with the -spec
>>>>> parameter lacks the environment variables. People like to iteratively
>>>>> continue building the software in the build directory while hacking on
>>>>> the package and then have no environment variable set.
>>>>>
>>>>> So introduce a `--encoded-package-metadata` linker flag that takes a
>>>>> percent-encoded JSON. Percent-encoding is used because it is a
>>>>> standard and simple to implement.
>>>>>
>>>>> Bug-Ubutru: https://bugs.launchpad.net/bugs/2071468
>>>>> Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
>>>>
>>>> Fundamentally fine, but please add a testcase (even if it's a contrived one).
>>>> And there are a number of style issues (see below).
>>>
>>> I am working on a test case, but I'll send the reformatted code as patch
>>> v2 for allowing to review the formatting changes.
>>
>> That looks much better, yes. Thanks.
> 
> is that an approval, and can be committed?

There was a v3 submitted, which still needs looking at. I can't (won't)
approve the testcase addition that was still missing in v2 without
having looked at that.

Jan


More information about the Binutils mailing list