3748 Commits

Author SHA1 Message Date
JF Bastien
acc1d6453b dlfcn.h implementation and detailed example. 2016-02-01 08:00:42 -08:00
JF Bastien
13f9666606 Stub dlfcn.h 2016-02-01 04:54:06 -08:00
JF Bastien
68531e26b5 More readme content. 2016-02-01 04:46:05 -08:00
Szabolcs Nagy
d150764697 fix malloc_usable_size for NULL input
the linux man page specifies malloc_usable_size(0) to return 0 and
this is the semantics other implementations follow (jemalloc).
reported by Alexander Monakov.
2016-01-31 17:34:45 -05:00
Szabolcs Nagy
2810b30fc3 regex: increase the stack tre uses for tnfa creation
10k elements stack is increased to 1000k, otherwise tnfa creation fails
for reasonable sized patterns: a single literal char can add 7 elements
to this stack, so regcomp of an 1500 char long pattern (with only litral
chars) fails with REG_ESPACE. (the new limit allows about < 150k chars,
this arbitrary limit allows most command line regex usage.)

ideally there would be no upper bound: regcomp dynamically reallocates
this buffer, every reallocation checks for allocation failure and at
the end this stack is freed so there is no reason for special bound.
however that may have unwanted effect on regcomp and regexec runtime
so this is a conservative change.
2016-01-31 17:33:54 -05:00
Szabolcs Nagy
3b27725385 better a_sc inline asm constraint on aarch64 and arm
"Q" input constraint was used for the written object, instead of "=Q"
output constraint.  this should not cause problems because "memory"
is on the clobber list, but "=Q" better documents the intent and more
consistent with the actual asm code.

this changes the generated code, because different registers are used,
but other than the register names nothing should change.
2016-01-31 17:32:56 -05:00
JF Bastien
ee62761f12 Typo. 2016-01-31 12:41:25 -08:00
JF Bastien
e5d2fe138b Still more readme. 2016-01-31 12:39:00 -08:00
JF Bastien
5a74c85f16 More readme. 2016-01-31 12:36:42 -08:00
JF Bastien
2809b1ff41 Code quotes 2016-01-31 06:57:10 -08:00
JF Bastien
e2ce69a6fd Merge branch 'wasm-prototype-1' of github.com:WebAssembly/musl into wasm-prototype-1 2016-01-31 06:55:58 -08:00
JF Bastien
556002b394 Add README.md 2016-01-31 06:55:45 -08:00
JF Bastien
26e7adf5d0 wasm objects don't have hasOwnProperty and functions aren't Function 2016-01-31 02:49:24 -08:00
Rich Felker
65498f289b don't suppress shared libc when linker lacks -Bsymbolic-functions
previous work overhauling the dynamic linker made it so that linking
libc with -Bsymbolic-functions was no longer mandatory, but the
configure logic that forced --disable-shared when ld failed to accept
the option was left in place.

this commit removes the hard-coded -Bsymbolic-functions from the
Makefile and changes the configure test to one that simply adds it to
the auto-detected LDFLAGS on success.
2016-01-31 00:40:33 -05:00
Felix Fietkau
c18d05f0e8 ldso: fix GDB dynamic linker info on MIPS
GDB is looking for a pointer to the ldso debug info in the data of the
..rld_map section.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
2016-01-30 20:55:22 -05:00
Szabolcs Nagy
831e9d9efa regex: simplify the {,} repetition parsing logic 2016-01-30 20:53:52 -05:00
Szabolcs Nagy
25160f1c08 regex: treat \+, \? as repetitions in BRE
These are undefined escape sequences by the standard, but often
used in sed scripts.
2016-01-30 20:53:42 -05:00
Szabolcs Nagy
03498ec22a regex: rewrite the repetition parsing code
The goto logic was hard to follow and modify. This is
in preparation for the BRE \+ and \? support.
2016-01-30 20:53:29 -05:00
Szabolcs Nagy
da4cc13b97 regex: treat \| in BRE as alternation
The standard does not define semantics for \| in BRE, but some code
depends on it meaning alternation. Empty alternative expression is
allowed to be consistent with ERE.

Based on a patch by Rob Landley.
2016-01-30 20:53:17 -05:00
Szabolcs Nagy
7eaa76fc2e regex: reject repetitions in some cases with REG_BADRPT
Previously repetitions were accepted after empty expressions like
in (*|?)|{2}, but in BRE the handling of * and \{\} were not
consistent: they were accepted as literals in some cases and
repetitions in others.

