SECTIONS { . = 0xffff /* set address counter */ .outputsection = { filename(.inputsection) } /* can use * for file */ } ENTRY(symbol) /* define entry point, overridden by -e option */ INCLUDE FILENAME /* command-line equivalents: */ INPUT(file file2...) /* include files in like, as if on cmd line */ GROUP(file file2...) /* like input, but for archives */ OUTPUT(name) /* overridden by -o command line option */ SEARCH_DIR(path) /* adds a -L option */ STARTUP(filename) /* adds file, as if to BEGINNING of list */ OUTPUT_FORMAT(bfdname/default,big,little) /* like -oformat */ TARGET(bfdname) /* affects how input files read. like -b BFDNAME */ /* Misc */ ASSERT(exp, message) /* assert is an EXPRESSION; must be used or assigned */ EXTERN(symbol symbol2...) FORCE_COMMON_ALLOCATION /* equivalent to -d */ NOCROSSREFS(section section2 ...) /* for use with, say, overlays */ OUTPUT_ARCH(bfdarch) /* set machine architecture of output */ ALIGN(alignment) /* . rounded up to alignment */ /* Symbol Creation */ SYMBOL = / += / -= / *= / /= / <<= / >>= / &= / != EXPRESSION ; /* can be done at root leve, inside SECTIONS, or inside a section */ PROVIDE(symbol = expression); /* define only if referenced and absent */ /* Sections */ SECTIONS { ENTRY() symbol=value; sectionname [address] [(type)] : [at(lma)] { symbol=value; inputfile(inputsection) BYTE(literal) /* or SHORT, LONG, QUAD, SQUAD */ FILL(literal) /* until the next section */ } [>regionname] [AT(lma_addr)] [:phdr :phdr ...] [=fillexp] /* address is vma. . is used if address and region not given. for input *(.s1 .s2) and *(.s1) *(.s2) include them in a different order *, ?, [], and \ work as special symbols magic section COMMON includes common symbols special section name /DISCARD/ throws shit out types: DSECT, COPY, INFO, OVERLAY (all man not allocatable) NOLOAD (don't load it, such as ROM) regionnames are set up with the MEMORY command */ } MEMORY { name [(attr) : ORIGIN = orig, LENGTH = len /* attr: R, W, X, A=alloc, I=init, ! inverts tset */ } PHDRS { name type [FILEHDR] [PHDRS] [AT (address)] [FLAGS(flags)] /* name is referred to on SECTIONS; not written type is PT_XXXX, as in the ELF spec */ } /* Version */ VERSION { name_number { global: symbol; local: local_*; /* wildcards allowed */ }; name_anothernumber { anothersymbol; } name_number; /* depends on previous version */ /* use __asm__(".symver [local:] symbol,exportname@name_version") in code */ /* double @@ indicates default for new linking */ /* when using explicit version script, leave off the outer VERSION block */ }