aboutsummaryrefslogtreecommitdiff
path: root/src/malloc/aligned_alloc.c (unfollow)
Commit message (Expand)AuthorFilesLines
2016-01-24add 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. Szabolcs Nagy1-1/+2
2016-01-24add AF_MPLS (PF_MPLS) address family to socket.h•••new in linux 4.0 commit 0189197f441602acdca3f97750d392a895b778fd. Szabolcs Nagy1-0/+2
2016-01-24add 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). Szabolcs Nagy1-0/+1
2016-01-24clean powerpc syscall.h•••remove ifdefs for powerpc64. Szabolcs Nagy1-24/+0
2016-01-24add missing powerpc specific PROT_SAO memory protection flag•••this flag for strong access ordering was added in linux v2.6.27 commit aba46c5027cb59d98052231b36efcbbde9c77a1d Szabolcs Nagy1-0/+1
2016-01-24fix powerpc MCL_* mlockall flags in bits/mman.h•••the definitions didn't match the linux uapi headers. Szabolcs Nagy1-2/+2
2016-01-24fix 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). Szabolcs Nagy1-2/+2
2016-01-23improve 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. Rich Felker1-16/+36
2016-01-22add arch/abi info to dynamic linker's id/version outputRich Felker1-1/+1
2016-01-22remove 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. Rich Felker1-1/+1
2016-01-22remove 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. Rich Felker1-5/+0
2016-01-22move sh port's __shcall internal function from arch/sh/src to src treeRich Felker1-0/+0
2016-01-22move sh __unmapself code from arch/sh/src to main src treeRich Felker2-1/+1
2016-01-22move x32 sysinfo impl and syscall fixup code out of arch/x32/src•••all such arch-specific translation units are being moved to appropriate arch dirs under the main src tree. Rich Felker3-1/+0
2016-01-22overhaul powerpc atomics for new atomics framework•••previously powerpc had a_cas defined in terms of its native ll/sc style operations, but all other atomics were defined in terms of a_cas. instead define a_ll and a_sc so the compiler can generate optimized versions of all the atomic ops and perform better inlining of a_cas. extracting the result of the sc (stwcx.) instruction is rather awkward because it's natively stored in a condition flag, which is not representable in inline asm. but even with this limitation the new code still seems significantly better. Rich Felker1-13/+37
2016-01-22clean up x86_64 (and x32) atomics for new atomics framework•••this commit mostly makes consistent things like spacing, function ordering in atomic_arch.h, argument names, use of volatile, etc. a_ctz_l was also removed from x86_64 since atomic.h provides it automatically using a_ctz_64. Rich Felker2-113/+130
2016-01-22clean up i386 atomics for new atomics framework•••this commit mostly makes consistent things like spacing, function ordering in atomic_arch.h, argument names, use of volatile, etc. the fake 64-bit and/or atomics are also removed because the shared atomic.h does a better job of implementing them; it avoids making two atomic memory accesses when only one 32-bit half needs to be touched. no major overhaul is needed or possible because x86 actually has native versions of all the usual atomic operations, rather than using ll/sc or needing cas loops. Rich Felker1-66/+58
2016-01-22overhaul mips atomics for new atomics frameworkRich Felker1-53/+31
2016-01-22move arm-specific translation units out of arch/arm/src, to src/*/arm•••this is possible with the new build system that allows src/*/$(ARCH)/* files which do not shadow a file in the parent directory, and yields a more logical organization. eventually it will be possible to remove arch/*/src from the build system. Rich Felker9-1/+0
2016-01-21overhaul arm atomics for new atomics framework•••switch to ll/sc model so that new atomic.h can provide optimized versions of all the atomic primitives without needing an ll/sc loop written in asm for each one. all isa levels which use ldrex/strex now use the inline ll/sc model even if the type of barrier to use is not known until runtime (v6). the cas model is only used for arm v5 and earlier, and it has been optimized to make the call via inline asm with custom constraints rather than as a C function call. Rich Felker1-142/+38
2016-01-21overhaul aarch64 atomics for new atomics frameworkRich Felker1-174/+25
2016-01-21overhaul sh atomics for new atomics framework, add j-core cas.l backend•••sh needs runtime-selected atomic backends since there are a number of supported models that use non-forwards-compatible (non-smp-compatible) atomic mechanisms. previously, the code paths for this were highly inefficient since they involved C function calls with multiple branches in the callee and heavy spills in the caller. the new code performs calls the runtime-selected asm fragment from inline asm with extremely minimal clobbers, rather than using a function call. for the sh4a case where the atomic mechanism is known and there is no forward-compatibility issue, the movli.l and movco.l instructions are provided as a_ll and a_sc, allowing the new shared atomic.h to generate efficient inline versions of all the basic atomic operations without needing a cas loop. Rich Felker6-262/+110
2016-01-21refactor internal atomic.h•••rather than having each arch provide its own atomic.h, there is a new shared atomic.h in src/internal which pulls arch-specific definitions from arc/$(ARCH)/atomic_arch.h. the latter can be extremely minimal, defining only a_cas or new ll/sc type primitives which the shared atomic.h will use to construct everything else. this commit avoids making heavy changes to the individual archs' atomic implementations. definitions which are identical or near-identical to what the new shared atomic.h would produce have been removed, but otherwise the changes made are just hooking up the arch-specific files to the new infrastructure. major changes to take advantage of the new system will come in subsequent commits. Rich Felker15-834/+491
2016-01-20fix global visibility (vis.h) support for out-of-tree builds•••commit 2f853dd6b9a95d5b13ee8f9df762125e0588df5d failed to change the test for -include vis.h support to use $srcdir, so vis.h was always disabled by configure for out-of-tree builds. Rich Felker1-1/+1
2016-01-20exclude vis.h when compiling assembly files•••otherwise C declarations are included into preprocessed (.S) asm source files, producing errors from the assembler. Khem Raj1-1/+1
2016-01-20simplify "make clean" and remove unneeded lib dir from tree•••the lib dir is automatically created if needed by the out-of-tree build logic, and now that all generated files are in obj and lib, deleting them is much simpler. using "rm -rf" is also more thorough, as it picks up object files that were left around from source files that no longer exist or which are no longer to be used because an arch-specific replacement file was added or removed. Rich Felker2-7/+1
2016-01-20deduplicate compiler invocation command line in makefile•••also clean up duplication of CFLAGS passing to assembler. Rich Felker1-7/+9
2016-01-20remove outdated/incorrect comment about AS_CMD from makefileRich Felker1-1/+0
2016-01-20remove support for subarch .sub files from the makefile•••as of commit af21a82ccc8687aa16e85def7db95efeae4cf72e, .sub files are no longer in use. removing the makefile machinery to handle them not only cleans up and simplifies the makefile, but also significantly reduces make's startup time. Rich Felker1-16/+2
2016-01-20fix build regression for arm pre-v7 from out-of-tree build patch•••commit 2f853dd6b9a95d5b13ee8f9df762125e0588df5d failed to replicate the old makefile logic that caused arch/arm/src/arm/atomics.s to be built. since this was the only .s file under arch/*/src, rather than trying to reproduce the old logic, I'm just moving it up a level and adjusting the glob pattern in the makefile to catch it. eventually arch/*/src will probably be removed in favor of moving all these files to appropriate src/*/$(ARCH) locations. Rich Felker3-1/+1
2016-01-20switch arm, sh, and mips fenv asm from .sub system to .S filesRich Felker12-6/+21
2016-01-20switch sh and mips setjmp asm from .sub system to .S filesRich Felker20-109/+12
2016-01-20fix dynamic linker path file selection for arm vs armhf•••the __SOFTFP__ macro which was wrongly being used does not reflect the ABI (arm vs armhf) but just the availability of floating point instructions/registers, so -mfloat-abi=softfp was wrongly being treated as armhf. __ARM_PCS_VFP is the correct predefined macro to check for the armhf EABI variant. this macro usage was corrected for the build process in commit 4918c2bb206bfaaf5a1f7d3448c2f63d5e2b7d56 but reloc.h was apparently overlooked at the time. Rich Felker1-3/+3
2016-01-20replace armhf math asm source files with inline asm•••this makes it possible to inline them with LTO, and is the simplest approach to eliminating the use of .sub files. this also makes VFP sqrt available for use with the standard EABI (plain arm rather than armhf subarch) when libc is built with -mfloat-abi=softfp. the same could have been done for fabs, but when the argument and return value are in integer registers, moving to VFP registers and back is almost certainly more costly than a simple integer operation. Rich Felker16-40/+60
2016-01-20adapt build of arm memcpy asm not to use .sub files•••this depends on commit 9f5eb77992b42d484d69e879d24ef86466f20f21, which made it possible to use a .c file for arch-specific replacements, and on commit 2f853dd6b9a95d5b13ee8f9df762125e0588df5d, the out-of-tree build support, which made it so that src/*/$(ARCH)/* 'replacement' files get used even if they don't match the base name of a .c file in the parent directory. Rich Felker4-2/+7
2016-01-19eliminate separate static/shared CFLAGS vars in makefile•••this allows the rules for .o and .lo files to be identical, with -fPIC and -DSHARED added for .lo files via target-specific variable append. this is arguably cleaner now and will allow more cleanup and removal of redundant rule bodies after other prerequisite changes are made. Rich Felker1-13/+13
2016-01-19add support for arch-provided replacement files as .c or .S•••previously, replacement files provided in $(ARCH) dirs under src/ had to be .s files. in order to replace a file with C source, an empty .s file was needed there to suppress the original file, and a separate .c file was needed in arch/$(ARCH)/src/. support for .S is new and is aimed at short-term use eliminating .sub files. asm source files are still expected not to make any heavy preprocessor use, just simple conditionals on subarch. eventually most affected files may be replaced with C source files with minimal inline asm instead of asm source files. Rich Felker1-3/+9
2016-01-17netinet/tcp: Add TCPOPT, TCPOLEN constants•••Programs such as iptables depend on these constants, which can also be found defined in other libcs. Since only TCP_* is reserved as part of tcp.h's namespace, we hide them behind _BSD_SOURCE (and therefore _DEFAULT_SOURCE) to expose them by default, but keep it standard conforming. Kylie McClain1-0/+13
2016-01-17fix if_nametoindex return value when socket open fails•••The return value of if_nametoindex is unsigned; it should return 0 on error. Ron Yorston1-1/+1
2016-01-17support out-of-tree build•••this change adds support for building musl outside of the source tree. the implementation is similar to autotools where running configure in a different directory creates config.mak in the current working directory and symlinks the makefile, which contains the logic for creating all necessary directories and resolving paths relative to the source directory. to support both in-tree and out-of-tree builds with implicit make rules, all object files are now placed into a separate directory. Petr Hosek3-60/+101
2016-01-06add missing protocols to protoent lookup functionsTimo Teräs1-1/+16
2015-12-29adjust mips crt_arch entry point asm to avoid assembler bugs•••apparently the .gpword directive does not work reliably with local text labels; values produced were offset by 64k from the correct value, resulting in incorrect computation of the got pointer at runtime. instead, use an external label so that the assembler does not munge the relocation; the linker will then get it right. commit 6fef8cafbd0f6f185897bc87feb1ff66e2e204e1 exposed this issue by removing the old, non-PIE-compatible handwritten crt1.s, which was not affected. presumably mips PIE executables (using Scrt1.o produced from crt_arch.h) were already affected at the time. Rich Felker1-1/+4
2015-12-29adjust i386 max_align_t definition to work around some broken compilers•••at least gcc 4.7 claims c++11 support but does not accept the alignas keyword, causing breakage when stddef.h is included in c++11 mode. instead, prefer using __attribute__((__aligned__)) on any compiler with GNU extensions, and only use the alignas keyword as a fallback for other C++ compilers. C code should not be affected by this patch. Rich Felker1-3/+5
2015-12-20fix overly pessimistic realloc strategy in getdelim•••previously, getdelim was allocating twice the space needed every time it expanded its buffer to implement exponential buffer growth (in order to avoid quadratic run time). however, this doubling was performed even when the final buffer length needed was already known, which is the common case that occurs whenever the delimiter is in the FILE's buffer. this patch makes two changes to remedy the situation: 1. over-allocation is no longer performed if the delimiter has already been found when realloc is needed. 2. growth factor is reduced from 2x to 1.5x to reduce the relative excess allocation in cases where the delimiter is not initially in the buffer, including unbuffered streams. in theory these changes could lead to quadratic time if the same buffer is reused to process a sequence of lines successively increasing in length, but once this length exceeds the stdio buffer size, the delimiter will not be found in the buffer right away and exponential growth will still kick in. Rich Felker1-1/+1
2015-12-19avoid updating caller's size when getdelim fails to realloc•••getdelim was updating *n, the caller's stored buffer size, before calling realloc. if getdelim then failed due to realloc failure, the caller would see in *n a value larger than the actual size of the allocated block, and use of that value is unsafe. in particular, passing it again to getdelim is unsafe. now, temporary storage is used for the desired new size, and *n is not written until realloc succeeds. Rich Felker1-5/+6
2015-12-15fix crash when signal number 0 is passed to sigaction•••this error case was overlooked in the old range checking logic. new check is moved out of __libc_sigaction to the public wrapper in order to unify the error path and reduce code size. Rich Felker1-5/+1
2015-12-15remove visibility suppression by SHARED macro in mips and x32 arch files•••commit 8a8fdf6398b85c99dffb237e47fa577e2ddc9e77 was intended to remove all such usage, but these arch-specific files were overlooked, leading to inconsistent declarations and definitions. Rich Felker2-6/+0
2015-12-08fix tsearch, tfind, tdelete to handle null pointer input•••POSIX specifies the behaviour for null rootp input, but it was not implemented correctly. Szabolcs Nagy1-0/+6
2015-12-08tsearch code cleanup•••changed the insertion method to simplify the recursion logic and reduce code size a bit. Szabolcs Nagy1-24/+28
2015-12-08fix tsearch to avoid crash on oom•••malloc failure was not properly propagated in the insertion method which led to null pointer dereference. Szabolcs Nagy1-1/+1