It is better to treat repetitions after an empty expression as an
error (this is allowed by the standard, and glibc mostly does the
same). This is hard to do consistently with the current logic so
the new rule is:

Reject repetitions after empty expressions, except after assertions
^*, $? and empty groups ()+ and never treat them as literals.

Empty alternation (|a) is undefined by the standard, but it can be
useful so that should be accepted.
2016-01-30 20:53:04 -05:00
Szabolcs Nagy
a8cc225384 regex: clean up position accounting for literal nodes
This should not change the meaning of the code, just make the intent
clearer: advancing position is tied to adding a new literal.
2016-01-30 20:51:58 -05:00
Rich Felker
9ee57db883 fix misaligned pointer-like objects in arm atomics asm source file
this file's .data section was not aligned, and just happened to get
the correct alignment with past builds. it's likely that the move of
atomic.s from arch/arm/src to src/thread/arm caused the change in
alignment, which broke the atomic and thread-pointer access fragments
on actual armv5 hardware.
2016-01-30 19:42:08 -05:00
JF Bastien
ae7274db9b Add a few todos. 2016-01-30 14:12:19 -08:00
JF Bastien
f11387c0bb Return -1 from syscall stubs. 2016-01-30 13:45:37 -08:00
Rich Felker
140ad50cbf fix regression in dynamic-linked tls when both main app & libs have tls
commit d56460c939c94a6c547abe8238f442b8de10bfbd introduced this bug by
setting up the tls module chain incorrectly when the main app has tls.
the singly-linked list head pointer was setup correctly, but the tail
pointer was not, so the first attempt to append to the list (for a
shared library with tls) would treat the list as empty and effectively
removed the main app from the list. this left all tls module id
numbers off-by-one.

this bug did not appear in any released versions.
2016-01-30 14:34:45 -05:00
JF Bastien
e1f64b81c3 Add wasm.js
Imported from: https://github.com/WebAssembly/waterfall/blob/master/src/test/wasm.js
Hash: 8074c23c566a65f32d6b7fac065abf1ffca95473
2016-01-30 09:08:51 -08:00
JF Bastien
2118407451 Remove a few files from the blacklist
This properly generates musl.wast and musl.wasm using tip-of-tree LLVM, binaryen (with --ignore-unknown) and sexpr-wasm.
2016-01-30 08:16:03 -08:00
JF Bastien
0861c7123e Hack around the import argument mismatch
sexpr-wasm rightfully complained that the imports weren't called with the right signatures. I'm not sure how the syscall macro layering works, but this hack works for now.
2016-01-30 06:45:11 -08:00
JF Bastien
cbc4701edb Remove the only non-wasm32-arch change
I fixed the issue in LLVM commit r259305.
2016-01-30 06:34:15 -08:00
JF Bastien
0c46644853 No need for 'global' 2016-01-30 03:55:31 -08:00
JF Bastien
406cb2e6b5 Fix compile list in verbose mode. 2016-01-30 02:50:24 -08:00
JF Bastien
f878c5fc09 Allow saving temporary files. 2016-01-30 02:44:50 -08:00
JF Bastien
52a00611c2 Hack around syscalls. 2016-01-30 02:27:36 -08:00
JF Bastien
66ec565817 Remove regcomp: it makes LLVM sad with byval 2016-01-30 02:27:23 -08:00
Rich Felker
1563587b45 reuse parsed resolv.conf in dns core to avoid re-reading/re-parsing 2016-01-28 20:51:31 -05:00
Rich Felker
dcad020c9c fix uninitialized variable in new resolv.conf parser 2016-01-28 20:50:30 -05:00
Rich Felker
3d6e2e477c add support for search domains to dns resolver
search is only performed if the search or domain keyword is used in
resolv.conf and the queried name has fewer than ndots dots. there is
no default domain and names with >=ndots dots are never subjected to
search; failure in the root scope is final.

the (non-POSIX) res_search API presently does not honor search. this
may be added at some point in the future if needed.

resolv.conf is now parsed twice, at two different layers of the code
involved. this will be fixed in a subsequent patch.
2016-01-28 20:29:55 -05:00
Rich Felker
0fef7ffac1 fix handling of dns response codes
rcode of 3 (NxDomain) was treated as a hard EAI_NONAME failure, but it
should instead return 0 (no results) so the caller can continue
searching. this will be important for adding search domain support.
the top-level caller will automatically return EAI_NONAME if there are
zero results at the end.

