Commit Graph

3594 Commits

Author SHA1 Message Date
Alexey Neyman
d2af095eb2 musl: Add multilib support.
Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Alexey Neyman
49d1d8f513 uClibc: move ldso check to post_cc.
It turns out that core GCC on binfmt architectures (m68k, for example)
cannot produce the final executable (looks for ld.real in the wrong
place). Need to wait for the final gcc to become available.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Alexey Neyman
98e556d386 Support multilib in sh/uClibc.
Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Alexey Neyman
258394c19f Treat multiroots differently.
'ld' does not search for dependency libraries in multi_os_directory, so
if there's both multi_os_directory and multi_root, and there is only one
configuration in each multi_root, forgo the multi_os_directory suffix.

Needed for sh4-multilib-linux-uclibc.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Alexey Neyman
99dd2f6f60 mips: allow o32 ABI as default for multilib
... since n32 and n64 are going to get built as well.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Alexey Neyman
f2ffdf798d First stab at multilib/uClibc.
Create a separate 'libc_backend_once', install headers into a
subdirectory (different sets of headers are installed for 32- and 64-bit
architectures), and create a symlink for the dynamic linker location
expected by GCC.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Alexey Neyman
bf3eceb5d9 uClibc: Split configuration tweaker into per-arch functions.
Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Alexey Neyman
0fdc1887a7 Change multilib functions to set the variable.
Rather than echo-ing the new value, set the value into the variable with
the name passed as an argument (similar to CT_SanitizeVarDir). This
allows to use CT_DoLog in these functions.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Alexey Neyman
3ebc5d0c1e libc/*.sh: Deprecate libc_check_config step.
This step was only used in uClibc. However, with upcoming multilib, the
config management will have to be done for each variant differently,
anyway.

uClibc was the only user of libc_check_config step, as well as
CT_CONFIG_DIR directory. Retire these.

Two other clean-ups in uClibc.sh:
- KERNEL_HEADERS check seems to be bogus, this config option is not
  present even in 0.9.30 - which is not supported already.
- SHARED_LIB_LOADER_PREFIX was renamed to MULTILIB_DIR in 0.9.31,
  according to ChangeLog - and MULTILIB_DIR is passed from command line
  instead.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Alexey Neyman
4ee22d66a8 uclibc: merge startfiles/final into single backend.
In preparation for multilib support, use the same "backend" model that
is already employed by glibc and musl.

Also, the verbosity setting descriptions were swapped. V=2 is actually
less verbose than V=1: V=1 prints full commands, while V=2 prints 'CC
<file> <defines>'.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Alexey Neyman
28c24f5034 uClibc.sh: typo, local -> locale.
Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Alexey Neyman
f204cc8ec4 Spelling fixes.
Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Alexey Neyman
d58e740be8 glibc.sh: cleanups
- Dump CT_LIBC_EXTRA_CC_ARGS: instead, treat CT_LIBC_EXTRA_CFLAGS as
  arguments to CC (or they are not applied to .S, for example).
  Combine them with multi_flags and CT_TARGET_CFLAGS in proper order.
- Analyze thus combined flags to determine --with-fp/--without-fp.
  Don't need to check CT_ARCH_FLOAT - it is reflected in
  CT_TARGET_CFLAGS anyway. Check more soft/hard float options defined
  on different architectures.
- Drop checking for endianness flags: they are not reflected in
  configure arguments in any way, and they're already present in CFLAGS
  (either via multi_flags or via CT_TARGET_CFLAGS). Besides,
  CT_ARCH_ENDIAN_OPT was actually called CT_ARCH_ENDIAN_CFLAG, so this
  was a no-op anyway.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Alexey Neyman
43c303c946 libc/*.sh: handle combinations of multilib root/dir.
Install startfiles for libc variants into the most specific combination
(suffixed sysroot, if applicable + suffixed multi-os dir, if
applicable). Install headers once in every suffixed sysroot (although it
seems that GCC picks up headers from top-level sysroot, GCC manual
claims that sysroot suffix affects headers search path).

In uClibc, this requires a better sanitization of the directory: it
creates symlinks from {sysroot}/usr/lib/{multi_os_dir} to
{sysroot}/lib/{multi_os_dir} and to do so, it counts the number of path
components in the libdir. This breaks if one of such components is `..'
- symlinks contain an extra `../..' then. Since such sanitization had to
be implemented anyway, use it in other places to print more sensible
directory names.

Also, fix the description of configure --host/--target per musl's
configure help message (and its actual code).

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Alexey Neyman
82072d0cbc multilib: Determine which options may pass through.
On some arches (e.g. MIPS) the options like -mabi do not work if
specified more than once (see the comment in 100-gcc.sh). Therefore,
we need to determine which of the options produced by <arch>.sh can
be passed to multilib builds and which must be removed (i.e., which
options vary among the multilibs).

This presents a chicken-and-egg problem. GCC developers, in their
infinite wisdom, do not allow arbitrary multilib specification to be
supplied to GCC's configure. Instead, the target (and sometimes some
extra options) determine the set of multilibs - which may include
different CPUs, different ABIs, different endianness, different FPUs,
different floating-point ABIs, ... That is, we don't know which parts
vary until we build GCC and ask it.

So, the solution implemented here is:
- For multilib builds, start with empty CT_ARCH_TARGET_CFLAGS/LDFLAGS.
- For multilib builds, require core pass 1. Pass 1 does not build any
  target binaries, so at that point, our target options have not been
  used yet.
- Provide an API to modify the environment variables for the steps that
  follow the current one.
- As a part of multilib-related housekeeping, determine the variable
  part of multilibs and filter out these options; pass the rest into
  CT_TARGET_CFLAGS/LDFLAGS.

This still does not handle extra dependencies between GCC options (like
-ma implying -mcpu=X -mtune=Y, etc.) but I feel that would complicate
matters too much. Let's leave this until there's a compelling case for
it.

Also, query GCC's sysroot suffix for targets that use it (SuperH,
for example) - the default multilib may not work if the command line
specifies the default option explicitly (%sysroot_suffix_spec is not
aware of multilib defaults).

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Ray Donnelly
cc86d80da2 glibc: Build manuals and locales last
Rather then building the manuals and locales for each multilib target, only
build the manuals on the last multilib target.

If you are not building a multilib toolchain, then the first libc build will
be the last.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
2016-08-23 11:00:27 -07:00
Ray Donnelly
27fed7e5f0 crosstool-NG.sh.in: Don't make lots of symlinks to lib folder
For 4 different folders:

${CT_PREFIX_DIR}
${CT_SYSROOT_DIR}
${CT_SYSROOT_DIR}/usr
${CT_PREFIX_DIR}/${CT_TARGET}

.. symlinks from 'lib32' and 'lib64' to 'lib' were created.
This was untidy and incorrect for multilib (the bitness of
the libraries in 'lib32' and 'lib64' will not be the same)
We can not know which folders this toolchain configuration
will require at this time so let them be created on-demand
instead.

Changed by Alexey Neyman: original change removed too much; we
still need to create the default directories because the os
directories are based off them (e.g. `lib/../lib64').

Signed-off-by: Ray Donnelly <mingw.android@gmail.com>
Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Alexey Neyman
098bd01f81 glibc.sh: Use --print-multi-os-directory
GCC makes the distinction between:
multilib (-print-multi-lib) and
multilib-os (--print-multi-os-directory)
as the GCC library and GCC sysroot library paths, respecitively.

Use this to build libc into the correct locations, the same
applies to the dummy libc.so

Changed by Alexey Neyman: restore missing CT_EndStep.

Signed-off-by: Ray Donnelly <mingw.android@gmail.com>
Signed-off-by: Alexey Neyman <stilor@att.net>
2016-08-23 11:00:27 -07:00
Bryan Hundven
87eb166c5b Merge pull request #418 from bhundven/Docs_Update
README.md: Fix a list formatting issue.
2016-08-04 13:09:48 -07:00
Bryan Hundven
7f2108deb6 README.md: Fix a list formatting issue.
Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
2016-08-04 13:08:46 -07:00
Bryan Hundven
cdcbdb1cbd Merge pull request #416 from bhundven/update_gitignore
Update .gitignore in kconfig/...
2016-08-04 01:24:46 -07:00
Bryan Hundven
5d9ac48c9a Update .gitignore in kconfig/...
Ignore `*.dep` and `*.o`.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
2016-08-04 01:23:27 -07:00
Bryan Hundven
73c93120a1 Merge pull request #415 from bhundven/Docs_Update
Fix waffle.io badges
2016-08-04 01:10:27 -07:00
Bryan Hundven
124e36142e Fix waffle.io badges
I had Ready twice and colums in the wrong order.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
2016-08-04 01:08:46 -07:00
Bryan Hundven
0c13553076 Merge pull request #414 from bhundven/Docs_Update
README.md: Add mailing list archive/subscription page
2016-08-04 01:04:05 -07:00
Bryan Hundven
c1388a9735 README.md: Add mailing list archive/subscription page
Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
2016-08-04 01:02:31 -07:00
Bryan Hundven
43ecb73bb4 Merge pull request #413 from bhundven/Docs_Update
Update README.md
2016-08-04 00:50:33 -07:00
Bryan Hundven
3f4e8e7b34 Update README.md
This commit makes the README.md more informative and basically jacks a
bunch of content from crosstool-ng.org (plus some extras).

I also added the waffle.io badges

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
2016-08-04 00:49:29 -07:00
Bryan Hundven
6e7c61650a Merge pull request #403 from stilor/multilib-1
First chunk of multilib changes for merging
2016-06-17 18:02:59 -07:00
Alexey Neyman
dc8f2d1c04 glibc.sh: build dummy libc.so with correct extra flags
Signed-off-by: Alexey Neyman <stilor@att.net>
2016-06-09 17:12:49 -07:00
Ray Donnelly
c7da54edf4 glibc: Use common arch call to get multilib targets
The previous patch added the function 'CT_DoMultilibTarget()' to
scripts/build/arch/*.sh.

This patch calls the common function to (currently) get just the target
tuple for the current multilib target.

This patch was originally by: Cody P Schafer

Changed by Alexey Neyman: first, try `gcc -print-multiarch`. If it is
supported, use whatever it reports. Otherwise, fall back to our
guesswork. Move "i486" quirk into glibc.sh, as it is specific to glibc
(e.g. uclibc will need i386, which is what GCC reports).

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
Signed-off-by: Ray Donnelly <mingw.android@gmail.com>
Signed-off-by: Alexey Neyman <stilor@att.net>
2016-06-09 17:12:49 -07:00
Alexey Neyman
67b314a051 arch/x86: add a sanity check
i[34567]86-*-gnux32 is not a valid tuple.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
Signed-off-by: Ray Donnelly <ray.donnelly@gmail.com>
Signed-off-by: Alexey Neyman <stilor@att.net>
2016-06-09 17:12:49 -07:00
Alexey Neyman
34ecc718d9 arch/all: Add common function to return multilib target
This code was abstracted out of Cody P Schafer's multilib patch.
It doesn't seem right having architecture dependent code in a
specific libc implementation script. So this patch breaks it out into
scripts/build/arch/<arch>.sh in a function:

  multilib_target_to_build="$(CT_DoArchMultilibTarget 'multi_flags'
'target-in')"

Note that this function gets called on each multilib variant with
different sets of compiler flags supplied in 'multi_flags'. The caller
will first filter the flags so that there is no conflicting flags (e.g.,
no '-m32 -m64') supplied.

Changed by Alexey Neyman:
- make option analysis check specific option rather than match global
  options string as a whole. Moreover, old code did not handle multiple
  options in the same multilib, e.g. '-m64 -mlittle'.
- fixed substitutions in powerpc.sh (*le variants did not match the
  pattern in the shell parameter expansion)
- make s390.sh actually apply the flags it gathered from the options.
- straighten the spaghetti in x86.sh by setting two flags, arch & abi.
  Also, do not depend on "gnu" being the last part - we can have
  '*-uclibcx32', for example.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
Signed-off-by: Ray Donnelly <ray.donnelly@gmail.com>
Signed-off-by: Alexey Neyman <stilor@att.net>
2016-06-09 17:12:49 -07:00
Ray Donnelly
aa30d0bc4f gcc: Add --with-multilib-list option
Written by Bryan Hundven.

Modified by Alexey Neyman to actually add the option to gcc.in.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
Signed-off-by: Ray Donnelly <mingw.android@gmail.com>
Signed-off-by: Alexey Neyman <stilor@att.net>
2016-06-09 17:12:49 -07:00
Alexey Neyman
a65d8841ec Enable multiarch support in pass-1 GCC.
By default, it is 'auto' - which means, it is enabled if there are
multilibs directories detected in the installation location for libgcc.
Thus, it is not detected for pass-1 GCC: the installation location is
empty at this point.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-06-09 17:12:49 -07:00
Alexey Neyman
55879ed1d8 glibc: do not add bogus options
If a multilib configuration contains an endianness option, the
${endian_extra} is set to, for example, 'mb' (note, no dash!). It is
then added to CFLAGS, resulting in bogus flags like 'mb -mb'. But it is
not even needed, as ${extra_flags} already contains the very same
option!

Found by experimenting with multilibs with different endianness on SH,
which still didn't work, but that's another story...

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-06-09 17:12:49 -07:00
Alexey Neyman
a49e13fb4e sh: require multilib
Now that libc backend installs the libraries into the directory reported
by gcc as 'multi-os-directory', sh4 libraries are installed into a '!m4'
subdirectory. This directory then confuses GNU ld, which assumes the
exclamation mark to be a word separator and attempts to link to
'/usr/lib' (a directory). However, if multilib is enabled, the default
libraries are installed into the [expected] '/usr/lib/./'. This looks
like an artifact of SuperH's unique way of specifying the multilibs to
be built in GCC (which may list exclusions, starting with '!').

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-06-09 17:12:49 -07:00
Alexey Neyman
a60946eb24 arch/sparc: better default CPU when targetting Linux
By default, sparc64-*-linux is configured with -mcpu=v9. However,
according to https://sourceware.org/ml/libc-alpha/2005-12/msg00027.html:
    "There is no Linux sparc64 port that runs on non-UltraSPARC-I+ ISA
     CPUs."

v9 is such a "non-UltraSPARC-I+ ISA CPU", so it makes no sense to
default to v9 when targetting Linux.

Change the default to ultrasparc, even though it can suboptimally
schedule instructions for newer SPARC CPUs. See the pending patch:
    https://patchwork.ozlabs.org/patch/409424/

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-06-09 17:12:49 -07:00
Alexey Neyman
08d91d41f3 musl: config is broken for !EXPERIMENTAL
If EXPERIMENTAL is not set, the only choice for version is the set of
released versions - currently, 1.1.14. But this only option is disabled
because it is also marked EXPERIMENTAL; this leaves no available choices
in the configuration.

Marking MUSL as experimental: it seems to have header issues which
prevent, for example, gdbserver from building. musl copied chunks of
ptrace.h code from the kernel into its own headers, which now clash with
Linux kernel headers. Manifests at least on SH4 target.

Also, musl breaks in powerpc builds: GCC balks at it with "unsupported
DEFAULT_LIBC" message. Also, 64-bit powerpc and mips are not supported.
So, until someone figures out the dependencies for musl in config/, mark
it experimental.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-06-09 17:12:49 -07:00
Bryan Hundven
7300eb17b4 Merge pull request #392 from bhundven/fix_building_gcc-5_with_gcc-6
patches/gcc: Backport fix for building gcc-5 with gcc-6
2016-05-13 14:33:33 -07:00
Bryan Hundven
5a5fcbe148 patches/gcc: Backport fix for building gcc-5 with gcc-6
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69959

...was observed while trying to build gcc-5.3.0 on latest (at the time
of this change) archlinux using gcc-6.1.1.

This patch fixes the issue.

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
2016-05-13 11:54:54 -07:00
Bryan Hundven
cd39285ff8 Merge pull request #373 from stilor/unbreak-ppc-uclibc
Unbreak samples
2016-05-12 20:34:42 -07:00
Bryan Hundven
cd6274dcad Merge pull request #390 from bhundven/addToolVersion_syntax_issues
addToolVersion: Fix syntax issues
2016-05-12 11:37:27 -07:00
Bryan Hundven
2b0cc92fab addToolVersion: Fix syntax issues
This issue was reported on github:
https://github.com/crosstool-ng/crosstool-ng/issues/378

by: alonbg

This is the same addToolVersion.sh change in the zipfile, with minor
changes. (whitespace)

This closes #378

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
2016-05-12 11:34:34 -07:00
Bryan Hundven
176594e4a1 Merge pull request #366 from CDKGlobal/glibc-getaddrinfo
Add patch for glibc 2.22 for CVE-2015-7547.
2016-05-12 11:24:13 -07:00
Alexey Neyman
2162cbbdb7 Work-around another quirk in GDB configure.
Previous fix for cross-gdb broke powerpc-unknown_nofpu-linux-gnu which
uses an old GDB (6.8a). That GDB's configure chokes on $CC values with
multiple consecutive spaces; see the comment in 300-gdb.sh.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-04-01 18:15:39 -07:00
Alexey Neyman
cc7f7db767 Mark x86_64-w64-mingw32,x86_64-pc-linux-gnu broken.
I couldn't get this sample to build. I tried rolling ct-ng back to 1.22
and back to the commit that introduced it, to no avail. Not sure if it
ever built on my machine.

The first problem is the failure to build binutils/gold because of the
missing <pthread.h> in mingw. However, even if CT_BINUTILS_GOLD_THREADS
option is unset, the build dies in configure of the pass-1 of the core CC.
The config.log states that it failed to link with libmpfr.a, which has
a lot of undefined references to symbols like '__imp___iob_func'.
Googling shows that these symbols are some dark Cygwin/MinGW magic and I
do not have the knowledge of these arcana. Let some other MinGWizard fix
it another day.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-04-01 18:15:39 -07:00
Alexey Neyman
712b617a74 Unbreak sparc-unknown-linux-gnu.
GLIBC 2.23 dropped support for pre-v9 SPARC in pthreads. Pass host
triplet with s/sparc/sparcv9/ replacement for 2.23.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-04-01 18:15:39 -07:00
Alexey Neyman
7ac327d6c3 Remove --with-expat from extra GDB args.
300-gdb.sh always adds --with-expat, no need to list it in
crosstool.config.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-04-01 18:15:39 -07:00
Alexey Neyman
62d357d3c0 Unbreak static cross-gdb.
GDB's configure mishandles the libexpat.{so,a} libraries when it is
given -static in CFLAGS AND --with-libexpat-prefix in configure's args:
it checks for <prefix>/lib/libexpat.so and finding that, attempts to
link it as `gcc -static .. conftest.c <prefix>/lib/libexpat.so`; this
obviously fails (.so cannot be statically linked), so configure assumes
libexpat is unusable. Thus, --with-libexpat-prefix is dangerous and
should be avoided; instead, configure should find the libraries via the
supplied CC/LD definitions.
2016-04-01 18:15:39 -07:00