3311 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
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
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
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
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
f9b8df464d add ssp suppression to some arch-override files that may need it
these were not covered by the parent-level rules with the new build
system. in the old build system, the equivalent files were often in
arch/$(ARCH)/src and likewise lacked the suppression. this could lead
to early crashing (before thread pointer init) when libc itself was
built with stack protector enabled.
2016-01-25 20:06:31 -05:00
Rich Felker
1619127c11 use same object files for libc.a and libc.so if compiler produces PIC
now that .lo and .o files differ only by whether -fPIC is passed (and
no longer at the source level based on the SHARED macro), it's
possible to use the same object files for both static and shared libc
when the compiler would produce PIC for the static files anyway. this
happens if the user has included -fPIC in their CFLAGS or if the
compiler has been configured to produce PIE by default.

we use the .lo files for both, and still append -fPIC to the CFLAGS,
rather than using the .o files so that libc.so does not break
catastrophically if the user later removes -fPIC from CFLAGS in
config.mak or on the make command line. this also ensures that we get
full -fPIC in case -fpic, -fPIE, or some other lesser-PIC option was
passed in CFLAGS.
2016-01-25 19:57:38 -05:00
Rich Felker
5552ce5200 move dynamic linker to its own top-level directory, ldso
this eliminates the last need for the SHARED macro to control how
files in the src tree are compiled. the same code is used for both
libc.a and libc.so, with additional code for the dynamic linker (from
the new ldso tree) being added to libc.so but not libc.a. separate .o
and .lo object files still exist for the src tree, but the only
difference is that the .lo files are built as PIC.

in the future, if/when we add dlopen support for static-linked
programs, much of the code in dynlink.c may be moved back into the src
tree, but properly factored into separate source files. in that case,
the code in the ldso tree will be reduced to just the dynamic linker
entry point, self-relocation, and loading of libraries needed by the
main application.
2016-01-25 19:29:55 -05:00
Rich Felker
16f70388d4 adapt static dl_iterate_phdr not to depend on !defined(SHARED)
like elsewhere, use a weak alias that the dynamic linker will override
with a more complete version capable of handling shared libraries.
2016-01-25 19:12:41 -05:00
Rich Felker
4058795d49 move static-linked stub dlsym out of dynlink.c
the function name is still __-prefixed because it requires an asm
wrapper to pass the caller's address in order for RTLD_NEXT to work.

since this was the last function in dynlink.c still used for static
linking, now the whole file is conditional on SHARED being defined.
2016-01-25 19:04:45 -05:00
Rich Felker
14469371cd move static-linked stub dlopen out of dynlink.c 2016-01-25 18:58:06 -05:00
Rich Felker
b98414732d move dlinfo out of dynlink.c 2016-01-25 18:55:35 -05:00
Rich Felker
da1fe7f500 move dlclose out of dynlink.c to its own source file 2016-01-25 18:53:40 -05:00
Rich Felker
891e6547b4 move static-linked stub invalid dso handle checking out of dynlink.c 2016-01-25 18:51:33 -05:00
Rich Felker
4f8f038060 move static/stub version of dladdr out of dynlink.c 2016-01-25 18:44:29 -05:00
Rich Felker
a4fbc82c8e factor dlerror and error-setting code out of dynlink.c
the ultimate goal of this change is to get all code used in libc.a out
of dynlink.c, so that the dynamic linker code can be moved to its own
tree and object files in the src tree can all be shared between libc.a
and libc.so.
2016-01-25 18:44:09 -05:00
Rich Felker
e7a1118984 fix arm a_crash for big endian
contrary to commit 89e149d275a7699a4a5e4c98bab267648f64cbba, big
endian arm does need the instruction bytes in big endian order. rather
than trying to use a special encoding that works as arm or thumb,
simply encode the simplest/canonical undefined instructions dependent
on whether __thumb__ is defined.
2016-01-25 21:59:55 +00:00
Rich Felker
89e149d275 add native a_crash primitive for arm
the .byte directive encodes a guaranteed-undefined instruction, the
same one Linux fills the kuser helper page with when it's disabled.
the udf mnemonic and and .insn directives are not supported by old
binutils versions, and larger-than-byte integer directives would
produce the wrong output on big-endian.
2016-01-25 02:44:56 +00:00
Szabolcs Nagy
2c9acc51cd add new IP_BIND_ADDRESS_NO_PORT and IPPROTO_MPLS to netinet/in.h
IP_BIND_ADDRESS_NO_PORT is a SOL_IP socket option to delay src port
allocation until connect in case src ip is set with bind(port=0).
new in linux v4.2, commit 90c337da1524863838658078ec34241f45d8394d

