I am looking for the formal grammar of the linker script. Something similar to the ones given to lex and yacc but not with the other yacc baggage. May be I can find the yacc like grammar if I look directly in the source code of the ld
. But I don't want to do that now.
I have seen this question and its answers, but it refers to manpages of ld
. The manpages are fine to a large extent but they do specify things in somewhat ambiguous manner. For example,
Take this snippet from the Assignment: Defining Symbols It says:
For example, to create an absolute symbol whose address is the last byte of an output section named .data:
SECTIONS{ ...
.data :
{
*(.data)
_edata = ABSOLUTE(.) ;
}
... }
How is one to interpret the ...
?
This is one example. I may be able to interpret this one thing sufficiently accurately after some struggle; but there are many such examples; so my question is: is there a better and formal specification available for linker scripts? Something like the C grammar that you see in an appendix of the book The C Language
by Ritchie and Kernighan?