summaryrefslogtreecommitdiff
path: root/Makefile
AgeCommit message (Collapse)AuthorFilesLines
2013-12-04remove dependency of version.h on .git/* to avoid errorsRich Felker1-1/+1
the wildcard function in GNU make includes dangling symlinks; if any exist under the .git directory, they would get added as dependencies, causing make to exit with an error due to lacking a rule to build the missing file. as far as I can tell, git operations which should force version.h to be rebuilt must all touch the mtime of the top-level .git directory.
2013-12-01add infrastructure to record and report the version of libc.soRich Felker1-1/+7
this is still experimental and subject to change. for git checkouts, an attempt is made to record the exact revision to aid in bug reports and debugging. no version information is recorded in the static libc.a or binaries it's linked into.
2013-08-31fix regression in creation of ldso symlinkRich Felker1-1/+1
DESTDIR was wrongly included in the symlink contents.
2013-08-18re-add logic for ignoring failure of ld.so symlink installationRich Felker1-1/+1
this was inadvertently removed when switching to the new install.sh.
2013-08-17replace system's install command with a shell scriptRich Felker1-7/+7
the historical (non-standardized) install command is really inappropriate for installing binaries/libraries on a system that utilizes memory-mapped executable files. rather than replacing an existing file atomically, it overwrites the existing file. this can cause running programs to see a partially-modified version of the file, resulting in unpredictable behavior, or SIGBUS. a MAP_COPY mode for mmap would get around this problem, but Linux lacks MAP_COPY. the shell script added with this commit works around the problem by writing temporary files and moving them into place. unlike the historical install utility, it also support a -l option for installing a symbolic link atomically, via the same method.
2013-08-16fix atomicity and other issues installing dynamic linker symlinkRich Felker1-5/+3
ln -sf is non-atomic; it unlinks the destination first. instead, make a temporary link and rename it into place. this commit also fixes some of the dependency tracking behavior for the link. depending on the directory it's to be installed in is not reasonable; it causes a new link to be attempted if the library directory has been modified, but does not attempt to make a new link just because libc has been updated. instead, depend on the target to be linked to. this will ensure that, if prefix has changed but syslibdir has not, the link will be updated to point to the new prefix.
2013-08-14rework makefile subarch logic to allow shared filesRich Felker1-4/+12
instead of subarchs getting their own .s files which are used directly by the makefile to replace the .c file, they now must provide a .sub file whose contents are a pathname, relative to the location of the .sub file, which will substitute for the .c file. essentially these files are acting as symbolic links, but implemented as text files.
2013-08-11add subarch asm support for PIC objects/shared libcRich Felker1-0/+3
this rule was omitted in previous subarch asm commit
2013-08-11allow subarch-specific asm, including asm specific to the defaultRich Felker1-0/+3
the default subarch is the one whose full name is just the base arch name, with no suffixes. normally, either the asm in the default subarch is suitable for all subarch variants, or separate asm is mandatory for each variant. however, in the case of asm which is purely for optimization purposes, it's possible to have asm that only works (or only performs well) on the default subarch, and not any othe the other variants. thus, I have added a mechanism to give a name to the default variant, for example "armel" for the default, little-endian arm. further such default-subarch names can be added in the future as needed.
2013-08-01work around gcc 4.8's generation of self-referential mem* functions at -O3Rich Felker1-0/+3
2013-07-26new mostly-C crt1 implementationRich Felker1-0/+4
the only immediate effect of this commit is enabling PIE support on some archs that did not previously have any Scrt1.s, since the existing asm files for crt1 override this C code. so some of the crt_arch.h files committed are only there for the sake of documenting what their archs "would do" if they used the new C-based crt1. the expectation is that new archs should use this new system rather than using heavy asm for crt1. aside from being easier and less error-prone, it also ensures that PIE support is available immediately (since Scrt1.o is generated from the same C source, using -fPIC) rather than having to be added as an afterthought in the porting process.
2013-07-22enhance build process to allow selective -O3 optimizationRich Felker1-0/+3
the motivation for this patch is that the vast majority of libc is code that does not benefit at all from optimizations, but that certain components like string/memory operations can be major performance bottlenecks. at the same time, the old -falign-*=1 options are removed, since they were only beneficial for avoiding bloat when global -O3 was used, and in that case, they may have prevented some of the performance gains. to be the most useful, this patch will need further tuning. in particular, research is needed to determine which components should be built with -O3 by default, and it may be desirable to remove the hard-coded -O3 and instead allow more customization of the optimization level used for selected modules.
2013-07-22refactor headers, especially alltypes.h, and improve C++ ABI compatRich Felker1-3/+3
the arch-specific bits/alltypes.h.sh has been replaced with a generic alltypes.h.in and minimal arch-specific bits/alltypes.h.in. this commit is intended to have no functional changes except: - exposing additional symbols that POSIX allows but does not require - changing the C++ name mangling for some types - fixing the signedness of blksize_t on powerpc (POSIX requires signed) - fixing the limit macros for sig_atomic_t on x86_64 - making dev_t an unsigned type (ABI matching goal, and more logical) in addition, some types that were wrongly defined with long on 32-bit archs were changed to int, and vice versa; this change is non-functional except for the possibility of making pointer types mismatch, and only affects programs that were using them incorrectly, and only at build-time, not runtime. the following changes were made in the interest of moving non-arch-specific types out of the alltypes system and into the headers they're associated with, and also will tend to improve application compatibility: - netdb.h now includes netinet/in.h (for socklen_t and uint32_t) - netinet/in.h now includes sys/socket.h and inttypes.h - sys/resource.h now includes sys/time.h (for struct timeval) - sys/wait.h now includes signal.h (for siginfo_t) - langinfo.h now includes nl_types.h (for nl_item) for the types in stdint.h: - types which are of no interest to other headers were moved out of the alltypes system. - fast types for 8- and 64-bit are hard-coded (at least for now); only the 16- and 32-bit ones have reason to vary by arch. and the following types have been changed for C++ ABI purposes; - mbstate_t now has a struct tag, __mbstate_t - FILE's struct tag has been changed to _IO_FILE - DIR's struct tag has been changed to __dirstream - locale_t's struct tag has been changed to __locale_struct - pthread_t is defined as unsigned long in C++ mode only - fpos_t now has a struct tag, _G_fpos64_t - fsid_t's struct tag has been changed to __fsid_t - idtype_t has been made an enum type (also required by POSIX) - nl_catd has been changed from long to void * - siginfo_t's struct tag has been removed - sigset_t's has been given a struct tag, __sigset_t - stack_t has been given a struct tag, sigaltstack - suseconds_t has been changed to long on 32-bit archs - [u]intptr_t have been changed from long to int rank on 32-bit archs - dev_t has been made unsigned summary of tests that have been performed against these changes: - nsz's libc-test (diff -u before and after) - C++ ABI check symbol dump (diff -u before, after, glibc) - grepped for __NEED, made sure types needed are still in alltypes - built gcc 3.4.6
2013-07-18add build system support for arch endian & float abi variantsRich Felker1-1/+1
2013-07-01fix Makefile so "make install" works before include/bits symlink existsRich Felker1-1/+5
previously, determination of the list of header files for installation depended on the include/bits symlink (to the arch-specific files) already having been created. in other words, running "make install" immediately after configure without first running "make" caused the bits headers not to be installed. the solution I have applied is to pull the list of headers directly from arch/$(ARCH)/bits rather than include/bits, and likewise to install directly from arch/$(ARCH)/bits rather than via the symlink. at this point, the only purpose served by keeping the symlink around is that it enables use of the in-tree headers and libs directly via -I and -L, which can be useful when testing against a new version of the library before installing it. on the other hand, removing the bits symlink would be beneficial if we ever want to support building multiple archs in the same source tree.
2013-03-09remove soname from libc.so/ld-muslRich Felker1-1/+1
it serves no purpose (binaries linked against musl as -lc/libc.so automatically get the right DT_NEEDED value of libc.so) and causes ldconfig to misbehave (making a symlink to ld-musl named libc.so in /lib). ldconfig is not used on pure musl systems, but if ld-musl is installed on a system where it's not the primary libc, this will pollute the system /lib with a symlink to musl named libc.so, which should NOT exist and could cause problems linking native apps. also, the existence of the soname caused spurious warnings from ldconfig when /lib and /usr/lib were the same physical directory.
2013-02-06Makefile: make it possible to build arch specific C filesrofl0r1-1/+1
2012-09-21offer REALGCC variable to configure musl-gcc wrapper at runtimeRich Felker1-1/+1
this is useful when the underlying gcc is already a wrapper, which is the case at least on some uclibc-based system images. it's also useful for running an older/newer/nondefault version of gcc.
2012-09-14remove forced -O3 from shared library CFLAGSRich Felker1-1/+1
I originally added -O3 for shared libraries to counteract very bad behavior by GCC when building PIC code: it insists on reloading the GOT register in static functions that need it, even if the address of the function is never leaked from the translation unit and all local callers of the function have already loaded the GOT register. this measurably degrades performance in a few key areas like malloc. the inlining done at -O3 avoids the issue, but that's really not a good reason for overriding the user's choice of optimization level.
2012-08-17split up installation targetRich Felker1-2/+10
patch by Luca Barbato (lu_zero)
2012-08-05make dynlink.lo depend on reloc.h in makefileRich Felker1-0/+2
this is mainly a development convenience but will also ensure users building from latest git always get up-to-date arch-specific dynamic linker code without having to "make clean".
2012-08-02abstract out compiler runtime library for linking libc.soRich Felker1-1/+2
this allows config.mak to override the default -lgcc for building with other compilers such as pcc/clang/etc.
2012-07-11changes to kernel sigaction struct handling in preparation for mips portRich Felker1-1/+1
2012-05-04improve the build rules for installing /lib/ld-musl-$ARCH.soRich Felker1-2/+4
these new rules should avoid spurious error messages when the directory (usually /lib) and the dynamic linker symlink already exist, and minimize the spam when they can't be created.
2012-05-03make all .o files depend on *_impl.h and libc.hRich Felker1-2/+3
hopefully the annoyance of this will be minimal. these files all define internal interfaces which can change at any time; if different modules are using different versions of the interfaces, the library will badly break. ideally we would scan and add the dependency only for C files that actually reference the affected interfaces, but for now, err on the side of caution and force a rebuild of everything if any of them have changed. this commit is in preparation for the upcoming ssp overhaul commit, which will change internals of the pthread struct.
2012-05-02PIE support for i386Rich Felker1-1/+1
2012-05-01reorganize Makefile to support "least surprise" config/make semanticsRich Felker1-11/+23
the major change here is that CFLAGS is now a variable that can be changed entirely under user control, without causing essential flags to be lost. previously, "CFLAGS += ..." was valid in config.mak, but using "CFLAGS = ..." in config.mak would have badly broken the build process unless the user took care to copy the necessary flags out of the main Makefile. I have also added a distclean target that removes config.mak.
2012-05-01remove objcopy --weaken from the makefileRich Felker1-2/+0
as far as I can tell, it's not useful and never way. I wrote it way back under the assumption that non-weak symbols in the POSIX or extension namespace could conflict with legitimate uses of the same symbol name in the main program or other libraries, but that does not seem to be the case.
2012-04-22new gcc wrapper, entirely specfile basedRich Felker1-3/+7
the _concept_ of this wrapper has been tested extensively, but the integration with the build/install system, and using a persistent specfile rather than one generated at build-time, have not been heavily tested and may need minor tweaks. this approach should be a lot more robust (and easier to improve) than writing a shell script that's responsible for trying to mimic gcc's logic about whether it's compiling or linking, building shared libs or executable files, etc. it's also lighter weight and should result in mildly faster builds when using the wrapper.
2012-03-17don't fail on inability to install dynamic linker (e.g. if not root)Rich Felker1-1/+1
2012-03-01search internal headers firstRich Felker1-1/+1
this is necessitated by the ugly <syscall.h> just added
2012-02-17two fixes for "make install" handling of shared libsRich Felker1-1/+2
1. don't try to install (and thus build) shared libs when they were disabled in config.mak 2. ensure that the path for the dynamic linker exists before attempting to install it.
2011-06-28fix a few bugs from last dynamic linking build system commitRich Felker1-2/+2
some cruft was left and DESTDIR was not being used correctly.
2011-06-27cleanup shared library build system to be more $HOME-local-install friendlyRich Felker1-13/+15
the path for the dynamic linker is now configurable, and failure to install the symlink for it will not stop the build.
2011-06-24use soname in ld-musl.so to prevent filename appearing in DT_NEEDEDsRich Felker1-1/+1
2011-06-24use symlink rather than bogus linker script for libc.soRich Felker1-2/+2
the linker script caused a bogus DT_NEEDED entry
2011-06-23adapt build/install/gcc-wrapper systems for dynamic linking supportRich Felker1-5/+15
2011-02-24various changes in preparation for dynamic linking supportRich Felker1-3/+3
prefer using visibility=hidden for __libc internal data, rather than an accessor function, if the compiler has visibility. optimize with -O3 for PIC targets (shared library). without heavy inlining, reloading the GOT register in small functions kills performance. 20-30% size increase for a single libc.so is not a big deal, compared to comparaible size increase in every static binaries. use -Bsymbolic-functions, not -Bsymbolic. global variables are subject to COPY relocations, and thus binding their addresses in the library at link time will cause library functions to read the wrong (original) copies instead of the copies made in the main program's bss section. add entry point, _start, for dynamic linker.
2011-02-17avoid deleting the lib/empty fileRich Felker1-1/+1
2011-02-17new solution for empty lib dir (old one had some problems)Rich Felker1-7/+5
2011-02-17improve Makefile handling of git checkouts with missing lib/ and config.makRich Felker1-4/+8
2011-02-15finish unifying thread register handling in preparation for portingRich Felker1-1/+1
2011-02-15preparing build system to handle ports - step 1Rich Felker1-0/+6
2011-02-13ensure that musl is compiled as C99 code & XSI option is available in headersRich Felker1-1/+1
2011-02-12initial check-in, version 0.5.0v0.5.0Rich Felker1-0/+97