also, the case where rcode is 0 (success) but there are no results was
not handled. this happens when the domain exists but there are no A or
AAAA records for it. in this case a hard EAI_NONAME should be imposed
to inhibit further search, since the name was defined and just does
not have any address associated with it. previously a misleading hard
failure of EAI_FAIL was reported.
2016-01-28 19:37:35 -05:00
Rich Felker
fe8453d2ee fix logic for matching search/domain keywords in resolv.conf 2016-01-28 19:20:13 -05:00
Rich Felker
d6cb08bcac factor resolv.conf parsing out of res_msend to its own file
this change is made in preparation for adding search domains, for
which higher-level code will need to parse resolv.conf. simply parsing
it twice for each lookup would be one reasonable option, but the
existing parser code was buggy anyway, which suggested to me that it's
a bad idea to have two variants of this code in two different places.

the old code in res_msend potentially misinterpreted overly long lines
in resolv.conf, and stopped parsing after it found 3 nameservers, even
if there were relevant options left to be parsed later in the file.
2016-01-28 18:39:22 -05:00
JF Bastien
910f9e5300 Hacky libc build 2016-01-28 11:10:19 -08:00
JF Bastien
317fa55ab1 Fixes. 2016-01-28 11:05:27 -08:00
JF Bastien
273da2708f Import arch/wasm32 from emscripten 2016-01-28 11:04:59 -08:00
Rich Felker
19df86cbb3 add errno setting to stub utmpxname function 2016-01-28 00:38:23 -05:00
Kylie McClain
378f8cb522 legacy/utmpx: Add utmp{,x}name stubs 2016-01-28 00:19:14 -05:00
Rich Felker
4dfac11538 deduplicate the bulk of the arch bits headers
all bits headers that were identical for a number of 'clean' archs are
moved to the new arch/generic tree. in addition, a few headers that
differed only cosmetically from the new generic version are removed.

additional deduplication may be possible in mman.h and in several
headers (limits.h, posix.h, stdint.h) that mostly depend on whether
the arch is 32- or 64-bit, but they are left alone for now because
greater gains are likely possible with more invasive changes to header
logic, which is beyond the scope of this commit.
2016-01-27 21:52:14 -05:00
Rich Felker
efdf04cf87 add arch/generic include fallback to build rules
this sets the stage for the first phase of the bits deduplication.
bits headers which are identical for "most" archs will be moved to
arch/generic/bits.
2016-01-27 19:31:15 -05:00
Rich Felker
e1d99894b6 remove unneeded -I options from configure test for may_alias attribute
this test does not include anything, so the -I options are not useful
and are just a maintenance burden if paths change.
2016-01-27 19:01:21 -05:00
Hauke Mehrtens
b0bf52f3e9 mips: add vdso support
vdso support is available on mips starting with kernel 4.4, see kernel
commit a7f4df4e21 "MIPS: VDSO: Add implementations of gettimeofday()
and clock_gettime()" for details.

In Linux kernel 4.4.0 the mips code returns -ENOSYS in case it can not
handle the vdso call and assumes the libc will call the original
syscall in this case. Handle this case in musl. Currently Linux kernel
4.4.0 handles the following types: CLOCK_REALTIME_COARSE,
CLOCK_MONOTONIC_COARSE, CLOCK_REALTIME and CLOCK_MONOTONIC.
2016-01-27 12:40:24 -05:00
Rich Felker
a5ba2d7507 improve clock_gettime and adapt it to support slightly-broken vdso
these changes are motivated by a functionally similar patch by Hauke
Mehrtens to address the needs of the new mips vdso clock_gettime,
which wrongly fails with ENOSYS rather than falling back to making a
syscall for clock ids it cannot handle from userspace. in the process
of preparing to handle that case, it was noticed that the old
clock_gettime use of the vdso was actually wrong with respect to error
handling -- the tail call to the vdso function failed to set errno and
instead returned an error code.

since tail calls to vdso are no longer possible and since the plain
syscall code is now needed as a fallback path anyway, it does not make
sense to use a function pointer to call the plain syscall code path.
instead, it's inlined at the end of the main clock_gettime function.

the new code also avoids the need to test for initialization of the
vdso function pointer by statically initializing it to a self-init
function, and eliminates redundant loads from the volatile pointer
object.

finally, the use of a_cas_p on an object of type other than void *,
which is not permitted aliasing, is replaced by using an object with
the correct type and casting the value.
2016-01-27 12:23:47 -05:00