vmlinux.lds.h 22 KB

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