Commit Graph

19 Commits

Author SHA1 Message Date
Rich Felker fb247fafa0 avoid "inline" in public headers for strict c89 compatibility
while musl itself requires a c99 compiler, some applications insist on
being compiled with c89 compilers, and use of "inline" in the headers
was breaking them. much of this had been avoided already by just
skipping the inline keyword in pre-c99 compilers or modes, but this
new unified solution is cleaner and may/should result in better code
generation in the default gcc configuration.
2012-09-02 12:46:06 -04:00
Rich Felker 036eaa24cf avoid need for -march=mips2 to compile mips atomic.h asm
linux guarantees ll/sc are always available. on mips1, they will be
emulated by the kernel. thus they are part of the linux mips1 abi and
safe to use.
2012-08-11 19:51:21 -04:00
Rich Felker c5875ad34b fix incorrect ptrdiff_t type on mips 2012-08-10 14:59:20 -04:00
Rich Felker 83b42d94bd add defines for number of sigset_t bytes syscalls expect
yet another gratuitous mips incompatibility...
2012-08-09 21:35:19 -04:00
Rich Felker ae0b9da48c further fixes for mips ioctl.h header
untested; hopefully it's right now
2012-08-07 19:59:28 -04:00
Rich Felker ff02f94e2d fix another mips gratuitous-incompatibility bug: ioctl numbers 2012-08-07 19:19:21 -04:00
Rich Felker 7fee5f9606 fix socket.h on mips
why does mips have to be gratuitously incompatible in every possible
imaginable way?
2012-08-05 14:23:40 -04:00
Rich Felker fa91df41e8 more stuff lost committing mips dynamic linker 2012-08-05 13:48:42 -04:00
Rich Felker babf820180 mips dynamic linker support
not heavily tested, but the basics are working. the basic concept is
that the dynamic linker entry point code invokes a pure-PIC (no global
accesses) C function in reloc.h to perform the early GOT relocations
needed to make the dynamic linker itself functional, then invokes
__dynlink like on other archs. since mips uses some ugly arch-specific
hacks to optimize relocating the GOT (rather than just using the
normal DT_REL[A] tables like on other archs), the dynamic linker has
been modified slightly to support calling arch-specific relocation
code in reloc.h.

most of the actual mips-specific behavior was developed by reading the
output of readelf on libc.so and simple executable files. i could not
find good reference information on which relocation types need to be
supported or their semantics, so it's possible that some legitimate
usage cases will not work yet.
2012-08-05 12:50:26 -04:00
Rich Felker dc046f55bb add floating point register saving/restoring to mips setjmp/longjmp
also fix the alignment of jmp_buf to meet the abi. linux always
emulates fpu on mips if it's not present, so enabling this code
unconditionally is "safe" but may be slow. in the long term it may be
preferable to find a way to disable it on soft float builds.
2012-07-22 18:55:01 -04:00
Rich Felker 48d20136b0 fix broken mips a_fetch_add
sc was overwriting the result
2012-07-12 23:18:03 -04:00
Rich Felker e1e4d6b269 mipsel (little endian) support
the fields in the mcontext_t are long long (for no good reason) even
on 32-bit mips, so the offset of the instruction pointer (as a word)
varies depending on endianness.
2012-07-12 21:49:30 -04:00
Rich Felker 96107564e2 workaround another sendmsg kernel bug on 64-bit machines
the kernel wrongly expects the cmsg length field to be size_t instead
of socklen_t. in order to work around the issue, we have to impose a
length limit and copy to a local buffer. the length limit should be
more than sufficient for any real-world use; these headers are only
used for passing file descriptors and permissions between processes
over unix sockets.
2012-07-12 21:37:54 -04:00
Rich Felker 90e123f4a8 fix redef of sigprocmask constants on mips
this fix is easier than trying to reorder the header stuff
2012-07-12 16:54:43 -04:00
Rich Felker ba8a96b068 more mips bits-header fixes
signal handling was very broken because of this
2012-07-12 14:21:41 -04:00
Rich Felker db11e96493 fix mips syscalls with long long args
like arm, mips requires 64-bit arguments to be "aligned" on an even
register boundary.
2012-07-12 13:48:56 -04:00
Rich Felker 5fac93db37 fix mips mcontext_t structure size
otherwise offs in ucontext_t will be wrong, and break code that
inspects or modifies the signal makes (including cancellation code).
2012-07-12 00:14:40 -04:00
Rich Felker 2b3cc04a8d fix MAP_ANONYMOUS value for mips, remove cruft copied from i386 2012-07-11 22:29:57 -04:00
Rich Felker 6315004f61 initial version of mips (o32) port, based on work by Richard Pennington (rdp)
basically, this version of the code was obtained by starting with
rdp's work from his ellcc source tree, adapting it to musl's build
system and coding style, auditing the bits headers for discrepencies
with kernel definitions or glibc/LSB ABI or large file issues, fixing
up incompatibility with the old binutils from aboriginal linux, and
adding some new special cases to deal with the oddities of sigaction
and pipe syscall interfaces on mips.

at present, minimal test programs work, but some interfaces are broken
or missing. threaded programs probably will not link.
2012-07-11 04:22:13 -04:00