aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic/vmlinux.lds.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-generic/vmlinux.lds.h')
-rw-r--r--include/asm-generic/vmlinux.lds.h75
1 files changed, 69 insertions, 6 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index c61fab1dd2f8..aa6b9b1b30b5 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -430,12 +430,75 @@
430 *(.initcall7.init) \ 430 *(.initcall7.init) \
431 *(.initcall7s.init) 431 *(.initcall7s.init)
432 432
433#define PERCPU(align) \ 433#define PERCPU_PROLOG(vaddr) \
434 . = ALIGN(align); \ 434 VMLINUX_SYMBOL(__per_cpu_load) = .; \
435 VMLINUX_SYMBOL(__per_cpu_start) = .; \ 435 .data.percpu vaddr : AT(VMLINUX_SYMBOL(__per_cpu_load) \
436 .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \ 436 - LOAD_OFFSET) { \
437 VMLINUX_SYMBOL(__per_cpu_start) = .;
438
439#define PERCPU_EPILOG(phdr) \
440 VMLINUX_SYMBOL(__per_cpu_end) = .; \
441 } phdr \
442 . = VMLINUX_SYMBOL(__per_cpu_load) + SIZEOF(.data.percpu);
443
444/**
445 * PERCPU_VADDR_PREALLOC - define output section for percpu area with prealloc
446 * @vaddr: explicit base address (optional)
447 * @phdr: destination PHDR (optional)
448 * @prealloc: the size of prealloc area
449 *
450 * Macro which expands to output section for percpu area. If @vaddr
451 * is not blank, it specifies explicit base address and all percpu
452 * symbols will be offset from the given address. If blank, @vaddr
453 * always equals @laddr + LOAD_OFFSET.
454 *
455 * @phdr defines the output PHDR to use if not blank. Be warned that
456 * output PHDR is sticky. If @phdr is specified, the next output
457 * section in the linker script will go there too. @phdr should have
458 * a leading colon.
459 *
460 * If @prealloc is non-zero, the specified number of bytes will be
461 * reserved at the start of percpu area. As the prealloc area is
462 * likely to break alignment, this macro puts areas in increasing
463 * alignment order.
464 *
465 * This macro defines three symbols, __per_cpu_load, __per_cpu_start
466 * and __per_cpu_end. The first one is the vaddr of loaded percpu
467 * init data. __per_cpu_start equals @vaddr and __per_cpu_end is the
468 * end offset.
469 */
470#define PERCPU_VADDR_PREALLOC(vaddr, segment, prealloc) \
471 PERCPU_PROLOG(vaddr) \
472 . += prealloc; \
473 *(.data.percpu) \
474 *(.data.percpu.shared_aligned) \
475 *(.data.percpu.page_aligned) \
476 PERCPU_EPILOG(segment)
477
478/**
479 * PERCPU_VADDR - define output section for percpu area
480 * @vaddr: explicit base address (optional)
481 * @phdr: destination PHDR (optional)
482 *
483 * Macro which expands to output section for percpu area. Mostly
484 * identical to PERCPU_VADDR_PREALLOC(@vaddr, @phdr, 0) other than
485 * using slighly different layout.
486 */
487#define PERCPU_VADDR(vaddr, phdr) \
488 PERCPU_PROLOG(vaddr) \
437 *(.data.percpu.page_aligned) \ 489 *(.data.percpu.page_aligned) \
438 *(.data.percpu) \ 490 *(.data.percpu) \
439 *(.data.percpu.shared_aligned) \ 491 *(.data.percpu.shared_aligned) \
440 } \ 492 PERCPU_EPILOG(phdr)
441 VMLINUX_SYMBOL(__per_cpu_end) = .; 493
494/**
495 * PERCPU - define output section for percpu area, simple version
496 * @align: required alignment
497 *
498 * Align to @align and outputs output section for percpu area. This
499 * macro doesn't maniuplate @vaddr or @phdr and __per_cpu_load and
500 * __per_cpu_start will be identical.
501 */
502#define PERCPU(align) \
503 . = ALIGN(align); \
504 PERCPU_VADDR( , )