arch/powerpc/tools/ftrace-gen-ool-stubs.sh
Source file repositories/reference/linux-study-clean/arch/powerpc/tools/ftrace-gen-ool-stubs.sh
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/tools/ftrace-gen-ool-stubs.sh- Extension
.sh- Size
- 1494 bytes
- Lines
- 53
- Domain
- Architecture Layer
- Bucket
- arch/powerpc
- Inferred role
- Architecture Layer: arch/powerpc
- Status
- atlas-only
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
Dependency Surface
asm/asm-offsets.hasm/ppc_asm.hlinux/linkage.h
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Error out on error
set -e
num_ool_stubs_text_builtin="$1"
is_64bit="$2"
objdump="$3"
vmlinux_o="$4"
arch_vmlinux_S="$5"
RELOCATION=R_PPC64_ADDR64
if [ -z "$is_64bit" ]; then
RELOCATION=R_PPC_ADDR32
fi
num_ool_stubs_total=$($objdump -r -j __patchable_function_entries -d "$vmlinux_o" |
grep -c "$RELOCATION")
num_ool_stubs_inittext=$($objdump -r -j __patchable_function_entries -d "$vmlinux_o" |
grep -e ".init.text" -e ".text.startup" | grep -c "$RELOCATION")
num_ool_stubs_text=$((num_ool_stubs_total - num_ool_stubs_inittext))
if [ "$num_ool_stubs_text" -gt "$num_ool_stubs_text_builtin" ]; then
num_ool_stubs_text_end=$((num_ool_stubs_text - num_ool_stubs_text_builtin))
else
num_ool_stubs_text_end=0
fi
cat > "$arch_vmlinux_S" <<EOF
#include <asm/asm-offsets.h>
#include <asm/ppc_asm.h>
#include <linux/linkage.h>
.pushsection .tramp.ftrace.text,"aw"
SYM_DATA(ftrace_ool_stub_text_end_count, .long $num_ool_stubs_text_end)
SYM_START(ftrace_ool_stub_text_end, SYM_L_GLOBAL, .balign SZL)
#if $num_ool_stubs_text_end
.space $num_ool_stubs_text_end * FTRACE_OOL_STUB_SIZE
#endif
SYM_CODE_END(ftrace_ool_stub_text_end)
.popsection
.pushsection .tramp.ftrace.init,"aw"
SYM_DATA(ftrace_ool_stub_inittext_count, .long $num_ool_stubs_inittext)
SYM_START(ftrace_ool_stub_inittext, SYM_L_GLOBAL, .balign SZL)
.space $num_ool_stubs_inittext * FTRACE_OOL_STUB_SIZE
SYM_CODE_END(ftrace_ool_stub_inittext)
.popsection
EOF
Annotation
- Immediate include surface: `asm/asm-offsets.h`, `asm/ppc_asm.h`, `linux/linkage.h`.
- Atlas domain: Architecture Layer / arch/powerpc.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.