Linker command file syntax is a notation and implies what an LCF file includes. Linker Command File Syntax shows the syntax for linker command files.
linker-command-file = command* memory? command* sections? command*
This syntax implies that an LCF file can contain:
Zero or more command directives followed by Zero or at most one memory directive followed by Zero or more command directives followed by Zero or at most one sections directive followed by Zero or more command directives.
The table below lists the notations used in the linker command file syntax.
| Notation | Description |
|---|---|
| * | Implies zero or any number of directives |
| ? | Implies zero or at most one directive |
Linker Command File Syntax (Commands, Directives, and Keywords) shows the syntax of all valid linker command file keywords, directives, and commands.
command =
exclude-files |
force-active |
force-files |
include-dwarf |
keep |
ref-include |
shorten-names-for-tornado-101 |
cats-bss-mod |
cats-header-mod |
data-type-converts |
entry |
init |
term |
external-symbol |
internal-symbol |
memory-gaps
exclude-files =
"EXCLUDEFILES" "{" file-name+ "}"
force-active =
"FORCEACTIVE" "{" symbol+ "}"
letter =
'a'|'b'|'c'|'d'|'e'|'f'|'g'|'h'|'i'|'j'|'k'|'l'|'m'|
'n'|'o'|'p'|'q'|'r'|'s'|'t'|'u'|'v'|'w'|'x'|'y'|'z'|
'A'|'B'|'C'|'D'|'E'|'F'|'G'|'H'|'I'|'J'|'K'|'L'|'M'|
'N'|'O'|'P'|'Q'|'R'|'S'|'T'|'U'|'V'|'W'|'X'|'Y'|'Z'
file-name =
(letter |"_") (letter |digit |"_")*
(".")?(letter |digit |"_")*
section-name =
(letter |"_") (letter |digit |"_")*
object-file =
(letter |"_") (letter |digit |"_")* (".") ("o"|"O")
archive-file =
(letter |"_") (letter | digit |"_")* (".") ("a"|"A")
include-dwarf =
"INCLUDEDWARF" "{" file-name "}"
keep =
"KEEP""(" *( section-name )")"
ref-include =
"REF_INCLUDE" "{" section-name+ "}"
shorten-names-for-tornado-101=
"SHORTEN_NAMES_FOR_TOR_101"
cats-bss-mod =
"CATS_BSS_MOD"
cats-header-mod =
"CATS_HEADER_MOD"
data-type-converts =
"DATA_TYPE_CONVERTS"
entry =
"ENTRY" "(" symbol ")"
init =
"INIT" "(" symbol ")"
term =
"TERM" "(" symbol ")"
external-symbol =
"EXTERNAL_SYMBOL" "{" symbol ["," symbol] "}"
internal-symbol =
"INTERNAL_SYMBOL" "{" symbol ["," symbol] "}"
group=
"GROUP" address-modifiers ":"
"{" (section-spec )* "}" ["=" fill-shortnumber ]
[ "> " mem-area-symbol ]
hexadigit =
'0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9'|
'A'|'B'|'C'|'D'|'E'|'a'|'b'|'c'|'d'|'e'
digit =
'0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9'
hexadecimal-number =
"0"("x"|"X")hexadigit+
decimal-number =
digit+
number =
hexadecimal-number | decimal-number
binary-op =
'+'|'-'|'*'|'/'| '%' '==' | '!=' | '>'| '>='| '<'| '<='|
'&&' | '||' '>>' | '<<' | '&' | '|' | '' | ''
unary-op =
'++' | '--' | '~' | '!'
postfix-unary-op =
'++' | '--'
symbol-declaration =
( symbol "=" address-spec ) |
( "PROVIDE" "(" identifier "=" address=spec ")" ) |
( "EXPORTSYMTAB") |
( "EXPORTSTRTAB") |
( "BYTE" "(" address-spec ")" |
( "SHORT" "(" address-spec ")" |
( "LONG" "(" address-spec ")"
symbol =
(letter |"_") (letter|"_"|digit )*
operand =
number |
("ADDR" "(" output-section-spec | address-expr ")" ) |
("ROMADDR" "(" output-section-spec | address-expr ")" |
("SIZEOF" "(" output-section-spec | address-expr ")" ) |
("SIZEOF_ROM" "(" output-section-spec | address-expr ")" )
address-spec =
number |
"." |
operand |
(address-spec binary-op operand ) |
(unary-op address-spec ) |
(address-spec postfix-unary-op )
memory-spec =
memory-area-symbol ":" "origin" |
"org" |
"o" "=" number "," "length"|
"len" |
"l" "=" number
[">" file-name]
memory-gaps =
"." "=" address-spec
memory =
"MEMORY" "{" memory-spec + "}"
sections =
"SECTIONS" "{"
(section-spec | memory-gaps | symbol-declaration | group )*
"}"
section-spec =
output-section-name ":"
["(" input-type ")"]
[address-modifiers ] "{"
[( input-section-spec )*] "}"
[= fill-shortnumber] [(">"|">>") memory-area-symbol ]
output-section-name =
section-name
input-type =
[ "TEXT" | "DATA" | "BSS" | "CONST" | "ZTEXT" | "ZCODE"|
"VLECODE" ]
address-modifiers =
["BIND" "(" address-spec ")" ]
["ALIGN" "(" address-spec ")" ]
["NEXT" "(" address-spec ")"]
["LOAD" "(" address-spec ")"]
["INTERNAL_LOAD" "(" address-spec ")"]
input-section-spec =
( file-name |
file-name "(" section-name ")" |
"*(" section-name ")" |
symbol-declaration |
data-write )+
data-write =
("LONG" | "SHORT" | "BYTE" ) "(" number ")"
fill-shortnumber =
number