public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: binutils@emagii.com, binutils@sourceware.org
Subject: Re: [RFC v0 0/6] ASCII Command for output section
Date: Wed, 15 Feb 2023 17:07:53 +0000	[thread overview]
Message-ID: <ce2103c9-5df7-bb59-ef38-07eeb35e1313@redhat.com> (raw)
In-Reply-To: <20230215114052.28292-1-binutils@emagii.com>

Hi Ulf,

> I would like to support
> 
>     ASCII <size> , <string>
> 
> when I try, and add
>     
>     ASCII  32 , "mystring"
> 
> I get a "syntax error", and would like to understand why.

Whilst I have not gone into this too deeply, I think that the
short answer is "because that is the way that the linker's
parser works".  It expects numerical expressions, including
constant integer values, to be enclosed in parentheses.

> If I do:
>     ASCII (<size>) <string>
> I do not get a syntax error when I do
> 
>     ASCII (32) "mystring"

Since this method works, I would suggest just sticking with it.

Also, whilst using sprintf() to process escape sequences is a
nice idea, it will not work.  Escape sequences are a C language
feature not a C library feature, so sprintf and its friends will
not translate them for you.

Cheers
   Nick



  parent reply	other threads:[~2023-02-15 17:08 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 ` Nick Clifton [this message]
2023-02-15 17:55   ` [RFC v0 0/6] ASCII Command for output section 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

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=ce2103c9-5df7-bb59-ef38-07eeb35e1313@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).