vmlinux.lds.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781
  1. /*
  2. * Helper macros to support writing architecture specific
  3. * linker scripts.
  4. *
  5. * A minimal linker scripts has following content:
  6. * [This is a sample, architectures may have special requiriements]
  7. *
  8. * OUTPUT_FORMAT(...)
  9. * OUTPUT_ARCH(...)
  10. * ENTRY(...)
  11. * SECTIONS
  12. * {
  13. * . = START;
  14. * __init_begin = .;
  15. * HEAD_TEXT_SECTION
  16. * INIT_TEXT_SECTION(PAGE_SIZE)
  17. * INIT_DATA_SECTION(...)
  18. * PERCPU(PAGE_SIZE)
  19. * __init_end = .;
  20. *
  21. * _stext = .;
  22. * TEXT_SECTION = 0
  23. * _etext = .;
  24. *
  25. * _sdata = .;
  26. * RO_DATA_SECTION(PAGE_SIZE)
  27. * RW_DATA_SECTION(...)
  28. * _edata = .;
  29. *
  30. * EXCEPTION_TABLE(...)
  31. * NOTES
  32. *
  33. * BSS_SECTION(0, 0, 0)
  34. * _end = .;
  35. *
  36. * STABS_DEBUG
  37. * DWARF_DEBUG
  38. *
  39. * DISCARDS // must be the last
  40. * }
  41. *
  42. * [__init_begin, __init_end] is the init section that may be freed after init
  43. * [_stext, _etext] is the text section
  44. * [_sdata, _edata] is the data section
  45. *
  46. * Some of the included output section have their own set of constants.
  47. * Examples are: [__initramfs_start, __initramfs_end] for initramfs and
  48. * [__nosave_begin, __nosave_end] for the nosave data
  49. */
  50. #ifndef LOAD_OFFSET
  51. #define LOAD_OFFSET 0
  52. #endif
  53. #ifndef SYMBOL_PREFIX
  54. #define VMLINUX_SYMBOL(sym) sym
  55. #else
  56. #define PASTE2(x,y) x##y
  57. #define PASTE(x,y) PASTE2(x,y)
  58. #define VMLINUX_SYMBOL(sym) PASTE(SYMBOL_PREFIX, sym)
  59. #endif
  60. /* Align . to a 8 byte boundary equals to maximum function alignment. */
  61. #define ALIGN_FUNCTION() . = ALIGN(8)
  62. /*
  63. * Align to a 32 byte boundary equal to the
  64. * alignment gcc 4.5 uses for a struct
  65. */
  66. #define STRUCT_ALIGN() . = ALIGN(32)
  67. /* The actual configuration determine if the init/exit sections
  68. * are handled as text/data or they can be discarded (which
  69. * often happens at runtime)
  70. */
  71. #ifdef CONFIG_HOTPLUG
  72. #define DEV_KEEP(sec) *(.dev##sec)
  73. #define DEV_DISCARD(sec)
  74. #else
  75. #define DEV_KEEP(sec)
  76. #define DEV_DISCARD(sec) *(.dev##sec)
  77. #endif
  78. #ifdef CONFIG_HOTPLUG_CPU
  79. #define CPU_KEEP(sec) *(.cpu##sec)
  80. #define CPU_DISCARD(sec)
  81. #else
  82. #define CPU_KEEP(sec)
  83. #define CPU_DISCARD(sec) *(.cpu##sec)
  84. #endif
  85. #if defined(CONFIG_MEMORY_HOTPLUG)
  86. #define MEM_KEEP(sec) *(.mem##sec)
  87. #define MEM_DISCARD(sec)
  88. #else
  89. #define MEM_KEEP(sec)
  90. #define MEM_DISCARD(sec) *(.mem##sec)
  91. #endif
  92. #ifdef CONFIG_FTRACE_MCOUNT_RECORD
  93. #define MCOUNT_REC() . = ALIGN(8); \
  94. VMLINUX_SYMBOL(__start_mcount_loc) = .; \
  95. *(__mcount_loc) \
  96. VMLINUX_SYMBOL(__stop_mcount_loc) = .;
  97. #else
  98. #define MCOUNT_REC()
  99. #endif
  100. #ifdef CONFIG_TRACE_BRANCH_PROFILING
  101. #define LIKELY_PROFILE() VMLINUX_SYMBOL(__start_annotated_branch_profile) = .; \
  102. *(_ftrace_annotated_branch) \
  103. VMLINUX_SYMBOL(__stop_annotated_branch_profile) = .;
  104. #else
  105. #define LIKELY_PROFILE()
  106. #endif
  107. #ifdef CONFIG_PROFILE_ALL_BRANCHES
  108. #define BRANCH_PROFILE() VMLINUX_SYMBOL(__start_branch_profile) = .; \
  109. *(_ftrace_branch) \
  110. VMLINUX_SYMBOL(__stop_branch_profile) = .;
  111. #else
  112. #define BRANCH_PROFILE()
  113. #endif
  114. #ifdef CONFIG_EVENT_TRACING
  115. #define FTRACE_EVENTS() VMLINUX_SYMBOL(__start_ftrace_events) = .; \
  116. *(_ftrace_events) \
  117. VMLINUX_SYMBOL(__stop_ftrace_events) = .;
  118. #else
  119. #define FTRACE_EVENTS()
  120. #endif
  121. #ifdef CONFIG_TRACING
  122. #define TRACE_PRINTKS() VMLINUX_SYMBOL(__start___trace_bprintk_fmt) = .; \
  123. *(__trace_printk_fmt) /* Trace_printk fmt' pointer */ \
  124. VMLINUX_SYMBOL(__stop___trace_bprintk_fmt) = .;
  125. #else
  126. #define TRACE_PRINTKS()
  127. #endif
  128. #ifdef CONFIG_FTRACE_SYSCALLS
  129. #define TRACE_SYSCALLS() VMLINUX_SYMBOL(__start_syscalls_metadata) = .; \
  130. *(__syscalls_metadata) \
  131. VMLINUX_SYMBOL(__stop_syscalls_metadata) = .;
  132. #else
  133. #define TRACE_SYSCALLS()
  134. #endif
  135. /* .data section */
  136. #define DATA_DATA \
  137. *(.data) \
  138. *(.ref.data) \
  139. DEV_KEEP(init.data) \
  140. DEV_KEEP(exit.data) \
  141. CPU_KEEP(init.data) \
  142. CPU_KEEP(exit.data) \
  143. MEM_KEEP(init.data) \
  144. MEM_KEEP(exit.data) \
  145. . = ALIGN(32); \
  146. VMLINUX_SYMBOL(__start___tracepoints) = .; \
  147. *(__tracepoints) \
  148. VMLINUX_SYMBOL(__stop___tracepoints) = .; \
  149. /* implement dynamic printk debug */ \
  150. . = ALIGN(8); \
  151. VMLINUX_SYMBOL(__start___verbose) = .; \
  152. *(__verbose) \
  153. VMLINUX_SYMBOL(__stop___verbose) = .; \
  154. LIKELY_PROFILE() \
  155. BRANCH_PROFILE() \
  156. TRACE_PRINTKS() \
  157. \
  158. STRUCT_ALIGN(); \
  159. FTRACE_EVENTS() \
  160. \
  161. STRUCT_ALIGN(); \
  162. TRACE_SYSCALLS()
  163. /*
  164. * Data section helpers
  165. */
  166. #define NOSAVE_DATA \
  167. . = ALIGN(PAGE_SIZE); \
  168. VMLINUX_SYMBOL(__nosave_begin) = .; \
  169. *(.data..nosave) \
  170. . = ALIGN(PAGE_SIZE); \
  171. VMLINUX_SYMBOL(__nosave_end) = .;
  172. #define PAGE_ALIGNED_DATA(page_align) \
  173. . = ALIGN(page_align); \
  174. *(.data..page_aligned)
  175. #define READ_MOSTLY_DATA(align) \
  176. . = ALIGN(align); \
  177. *(.data..read_mostly)
  178. #define CACHELINE_ALIGNED_DATA(align) \
  179. . = ALIGN(align); \
  180. *(.data..cacheline_aligned)
  181. #define INIT_TASK_DATA(align) \
  182. . = ALIGN(align); \
  183. *(.data..init_task)
  184. /*
  185. * Read only Data
  186. */
  187. #define RO_DATA_SECTION(align) \
  188. . = ALIGN((align)); \
  189. .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
  190. VMLINUX_SYMBOL(__start_rodata) = .; \
  191. *(.rodata) *(.rodata.*) \
  192. *(__vermagic) /* Kernel version magic */ \
  193. *(__markers_strings) /* Markers: strings */ \
  194. *(__tracepoints_strings)/* Tracepoints: strings */ \
  195. } \
  196. \
  197. .rodata1 : AT(ADDR(.rodata1) - LOAD_OFFSET) { \
  198. *(.rodata1) \
  199. } \
  200. \
  201. BUG_TABLE \
  202. \
  203. JUMP_TABLE \
  204. \
  205. /* PCI quirks */ \
  206. .pci_fixup : AT(ADDR(.pci_fixup) - LOAD_OFFSET) { \
  207. VMLINUX_SYMBOL(__start_pci_fixups_early) = .; \
  208. *(.pci_fixup_early) \
  209. VMLINUX_SYMBOL(__end_pci_fixups_early) = .; \
  210. VMLINUX_SYMBOL(__start_pci_fixups_header) = .; \
  211. *(.pci_fixup_header) \
  212. VMLINUX_SYMBOL(__end_pci_fixups_header) = .; \
  213. VMLINUX_SYMBOL(__start_pci_fixups_final) = .; \
  214. *(.pci_fixup_final) \
  215. VMLINUX_SYMBOL(__end_pci_fixups_final) = .; \
  216. VMLINUX_SYMBOL(__start_pci_fixups_enable) = .; \
  217. *(.pci_fixup_enable) \
  218. VMLINUX_SYMBOL(__end_pci_fixups_enable) = .; \
  219. VMLINUX_SYMBOL(__start_pci_fixups_resume) = .; \
  220. *(.pci_fixup_resume) \
  221. VMLINUX_SYMBOL(__end_pci_fixups_resume) = .; \
  222. VMLINUX_SYMBOL(__start_pci_fixups_resume_early) = .; \
  223. *(.pci_fixup_resume_early) \
  224. VMLINUX_SYMBOL(__end_pci_fixups_resume_early) = .; \
  225. VMLINUX_SYMBOL(__start_pci_fixups_suspend) = .; \
  226. *(.pci_fixup_suspend) \
  227. VMLINUX_SYMBOL(__end_pci_fixups_suspend) = .; \
  228. } \
  229. \
  230. /* Built-in firmware blobs */ \
  231. .builtin_fw : AT(ADDR(.builtin_fw) - LOAD_OFFSET) { \
  232. VMLINUX_SYMBOL(__start_builtin_fw) = .; \
  233. *(.builtin_fw) \
  234. VMLINUX_SYMBOL(__end_builtin_fw) = .; \
  235. } \
  236. \
  237. /* RapidIO route ops */ \
  238. .rio_ops : AT(ADDR(.rio_ops) - LOAD_OFFSET) { \
  239. VMLINUX_SYMBOL(__start_rio_switch_ops) = .; \
  240. *(.rio_switch_ops) \
  241. VMLINUX_SYMBOL(__end_rio_switch_ops) = .; \
  242. } \
  243. \
  244. TRACEDATA \
  245. \
  246. /* Kernel symbol table: Normal symbols */ \
  247. __ksymtab : AT(ADDR(__ksymtab) - LOAD_OFFSET) { \
  248. VMLINUX_SYMBOL(__start___ksymtab) = .; \
  249. *(__ksymtab) \
  250. VMLINUX_SYMBOL(__stop___ksymtab) = .; \
  251. } \
  252. \
  253. /* Kernel symbol table: GPL-only symbols */ \
  254. __ksymtab_gpl : AT(ADDR(__ksymtab_gpl) - LOAD_OFFSET) { \
  255. VMLINUX_SYMBOL(__start___ksymtab_gpl) = .; \
  256. *(__ksymtab_gpl) \
  257. VMLINUX_SYMBOL(__stop___ksymtab_gpl) = .; \
  258. } \
  259. \
  260. /* Kernel symbol table: Normal unused symbols */ \
  261. __ksymtab_unused : AT(ADDR(__ksymtab_unused) - LOAD_OFFSET) { \
  262. VMLINUX_SYMBOL(__start___ksymtab_unused) = .; \
  263. *(__ksymtab_unused) \
  264. VMLINUX_SYMBOL(__stop___ksymtab_unused) = .; \
  265. } \
  266. \
  267. /* Kernel symbol table: GPL-only unused symbols */ \
  268. __ksymtab_unused_gpl : AT(ADDR(__ksymtab_unused_gpl) - LOAD_OFFSET) { \
  269. VMLINUX_SYMBOL(__start___ksymtab_unused_gpl) = .; \
  270. *(__ksymtab_unused_gpl) \
  271. VMLINUX_SYMBOL(__stop___ksymtab_unused_gpl) = .; \
  272. } \
  273. \
  274. /* Kernel symbol table: GPL-future-only symbols */ \
  275. __ksymtab_gpl_future : AT(ADDR(__ksymtab_gpl_future) - LOAD_OFFSET) { \
  276. VMLINUX_SYMBOL(__start___ksymtab_gpl_future) = .; \
  277. *(__ksymtab_gpl_future) \
  278. VMLINUX_SYMBOL(__stop___ksymtab_gpl_future) = .; \
  279. } \
  280. \
  281. /* Kernel symbol table: Normal symbols */ \
  282. __kcrctab : AT(ADDR(__kcrctab) - LOAD_OFFSET) { \
  283. VMLINUX_SYMBOL(__start___kcrctab) = .; \
  284. *(__kcrctab) \
  285. VMLINUX_SYMBOL(__stop___kcrctab) = .; \
  286. } \
  287. \
  288. /* Kernel symbol table: GPL-only symbols */ \
  289. __kcrctab_gpl : AT(ADDR(__kcrctab_gpl) - LOAD_OFFSET) { \
  290. VMLINUX_SYMBOL(__start___kcrctab_gpl) = .; \
  291. *(__kcrctab_gpl) \
  292. VMLINUX_SYMBOL(__stop___kcrctab_gpl) = .; \
  293. } \
  294. \
  295. /* Kernel symbol table: Normal unused symbols */ \
  296. __kcrctab_unused : AT(ADDR(__kcrctab_unused) - LOAD_OFFSET) { \
  297. VMLINUX_SYMBOL(__start___kcrctab_unused) = .; \
  298. *(__kcrctab_unused) \
  299. VMLINUX_SYMBOL(__stop___kcrctab_unused) = .; \
  300. } \
  301. \
  302. /* Kernel symbol table: GPL-only unused symbols */ \
  303. __kcrctab_unused_gpl : AT(ADDR(__kcrctab_unused_gpl) - LOAD_OFFSET) { \
  304. VMLINUX_SYMBOL(__start___kcrctab_unused_gpl) = .; \
  305. *(__kcrctab_unused_gpl) \
  306. VMLINUX_SYMBOL(__stop___kcrctab_unused_gpl) = .; \
  307. } \
  308. \
  309. /* Kernel symbol table: GPL-future-only symbols */ \
  310. __kcrctab_gpl_future : AT(ADDR(__kcrctab_gpl_future) - LOAD_OFFSET) { \
  311. VMLINUX_SYMBOL(__start___kcrctab_gpl_future) = .; \
  312. *(__kcrctab_gpl_future) \
  313. VMLINUX_SYMBOL(__stop___kcrctab_gpl_future) = .; \
  314. } \
  315. \
  316. /* Kernel symbol table: strings */ \
  317. __ksymtab_strings : AT(ADDR(__ksymtab_strings) - LOAD_OFFSET) { \
  318. *(__ksymtab_strings) \
  319. } \
  320. \
  321. /* __*init sections */ \
  322. __init_rodata : AT(ADDR(__init_rodata) - LOAD_OFFSET) { \
  323. *(.ref.rodata) \
  324. DEV_KEEP(init.rodata) \
  325. DEV_KEEP(exit.rodata) \
  326. CPU_KEEP(init.rodata) \
  327. CPU_KEEP(exit.rodata) \
  328. MEM_KEEP(init.rodata) \
  329. MEM_KEEP(exit.rodata) \
  330. } \
  331. \
  332. /* Built-in module parameters. */ \
  333. __param : AT(ADDR(__param) - LOAD_OFFSET) { \
  334. VMLINUX_SYMBOL(__start___param) = .; \
  335. *(__param) \
  336. VMLINUX_SYMBOL(__stop___param) = .; \
  337. . = ALIGN((align)); \
  338. VMLINUX_SYMBOL(__end_rodata) = .; \
  339. } \
  340. . = ALIGN((align));
  341. /* RODATA & RO_DATA provided for backward compatibility.
  342. * All archs are supposed to use RO_DATA() */
  343. #define RODATA RO_DATA_SECTION(4096)
  344. #define RO_DATA(align) RO_DATA_SECTION(align)
  345. #define SECURITY_INIT \
  346. .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
  347. VMLINUX_SYMBOL(__security_initcall_start) = .; \
  348. *(.security_initcall.init) \
  349. VMLINUX_SYMBOL(__security_initcall_end) = .; \
  350. }
  351. /* .text section. Map to function alignment to avoid address changes
  352. * during second ld run in second ld pass when generating System.map */
  353. #define TEXT_TEXT \
  354. ALIGN_FUNCTION(); \
  355. *(.text.hot) \
  356. *(.text) \
  357. *(.ref.text) \
  358. DEV_KEEP(init.text) \
  359. DEV_KEEP(exit.text) \
  360. CPU_KEEP(init.text) \
  361. CPU_KEEP(exit.text) \
  362. MEM_KEEP(init.text) \
  363. MEM_KEEP(exit.text) \
  364. *(.text.unlikely)
  365. /* sched.text is aling to function alignment to secure we have same
  366. * address even at second ld pass when generating System.map */
  367. #define SCHED_TEXT \
  368. ALIGN_FUNCTION(); \
  369. VMLINUX_SYMBOL(__sched_text_start) = .; \
  370. *(.sched.text) \
  371. VMLINUX_SYMBOL(__sched_text_end) = .;
  372. /* spinlock.text is aling to function alignment to secure we have same
  373. * address even at second ld pass when generating System.map */
  374. #define LOCK_TEXT \
  375. ALIGN_FUNCTION(); \
  376. VMLINUX_SYMBOL(__lock_text_start) = .; \
  377. *(.spinlock.text) \
  378. VMLINUX_SYMBOL(__lock_text_end) = .;
  379. #define KPROBES_TEXT \
  380. ALIGN_FUNCTION(); \
  381. VMLINUX_SYMBOL(__kprobes_text_start) = .; \
  382. *(.kprobes.text) \
  383. VMLINUX_SYMBOL(__kprobes_text_end) = .;
  384. #ifdef CONFIG_FUNCTION_GRAPH_TRACER
  385. #define IRQENTRY_TEXT \
  386. ALIGN_FUNCTION(); \
  387. VMLINUX_SYMBOL(__irqentry_text_start) = .; \
  388. *(.irqentry.text) \
  389. VMLINUX_SYMBOL(__irqentry_text_end) = .;
  390. #else
  391. #define IRQENTRY_TEXT
  392. #endif
  393. /* Section used for early init (in .S files) */
  394. #define HEAD_TEXT *(.head.text)
  395. #define HEAD_TEXT_SECTION \
  396. .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) { \
  397. HEAD_TEXT \
  398. }
  399. /*
  400. * Exception table
  401. */
  402. #define EXCEPTION_TABLE(align) \
  403. . = ALIGN(align); \
  404. __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \
  405. VMLINUX_SYMBOL(__start___ex_table) = .; \
  406. *(__ex_table) \
  407. VMLINUX_SYMBOL(__stop___ex_table) = .; \
  408. }
  409. /*
  410. * Init task
  411. */
  412. #define INIT_TASK_DATA_SECTION(align) \
  413. . = ALIGN(align); \
  414. .data..init_task : AT(ADDR(.data..init_task) - LOAD_OFFSET) { \
  415. INIT_TASK_DATA(align) \
  416. }
  417. #ifdef CONFIG_CONSTRUCTORS
  418. #define KERNEL_CTORS() . = ALIGN(8); \
  419. VMLINUX_SYMBOL(__ctors_start) = .; \
  420. *(.ctors) \
  421. VMLINUX_SYMBOL(__ctors_end) = .;
  422. #else
  423. #define KERNEL_CTORS()
  424. #endif
  425. /* init and exit section handling */
  426. #define INIT_DATA \
  427. *(.init.data) \
  428. DEV_DISCARD(init.data) \
  429. CPU_DISCARD(init.data) \
  430. MEM_DISCARD(init.data) \
  431. KERNEL_CTORS() \
  432. *(.init.rodata) \
  433. MCOUNT_REC() \
  434. DEV_DISCARD(init.rodata) \
  435. CPU_DISCARD(init.rodata) \
  436. MEM_DISCARD(init.rodata)
  437. #define INIT_TEXT \
  438. *(.init.text) \
  439. DEV_DISCARD(init.text) \
  440. CPU_DISCARD(init.text) \
  441. MEM_DISCARD(init.text)
  442. #define EXIT_DATA \
  443. *(.exit.data) \
  444. DEV_DISCARD(exit.data) \
  445. DEV_DISCARD(exit.rodata) \
  446. CPU_DISCARD(exit.data) \
  447. CPU_DISCARD(exit.rodata) \
  448. MEM_DISCARD(exit.data) \
  449. MEM_DISCARD(exit.rodata)
  450. #define EXIT_TEXT \
  451. *(.exit.text) \
  452. DEV_DISCARD(exit.text) \
  453. CPU_DISCARD(exit.text) \
  454. MEM_DISCARD(exit.text)
  455. #define EXIT_CALL \
  456. *(.exitcall.exit)
  457. /*
  458. * bss (Block Started by Symbol) - uninitialized data
  459. * zeroed during startup
  460. */
  461. #define SBSS(sbss_align) \
  462. . = ALIGN(sbss_align); \
  463. .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \
  464. *(.sbss) \
  465. *(.scommon) \
  466. }
  467. #define BSS(bss_align) \
  468. . = ALIGN(bss_align); \
  469. .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \
  470. *(.bss..page_aligned) \
  471. *(.dynbss) \
  472. *(.bss) \
  473. *(COMMON) \
  474. }
  475. /*
  476. * DWARF debug sections.
  477. * Symbols in the DWARF debugging sections are relative to
  478. * the beginning of the section so we begin them at 0.
  479. */
  480. #define DWARF_DEBUG \
  481. /* DWARF 1 */ \
  482. .debug 0 : { *(.debug) } \
  483. .line 0 : { *(.line) } \
  484. /* GNU DWARF 1 extensions */ \
  485. .debug_srcinfo 0 : { *(.debug_srcinfo) } \
  486. .debug_sfnames 0 : { *(.debug_sfnames) } \
  487. /* DWARF 1.1 and DWARF 2 */ \
  488. .debug_aranges 0 : { *(.debug_aranges) } \
  489. .debug_pubnames 0 : { *(.debug_pubnames) } \
  490. /* DWARF 2 */ \
  491. .debug_info 0 : { *(.debug_info \
  492. .gnu.linkonce.wi.*) } \
  493. .debug_abbrev 0 : { *(.debug_abbrev) } \
  494. .debug_line 0 : { *(.debug_line) } \
  495. .debug_frame 0 : { *(.debug_frame) } \
  496. .debug_str 0 : { *(.debug_str) } \
  497. .debug_loc 0 : { *(.debug_loc) } \
  498. .debug_macinfo 0 : { *(.debug_macinfo) } \
  499. /* SGI/MIPS DWARF 2 extensions */ \
  500. .debug_weaknames 0 : { *(.debug_weaknames) } \
  501. .debug_funcnames 0 : { *(.debug_funcnames) } \
  502. .debug_typenames 0 : { *(.debug_typenames) } \
  503. .debug_varnames 0 : { *(.debug_varnames) } \
  504. /* Stabs debugging sections. */
  505. #define STABS_DEBUG \
  506. .stab 0 : { *(.stab) } \
  507. .stabstr 0 : { *(.stabstr) } \
  508. .stab.excl 0 : { *(.stab.excl) } \
  509. .stab.exclstr 0 : { *(.stab.exclstr) } \
  510. .stab.index 0 : { *(.stab.index) } \
  511. .stab.indexstr 0 : { *(.stab.indexstr) } \
  512. .comment 0 : { *(.comment) }
  513. #ifdef CONFIG_GENERIC_BUG
  514. #define BUG_TABLE \
  515. . = ALIGN(8); \
  516. __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \
  517. VMLINUX_SYMBOL(__start___bug_table) = .; \
  518. *(__bug_table) \
  519. VMLINUX_SYMBOL(__stop___bug_table) = .; \
  520. }
  521. #else
  522. #define BUG_TABLE
  523. #endif
  524. #define JUMP_TABLE \
  525. . = ALIGN(8); \
  526. __jump_table : AT(ADDR(__jump_table) - LOAD_OFFSET) { \
  527. VMLINUX_SYMBOL(__start___jump_table) = .; \
  528. *(__jump_table) \
  529. VMLINUX_SYMBOL(__stop___jump_table) = .; \
  530. }
  531. #ifdef CONFIG_PM_TRACE
  532. #define TRACEDATA \
  533. . = ALIGN(4); \
  534. .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \
  535. VMLINUX_SYMBOL(__tracedata_start) = .; \
  536. *(.tracedata) \
  537. VMLINUX_SYMBOL(__tracedata_end) = .; \
  538. }
  539. #else
  540. #define TRACEDATA
  541. #endif
  542. #define NOTES \
  543. .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \
  544. VMLINUX_SYMBOL(__start_notes) = .; \
  545. *(.note.*) \
  546. VMLINUX_SYMBOL(__stop_notes) = .; \
  547. }
  548. #define INIT_SETUP(initsetup_align) \
  549. . = ALIGN(initsetup_align); \
  550. VMLINUX_SYMBOL(__setup_start) = .; \
  551. *(.init.setup) \
  552. VMLINUX_SYMBOL(__setup_end) = .;
  553. #define INITCALLS \
  554. *(.initcallearly.init) \
  555. VMLINUX_SYMBOL(__early_initcall_end) = .; \
  556. *(.initcall0.init) \
  557. *(.initcall0s.init) \
  558. *(.initcall1.init) \
  559. *(.initcall1s.init) \
  560. *(.initcall2.init) \
  561. *(.initcall2s.init) \
  562. *(.initcall3.init) \
  563. *(.initcall3s.init) \
  564. *(.initcall4.init) \
  565. *(.initcall4s.init) \
  566. *(.initcall5.init) \
  567. *(.initcall5s.init) \
  568. *(.initcallrootfs.init) \
  569. *(.initcall6.init) \
  570. *(.initcall6s.init) \
  571. *(.initcall7.init) \
  572. *(.initcall7s.init)
  573. #define INIT_CALLS \
  574. VMLINUX_SYMBOL(__initcall_start) = .; \
  575. INITCALLS \
  576. VMLINUX_SYMBOL(__initcall_end) = .;
  577. #define CON_INITCALL \
  578. VMLINUX_SYMBOL(__con_initcall_start) = .; \
  579. *(.con_initcall.init) \
  580. VMLINUX_SYMBOL(__con_initcall_end) = .;
  581. #define SECURITY_INITCALL \
  582. VMLINUX_SYMBOL(__security_initcall_start) = .; \
  583. *(.security_initcall.init) \
  584. VMLINUX_SYMBOL(__security_initcall_end) = .;
  585. #ifdef CONFIG_BLK_DEV_INITRD
  586. #define INIT_RAM_FS \
  587. . = ALIGN(PAGE_SIZE); \
  588. VMLINUX_SYMBOL(__initramfs_start) = .; \
  589. *(.init.ramfs) \
  590. VMLINUX_SYMBOL(__initramfs_end) = .;
  591. #else
  592. #define INIT_RAM_FS
  593. #endif
  594. /*
  595. * Default discarded sections.
  596. *
  597. * Some archs want to discard exit text/data at runtime rather than
  598. * link time due to cross-section references such as alt instructions,
  599. * bug table, eh_frame, etc. DISCARDS must be the last of output
  600. * section definitions so that such archs put those in earlier section
  601. * definitions.
  602. */
  603. #define DISCARDS \
  604. /DISCARD/ : { \
  605. EXIT_TEXT \
  606. EXIT_DATA \
  607. EXIT_CALL \
  608. *(.discard) \
  609. *(.discard.*) \
  610. }
  611. /**
  612. * PERCPU_VADDR - define output section for percpu area
  613. * @vaddr: explicit base address (optional)
  614. * @phdr: destination PHDR (optional)
  615. *
  616. * Macro which expands to output section for percpu area. If @vaddr
  617. * is not blank, it specifies explicit base address and all percpu
  618. * symbols will be offset from the given address. If blank, @vaddr
  619. * always equals @laddr + LOAD_OFFSET.
  620. *
  621. * @phdr defines the output PHDR to use if not blank. Be warned that
  622. * output PHDR is sticky. If @phdr is specified, the next output
  623. * section in the linker script will go there too. @phdr should have
  624. * a leading colon.
  625. *
  626. * Note that this macros defines __per_cpu_load as an absolute symbol.
  627. * If there is no need to put the percpu section at a predetermined
  628. * address, use PERCPU().
  629. */
  630. #define PERCPU_VADDR(vaddr, phdr) \
  631. VMLINUX_SYMBOL(__per_cpu_load) = .; \
  632. .data..percpu vaddr : AT(VMLINUX_SYMBOL(__per_cpu_load) \
  633. - LOAD_OFFSET) { \
  634. VMLINUX_SYMBOL(__per_cpu_start) = .; \
  635. *(.data..percpu..first) \
  636. . = ALIGN(PAGE_SIZE); \
  637. *(.data..percpu..page_aligned) \
  638. *(.data..percpu..readmostly) \
  639. *(.data..percpu) \
  640. *(.data..percpu..shared_aligned) \
  641. VMLINUX_SYMBOL(__per_cpu_end) = .; \
  642. } phdr \
  643. . = VMLINUX_SYMBOL(__per_cpu_load) + SIZEOF(.data..percpu);
  644. /**
  645. * PERCPU - define output section for percpu area, simple version
  646. * @align: required alignment
  647. *
  648. * Align to @align and outputs output section for percpu area. This
  649. * macro doesn't maniuplate @vaddr or @phdr and __per_cpu_load and
  650. * __per_cpu_start will be identical.
  651. *
  652. * This macro is equivalent to ALIGN(align); PERCPU_VADDR( , ) except
  653. * that __per_cpu_load is defined as a relative symbol against
  654. * .data..percpu which is required for relocatable x86_32
  655. * configuration.
  656. */
  657. #define PERCPU(align) \
  658. . = ALIGN(align); \
  659. .data..percpu : AT(ADDR(.data..percpu) - LOAD_OFFSET) { \
  660. VMLINUX_SYMBOL(__per_cpu_load) = .; \
  661. VMLINUX_SYMBOL(__per_cpu_start) = .; \
  662. *(.data..percpu..first) \
  663. . = ALIGN(PAGE_SIZE); \
  664. *(.data..percpu..page_aligned) \
  665. *(.data..percpu..readmostly) \
  666. *(.data..percpu) \
  667. *(.data..percpu..shared_aligned) \
  668. VMLINUX_SYMBOL(__per_cpu_end) = .; \
  669. }
  670. /*
  671. * Definition of the high level *_SECTION macros
  672. * They will fit only a subset of the architectures
  673. */
  674. /*
  675. * Writeable data.
  676. * All sections are combined in a single .data section.
  677. * The sections following CONSTRUCTORS are arranged so their
  678. * typical alignment matches.
  679. * A cacheline is typical/always less than a PAGE_SIZE so
  680. * the sections that has this restriction (or similar)
  681. * is located before the ones requiring PAGE_SIZE alignment.
  682. * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
  683. * matches the requirment of PAGE_ALIGNED_DATA.
  684. *
  685. * use 0 as page_align if page_aligned data is not used */
  686. #define RW_DATA_SECTION(cacheline, pagealigned, inittask) \
  687. . = ALIGN(PAGE_SIZE); \
  688. .data : AT(ADDR(.data) - LOAD_OFFSET) { \
  689. INIT_TASK_DATA(inittask) \
  690. NOSAVE_DATA \
  691. PAGE_ALIGNED_DATA(pagealigned) \
  692. CACHELINE_ALIGNED_DATA(cacheline) \
  693. READ_MOSTLY_DATA(cacheline) \
  694. DATA_DATA \
  695. CONSTRUCTORS \
  696. }
  697. #define INIT_TEXT_SECTION(inittext_align) \
  698. . = ALIGN(inittext_align); \
  699. .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { \
  700. VMLINUX_SYMBOL(_sinittext) = .; \
  701. INIT_TEXT \
  702. VMLINUX_SYMBOL(_einittext) = .; \
  703. }
  704. #define INIT_DATA_SECTION(initsetup_align) \
  705. .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { \
  706. INIT_DATA \
  707. INIT_SETUP(initsetup_align) \
  708. INIT_CALLS \
  709. CON_INITCALL \
  710. SECURITY_INITCALL \
  711. INIT_RAM_FS \
  712. }
  713. #define BSS_SECTION(sbss_align, bss_align, stop_align) \
  714. . = ALIGN(sbss_align); \
  715. VMLINUX_SYMBOL(__bss_start) = .; \
  716. SBSS(sbss_align) \
  717. BSS(bss_align) \
  718. . = ALIGN(stop_align); \
  719. VMLINUX_SYMBOL(__bss_stop) = .;