From cf051123064ba6530fb42c78fb62ad05cbf228c8 Mon Sep 17 00:00:00 2001 From: Daniel Kolesa Date: Fri, 8 Jan 2021 04:52:46 +0100 Subject: [PATCH] ppc, ppc64: use common ALIAS/FUNC/END macros --- arch/ppc/getcontext.S | 12 ++++++------ arch/ppc/setcontext.S | 12 ++++++------ arch/ppc/startcontext.S | 7 +++++-- arch/ppc/swapcontext.S | 16 +++++++--------- arch/ppc64/getcontext.S | 12 ++++++------ arch/ppc64/setcontext.S | 12 ++++++------ arch/ppc64/startcontext.S | 8 +++++--- arch/ppc64/swapcontext.S | 16 +++++++--------- 8 files changed, 48 insertions(+), 47 deletions(-) diff --git a/arch/ppc/getcontext.S b/arch/ppc/getcontext.S index 034704c..c6e1d92 100644 --- a/arch/ppc/getcontext.S +++ b/arch/ppc/getcontext.S @@ -10,12 +10,12 @@ * from the use of this software. */ -.global libucontext_getcontext +#include "common-defs.h" + +ALIAS(getcontext, libucontext_getcontext) + .hidden __libucontext_swapcontext -.type libucontext_getcontext, @function -libucontext_getcontext: +FUNC(libucontext_getcontext) li 4, 0 b __libucontext_swapcontext@local - -.weak getcontext -getcontext = libucontext_getcontext +END(libucontext_getcontext) diff --git a/arch/ppc/setcontext.S b/arch/ppc/setcontext.S index 7a612f9..a30f519 100644 --- a/arch/ppc/setcontext.S +++ b/arch/ppc/setcontext.S @@ -10,13 +10,13 @@ * from the use of this software. */ -.global libucontext_setcontext +#include "common-defs.h" + +ALIAS(setcontext, libucontext_setcontext) + .hidden __libucontext_swapcontext -.type libucontext_setcontext, @function -libucontext_setcontext: +FUNC(libucontext_setcontext) mr 4, 3 li 3, 0 b __libucontext_swapcontext@local - -.weak setcontext -setcontext = libucontext_setcontext +END(libucontext_setcontext) diff --git a/arch/ppc/startcontext.S b/arch/ppc/startcontext.S index ab0d4f0..7833808 100644 --- a/arch/ppc/startcontext.S +++ b/arch/ppc/startcontext.S @@ -10,8 +10,10 @@ * from the use of this software. */ -.globl libucontext_trampoline; -libucontext_trampoline: +#include "common-defs.h" + +.hidden libucontext_trampoline +FUNC(libucontext_trampoline) /* get the proper context into position and test for NULL */ mr. 3,31 @@ -23,3 +25,4 @@ libucontext_trampoline: no_linked_context: b exit@GOT +END(libucontext_trampoline) diff --git a/arch/ppc/swapcontext.S b/arch/ppc/swapcontext.S index 25d7aa5..5be5a05 100644 --- a/arch/ppc/swapcontext.S +++ b/arch/ppc/swapcontext.S @@ -10,18 +10,16 @@ * from the use of this software. */ -.global __libucontext_swapcontext -.type __libucontext_swapcontext, @function -__libucontext_swapcontext: +#include "common-defs.h" + +ALIAS(swapcontext, __libucontext_swapcontext) +ALIAS(libucontext_swapcontext, __libucontext_swapcontext) + +FUNC(__libucontext_swapcontext) li 0, 249 # SYS_swapcontext li 5, 1184 # sizeof(ucontext_t) sc .hidden __retfromsyscall b __retfromsyscall@local - -.weak swapcontext -swapcontext = libucontext_swapcontext - -.weak libucontext_swapcontext -libucontext_swapcontext = __libucontext_swapcontext +END(__libucontext_swapcontext) diff --git a/arch/ppc64/getcontext.S b/arch/ppc64/getcontext.S index 87321af..a86c4ac 100644 --- a/arch/ppc64/getcontext.S +++ b/arch/ppc64/getcontext.S @@ -10,10 +10,12 @@ * from the use of this software. */ -.global libucontext_getcontext +#include "common-defs.h" + +ALIAS(getcontext, libucontext_getcontext) + .hidden __libucontext_swapcontext -.type libucontext_getcontext, @function -libucontext_getcontext: +FUNC(libucontext_getcontext) addis 2, 12, .TOC.-libucontext_getcontext@ha addi 2, 12, .TOC.-libucontext_getcontext@l @@ -21,6 +23,4 @@ libucontext_getcontext: li 4, 0 b __libucontext_swapcontext - -.weak getcontext -getcontext = libucontext_getcontext +END(libucontext_getcontext) diff --git a/arch/ppc64/setcontext.S b/arch/ppc64/setcontext.S index c8aa584..9798e50 100644 --- a/arch/ppc64/setcontext.S +++ b/arch/ppc64/setcontext.S @@ -10,10 +10,12 @@ * from the use of this software. */ -.global libucontext_setcontext +#include "common-defs.h" + +ALIAS(setcontext, libucontext_setcontext) + .hidden __libucontext_swapcontext -.type libucontext_setcontext, @function -libucontext_setcontext: +FUNC(libucontext_setcontext) addis 2, 12, .TOC.-libucontext_setcontext@ha addi 2, 12, .TOC.-libucontext_setcontext@l @@ -22,6 +24,4 @@ libucontext_setcontext: mr 4, 3 li 3, 0 b __libucontext_swapcontext - -.weak setcontext -setcontext = libucontext_setcontext +END(libucontext_setcontext) diff --git a/arch/ppc64/startcontext.S b/arch/ppc64/startcontext.S index 14b2576..367f99d 100644 --- a/arch/ppc64/startcontext.S +++ b/arch/ppc64/startcontext.S @@ -10,9 +10,10 @@ * from the use of this software. */ -.globl libucontext_trampoline; -.hidden libucontext_trampoline; -libucontext_trampoline: +#include "common-defs.h" + +.hidden libucontext_trampoline +FUNC(libucontext_trampoline) cmpdi 31,0 /* test if ucontext link pointer is null */ beq no_linked_context /* if it is, exit */ @@ -29,3 +30,4 @@ libucontext_trampoline: no_linked_context: b exit@GOT nop +END(libucontext_trampoline) diff --git a/arch/ppc64/swapcontext.S b/arch/ppc64/swapcontext.S index 554ac55..7f27c6c 100644 --- a/arch/ppc64/swapcontext.S +++ b/arch/ppc64/swapcontext.S @@ -10,9 +10,12 @@ * from the use of this software. */ -.global __libucontext_swapcontext -.type __libucontext_swapcontext, @function -__libucontext_swapcontext: +#include "common-defs.h" + +ALIAS(swapcontext, __libucontext_swapcontext) +ALIAS(libucontext_swapcontext, __libucontext_swapcontext) + +FUNC(__libucontext_swapcontext) addis 2, 12, .TOC.-__libucontext_swapcontext@ha addi 2, 12, .TOC.-__libucontext_swapcontext@l @@ -24,9 +27,4 @@ __libucontext_swapcontext: .hidden __retfromsyscall b __retfromsyscall - -.weak swapcontext -swapcontext = __libucontext_swapcontext - -.weak libucontext_swapcontext -libucontext_swapcontext = __libucontext_swapcontext +END(__libucontext_swapcontext)