Linux Audio

Check our new training course

In-person Linux kernel drivers training

Jun 16-20, 2025
Register
Loading...
  1#include <asm/vmlinux.lds.h>
  2#include <asm/page.h>
  3
  4OUTPUT_FORMAT(ELF_FORMAT)
  5OUTPUT_ARCH(ELF_ARCH)
  6ENTRY(_start)
  7jiffies = jiffies_64;
  8
  9VERSION {
 10  {
 11    local: *;
 12  };
 13}
 14
 15SECTIONS
 16{
 17  PROVIDE (__executable_start = START);
 18  . = START + SIZEOF_HEADERS;
 19  .interp         : { *(.interp) }
 20  __binary_start = .;
 21  . = ALIGN(4096);		/* Init code and data */
 22  _text = .;
 23  INIT_TEXT_SECTION(PAGE_SIZE)
 24
 25  . = ALIGN(PAGE_SIZE);
 26
 27  /* Read-only sections, merged into text segment: */
 28  .hash           : { *(.hash) }
 29  .gnu.hash       : { *(.gnu.hash) }
 30  .dynsym         : { *(.dynsym) }
 31  .dynstr         : { *(.dynstr) }
 32  .gnu.version    : { *(.gnu.version) }
 33  .gnu.version_d  : { *(.gnu.version_d) }
 34  .gnu.version_r  : { *(.gnu.version_r) }
 35  .rel.init       : { *(.rel.init) }
 36  .rela.init      : { *(.rela.init) }
 37  .rel.text       : { *(.rel.text .rel.text.* .rel.gnu.linkonce.t.*) }
 38  .rela.text      : { *(.rela.text .rela.text.* .rela.gnu.linkonce.t.*) }
 39  .rel.fini       : { *(.rel.fini) }
 40  .rela.fini      : { *(.rela.fini) }
 41  .rel.rodata     : { *(.rel.rodata .rel.rodata.* .rel.gnu.linkonce.r.*) }
 42  .rela.rodata    : { *(.rela.rodata .rela.rodata.* .rela.gnu.linkonce.r.*) }
 43  .rel.data       : { *(.rel.data .rel.data.* .rel.gnu.linkonce.d.*) }
 44  .rela.data      : { *(.rela.data .rela.data.* .rela.gnu.linkonce.d.*) }
 45  .rel.tdata	  : { *(.rel.tdata .rel.tdata.* .rel.gnu.linkonce.td.*) }
 46  .rela.tdata	  : { *(.rela.tdata .rela.tdata.* .rela.gnu.linkonce.td.*) }
 47  .rel.tbss	  : { *(.rel.tbss .rel.tbss.* .rel.gnu.linkonce.tb.*) }
 48  .rela.tbss	  : { *(.rela.tbss .rela.tbss.* .rela.gnu.linkonce.tb.*) }
 49  .rel.ctors      : { *(.rel.ctors) }
 50  .rela.ctors     : { *(.rela.ctors) }
 51  .rel.dtors      : { *(.rel.dtors) }
 52  .rela.dtors     : { *(.rela.dtors) }
 53  .rel.got        : { *(.rel.got) }
 54  .rela.got       : { *(.rela.got) }
 55  .rel.bss        : { *(.rel.bss .rel.bss.* .rel.gnu.linkonce.b.*) }
 56  .rela.bss       : { *(.rela.bss .rela.bss.* .rela.gnu.linkonce.b.*) }
 57  .rel.plt : {
 58	*(.rel.plt)
 59	PROVIDE_HIDDEN(__rel_iplt_start = .);
 60	*(.rel.iplt)
 61	PROVIDE_HIDDEN(__rel_iplt_end = .);
 62  }
 63  .rela.plt : {
 64	*(.rela.plt)
 65	PROVIDE_HIDDEN(__rela_iplt_start = .);
 66	*(.rela.iplt)
 67	PROVIDE_HIDDEN(__rela_iplt_end = .);
 68  }
 69  .init           : {
 70    KEEP (*(.init))
 71  } =0x90909090
 72  .plt            : { *(.plt) }
 73  .text           : {
 74    _stext = .;
 75    TEXT_TEXT
 76    SCHED_TEXT
 77    LOCK_TEXT
 78    IRQENTRY_TEXT
 79    SOFTIRQENTRY_TEXT
 80    *(.fixup)
 81    *(.stub .text.* .gnu.linkonce.t.*)
 82    /* .gnu.warning sections are handled specially by elf32.em.  */
 83    *(.gnu.warning)
 84
 85    . = ALIGN(PAGE_SIZE);
 86  } =0x90909090
 87  . = ALIGN(PAGE_SIZE);
 88  .syscall_stub : {
 89	__syscall_stub_start = .;
 90	*(.__syscall_stub*)
 91	__syscall_stub_end = .;
 92  }
 93  .fini           : {
 94    KEEP (*(.fini))
 95  } =0x90909090
 96
 97  .kstrtab : { *(.kstrtab) }
 98
 99  #include <asm/common.lds.S>
100
101  __init_begin = .;
102  init.data : { INIT_DATA }
103  __init_end = .;
104
105  /* Ensure the __preinit_array_start label is properly aligned.  We
106     could instead move the label definition inside the section, but
107     the linker would then create the section even if it turns out to
108     be empty, which isn't pretty.  */
109  . = ALIGN(32 / 8);
110  .preinit_array     : { *(.preinit_array) }
111  .init_array     : {
112    *(.kasan_init)
113    *(.init_array.*)
114    *(.init_array)
115  }
116  .fini_array     : { *(.fini_array) }
117  .data           : {
118    INIT_TASK_DATA(KERNEL_STACK_SIZE)
119    DATA_DATA
120    *(.data.* .gnu.linkonce.d.*)
121    SORT(CONSTRUCTORS)
122  }
123  .data1          : { *(.data1) }
124  .tdata	  : { *(.tdata .tdata.* .gnu.linkonce.td.*) }
125  .tbss		  : { *(.tbss .tbss.* .gnu.linkonce.tb.*) *(.tcommon) }
126  .eh_frame       : { KEEP (*(.eh_frame)) }
127  .gcc_except_table   : { *(.gcc_except_table) }
128  .dynamic        : { *(.dynamic) }
129  .ctors          : {
130    /* gcc uses crtbegin.o to find the start of
131       the constructors, so we make sure it is
132       first.  Because this is a wildcard, it
133       doesn't matter if the user does not
134       actually link against crtbegin.o; the
135       linker won't look for a file to match a
136       wildcard.  The wildcard also means that it
137       doesn't matter which directory crtbegin.o
138       is in.  */
139    KEEP (*crtbegin.o(.ctors))
140    /* We don't want to include the .ctor section from
141       from the crtend.o file until after the sorted ctors.
142       The .ctor section from the crtend file contains the
143       end of ctors marker and it must be last */
144    KEEP (*(EXCLUDE_FILE (*crtend.o ) .ctors))
145    KEEP (*(SORT(.ctors.*)))
146    KEEP (*(.ctors))
147  }
148  .dtors          : {
149    KEEP (*crtbegin.o(.dtors))
150    KEEP (*(EXCLUDE_FILE (*crtend.o ) .dtors))
151    KEEP (*(SORT(.dtors.*)))
152    KEEP (*(.dtors))
153  }
154  .jcr            : { KEEP (*(.jcr)) }
155  .got            : { *(.got.plt) *(.got) }
156  _edata = .;
157  PROVIDE (edata = .);
158  .bss            : {
159   __bss_start = .;
160   *(.dynbss)
161   *(.bss .bss.* .gnu.linkonce.b.*)
162   *(COMMON)
163   /* Align here to ensure that the .bss section occupies space up to
164      _end.  Align after .bss to ensure correct alignment even if the
165      .bss section disappears because there are no input sections.  */
166   . = ALIGN(32 / 8);
167  . = ALIGN(32 / 8);
168  }
169   __bss_stop = .;
170  _end = .;
171  PROVIDE (end = .);
172
173  STABS_DEBUG
174  DWARF_DEBUG
175  ELF_DETAILS
176
177  DISCARDS
178}
179
180ASSERT(__syscall_stub_end - __syscall_stub_start <= PAGE_SIZE,
181       "STUB code must not be larger than one page");