arch/powerpc/kernel/reloc_32.S
Source file repositories/reference/linux-study-clean/arch/powerpc/kernel/reloc_32.S
File Facts
- System
- Linux kernel
- Corpus path
arch/powerpc/kernel/reloc_32.S- Extension
.S- Size
- 5349 bytes
- Lines
- 206
- 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/ppc_asm.h
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
#include <asm/ppc_asm.h>
/* Dynamic section table entry tags */
DT_RELA = 7 /* Tag for Elf32_Rela section */
DT_RELASZ = 8 /* Size of the Rela relocs */
DT_RELAENT = 9 /* Size of one Rela reloc entry */
STN_UNDEF = 0 /* Undefined symbol index */
STB_LOCAL = 0 /* Local binding for the symbol */
R_PPC_ADDR16_LO = 4 /* Lower half of (S+A) */
R_PPC_ADDR16_HI = 5 /* Upper half of (S+A) */
R_PPC_ADDR16_HA = 6 /* High Adjusted (S+A) */
R_PPC_RELATIVE = 22
/*
* r3 = desired final address
*/
_GLOBAL(relocate)
mflr r0 /* Save our LR */
bcl 20,31,$+4 /* Find our current runtime address */
0: mflr r12 /* Make it accessible */
mtlr r0
lwz r11, (p_dyn - 0b)(r12)
add r11, r11, r12 /* runtime address of .dynamic section */
lwz r9, (p_rela - 0b)(r12)
add r9, r9, r12 /* runtime address of .rela.dyn section */
lwz r10, (p_st - 0b)(r12)
add r10, r10, r12 /* runtime address of _stext section */
lwz r13, (p_sym - 0b)(r12)
add r13, r13, r12 /* runtime address of .dynsym section */
/*
* Scan the dynamic section for RELA, RELASZ entries
*/
li r6, 0
li r7, 0
li r8, 0
1: lwz r5, 0(r11) /* ELF_Dyn.d_tag */
cmpwi r5, 0 /* End of ELF_Dyn[] */
beq eodyn
cmpwi r5, DT_RELA
bne relasz
lwz r7, 4(r11) /* r7 = rela.link */
b skip
relasz:
cmpwi r5, DT_RELASZ
bne relaent
lwz r8, 4(r11) /* r8 = Total Rela relocs size */
b skip
relaent:
cmpwi r5, DT_RELAENT
bne skip
lwz r6, 4(r11) /* r6 = Size of one Rela reloc */
skip:
addi r11, r11, 8
b 1b
eodyn: /* End of Dyn Table scan */
/* Check if we have found all the entries */
cmpwi r7, 0
beq done
cmpwi r8, 0
beq done
cmpwi r6, 0
beq done
Annotation
- Immediate include surface: `asm/ppc_asm.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.