|
430 | 430 | *(.initcall7.init) \ |
431 | 431 | *(.initcall7s.init) |
432 | 432 |
|
433 | | -#define PERCPU(align) \ |
434 | | - . = ALIGN(align); \ |
435 | | - VMLINUX_SYMBOL(__per_cpu_start) = .; \ |
436 | | - .data.percpu : AT(ADDR(.data.percpu) - LOAD_OFFSET) { \ |
| 433 | +#define PERCPU_PROLOG(vaddr) \ |
| 434 | + VMLINUX_SYMBOL(__per_cpu_load) = .; \ |
| 435 | + .data.percpu vaddr : AT(__per_cpu_load - LOAD_OFFSET) { \ |
| 436 | + VMLINUX_SYMBOL(__per_cpu_start) = .; |
| 437 | + |
| 438 | +#define PERCPU_EPILOG(phdr) \ |
| 439 | + VMLINUX_SYMBOL(__per_cpu_end) = .; \ |
| 440 | + } phdr \ |
| 441 | + . = __per_cpu_load + SIZEOF(.data.percpu); |
| 442 | + |
| 443 | +/** |
| 444 | + * PERCPU_VADDR - define output section for percpu area |
| 445 | + * @vaddr: explicit base address (optional) |
| 446 | + * @phdr: destination PHDR (optional) |
| 447 | + * |
| 448 | + * Macro which expands to output section for percpu area. If @vaddr |
| 449 | + * is not blank, it specifies explicit base address and all percpu |
| 450 | + * symbols will be offset from the given address. If blank, @vaddr |
| 451 | + * always equals @laddr + LOAD_OFFSET. |
| 452 | + * |
| 453 | + * @phdr defines the output PHDR to use if not blank. Be warned that |
| 454 | + * output PHDR is sticky. If @phdr is specified, the next output |
| 455 | + * section in the linker script will go there too. @phdr should have |
| 456 | + * a leading colon. |
| 457 | + * |
| 458 | + * This macro defines three symbols, __per_cpu_load, __per_cpu_start |
| 459 | + * and __per_cpu_end. The first one is the vaddr of loaded percpu |
| 460 | + * init data. __per_cpu_start equals @vaddr and __per_cpu_end is the |
| 461 | + * end offset. |
| 462 | + */ |
| 463 | +#define PERCPU_VADDR(vaddr, phdr) \ |
| 464 | + PERCPU_PROLOG(vaddr) \ |
437 | 465 | *(.data.percpu.page_aligned) \ |
438 | 466 | *(.data.percpu) \ |
439 | 467 | *(.data.percpu.shared_aligned) \ |
440 | | - } \ |
441 | | - VMLINUX_SYMBOL(__per_cpu_end) = .; |
| 468 | + PERCPU_EPILOG(phdr) |
| 469 | + |
| 470 | +/** |
| 471 | + * PERCPU - define output section for percpu area, simple version |
| 472 | + * @align: required alignment |
| 473 | + * |
| 474 | + * Align to @align and outputs output section for percpu area. This |
| 475 | + * macro doesn't maniuplate @vaddr or @phdr and __per_cpu_load and |
| 476 | + * __per_cpu_start will be identical. |
| 477 | + */ |
| 478 | +#define PERCPU(align) \ |
| 479 | + . = ALIGN(align); \ |
| 480 | + PERCPU_VADDR( , ) |
0 commit comments