2 * arch/arm/libpie/relocate.S - Relocation updating for PIEs
4 * Copyright 2013 Texas Instruments, Inc.
5 * Russ Dill <russ.dill@ti.com>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
12 #include <linux/linkage.h>
15 * Update relocations based on current pc
22 /* Calculate offset of our code compared to existing relocations */
23 ldr r4, pie_relocate_address
24 adr r5, __pie_relocate
26 moveq pc, lr /* 0 offset, no need to do anything */
28 /* Base of PIE group */
32 /* Calculate address of tail */
36 /* First byte of tail is number of entries */
38 add r8, r7, r8, lsl #2
41 * r5 - current base address of PIE group
42 * r6 - fixup offset needed for relocs
49 ldrne r4, [r7], #4 /* Load next reloc offset */
51 addne r4, r4, r5 /* Calculate address of reloc entry */
53 addne r9, r9, r6 /* Fixup reloc entry */
59 ENDPROC(__pie_relocate)
62 * This ends up in the .rel.dyn section and can be used to read the current
68 /* Offset from PIE section start to reloc function */
73 /* Offset from PIE section start to tail */