Commit Graph

27 Commits

Author SHA1 Message Date
Rich Felker 9f74574fe6 remove forced -O3 from shared library CFLAGS
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-09-14 23:38:10 -04:00
Rich Felker 0780936312 split up installation target
patch by Luca Barbato (lu_zero)
2012-08-17 19:32:24 -04:00
Rich Felker d04378016b make dynlink.lo depend on reloc.h in makefile
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-05 12:32:20 -04:00
Rich Felker 1b23145e88 abstract out compiler runtime library for linking libc.so
this allows config.mak to override the default -lgcc for building with
other compilers such as pcc/clang/etc.
2012-08-02 21:05:43 -04:00
Rich Felker fcaec912ed changes to kernel sigaction struct handling in preparation for mips port 2012-07-11 02:44:14 -04:00
Rich Felker f8e054f951 improve the build rules for installing /lib/ld-musl-$ARCH.so
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-04 21:54:57 -04:00
Rich Felker e765239f33 make all .o files depend on *_impl.h and libc.h
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-03 20:35:11 -04:00
Rich Felker 83023d1b50 PIE support for i386 2012-05-02 21:01:55 -04:00
Rich Felker d76eafcbdc reorganize Makefile to support "least surprise" config/make semantics
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-01 19:30:03 -04:00
Rich Felker d86d2829ab remove objcopy --weaken from the makefile
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-05-01 14:31:55 -04:00
Rich Felker 58f430c1e0 new gcc wrapper, entirely specfile based
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-04-22 14:32:49 -04:00
Rich Felker 523a3ab1a2 don't fail on inability to install dynamic linker (e.g. if not root) 2012-03-17 00:48:55 -04:00
Rich Felker 15d143b547 search internal headers first
this is necessitated by the ugly <syscall.h> just added
2012-03-01 00:21:20 -05:00
Rich Felker 3c870263c5 two fixes for "make install" handling of shared libs
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.
2012-02-17 23:17:48 -05:00
Rich Felker 8d54681f15 fix a few bugs from last dynamic linking build system commit
some cruft was left and DESTDIR was not being used correctly.
2011-06-28 08:27:38 -04:00
Rich Felker 207c45d7ab cleanup shared library build system to be more $HOME-local-install friendly
the path for the dynamic linker is now configurable, and failure to
install the symlink for it will not stop the build.
2011-06-27 21:38:11 -04:00
Rich Felker e0b0ff1598 use soname in ld-musl.so to prevent filename appearing in DT_NEEDEDs 2011-06-24 18:32:30 -04:00
Rich Felker a654b0243b use symlink rather than bogus linker script for libc.so
the linker script caused a bogus DT_NEEDED entry
2011-06-24 14:02:47 -04:00
Rich Felker ec05a0b08f adapt build/install/gcc-wrapper systems for dynamic linking support 2011-06-23 22:13:47 -04:00
Rich Felker 41d518360f various changes in preparation for dynamic linking support
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-24 16:37:21 -05:00
Rich Felker 127ab575fc avoid deleting the lib/empty file 2011-02-17 17:57:26 -05:00
Rich Felker 4fd159568a new solution for empty lib dir (old one had some problems) 2011-02-17 17:12:52 -05:00
Rich Felker a36164c474 improve Makefile handling of git checkouts with missing lib/ and config.mak 2011-02-17 15:15:03 -05:00
Rich Felker 7b2dd2235d finish unifying thread register handling in preparation for porting 2011-02-15 03:56:52 -05:00
Rich Felker 1355fdca7c preparing build system to handle ports - step 1 2011-02-15 00:33:23 -05:00
Rich Felker 6027201e5a ensure that musl is compiled as C99 code & XSI option is available in headers 2011-02-13 16:48:39 -05:00
Rich Felker 0b44a0315b initial check-in, version 0.5.0 2011-02-12 00:22:29 -05:00