Skip to content

Commit 169c7ce

Browse files
powerpc: Add _GLOBAL_TOC for ABIv2 assembly functions exported to modules
If an assembly function that calls back into c code is exported to modules, we need to ensure r2 is setup correctly. There are only two places crazy enough to do it (two of which are my fault). Signed-off-by: Anton Blanchard <anton@samba.org>
1 parent 008d7a9 commit 169c7ce

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

‎arch/powerpc/include/asm/ppc_asm.h‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,16 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_SPLPAR)
207207
.globl name; \
208208
name:
209209

210+
#define _GLOBAL_TOC(name) \
211+
.section ".text"; \
212+
.align 2 ; \
213+
.type name,@function; \
214+
.globl name; \
215+
name: \
216+
0: addis r2,r12,(.TOC.-0b)@ha; \
217+
addi r2,r2,(.TOC.-0b)@l; \
218+
.localentry name,.-name
219+
210220
#define _KPROBE(name) \
211221
.section ".kprobes.text","a"; \
212222
.align 2 ; \
@@ -235,6 +245,8 @@ name: \
235245
.type GLUE(.,name),@function; \
236246
GLUE(.,name):
237247

248+
#define _GLOBAL_TOC(name) _GLOBAL(name)
249+
238250
#define _KPROBE(name) \
239251
.section ".kprobes.text","a"; \
240252
.align 2 ; \

‎arch/powerpc/lib/copyuser_64.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#endif
1919

2020
.align 7
21-
_GLOBAL(__copy_tofrom_user)
21+
_GLOBAL_TOC(__copy_tofrom_user)
2222
BEGIN_FTR_SECTION
2323
nop
2424
FTR_SECTION_ELSE

‎arch/powerpc/lib/memcpy_64.S‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include <asm/ppc_asm.h>
1111

1212
.align 7
13-
_GLOBAL(memcpy)
13+
_GLOBAL_TOC(memcpy)
1414
BEGIN_FTR_SECTION
1515
std r3,-STACKFRAMESIZE+STK_REG(R31)(r1) /* save destination pointer for return value */
1616
FTR_SECTION_ELSE

0 commit comments

Comments
 (0)