COMMONPAGESIZE)' This is equivalent to either (ALIGN(MAXPAGESIZE) + (. & (MAXPAGESIZE - 1))) or (ALIGN(MAXPAGESIZE) + ((. + COMMONPAGESIZE - 1) & (MAXPAGESIZE - COMMONPAGESIZE))) depending on whether the latter uses fewer COMMONPAGESIZE sized pages for the data segment (area between the result of this expression and 'DATA_SEGMENT_END') than the former or not. If the latter form is used, it means COMMONPAGESIZE bytes of runtime memory will be saved at the expense of up to COMMONPAGESIZE wasted bytes in the on-disk file. This expression can only be used directly in 'SECTIONS' commands, not in any output section descriptions and only once in the linker script. COMMONPAGESIZE should be less or equal to MAXPAGESIZE and should be the system page size the object wants to be optimized for while still running on system page sizes up to MAXPAGESIZE. Note however that '-z relro' protection will not be effective if the system page size is larger than COMMONPAGESIZE. Example: . = DATA_SEGMENT_ALIGN(0x10000, 0x2000); 'DATA_SEGMENT_END(EXP)' This defines the end of data segment for 'DATA_SEGMENT_ALIGN' evaluation purposes. . = DATA_SEGMENT_END(.); 'DATA_SEGMENT_RELRO_END(OFFSET, EXP)' This defines the end of the 'PT_GNU_RELRO' segment when '-z relro' option is used. When '-z relro' option is not present, 'DATA_SEGMENT_RELRO_END' does nothing, otherwise 'DATA_SEGMENT_ALIGN' is padded so that EXP + OFFSET is aligned to the COMMONPAGESIZE argument given to 'DATA_SEGMENT_ALIGN'. If present in the linker script, it must be placed between 'DATA_SEGMENT_ALIGN' and 'DATA_SEGMENT_END'. Evaluates to the second argument plus any padding needed at the end of the 'PT_GNU_RELRO' segment due to section alignment. . = DATA_SEGMENT_RELRO_END(24, .); 'DEFINED(SYMBOL)' Return 1 if SYMBOL is in the linker global symbol table and is defined before the statement using DEFINED in the script, otherwise return 0. You can use this function to provide default values for symbols. For example, the following script fragment shows how to set a global symbol 'begin' to the first location in the '.text' section--but if a symbol called 'begin' already existed, its value is preserved: SECTIONS { ... .text : { begin = DEFINED(begin) ? begin : . ; ... } ... } 'LENGTH(MEMORY)' Return the length of the memory region named MEMORY. 'LOADADDR(SECTION)' Return the absolute LMA of the named SECTION. (*note Output Section LMA::). 'LOG2CEIL(EXP)' Return the binary logarithm of EXP rounded towards infinity. 'LOG2CEIL(0)' returns 0. 'MAX(EXP1, EXP2)' Returns the maximum of EXP1 and EXP2. 'MIN(EXP1, EXP2)' Returns the minimum of EXP1 and EXP2. 'NEXT(EXP)' Return the next unallocated address that is a multiple of EXP. This function is closely related to 'ALIGN(EXP)'; unless you use the 'MEMORY' command to define discontinuous memory for the output file, the two functions are equivalent. 'ORIGIN(MEMORY)' Return the origin of the memory region named MEMORY. 'SEGMENT_START(SEGMENT, DEFAULT)' Return the base address of the named SEGMENT. If an explicit value has already been given for this segment (with a command-line '-T' option) then that value will be returned otherwise the value will be DEFAULT. At present, the '-T' command-line option can only be used to set the base address for the "text", "data", and "bss" sections, but you can use 'SEGMENT_START' with any segment name. 'SIZEOF(SECTION)' Return the size in bytes of the named SECTION, if that section has been allocated. If the section has not been allocated when this is evaluated, the linker will report an error. In the following example, 'symbol_1' and 'symbol_2' are assigned identical values: SECTIONS{ ... .output { .start = . ; ... .end = . ; } symbol_1 = .end - .start ; symbol_2 = SIZEOF(.output); ... } 'SIZEOF_HEADERS' 'sizeof_headers' Return the size in bytes of the output file's headers. This is information which appears at the start of the output file. You can use this number when setting the start address of the first section, if you choose, to facilitate paging. When producing an ELF output file, if the linker script uses the 'SIZEOF_HEADERS' builtin function, the linker must compute the number of program headers before it has determined all the section addresses and sizes. If the linker later discovers that it needs additional program headers, it will report an error 'not enough room for program headers'. To avoid this error, you must avoid using the 'SIZEOF_HEADERS' function, or you must rework your linker script to avoid forcing the linker to use additional program headers, or you must define the program headers yourself using the 'PHDRS' command (*note PHDRS::).