vmlinux.lds.h 21 KB

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