Commit Graph

56 Commits

Author SHA1 Message Date
Bobby Bingham 23d64182d8 fix superh nofpu check on old gcc versions
As far as gcc3 knows, sh4 is the only processor version that can have an
FPU, so it indicates the FPU's presence by defining __SH4__.  This is not
defined if there is no FPU, even if the processor really is an SH4.

Starting with gcc4, there is support for the sh2a processor, which has an
FPU but is not an SH4.  gcc4 therefore additionally defines __SH_FPU_ANY__
when there is an FPU, but still doesn't define __SH4__ for an FPU-less sh4.

Therefore, to support all gcc versions, we must look at both preprocessor
symbols.
2014-04-27 21:13:59 -05:00
rofl0r 8c820231ed configure: check for __ILP32__ if arch is x86_64
otherwise a multilib compiler used with -mx32 will not be detected
properly.
2014-03-19 22:31:02 +01:00
Rich Felker f162c064ab make configure accept alternate gcc tuples for x32
the previous pattern required "x32" to be used as the second field of
the gcc tuple, which is usually reserved for vendor use and not
appropriate as an ABI specifier. with this change, putting "x32" at
the end of the tuple, the way ABI specifiers are normally done, is
also permitted.
2014-03-17 17:38:22 -04:00
Rich Felker 0b8f0c57c0 improve configure's target arch matching
most notably, it was failing to match sh4-*, etc., but in general the
explicit matching of hyphens for some archs was problematic because it
failed to accept simply the musl-style arch name (without a gcc-style
tuple) as an input. the original motivation of matching hyphens was to
prevent incorrectly identifying a 64-bit arch as the corresponding
32-bit arch (e.g. mips* matching mips64) but this is easily fixed by
simply checking (and for now, rejecting as unsupported) the relevant
64-bit archs.
2014-02-28 13:12:40 -05:00
Rich Felker 3d7f5c363e fix missing CFLAGS in configure test for float on sh 2014-02-28 00:09:55 -05:00
Rich Felker 946b9fad03 fix copy-and-paste error in configure's IEEE double check for sh 2014-02-27 23:55:04 -05:00
Rich Felker b1683a1d6a add nofpu subarchs to the sh arch, and properly detect compiler's fpu config 2014-02-27 23:18:42 -05:00
Rich Felker 5c27c4458f fix endian subarchs for sh arch
default endianness for sh on linux is little, and while conventions
vary, "eb" seems to be the most widely used suffix for big endian.
2014-02-27 22:20:44 -05:00
Rich Felker aacd348637 rename superh port to "sh" for consistency
linux, gcc, etc. all use "sh" as the name for the superh arch. there
was already some inconsistency internally in musl: the dynamic linker
was searching for "ld-musl-sh.path" as its path file despite its own
name being "ld-musl-superh.so.1". there was some sentiment in both
directions as to how to resolve the inconsistency, but overall "sh"
was favored.
2014-02-27 22:03:25 -05:00
Szabolcs Nagy e5bb165bed mips: add mips-sf subarch support (soft-float)
Userspace emulated floating-point (gcc -msoft-float) is not compatible
with the default mips abi (assumes an FPU or in kernel emulation of it).
Soft vs hard float abi should not be mixed, __mips_soft_float is checked
in musl's configure script and there is no runtime check. The -sf subarch
does not save/restore floating-point registers in setjmp/longjmp and only
provides dummy fenv implementation.
2014-02-24 23:16:29 +01:00
Bobby Bingham 3a3c813e08 superh port 2014-02-23 16:15:54 -06:00
rofl0r adbeefbebd configure: suppress bogus pointer-int cast warnings 2014-02-23 11:09:33 +01:00
rofl0r 3e4b2cdc1b configure: recognize x86_64-x32 and x32
x32 is the internal arch name, but glibc uses x86_64-x32.
there doesn't exist a specific triple for x32 in gcc and binutils.
you're supposed to build your compiler for x86_64 and configure
it with multilib support for "mx32".

however it turns out that using a triple of x86_64-x32 makes
gcc and binutils pick up the right arch (they detect it as x86_64)
and allows us to have a unique triple for cross-compiler toolchains.
2014-02-23 11:09:33 +01:00
Rich Felker f7bc29ed22 remove -Wcast-align from --enable-warnings
I originally added this warning option based on a misunderstanding of
how it works. it does not warn whenever the destination of the cast
has stricter alignment; it only warns in cases where misaligned
dereference could lead to a fault. thus, it's essentially a no-op for
i386, which had me wrongly believing the code was clean for this
warning level. on other archs, numerous diagnostic messages are
produced, and all of them are false-positives, so it's better just not
to use it.
2013-08-28 05:08:16 -04:00
Rich Felker 06ceee8ca3 add attribute((may_alias)) checking in configure
this will be needed for upcoming commits to the string/mem functions
to correct their unannounced use of aliasing violations for
word-at-a-time search, fill, and copy operations.
2013-08-27 17:33:47 -04:00
Rich Felker e449974dc5 fix two bugs in sed code configure uses to save command line
one place where semicolon (non-portable) was still used in place of
separate -e options (copied over from an old version of this code),
and use of a literal slash in the bracket expression for the final
command, despite slash being used as the delimiter for the s command.
2013-08-20 13:51:46 -04:00
Rich Felker 453f462297 make configure store its command line in config.mak for easy re-run
proper shell quoting and pretty-printing (avoiding ugly gratuitous
quoting and bad quoting style) is included.
2013-08-16 18:19:47 -04:00
Rich Felker 4918c2bb20 fix detection of arm hardfloat
it turns out that __SOFTFP__ does not indicate the ABI in use but
rather that fpu instructions are not to be used at all. this is
specified in ARM's documentation so I'm unclear on how I previously
got the wrong idea. unfortunately, this resulted in the 0.9.12 release
producing a dynamic linker with the wrong name. fortunately, there do
not yet seem to be any public toolchain builds using the wrong name.

