ppc, ppc64: tag global symbols as functions

it is necessary to tag these symbols as functions otherwise the
linker gets confused; this previously manifested as the internal
functions (pre-rename) like __getcontext leaking into the symbol
table of things linked against libucontext that used the ucontext
POSIX API through the weak aliases

it also had another bad effect and that is if you tried to use
libucontext's API (post-rename), the linker would warn you during
compile time that the type is unknown, and the resulting program
would crash at runtime

after properly tagging everything, I no longer notice any leakage,
i.e. there don't seem to be any references to the aliased symbols
in the resulting symbol table when using the aliases, and using
the libucontext prefixed symbols directly also works
pull/24/head
Daniel Kolesa 2021-01-08 04:18:21 +01:00
parent d81154a61c
commit 6026980cac
6 changed files with 6 additions and 0 deletions

View File

@ -12,6 +12,7 @@
.global libucontext_getcontext .global libucontext_getcontext
.hidden __libucontext_swapcontext .hidden __libucontext_swapcontext
.type libucontext_getcontext, @function
libucontext_getcontext: libucontext_getcontext:
li 4, 0 li 4, 0
b __libucontext_swapcontext@local b __libucontext_swapcontext@local

View File

@ -12,6 +12,7 @@
.global libucontext_setcontext .global libucontext_setcontext
.hidden __libucontext_swapcontext .hidden __libucontext_swapcontext
.type libucontext_setcontext, @function
libucontext_setcontext: libucontext_setcontext:
mr 4, 3 mr 4, 3
li 3, 0 li 3, 0

View File

@ -11,6 +11,7 @@
*/ */
.global __libucontext_swapcontext .global __libucontext_swapcontext
.type __libucontext_swapcontext, @function
__libucontext_swapcontext: __libucontext_swapcontext:
li 0, 249 # SYS_swapcontext li 0, 249 # SYS_swapcontext
li 5, 1184 # sizeof(ucontext_t) li 5, 1184 # sizeof(ucontext_t)

View File

@ -12,6 +12,7 @@
.global libucontext_getcontext .global libucontext_getcontext
.hidden __libucontext_swapcontext .hidden __libucontext_swapcontext
.type libucontext_getcontext, @function
libucontext_getcontext: libucontext_getcontext:
addis 2, 12, .TOC.-libucontext_getcontext@ha addis 2, 12, .TOC.-libucontext_getcontext@ha
addi 2, 12, .TOC.-libucontext_getcontext@l addi 2, 12, .TOC.-libucontext_getcontext@l

View File

@ -12,6 +12,7 @@
.global libucontext_setcontext .global libucontext_setcontext
.hidden __libucontext_swapcontext .hidden __libucontext_swapcontext
.type libucontext_setcontext, @function
libucontext_setcontext: libucontext_setcontext:
addis 2, 12, .TOC.-libucontext_setcontext@ha addis 2, 12, .TOC.-libucontext_setcontext@ha
addi 2, 12, .TOC.-libucontext_setcontext@l addi 2, 12, .TOC.-libucontext_setcontext@l

View File

@ -11,6 +11,7 @@
*/ */
.global __libucontext_swapcontext .global __libucontext_swapcontext
.type __libucontext_swapcontext, @function
__libucontext_swapcontext: __libucontext_swapcontext:
addis 2, 12, .TOC.-__libucontext_swapcontext@ha addis 2, 12, .TOC.-__libucontext_swapcontext@ha
addi 2, 12, .TOC.-__libucontext_swapcontext@l addi 2, 12, .TOC.-__libucontext_swapcontext@l