IPPROTO_MPLS protocol number for mpls over ip.
new in linux v4.2, commit 730fc4371333636a00fed32c587fc1e85c5367e2
2016-01-24 19:19:29 -05:00
Szabolcs Nagy
4da2d96591 update netinet/tcp.h for linux v4.2
TCP_CC_INFO is a new socket option to get congestion control info without
netlink (union tcp_cc_info is in linux/inet_diag.h kernel header).
linux commit 6e9250f59ef9efb932c84850cd221f22c2a03c4a

TCP_SAVE_SYN, TCP_SAVED_SYN socket options are for saving and getting the
SYN headers of passive connections in a server application.
linux commit cd8ae85299d54155702a56811b2e035e63064d3d

Add new tcpi_* fields to struct tcp_info implementing RFC4898 counters.
linux commit 2efd055c53c06b7e89c167c98069bab9afce7e59
2016-01-24 19:18:51 -05:00
Szabolcs Nagy
ecf02f4e8a add MS_LAZYTIME mount option to sys/mount.h
new in linux 4.0 commit 0ae45f63d4ef8d8eeec49c7d8b44a1775fff13e8,
used to update atime/mtime/ctime only in memory when possible.
2016-01-24 19:18:41 -05:00
Szabolcs Nagy
9f52c17eb2 add AF_MPLS (PF_MPLS) address family to socket.h
new in linux 4.0 commit 0189197f441602acdca3f97750d392a895b778fd.
2016-01-24 19:18:21 -05:00
Szabolcs Nagy
ea4fc27d28 add MSG_FASTOPEN sendmsg/sendto flag to socket.h
This was new in linux 3.5 in commit cf60af03ca4e71134206809ea892e49b92a88896,
needed for tcp fastopen feature (sending data in TCP SYN packet).
2016-01-24 19:18:02 -05:00
Szabolcs Nagy
bc443c3fe3 clean powerpc syscall.h
remove ifdefs for powerpc64.
2016-01-24 19:08:57 -05:00
Szabolcs Nagy
f9c3a2e048 add missing powerpc specific PROT_SAO memory protection flag
this flag for strong access ordering was added in linux v2.6.27
commit aba46c5027cb59d98052231b36efcbbde9c77a1d
2016-01-24 19:08:40 -05:00
Szabolcs Nagy
2f6f3dccb4 fix powerpc MCL_* mlockall flags in bits/mman.h
the definitions didn't match the linux uapi headers.
2016-01-24 19:08:19 -05:00
Szabolcs Nagy
2d14fa39b0 fix aarch64 atomics to load/store 32bit only
a_ll/a_sc inline asm used 64bit register operands (%0) instead of 32bit
ones (%w0), this at least broke a_and_64 (which always cleared the top
32bit, leaking memory in malloc).
2016-01-24 19:07:35 -05:00
Rich Felker
b17fbd3520 improve aarch64 atomics
aarch64 provides ll/sc variants with acquire/release memory order,
freeing us from the need to have full barriers both before and after
the ll/sc operation. previously they were not used because the a_cas
can fail without performing a_sc, in which case half of the barrier
would be omitted. instead, define a custom version of a_cas for
aarch64 which uses a_barrier explicitly when aborting the cas
operation. aside from cas, other operations built on top of ll/sc are
not affected since they never abort but rather loop until they
succeed.

a split ll/sc version of the pointer-sized a_cas_p is also introduced
using the same technique.

patch by Szabolcs Nagy.
2016-01-23 14:03:40 -05:00
Rich Felker
0f5eb3de29 add arch/abi info to dynamic linker's id/version output 2016-01-22 04:04:16 +00:00
Rich Felker
5a2e88257a remove arch/$(ARCH)/src from the build system
the files that used to come from extra src dirs under the arch dir
have all been removed or moved to appropriate places under the main
src tree.
2016-01-22 03:58:51 +00:00
Rich Felker
4de1bc1164 remove sh port's __fpscr_values source file
commit f3ddd173806fd5c60b3f034528ca24542aecc5b9, the dynamic linker
bootstrap overhaul, silently disabled the definition of __fpscr_values
in this file since libc.so's copy of __fpscr_values now comes from
crt_arch.h, the same place the public definition in the main program's
crt1.o ultimately comes from. remove this file which is no longer in
use.
2016-01-22 03:50:58 +00:00