vmlinux.lds.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760
  1. /*
  2. * Helper macros to support writing architecture specific
  3. * linker scripts.
  4. *
  5. * A minimal linker scripts has following content:
  6. * [This is a sample, architectures may have special requiriements]
  7. *
  8. * OUTPUT_FORMAT(...)
  9. * OUTPUT_ARCH(...)
  10. * ENTRY(...)
  11. * SECTIONS
  12. * {
  13. * . = START;
  14. * __init_begin = .;
  15. * HEAD_TEXT_SECTION
  16. * INIT_TEXT_SECTION(PAGE_SIZE)
  17. * INIT_DATA_SECTION(...)
  18. * PERCPU(PAGE_SIZE)
  19. * __init_end = .;
  20. *
  21. * _stext = .;
  22. * TEXT_SECTION = 0
  23. * _etext = .;
  24. *
  25. * _sdata = .;
  26. * RO_DATA_SECTION(PAGE_SIZE)
  27. * RW_DATA_SECTION(...)
  28. * _edata = .;
  29. *
  30. * EXCEPTION_TABLE(...)
  31. * NOTES
  32. *
  33. * BSS_SECTION(0, 0, 0)
  34. * _end = .;
  35. *
  36. * STABS_DEBUG
  37. * DWARF_DEBUG
  38. *
  39. * DISCARDS // must be the last
  40. * }
  41. *
  42. * [__init_begin, __init_end] is the init section that may be freed after init
  43. * [_stext, _etext] is the text section
  44. * [_sdata, _edata] is the data section
  45. *
  46. * Some of the included output section have their own set of constants.
  47. * Examples are: [__initramfs_start, __initramfs_end] for initramfs and
  48. * [__nosave_begin, __nosave_end] for the nosave data
  49. */
  50. #ifndef LOAD_OFFSET
  51. #define LOAD_OFFSET 0
  52. #endif
  53. #ifndef SYMBOL_PREFIX
  54. #define VMLINUX_SYMBOL(sym) sym
  55. #else
  56. #define PASTE2(x,y) x##y
  57. #define PASTE(x,y) PASTE2(x,y)
  58. #define VMLINUX_SYMBOL(sym) PASTE(SYMBOL_PREFIX, sym)
  59. #endif
  60. /* Align . to a 8 byte boundary equals to maximum function alignment. */
  61. #define ALIGN_FUNCTION() . = ALIGN(8)
  62. /* The actual configuration determine if the init/exit sections
  63. * are handled as text/data or they can be discarded (which
  64. * often happens at runtime)
  65. */
  66. #ifdef CONFIG_HOTPLUG
  67. #define DEV_KEEP(sec) *(.dev##sec)
  68. #define DEV_DISCARD(sec)
  69. #else
  70. #define DEV_KEEP(sec)
  71. #define DEV_DISCARD(sec) *(.dev##sec)
  72. #endif
  73. #ifdef CONFIG_HOTPLUG_CPU
  74. #define CPU_KEEP(sec) *(.cpu##sec)
  75. #define CPU_DISCARD(sec)
  76. #else
  77. #define CPU_KEEP(sec)
  78. #define CPU_DISCARD(sec) *(.cpu##sec)
  79. #endif
  80. #if defined(CONFIG_MEMORY_HOTPLUG)
  81. #define MEM_KEEP(sec) *(.mem##sec)
  82. #define MEM_DISCARD(sec)
  83. #else
  84. #define MEM_KEEP(sec)
  85. #define MEM_DISCARD(sec) *(.mem##sec)
  86. #endif
  87. #ifdef CONFIG_FTRACE_MCOUNT_RECORD
  88. #define MCOUNT_REC() . = ALIGN(8); \
  89. 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_DATA(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. DEV_KEEP(init.rodata) \
  318. DEV_KEEP(exit.rodata) \
  319. CPU_KEEP(init.rodata) \
  320. CPU_KEEP(exit.rodata) \
  321. MEM_KEEP(init.rodata) \
  322. MEM_KEEP(exit.rodata) \
  323. } \
  324. \
  325. /* Built-in module parameters. */ \
  326. __param : AT(ADDR(__param) - LOAD_OFFSET) { \
  327. VMLINUX_SYMBOL(__start___param) = .; \
  328. *(__param) \
  329. VMLINUX_SYMBOL(__stop___param) = .; \
  330. . = ALIGN((align)); \
  331. VMLINUX_SYMBOL(__end_rodata) = .; \
  332. } \
  333. . = ALIGN((align));
  334. /* RODATA & RO_DATA provided for backward compatibility.
  335. * All archs are supposed to use RO_DATA() */
  336. #define RODATA RO_DATA_SECTION(4096)
  337. #define RO_DATA(align) RO_DATA_SECTION(align)
  338. #define SECURITY_INIT \
  339. .security_initcall.init : AT(ADDR(.security_initcall.init) - LOAD_OFFSET) { \
  340. VMLINUX_SYMBOL(__security_initcall_start) = .; \
  341. *(.security_initcall.init) \
  342. VMLINUX_SYMBOL(__security_initcall_end) = .; \
  343. }
  344. /* .text section. Map to function alignment to avoid address changes
  345. * during second ld run in second ld pass when generating System.map */
  346. #define TEXT_TEXT \
  347. ALIGN_FUNCTION(); \
  348. *(.text.hot) \
  349. *(.text) \
  350. *(.ref.text) \
  351. DEV_KEEP(init.text) \
  352. DEV_KEEP(exit.text) \
  353. CPU_KEEP(init.text) \
  354. CPU_KEEP(exit.text) \
  355. MEM_KEEP(init.text) \
  356. MEM_KEEP(exit.text) \
  357. *(.text.unlikely)
  358. /* sched.text is aling to function alignment to secure we have same
  359. * address even at second ld pass when generating System.map */
  360. #define SCHED_TEXT \
  361. ALIGN_FUNCTION(); \
  362. VMLINUX_SYMBOL(__sched_text_start) = .; \
  363. *(.sched.text) \
  364. VMLINUX_SYMBOL(__sched_text_end) = .;
  365. /* spinlock.text is aling to function alignment to secure we have same
  366. * address even at second ld pass when generating System.map */
  367. #define LOCK_TEXT \
  368. ALIGN_FUNCTION(); \
  369. VMLINUX_SYMBOL(__lock_text_start) = .; \
  370. *(.spinlock.text) \
  371. VMLINUX_SYMBOL(__lock_text_end) = .;
  372. #define KPROBES_TEXT \
  373. ALIGN_FUNCTION(); \
  374. VMLINUX_SYMBOL(__kprobes_text_start) = .; \
  375. *(.kprobes.text) \
  376. VMLINUX_SYMBOL(__kprobes_text_end) = .;
  377. #ifdef CONFIG_FUNCTION_GRAPH_TRACER
  378. #define IRQENTRY_TEXT \
  379. ALIGN_FUNCTION(); \
  380. VMLINUX_SYMBOL(__irqentry_text_start) = .; \
  381. *(.irqentry.text) \
  382. VMLINUX_SYMBOL(__irqentry_text_end) = .;
  383. #else
  384. #define IRQENTRY_TEXT
  385. #endif
  386. /* Section used for early init (in .S files) */
  387. #define HEAD_TEXT *(.head.text)
  388. #define HEAD_TEXT_SECTION \
  389. .head.text : AT(ADDR(.head.text) - LOAD_OFFSET) { \
  390. HEAD_TEXT \
  391. }
  392. /*
  393. * Exception table
  394. */
  395. #define EXCEPTION_TABLE(align) \
  396. . = ALIGN(align); \
  397. __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { \
  398. VMLINUX_SYMBOL(__start___ex_table) = .; \
  399. *(__ex_table) \
  400. VMLINUX_SYMBOL(__stop___ex_table) = .; \
  401. }
  402. /*
  403. * Init task
  404. */
  405. #define INIT_TASK_DATA_SECTION(align) \
  406. . = ALIGN(align); \
  407. .data.init_task : { \
  408. INIT_TASK_DATA(align) \
  409. }
  410. #ifdef CONFIG_CONSTRUCTORS
  411. #define KERNEL_CTORS() . = ALIGN(8); \
  412. VMLINUX_SYMBOL(__ctors_start) = .; \
  413. *(.ctors) \
  414. VMLINUX_SYMBOL(__ctors_end) = .;
  415. #else
  416. #define KERNEL_CTORS()
  417. #endif
  418. /* init and exit section handling */
  419. #define INIT_DATA \
  420. *(.init.data) \
  421. DEV_DISCARD(init.data) \
  422. CPU_DISCARD(init.data) \
  423. MEM_DISCARD(init.data) \
  424. KERNEL_CTORS() \
  425. *(.init.rodata) \
  426. MCOUNT_REC() \
  427. DEV_DISCARD(init.rodata) \
  428. CPU_DISCARD(init.rodata) \
  429. MEM_DISCARD(init.rodata)
  430. #define INIT_TEXT \
  431. *(.init.text) \
  432. DEV_DISCARD(init.text) \
  433. CPU_DISCARD(init.text) \
  434. MEM_DISCARD(init.text)
  435. #define EXIT_DATA \
  436. *(.exit.data) \
  437. DEV_DISCARD(exit.data) \
  438. DEV_DISCARD(exit.rodata) \
  439. CPU_DISCARD(exit.data) \
  440. CPU_DISCARD(exit.rodata) \
  441. MEM_DISCARD(exit.data) \
  442. MEM_DISCARD(exit.rodata)
  443. #define EXIT_TEXT \
  444. *(.exit.text) \
  445. DEV_DISCARD(exit.text) \
  446. CPU_DISCARD(exit.text) \
  447. MEM_DISCARD(exit.text)
  448. #define EXIT_CALL \
  449. *(.exitcall.exit)
  450. /*
  451. * bss (Block Started by Symbol) - uninitialized data
  452. * zeroed during startup
  453. */
  454. #define SBSS(sbss_align) \
  455. . = ALIGN(sbss_align); \
  456. .sbss : AT(ADDR(.sbss) - LOAD_OFFSET) { \
  457. *(.sbss) \
  458. *(.scommon) \
  459. }
  460. #define BSS(bss_align) \
  461. . = ALIGN(bss_align); \
  462. .bss : AT(ADDR(.bss) - LOAD_OFFSET) { \
  463. *(.bss.page_aligned) \
  464. *(.dynbss) \
  465. *(.bss) \
  466. *(COMMON) \
  467. }
  468. /*
  469. * DWARF debug sections.
  470. * Symbols in the DWARF debugging sections are relative to
  471. * the beginning of the section so we begin them at 0.
  472. */
  473. #define DWARF_DEBUG \
  474. /* DWARF 1 */ \
  475. .debug 0 : { *(.debug) } \
  476. .line 0 : { *(.line) } \
  477. /* GNU DWARF 1 extensions */ \
  478. .debug_srcinfo 0 : { *(.debug_srcinfo) } \
  479. .debug_sfnames 0 : { *(.debug_sfnames) } \
  480. /* DWARF 1.1 and DWARF 2 */ \
  481. .debug_aranges 0 : { *(.debug_aranges) } \
  482. .debug_pubnames 0 : { *(.debug_pubnames) } \
  483. /* DWARF 2 */ \
  484. .debug_info 0 : { *(.debug_info \
  485. .gnu.linkonce.wi.*) } \
  486. .debug_abbrev 0 : { *(.debug_abbrev) } \
  487. .debug_line 0 : { *(.debug_line) } \
  488. .debug_frame 0 : { *(.debug_frame) } \
  489. .debug_str 0 : { *(.debug_str) } \
  490. .debug_loc 0 : { *(.debug_loc) } \
  491. .debug_macinfo 0 : { *(.debug_macinfo) } \
  492. /* SGI/MIPS DWARF 2 extensions */ \
  493. .debug_weaknames 0 : { *(.debug_weaknames) } \
  494. .debug_funcnames 0 : { *(.debug_funcnames) } \
  495. .debug_typenames 0 : { *(.debug_typenames) } \
  496. .debug_varnames 0 : { *(.debug_varnames) } \
  497. /* Stabs debugging sections. */
  498. #define STABS_DEBUG \
  499. .stab 0 : { *(.stab) } \
  500. .stabstr 0 : { *(.stabstr) } \
  501. .stab.excl 0 : { *(.stab.excl) } \
  502. .stab.exclstr 0 : { *(.stab.exclstr) } \
  503. .stab.index 0 : { *(.stab.index) } \
  504. .stab.indexstr 0 : { *(.stab.indexstr) } \
  505. .comment 0 : { *(.comment) }
  506. #ifdef CONFIG_GENERIC_BUG
  507. #define BUG_TABLE \
  508. . = ALIGN(8); \
  509. __bug_table : AT(ADDR(__bug_table) - LOAD_OFFSET) { \
  510. VMLINUX_SYMBOL(__start___bug_table) = .; \
  511. *(__bug_table) \
  512. VMLINUX_SYMBOL(__stop___bug_table) = .; \
  513. }
  514. #else
  515. #define BUG_TABLE
  516. #endif
  517. #ifdef CONFIG_PM_TRACE
  518. #define TRACEDATA \
  519. . = ALIGN(4); \
  520. .tracedata : AT(ADDR(.tracedata) - LOAD_OFFSET) { \
  521. VMLINUX_SYMBOL(__tracedata_start) = .; \
  522. *(.tracedata) \
  523. VMLINUX_SYMBOL(__tracedata_end) = .; \
  524. }
  525. #else
  526. #define TRACEDATA
  527. #endif
  528. #define NOTES \
  529. .notes : AT(ADDR(.notes) - LOAD_OFFSET) { \
  530. VMLINUX_SYMBOL(__start_notes) = .; \
  531. *(.note.*) \
  532. VMLINUX_SYMBOL(__stop_notes) = .; \
  533. }
  534. #define INIT_SETUP(initsetup_align) \
  535. . = ALIGN(initsetup_align); \
  536. VMLINUX_SYMBOL(__setup_start) = .; \
  537. *(.init.setup) \
  538. VMLINUX_SYMBOL(__setup_end) = .;
  539. #define INITCALLS \
  540. *(.initcallearly.init) \
  541. VMLINUX_SYMBOL(__early_initcall_end) = .; \
  542. *(.initcall0.init) \
  543. *(.initcall0s.init) \
  544. *(.initcall1.init) \
  545. *(.initcall1s.init) \
  546. *(.initcall2.init) \
  547. *(.initcall2s.init) \
  548. *(.initcall3.init) \
  549. *(.initcall3s.init) \
  550. *(.initcall4.init) \
  551. *(.initcall4s.init) \
  552. *(.initcall5.init) \
  553. *(.initcall5s.init) \
  554. *(.initcallrootfs.init) \
  555. *(.initcall6.init) \
  556. *(.initcall6s.init) \
  557. *(.initcall7.init) \
  558. *(.initcall7s.init)
  559. #define INIT_CALLS \
  560. VMLINUX_SYMBOL(__initcall_start) = .; \
  561. INITCALLS \
  562. VMLINUX_SYMBOL(__initcall_end) = .;
  563. #define CON_INITCALL \
  564. VMLINUX_SYMBOL(__con_initcall_start) = .; \
  565. *(.con_initcall.init) \
  566. VMLINUX_SYMBOL(__con_initcall_end) = .;
  567. #define SECURITY_INITCALL \
  568. VMLINUX_SYMBOL(__security_initcall_start) = .; \
  569. *(.security_initcall.init) \
  570. VMLINUX_SYMBOL(__security_initcall_end) = .;
  571. #ifdef CONFIG_BLK_DEV_INITRD
  572. #define INIT_RAM_FS \
  573. . = ALIGN(PAGE_SIZE); \
  574. VMLINUX_SYMBOL(__initramfs_start) = .; \
  575. *(.init.ramfs) \
  576. VMLINUX_SYMBOL(__initramfs_end) = .;
  577. #else
  578. #define INIT_RAM_FS
  579. #endif
  580. /*
  581. * Default discarded sections.
  582. *
  583. * Some archs want to discard exit text/data at runtime rather than
  584. * link time due to cross-section references such as alt instructions,
  585. * bug table, eh_frame, etc. DISCARDS must be the last of output
  586. * section definitions so that such archs put those in earlier section
  587. * definitions.
  588. */
  589. #define DISCARDS \
  590. /DISCARD/ : { \
  591. EXIT_TEXT \
  592. EXIT_DATA \
  593. EXIT_CALL \
  594. *(.discard) \
  595. }
  596. /**
  597. * PERCPU_VADDR - define output section for percpu area
  598. * @vaddr: explicit base address (optional)
  599. * @phdr: destination PHDR (optional)
  600. *
  601. * Macro which expands to output section for percpu area. If @vaddr
  602. * is not blank, it specifies explicit base address and all percpu
  603. * symbols will be offset from the given address. If blank, @vaddr
  604. * always equals @laddr + LOAD_OFFSET.
  605. *
  606. * @phdr defines the output PHDR to use if not blank. Be warned that
  607. * output PHDR is sticky. If @phdr is specified, the next output
  608. * section in the linker script will go there too. @phdr should have
  609. * a leading colon.
  610. *
  611. * Note that this macros defines __per_cpu_load as an absolute symbol.
  612. * If there is no need to put the percpu section at a predetermined
  613. * address, use PERCPU().
  614. */
  615. #define PERCPU_VADDR(vaddr, phdr) \
  616. VMLINUX_SYMBOL(__per_cpu_load) = .; \
  617. .data.percpu vaddr : AT(VMLINUX_SYMBOL(__per_cpu_load) \
  618. - LOAD_OFFSET) { \
  619. VMLINUX_SYMBOL(__per_cpu_start) = .; \
  620. *(.data.percpu.first) \
  621. *(.data.percpu.page_aligned) \
  622. *(.data.percpu) \
  623. *(.data.percpu.shared_aligned) \
  624. VMLINUX_SYMBOL(__per_cpu_end) = .; \
  625. } phdr \
  626. . = VMLINUX_SYMBOL(__per_cpu_load) + SIZEOF(.data.percpu);
  627. /**
  628. * PERCPU - define output section for percpu area, simple version
  629. * @align: required alignment
  630. *
  631. * Align to @align and outputs output section for percpu area. This
  632. * macro doesn't maniuplate @vaddr or @phdr and __per_cpu_load and
  633. * __per_cpu_start will be identical.
  634. *
  635. * This macro is equivalent to ALIGN(align); PERCPU_VADDR( , ) except
  636. * that __per_cpu_load is defined as a relative symbol against
  637. * .data.percpu which is required for relocatable x86_32
  638. * configuration.
  639. */
  640. #define PERCPU(align) \
  641. . = ALIGN(align); \
  642. .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \
  643. VMLINUX_SYMBOL(__per_cpu_load) = .; \
  644. VMLINUX_SYMBOL(__per_cpu_start) = .; \
  645. *(.data.percpu.first) \
  646. *(.data.percpu.page_aligned) \
  647. *(.data.percpu) \
  648. *(.data.percpu.shared_aligned) \
  649. VMLINUX_SYMBOL(__per_cpu_end) = .; \
  650. }
  651. /*
  652. * Definition of the high level *_SECTION macros
  653. * They will fit only a subset of the architectures
  654. */
  655. /*
  656. * Writeable data.
  657. * All sections are combined in a single .data section.
  658. * The sections following CONSTRUCTORS are arranged so their
  659. * typical alignment matches.
  660. * A cacheline is typical/always less than a PAGE_SIZE so
  661. * the sections that has this restriction (or similar)
  662. * is located before the ones requiring PAGE_SIZE alignment.
  663. * NOSAVE_DATA starts and ends with a PAGE_SIZE alignment which
  664. * matches the requirment of PAGE_ALIGNED_DATA.
  665. *
  666. * use 0 as page_align if page_aligned data is not used */
  667. #define RW_DATA_SECTION(cacheline, pagealigned, inittask) \
  668. . = ALIGN(PAGE_SIZE); \
  669. .data : AT(ADDR(.data) - LOAD_OFFSET) { \
  670. INIT_TASK_DATA(inittask) \
  671. NOSAVE_DATA \
  672. PAGE_ALIGNED_DATA(pagealigned) \
  673. CACHELINE_ALIGNED_DATA(cacheline) \
  674. READ_MOSTLY_DATA(cacheline) \
  675. DATA_DATA \
  676. CONSTRUCTORS \
  677. }
  678. #define INIT_TEXT_SECTION(inittext_align) \
  679. . = ALIGN(inittext_align); \
  680. .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { \
  681. VMLINUX_SYMBOL(_sinittext) = .; \
  682. INIT_TEXT \
  683. VMLINUX_SYMBOL(_einittext) = .; \
  684. }
  685. #define INIT_DATA_SECTION(initsetup_align) \
  686. .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { \
  687. INIT_DATA \
  688. INIT_SETUP(initsetup_align) \
  689. INIT_CALLS \
  690. CON_INITCALL \
  691. SECURITY_INITCALL \
  692. INIT_RAM_FS \
  693. }
  694. #define BSS_SECTION(sbss_align, bss_align, stop_align) \
  695. . = ALIGN(sbss_align); \
  696. VMLINUX_SYMBOL(__bss_start) = .; \
  697. SBSS(sbss_align) \
  698. BSS(bss_align) \
  699. . = ALIGN(stop_align); \
  700. VMLINUX_SYMBOL(__bss_stop) = .;