musl/src
Rich Felker 7586360bad add support for init/fini array in main program, and greatly simplify
modern (4.7.x and later) gcc uses init/fini arrays, rather than the
legacy _init/_fini function pasting and crtbegin/crtend ctors/dtors
system, on most or all archs. some archs had already switched a long
time ago. without following this change, global ctors/dtors will cease
to work under musl when building with new gcc versions.

the most surprising part of this patch is that it actually reduces the
size of the init code, for both static and shared libc. this is
achieved by (1) unifying the handling main program and shared
libraries in the dynamic linker, and (2) eliminating the
glibc-inspired rube goldberg machine for passing around init and fini
function pointers. to clarify, some background:

the function signature for __libc_start_main was based on glibc, as
part of the original goal of being able to run some glibc-linked
binaries. it worked by having the crt1 code, which is linked into
every application, static or dynamic, obtain and pass pointers to the
init and fini functions, which __libc_start_main is then responsible
for using and recording for later use, as necessary. however, in
neither the static-linked nor dynamic-linked case do we actually need
crt1.o's help. with dynamic linking, all the pointers are available in
the _DYNAMIC block. with static linking, it's safe to simply access
the _init/_fini and __init_array_start, etc. symbols directly.

obviously changing the __libc_start_main function signature in an
incompatible way would break both old musl-linked programs and
glibc-linked programs, so let's not do that. instead, the function can
just ignore the information it doesn't need. new archs need not even
provide the useless args in their versions of crt1.o. existing archs
should continue to provide it as long as there is an interest in
having newly-linked applications be able to run on old versions of
musl; at some point in the future, this support can be removed.
2013-07-21 03:00:54 -04:00
..
aio fix invalid access in aio notification 2013-06-16 10:39:02 -04:00
complex complex: add C11 CMPLX macros and replace cpack with them 2012-11-13 01:31:49 +01:00
conf document in sysconf and unistd.h that per-thread cpu clocks exist 2013-06-26 19:43:24 -04:00
crypt comment potentially-confusing use of struct crypt_data type 2013-04-20 14:07:01 -04:00
ctype fix types for wctype_t and wctrans_t 2013-03-04 19:22:14 -05:00
dirent use restrict everywhere it's required by c99 and/or posix 2008 2012-09-06 22:44:55 -04:00
env add support for init/fini array in main program, and greatly simplify 2013-07-21 03:00:54 -04:00
errno fix typo in newly-added error message for EOWNERDEAD 2013-02-07 03:13:35 -05:00
exit add support for init/fini array in main program, and greatly simplify 2013-07-21 03:00:54 -04:00
fcntl provide emulation of fcntl F_DUPFD_CLOEXEC on old kernels 2013-03-26 22:54:57 -04:00
fenv fenv support for ppc, untested 2012-11-18 16:31:14 -05:00
internal add support for init/fini array in main program, and greatly simplify 2013-07-21 03:00:54 -04:00
ipc prevent shmget from allocating objects that overflow ptrdiff_t 2013-06-29 00:02:38 -04:00
ldso add support for init/fini array in main program, and greatly simplify 2013-07-21 03:00:54 -04:00
legacy make err.h functions print __progname 2013-05-18 10:20:42 -04:00
linux fix the prototype of settimeofday to follow the original BSD declaration 2013-05-26 16:01:38 +00:00
locale fix iconv conversion to legacy 8bit codepages 2013-06-26 14:27:45 -04:00
malloc harden realloc/free to detect simple overflows 2013-07-19 20:00:11 -04:00
math math: add fma TODO comments about the underflow issue 2013-05-19 14:43:32 +00:00
misc Add ABI compatability aliases. 2013-04-05 23:20:28 -07:00
mman fix shm_open wrongly being cancellable 2013-07-20 13:19:14 -04:00
mq use restrict everywhere it's required by c99 and/or posix 2008 2012-09-06 22:44:55 -04:00
multibyte fix failure of mbsrtowcs to record stop position when dest is full 2013-06-29 16:16:47 -04:00
network fix missing SOCK_CLOEXEC in various functions that use sockets internally 2013-07-09 00:40:17 -04:00
passwd change uid_t, gid_t, and id_t to unsigned types 2013-07-19 01:34:28 -04:00
prng improve the quality of output from rand_r 2013-06-12 18:20:48 -04:00
process make posix_spawn (and functions that use it) use CLONE_VFORK flag 2013-07-17 13:54:41 -04:00
regex revert regex "cleanup" that seems unjustified and may break backtracking 2013-02-01 01:10:59 -05:00
sched add support for thread scheduling (POSIX TPS option) 2012-11-11 15:38:04 -05:00
search search: add comments to tsearch_avl.c 2012-05-13 01:50:53 +02:00
select remove __SYSCALL_SSLEN arch macro in favor of using public _NSIG 2013-03-26 23:07:31 -04:00
setjmp remove fenv saving/loading code from setjmp/longjmp on arm 2012-12-05 19:13:47 -05:00
signal fix off-by-one error in checks for implementation-internal signal numbers 2013-07-18 19:21:06 -04:00
stat improve [f]stat[v]fs functions, and possibly work around old kernels 2013-07-19 02:48:18 -04:00
stdio fix uninitialized/stale use of alloc (%m modifier) flag in scanf 2013-07-20 00:21:11 -04:00
stdlib clean up stdio_impl.h 2012-11-08 16:39:41 -05:00
string fix a couple misleading/wrong signal descriptions in strsignal 2013-07-09 02:30:21 -04:00
temp use memcmp instead of str[n]cmp for temp function XXXXXX checking 2013-02-20 23:01:22 -05:00
termios legacy junk compatibility grab-bag 2012-04-18 12:22:24 -04:00
thread fix syscall argument bug in pthread_getschedparam 2013-06-26 22:02:23 -04:00
time fix error code on time conversion overflows 2013-07-17 10:39:11 -04:00
unistd fix bogus lazy allocation in ctermid and missing malloc failure check 2013-07-09 00:50:11 -04:00