diff options
author | Rich Felker <dalias@aerifal.cx> | 2015-09-12 02:55:28 +0000 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2015-09-12 02:55:28 +0000 |
commit | 234c58467c3709bafdd3ffa6ac73655e1dfd9ddb (patch) | |
tree | d1357427a86e6dc14fe09573745a506c36b146c0 /src/thread | |
parent | ad5d8a2bf3526bce4317055612709ac076b5c4c3 (diff) | |
download | musl-234c58467c3709bafdd3ffa6ac73655e1dfd9ddb.zip musl-234c58467c3709bafdd3ffa6ac73655e1dfd9ddb.tar.gz musl-234c58467c3709bafdd3ffa6ac73655e1dfd9ddb.tar.bz2 |
make sh clone asm fdpic-compatible
clone calls back to a function pointer provided by the caller, which
will actually be a pointer to a function descriptor on fdpic. the
obvious solution is to have a separate version of clone for fdpic, but
I have taken a simpler approach to go around the problem. instead of
calling the pointed-to function from asm, a direct call is made to an
internal C function which then calls the pointed-to function. this
lets the C compiler generate the appropriate calling convention for an
indirect call with no need for ABI-specific assembly.
Diffstat (limited to 'src/thread')
-rw-r--r-- | src/thread/sh/clone.s | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/thread/sh/clone.s b/src/thread/sh/clone.s index f8ad845..aa4d0df 100644 --- a/src/thread/sh/clone.s +++ b/src/thread/sh/clone.s @@ -33,10 +33,12 @@ __clone: nop 1: ! we are the child, call fn(arg) - jsr @r1 - mov r2, r4 + mov.l 1f, r0 + mov r1, r5 + bsrf r0 + mov r2, r4 - mov #1, r3 ! __NR_exit +2: mov #1, r3 ! __NR_exit mov r0, r4 trapa #31 @@ -45,3 +47,7 @@ __clone: or r0, r0 or r0, r0 or r0, r0 + +.align 2 +.hidden __shcall +1: .long __shcall@PCREL+(.-2b) |