[klibc] mips64: compile with -mno-abicalls

By default, the MIPS toolchain compiles all code as PIC. Since klibc
links everything at static addresses, we don't need PIC code so use
-mno-abicalls to disable it. To fix subsequent link errors, use
-Ttext-segment to adjust the base address of klibc to a more sensible
location.

This fixes a bug in the shared library form of klibc where programs
would segfault in the syscall handler because we tried to store into the
"errno" variable without setting up the gp register. This is only required
under the PIC ABI.

Signed-off-by: James Cowgill <james.cowgill@mips.com>
Link: https://www.zytor.com/pipermail/klibc/2018-March/003985.html
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
1 file changed