vmlinux.lds.h 21 KB

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