Skip to content

Latest commit

 

History

History
133 lines (120 loc) · 6.22 KB

File metadata and controls

133 lines (120 loc) · 6.22 KB

Linker Script Support

This page documents which linker script features Wild supports, which are partially implemented, and which are planned for the future. Each feature is marked with one of four statuses: (supported), 🧪 (partial), 📅 (planned), or (not planned). A dedicated section at the end lists the features required to link the Linux kernel.

Top-Level Commands

Feature Status Notes
GROUP(files...)
INPUT(files...)
AS_NEEDED(files...)
INCLUDE(file) 📅
OUTPUT_FORMAT(...) 🧪 Emits error if the format doest not match the target
OUTPUT_ARCH(arch) 🧪 Parsed and ignored
OUTPUT(filename)
SECTIONS { ... }
ENTRY(symbol)
VERSION { ... }
PROVIDE(sym = expr)
PROVIDE_HIDDEN(sym = expr)
ASSERT(expr, "msg")
MEMORY { ... } 🧪 Region parsing supported; attribute flags and >region placement not yet implemented
REGION_ALIAS(alias, region)
SEARCH_DIR(path)
STARTUP(filename)
TARGET(bfdname)
NOCROSSREFS(sections...)
INSERT [AFTER|BEFORE] section
Top-level symbol assignment (sym = expr)
Compound assignment operators (+=, -=, etc.)
PHDRS command for explicit program header definition 🧪 The AT attribute is not yet supported

SECTIONS Block

Feature Status Notes
Output section definitions (name : { ... })
Input section matchers (*(pattern), file(pattern))
Glob patterns in section and file names
KEEP(...) to prevent garbage collection
PROVIDE(sym = expr) inside sections
PROVIDE_HIDDEN(sym = expr) inside sections
Symbol assignment inside sections (sym = .)
Location counter assignment (. = expr) 🧪 constant expressions (e.g. . = 0x1000 * 2) are supported
ALIGN(n) on the location counter (. = ALIGN(n))
Per-section ALIGN(n) specifier
ASSERT(expr, "msg") inside SECTIONS
OVERLAY { ... }
Output section type specifiers ((NOLOAD), (COPY), etc.) 🧪 Setting the section type using the TYPE attribute is not yet supported
FILL(value) 📅
=fillexp
AT(addr) load-address specifier on output sections
Numeric address between section name and : (e.g. name 0 : { ... }) 🧪 Only numeric literals are currently supported
SORT(...), SORT_BY_NAME(...)
SORT_BY_ALIGNMENT(...) Parsed and ignored, as sections are sorted by alignment by default
SORT_BY_INIT_PRIORITY(...) 📅
EXCLUDE_FILE(...) inside input section matchers 📅
BYTE(expr), SHORT(expr), LONG(expr), QUAD(expr) output data
SUBALIGN(n) forced input alignment
ONLY_IF_RO / ONLY_IF_RW output section constraints
:phdr output section phdrs

Expressions and Functions

Feature Status Notes
Arithmetic operators: +, -, *, /
Comparison operators: <, >, <=, >=, ==, !=
Bitwise operators: &, |, ^, ~, <<, >>
Logical operators: &&, ||
Unary operators: -, !, ~
Numeric literals: decimal and hexadecimal
Numeric literal K/M suffixes (e.g. 64K, 2M)
Symbol references and location counter (.)
Parenthesised sub-expressions
SIZEOF(section)
ALIGNOF(section)
ADDR(section)
LOADADDR(section)
ALIGN(expr)
LENGTH(region)
ORIGIN(region)
MIN(a, b)
MAX(a, b)
Ternary operator (condition ? a : b)
DEFINED(sym)
SIZEOF_HEADERS
SEGMENT_START(segment, default) Supports "text", "data", "bss", "rodata"; returns -Ttext/-Tdata/-Tbss override if provided, otherwise default; unknown segment names always return default

MEMORY Command

The MEMORY command defines named memory regions with an origin address and a length. Wild parses MEMORY blocks including the ORIGIN/org/o and LENGTH/len/l attribute keywords and their expressions. Attribute flags such as (rwx) are not yet parsed. Placement directives that assign an output section to a named region (>region, AT>region) are not yet implemented.

Feature Status Notes
MEMORY { ... } block parsing
Region name
ORIGIN/org/o attribute
LENGTH/len/l attribute
Attribute flags ((rwx), (rx), etc.) 📅
>region output section placement 📅
AT>region load-region placement 📅

Linux Kernel Requirements

The Linux kernel's build system uses a rich set of linker script features across vmlinux.lds and related architecture-specific scripts. Several of these features are not yet fully supported by Wild. The table below lists each such feature along with its current status, so contributors can see at a glance what remains before Wild can link the kernel.

Feature Status Notes
OVERLAY { ... } sections
Output section type specifiers ((NOLOAD), (COPY)) The TYPE attribute is not used in the kernel
FILL(value) 📅
=fillexp
AT(addr) load-address specifier on output sections
>region and AT>region memory region placement 📅
SORT(...), SORT_BY_NAME(...)
SORT_BY_ALIGNMENT(...) Parsed and ignored, as sections are sorted by alignment by default
EXCLUDE_FILE(...) inside input section matchers 📅
CONSTRUCTORS command Parsed and ignored, it is a nop for ELF.
PHDRS command for explicit program header definition
Ternary operator (condition ? a : b)
DEFINED(sym) function
SIZEOF_HEADERS built-in symbol
/DISCARD/ command