public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Luca Boccassi <bluca@debian.org>
To: Cary Coutant <ccoutant@gmail.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: [PATCH] gold: add --package-metadata
Date: Fri, 29 Jul 2022 23:30:43 +0100	[thread overview]
Message-ID: <CAMw=ZnQs6dMeJxvyq-hn3xHQqbLUx5ycL2qiQLkrqLKtoeQqEA@mail.gmail.com> (raw)
In-Reply-To: <CAJimCsEGR3BAB1pPZdibdfG-k2Ygs7id2WqQjKnNkVnHmAtD2Q@mail.gmail.com>

On Fri, 29 Jul 2022 at 20:41, Cary Coutant <ccoutant@gmail.com> wrote:
>
> > Following the same format as the implementation in ld:
> > 9e2bb0cb5e74aed4158f08495534922d7108f928
> >
> > Generate a .note.package FDO package metadata ELF note, following
> > the spec: https://systemd.io/ELF_PACKAGE_METADATA/
> >
> > If the jansson library is available at build time (and it is explicitly
> > enabled), link ld to it, and use it to validate that the input is
> > correct JSON, to avoid writing garbage to the file. The
> > configure option --enable-jansson has to be used to explicitly enable
> > it (error out when not found). This allows bootstrappers (or others who
> > are not interested) to seamlessly skip it without issues.
>
> I reviewed the earlier discussion and I had some of the same questions
> and concerns as others did there, so they've all been answered. I'd
> have preferred an option syntax that would let you build up the
> metadata info one key/value pair at a time. Given that it has already
> been accepted for ld, however, I'll OK it for gold as well, with the
> following fixes...
>
> +  json_t *json = json_loads (desc, 0, &json_error);
>
> C++ coding conventions here: no space before the paren in a function call.
>
> +  if (!json)
> +    gold_fatal(_("error: --package-metadata=%s does not contain valid "
> +      "JSON: %s\n"),
> +    desc, json_error.text);
> +  else
> +    json_decref (json);
>
> Put the shorter, non-error path first (i.e., make it "if
> (json)...else..."), and use { } for the longer error path (even though
> it's only one statement, I think braces around a multi-line statement
> help readability). Also, no space before the paren.
>
> +  if (trailing_padding != 0)
> +  {
> +    posd = new Output_data_zero_fill(trailing_padding, 0);
> +    os->add_output_section_data(posd);
> +  }
>
> The braces and what's inside them need an extra two spaces of indent.
>
> -cary

Thank you for the review, sent v2 with the requested changes.

Kind regards,
Luca Boccassi

  reply	other threads:[~2022-07-29 22:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-26 19:22 luca.boccassi
2022-07-29 19:41 ` Cary Coutant
2022-07-29 22:30   ` Luca Boccassi [this message]
2022-07-29 22:29 ` [PATCH v2] " luca.boccassi
2022-08-02 10:50   ` Luca Boccassi
2022-08-04 14:08     ` Luca Boccassi
2022-08-05  0:41   ` Cary Coutant
2022-08-05  9:54     ` Luca Boccassi
  -- strict thread matches above, loose matches on Subject: below --
2022-05-26 18:52 [PATCH] " luca.boccassi
2022-06-08 13:29 ` Luca Boccassi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMw=ZnQs6dMeJxvyq-hn3xHQqbLUx5ycL2qiQLkrqLKtoeQqEA@mail.gmail.com' \
    --to=bluca@debian.org \
    --cc=binutils@sourceware.org \
    --cc=ccoutant@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).