From: Nick Clifton <nickc@redhat.com>
To: Ulf Samuelsson <binutils@emagii.com>, binutils@sourceware.org
Subject: Re: [RFC v0 0/6] ASCII Command for output section
Date: Thu, 16 Feb 2023 16:31:51 +0000 [thread overview]
Message-ID: <24fb6e9d-1452-b36a-9a2e-afabb46e2f76@redhat.com> (raw)
In-Reply-To: <83926d68-c2da-e99b-848f-525a9dc28f47@emagii.com>
Hi Ulf,
>> What do you think of this alternative version of your patch ?
OK, I have now applied a tweaked version of the patch.
> A little closer look reveals that there is some oddities in the white space.
> Also, when the string in the ASCII command is longer than the specified
> length, only we need to insert a '\0' character at the end.
>
> For this:
>
> len = size;
>
> must be changed to
>
> len = size - 1;
Done.
> The size is specified by a "mustbe_exp"
>
> | ASCII '(' mustbe_exp ')' NAME
>
> {
> /* 'value' is a memory leak, do we care? */
> etree_type *value = $3;
> lang_add_string (value->value.value, $5);
> }
>
> I cannot judge the consequences of having a full expression, instead of an INT.
>
> Will the "value->value.value" work, if we do
>
> ASCII (3 * 15) "Long string"
It works. The area assigned will be 45 bytes. I tested it, and included a version
of this expression in the new linker test.
> We do a malloc in the "etree_type *value = $3;" statement.
> This is thrown away without a "free".
>
> Is that a problem anywhere?
> I guess most OSes would reclaim everything once the 'ld' terminates.
> There will not be that many ASCII statements in a linker command file.
Right. As far as I am concerned a leak this small is not important.
Cheers
Nick
prev parent reply other threads:[~2023-02-16 16:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-15 11:40 binutils
2023-02-15 11:40 ` [PATCH v0 1/6] Add testsuite for ASCII command binutils
2023-02-15 11:40 ` [PATCH v0 2/6] Add ASCII command info to NEWS binutils
2023-02-15 11:40 ` [PATCH v0 3/6] Add ASCII to info file binutils
2023-02-15 11:40 ` [PATCH v0 4/6] ldlex.l: add ASCII binutils
2023-02-15 11:44 ` Ulf Samuelsson
2023-02-15 11:40 ` [PATCH v0 5/6] ldgram.y: " binutils
2023-02-15 11:40 ` [PATCH v0 6/6] ldlang.*: parse ASCII command binutils
2023-02-15 17:07 ` [RFC v0 0/6] ASCII Command for output section Nick Clifton
2023-02-15 17:55 ` Ulf Samuelsson
2023-02-15 17:28 ` Nick Clifton
2023-02-15 17:52 ` Ulf Samuelsson
2023-02-15 18:29 ` Ulf Samuelsson
2023-02-16 16:31 ` Nick Clifton [this message]
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=24fb6e9d-1452-b36a-9a2e-afabb46e2f76@redhat.com \
--to=nickc@redhat.com \
--cc=binutils@emagii.com \
--cc=binutils@sourceware.org \
/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).