vmlinux.lds.h 22 KB

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