[RFC v0 0/6] ASCII Command for output section

Nick Clifton nickc@redhat.com
Wed Feb 15 17:07:53 GMT 2023


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




More information about the Binutils mailing list