Skip to content
This repository has been archived by the owner on Apr 3, 2021. It is now read-only.

Commit

Permalink
Fix implementation of __syscall_set_errno for PIC
Browse files Browse the repository at this point in the history
Forgot to add the thread pointer, derp.
  • Loading branch information
aswaterman committed Dec 22, 2016
1 parent 5532f04 commit e84d3a5
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions sysdeps/unix/sysv/linux/riscv/sysdep.S
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
# define errno __libc_errno
#endif

ENTRY (__syscall_error)
mv t0, ra
/* Fall through to __syscall_set_errno. */
END (__syscall_error)

/* Non-standard calling convention: argument in a0, return address in t0,
and clobber only t1. */
ENTRY (__syscall_set_errno)
Expand All @@ -34,6 +39,7 @@ ENTRY (__syscall_set_errno)
sw a0, rtld_errno, t1
#elif defined(__PIC__)
la.tls.ie t1, errno
add t1, t1, tp
sw a0, 0(t1)
#else
lui t1, %tprel_hi(errno)
Expand All @@ -43,8 +49,3 @@ ENTRY (__syscall_set_errno)
li a0, -1
1: jr t0
END (__syscall_set_errno)

ENTRY (__syscall_error)
mv t0, ra
j __syscall_set_errno
END (__syscall_error)

0 comments on commit e84d3a5

Please sign in to comment.