summaryrefslogtreecommitdiff
path: root/tools
AgeCommit message (Collapse)AuthorLines
2020-01-20fix incorrect escaping in add-cfi.*.awk scriptsWill Dietz-2/+2
gawk 5 complains.
2018-08-02fix musl-gcc wrapper to be compatible with default-pie gcc toolchainsRich Felker-2/+2
the specfile for the wrapper was written assuming output is pie only if -pie appears on the command line. recent (and older patched) versions of gcc can be configured to produce pie output by default, adn when used with such a toolchain, the wrapper linked the wrong startfiles (crt*) containing pic-incompatible code. rather than trying to figure out gcc's default, simply always use the pic-compatible start files.
2015-10-13add CFI generation script for x86_64Alex Dowad-0/+196
2015-10-13recognize partial register operands in i386 CFI generationAlex Dowad-10/+19
2015-10-13fix misinterpretation of indexed memory operand in i386 CFI generationAlex Dowad-1/+1
a register used as an index in the memory destination of a mov instruction was wrongly interpreted as the destination of the mov.
2015-10-13fix misinterpretation of operand order in i386 CFI generationAlex Dowad-5/+5
binary ops like ADD, AND, etc. modify the 2nd operand, not 1st.
2015-10-08fix instruction matching errors in i386 CFI generationAlex Dowad-3/+3
fdiv and fmul instructions were wrongly matched by the rules for integer div and mul instructions, leading to incorrect conclusions about register values being clobbered.
2015-10-08factor common awk functions for CFI generation scripts into new fileAlex Dowad-27/+26
There is a lot which could be common between i386 and x86_64, but none of it will be useful for any other arch. These should be useful for all archs, however.
2015-08-26Build process uses script to add CFI directives to x86 asmAlex Dowad-0/+227
Some functions implemented in asm need to use EBP for purposes other than acting as a frame pointer. (Notably, it is used for the 6th argument to syscalls with 6 arguments.) Without frame pointers, GDB can only show backtraces if it gets CFI information from a .debug_frame or .eh_frame ELF section. Rather than littering our asm with ugly .cfi directives, use an awk script to insert them in the right places during the build process, so GDB can keep track of where the current stack frame is relative to the stack pointer. This means GDB can produce beautiful stack traces at any given point when single-stepping through asm functions. Additionally, when registers are saved on the stack and later overwritten, emit ..cfi directives so GDB will know where they were saved relative to the stack pointer. This way, when you look back up the stack from within an asm function, you can still reliably print the values of local variables in the caller. If this awk script were to understand every possible wild and crazy contortion that an asm programmer can do with the stack and registers, and always emit the exact ..cfi directives needed for GDB to know what the register values were in the preceding stack frame, it would necessarily be as complex as a full x86 emulator. That way lies madness. Hence, we assume that the stack pointer will _only_ ever be adjusted using push/pop or else add/sub with a constant. We do not attempt to detect every possible way that a register value could be saved for later use, just the simple and common ways. Thanks to Szabolcs Nagy for suggesting numerous improvements to this code.
2015-07-06add musl-clang, a wrapper for system clang installsShiz-0/+86
musl-clang allows the user to compile musl-powered programs using their already existent clang install, without the need of a special cross compiler. it achieves this by wrapping around both the system clang install and the linker and passing them special flags to re-target musl at runtime. it does only affect invocations done through the special musl-clang wrapper script, so that the user setup remains fully intact otherwise. the clang wrapper consists of the compiler frontend wrapper script, musl-clang, and the linker wrapper script, ld.musl-clang. musl-clang makes sure clang invokes ld.musl-clang to link objects; neither script needs to be in PATH for the wrapper to work.
2014-01-15fix system breakage window during make install due to permissionsRich Felker-2/+1
install.sh was wrongly waiting until after atomically replacing the old file to set the correct permissions on the new file. in the case of the dynamic linker, this would cause a dynamic-linked chmod command not to run (due to missing executable permissions on the dynamic linker) and thus leave the system in an unusable state. even if chmod is static-linked, the old behavior had a race window where dynamic-linked programs could fail to run.
2013-12-03fix mv usage in install.sh to avoid bogus interactive promptingRich Felker-1/+1
2013-12-01add infrastructure to record and report the version of libc.soRich Felker-0/+12
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-17replace system's install command with a shell scriptRich Felker-0/+65
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-07-22refactor headers, especially alltypes.h, and improve C++ ABI compatRich Felker-0/+15
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-06-07fix mixup in previous change to gcc wrapperRich Felker-1/+1
2013-06-07make gcc-specific headers (intrinsics, etc.) available with wrapperRich Felker-2/+2
they are intentionally listed after the libc include directory so that the gcc float.h, etc. don't get used in place of the libc ones.
2012-07-23gcc wrapper improvement: leave libgcc dir in the library pathRich Felker-1/+1
this is needed in case -lgcc is passed explicitly on the link command line, for example if the wrapper is being used to build musl itself.
2012-06-06make gcc wrapper rewrite link options rather than just extending themRich Felker-3/+1
this is not tested yet, but should work to get rid of unwanted --hash-style=gnu hacks present in some distro-patched gcc versions.
2012-05-30fix musl-gcc wrapper to work with -pieRich Felker-1/+1
linking the wrong crt1.o resulted in textrels and thus crashing
2012-04-22new gcc wrapper, entirely specfile basedRich Felker-60/+39
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-02-17remove -std=gnu99 from musl-gcc wrapperRich Felker-1/+1
while probably desirable, changing the default language variant is outside the scope of the wrapper's responsibility.
2012-02-02improve gcc wrapper to support -nostdlib, -nostartfilesRich Felker-1/+1
2012-01-24make gcc wrapper support -shared correctlyRich Felker-2/+7
it was previously attempting to link start files as part of shared objects. this is definitely wrong and depending on the platform and linker could range from just adding extraneous junk to introducing textrels to making linking fail entirely.
2011-09-21new gcc wrapper now supports pre-4.4 gcc versions and is more robustRich Felker-17/+40
2011-06-27cleanup shared library build system to be more $HOME-local-install friendlyRich Felker-2/+2
the path for the dynamic linker is now configurable, and failure to install the symlink for it will not stop the build.
2011-06-25fix dynamic linker issue in musl-gcc wrapperRich Felker-1/+1
2011-06-23adapt build/install/gcc-wrapper systems for dynamic linking supportRich Felker-2/+3
2011-03-01use -L/...../ -lgcc instead of /...../libgcc.a in musl-gcc wrapperRich Felker-1/+2
this should avoid warnings about unused libs when not linking, and might fix some other obscure issues too. i might replace this approach with a completely different one soon though.
2011-02-12initial check-in, version 0.5.0v0.5.0Rich Felker-0/+30