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