musl - an implementation of the standard library for Linux-based systems
Go to file
Rich Felker c8798ef974 fix regression in i386 inline syscall asm producing invalid code
commit 22e5bbd0de inlined the i386
syscall mechanism, but wrongly assumed memory operands to the 5- and
6-argument syscall asm would be esp-based. however, nothing in the
constraints prevented them from being ebx- or ebp-based, and in those
cases, ebx and ebp could be clobbered before use of the memory operand
was complete. in the 6-argument case, this prevented restoration of
the original register values before the end of the asm block, breaking
the asm contract since ebx and ebp are not marked as clobbered. (they
can't be, because lots of compilers don't accept these registers in
constraints or clobbers if PIC or frame pointer is enabled).

doing this right is complicated by the fact that, after a single push,
no operands which might be memory operands are usable. if they are
esp-based, the value of esp has changed, rendering them invalid.

introduce some new dances to load the registers. for the 5-arg case,
push the operand that may be a memory operand first, and after that,
it doesn't matter if the operand is invalid, since we'll just use the
newly pushed value. for the 6-arg case, we need to put both operands
in memory to begin with, like the old non-inline code prior to commit
22e5bbd0de accepted, so that there's
only one potentially memory-based operand to the asm. this can then be
saved with a single push, and after that the values can be read off
into the registers they're needed in.

there's some size overhead, but still a lot less execution overhead
than the old out-of-line code. doing it better depends on a modern
compiler that lets you use ebx and ebp in asm constraints without
restriction. the failure modes on compilers where this doesn't work
are inconsistent and dangerous (on at least some gcc versions 4.x and
earlier, wrong codegen!), so this is a delicate matter. it can be
addressed later if needed.
2019-05-10 20:56:19 -04:00
arch fix regression in i386 inline syscall asm producing invalid code 2019-05-10 20:56:19 -04:00
crt define and use internal macros for hidden visibility, weak refs 2018-09-05 14:05:14 -04:00
dist add another example option to dist/config.mak 2012-04-24 16:49:11 -04:00
include define FP_FAST_FMA* when fma* can be inlined 2019-04-17 13:02:47 -04:00
ldso overhaul i386 syscall mechanism not to depend on external asm source 2019-04-10 17:10:36 -04:00
src make fgetwc set error indicator for stream on encoding errors 2019-05-05 22:50:57 -04:00
tools fix musl-gcc wrapper to be compatible with default-pie gcc toolchains 2018-08-02 19:15:48 -04:00
.gitignore remove obsolete gitignore rules 2016-07-06 00:21:25 -04:00
COPYRIGHT new tsearch implementation 2018-09-20 17:57:47 -04:00
INSTALL add powerpc64 and s390x to list of supported archs in INSTALL file 2017-08-29 20:48:02 -04:00
Makefile overhaul internally-public declarations using wrapper headers 2018-09-12 14:34:33 -04:00
README update version reference in the README file 2014-06-25 14:16:53 -04:00
VERSION release 1.1.22 2019-04-09 20:39:21 -04:00
WHATSNEW release 1.1.22 2019-04-09 20:39:21 -04:00
configure configure: accept ppc[64] as alias for powerpc[64] in gcc tuples 2019-01-19 18:39:54 -05:00
dynamic.list fix regression in access to optopt object 2018-11-19 13:20:41 -05:00

README

    musl libc

musl, pronounced like the word "mussel", is an MIT-licensed
implementation of the standard C library targetting the Linux syscall
API, suitable for use in a wide range of deployment environments. musl
offers efficient static and dynamic linking support, lightweight code
and low runtime overhead, strong fail-safe guarantees under correct
usage, and correctness in the sense of standards conformance and
safety. musl is built on the principle that these goals are best
achieved through simple code that is easy to understand and maintain.

The 1.1 release series for musl features coverage for all interfaces
defined in ISO C99 and POSIX 2008 base, along with a number of
non-standardized interfaces for compatibility with Linux, BSD, and
glibc functionality.

For basic installation instructions, see the included INSTALL file.
Information on full musl-targeted compiler toolchains, system
bootstrapping, and Linux distributions built on musl can be found on
the project website:

    http://www.musl-libc.org/