vmlinux.lds.h 23 KB

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