the __ARM_PCS_VFP macro does not seem to be official from ARM, and in
fact it was missing from the very earliest gcc versions (around 4.5.x)
that added -mfloat-abi=hard. it would be possible on such versions to
perform some ugly linker-based tests instead in hopes that the linker
will reject ABI-mismatching object files, if there is demand for
supporting such versions. I would probably prefer to document which
versions are broken and warn users to manually add -D__ARM_PCS_VFP if
using such a version.

there's definitely an argument to be made that the fenv macros should
be exposed even in -mfloat-abi=softfp mode. for now, I have chosen not
to expose them in this case, since the math library will not
necessarily have the capability to raise exceptions (it depends on the
CFLAGS used to compile it), and since exceptions are officially
excluded from the ARM EABI, which the plain "arm" arch aims to
follow.
2013-08-16 17:09:07 -04:00
Rich Felker 90d7772251 allow subarch-specific asm, including asm specific to the default
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-11 03:27:35 -04:00
Rich Felker 86cc54b577 protect against long double type mismatches (mainly powerpc for now)
check in configure to be polite (failing early if we're going to fail)
and in vfprintf.c since that is the point at which a mismatching type
would be extremely dangerous.
2013-08-02 19:34:22 -04:00
Rich Felker 4a1f55e92f work around gcc 4.8's generation of self-referential mem* functions at -O3 2013-08-01 17:12:23 -04:00
Rich Felker 43d2531316 do not include math modules in the default -O3 optimization set
it's not clear that -O3 helps them, and gcc seems to have floating
point optimization bugs that introduce additional failures when -O3 is
used on some of these files.
2013-07-24 23:21:45 -04:00
Rich Felker a80847d86a enhance build process to allow selective -O3 optimization
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-22 21:22:04 -04:00
Rich Felker df065781ee fix invalid C in new trycppif tests in configure script
an empty program is not valid and would be reasonable grounds for the
compiler to give an error, which would break these tests.
2013-07-18 20:37:19 -04:00
Rich Felker 3e7f186ea1 add build system support for arch endian & float abi variants 2013-07-18 20:30:58 -04:00
Rich Felker 2384f27d34 treat invalid C as an error even if warnings aren't enabled. 2012-12-11 23:28:31 -05:00
Rich Felker 6c0cba819f fix error in configure script using >/dev/null in noclobber mode 2012-11-18 23:15:47 -05:00
Rich Felker c6d441e3a2 Merge remote-tracking branch 'ppc-port/ppc-squashed' 2012-11-14 14:01:39 -05:00
rofl0r 1c8eb8bad7 PPC port cleaned up, static linking works well now. 2012-11-13 19:12:25 +01:00
Rich Felker 3d9e3a309f fix "configure --prefix=" and improve path/arg handling in configure
previously, empty string was treated as "use default". this is
apparently not compatible with standard configure semantics where an
empty prefix puts everything under /. the new logic should be a lot
cleaner and not suffer from such issues.
2012-11-08 17:20:50 -05:00
Rich Felker cd31a1fc08 further pcc fixes in configure
-lpcc only works if -nostdlib is not passed, so it's useless. instead,
use -print-file-name to look up the full pathname for libpcc.a, and
check whether that succeeds before trying to link with the result.

also, silence pcc's junk printed on stdout during tests.
2012-10-26 18:15:51 -04:00
Rich Felker 3d99266b5e add support for detecting pcc's compiler runtime
in old versions of pcc, the directory containing libpcc.a was not in
the library path, and other options like -print-file-name may have
been needed to locate it. however, -print-file-name itself seems to
have been added around the same time that the directory was added to
the search path, and moreover, I see no evidence that older versions
of pcc are capable of building a working musl shared library. thus, it
seems reasonable to just test whether -lpcc is accepted.
2012-10-26 16:30:07 -04:00
Rich Felker 80a45458e0 configure: test not just compiling but linking with -march/-mtune
pcc wrongly passes any option beginning with -m to the linker, and
will break at link time if these options were added to CFLAGS. testing
linking lets us catch this at configure time and skip them.
2012-10-25 14:52:12 -04:00
Rich Felker 01e5a1b6cd use $CC rather than "$CC" in configure script
this is necessary to allow $CC with arguments in it
2012-10-18 23:02:53 -04:00
Rich Felker adefe830dd tell the assembler to mark all files as not requiring executable stack
for some reason this option is undocumented. not sure when it was
added, so I'm using a configure test. gcc was already setting the mark
correctly for C files, but assembler source files would need ugly
.note boilerplate in every single file to achieve this without the
option to the assembler.

blame whoever thought it would be a good idea to make the stack
executable by default rather than doing it the other way around...
2012-10-03 11:49:58 -04:00
Rich Felker 8c0a3d9e5c microblaze port
based on initial work by rdp, with heavy modifications. some features
including threads are untested because qemu app-level emulation seems
to be broken and I do not have a proper system image for testing.
2012-09-29 01:05:31 -04:00
Rich Felker 2c1cd2399a add LIBCC (compiler runtime) logic and override to configure
this should both fix the issue with ARM needing -lgcc_eh (although
that's really a bug in the libgcc build process that's causing
considerable bloat, which should be fixed) and make it easier to build
musl using clang/llvm in place of gcc. unfortunately I don't know a
good way to detect and support pcc's -lpcc since it's not in pcc's
default library search path...
2012-09-10 15:30:52 -04:00
Rich Felker b439c051c7 get rid of eh_frame bloat
if needed for debugging, it will be output in the .debug_frame section
instead, where it is not part of the loaded program and where the
strip command is free to strip it.
2012-08-29 09:36:02 -04:00
Rich Felker 2bd05a4fc2 add gnu hash support in the dynamic linker
based on the patches contributed by boris brezillon.
2012-08-25 17:13:28 -04:00
Rich Felker 94e920d0cd support configuring cross compiling with CROSS_COMPILE prefix variable 2012-08-14 22:50:16 -04:00
Rich Felker 721564a264 make configure accept mipsel 2012-08-05 17:23:38 -04:00
Rich Felker 470569ca00 remove configure check disabling shared libraries on mips 2012-08-05 12:57:19 -04:00
Rich Felker a1546e8d61 disable dynamic linking on mips for now (broken) 2012-07-12 14:24:10 -04:00
Rich Felker 6315004f61 initial version of mips (o32) port, based on work by Richard Pennington (rdp)
basically, this version of the code was obtained by starting with
rdp's work from his ellcc source tree, adapting it to musl's build
system and coding style, auditing the bits headers for discrepencies
with kernel definitions or glibc/LSB ABI or large file issues, fixing
up incompatibility with the old binutils from aboriginal linux, and
adding some new special cases to deal with the oddities of sigaction
and pipe syscall interfaces on mips.

at present, minimal test programs work, but some interfaces are broken
or missing. threaded programs probably will not link.
2012-07-11 04:22:13 -04:00
Rich Felker 2121b8a44f configure: only use -ffloat-store on i386
this option is expensive and only used on old gcc's that lack
-fexcess-precision=standed, but it's not needed on non-i386 archs
where floating point does not have excess precision anyway.

if musl ever supports m68k, i think it will need to be special-cased
too. i'm not aware of any other archs with excess precision.
2012-07-03 23:53:05 -04:00
Rich Felker 498a100d05 check for ld support of -Bsymbolic-functions; disable shared if not avail
this issue affects the last gpl2 version of binutils, which some
people are still using out of aversion to gpl3. musl requires
-Bsymbolic-functions because it's the only way to make a libc.so
that's able to operate prior to dynamic linking but that still behaves
correctly with respect to global vars that may be moved to the main
program via copy relocations.
2012-06-07 00:32:22 -04:00
Rich Felker f1fd7577ba use -nostdlib in linker tests to avoid possible missing crt/lib issues 2012-06-07 00:27:34 -04:00
Rich Felker 67a0383d07 avoid linking main program in linker tests
it's possible that the user has provided a compiler that does not have
any libc to link to, so linking a main program is a bad idea. instead,
generate an empty shared library with no dependencies.
2012-06-07 00:23:58 -04:00
Rich Felker 0c5efde8d0 make configure try to disable stack protector
in theory we could support stack protector in the libc itself, and
users wanting to experiment with such usage could add
-fstack-protector to CFLAGS intentionally. but to avoid breakage in
the default case, override broken distro-patched gcc that forces stack
protector on.
2012-06-06 22:00:08 -04:00
Rich Felker 08f70a30c0 add configure check for gnu linker hash style setting
some broken distro-provided toolchains have modified gcc to produce
only "gnu hash" dynamic hash table by default. as this is unsupported
by musl, that results in a non-working libc.so. we detect and switch
this on in configure rather than hard-coding it in the Makefile
because it's not supported by old binutils versions, but that might
not even be relevant since old binutils versions already fail from
-Bsymbolic-functions being missing. at some point I may review whether
this should just go in the Makefile...
2012-06-06 20:45:52 -04:00