Commit Graph

1667 Commits

Author SHA1 Message Date
Alexey Neyman
4a138d8407 Shut clang's warning that confuses configure.
Warning causes gdb's configure to not detect <limit.h> declarations
of LONG_MIN/MAX.

Found-by: Kirill Smirnov <kirill.k.smirnov@gmail.com>
Signed-off-by: Alexey Neyman <stilor@att.net>
2017-01-10 10:39:37 -08:00
Alexey Neyman
25bc99f4d0 Darwin needs -liconv when building glibc.
Signed-off-by: Alexey Neyman <stilor@att.net>
2017-01-10 10:39:37 -08:00
Alexey Neyman
c1b7324fc3 Avoid trampling user's LDFLAGS_FOR_HOST...
... by passing BUILD_LDFLAGS twice (the 2nd argument overrides the first).
Also, no need to pass -I/-L for BUILD_CFLAGS/LDFLAGS, they are already included
by crosstool-NG.sh (but keep for BUILD_CPPFLAGS, as we set it up here).
Remove -Wl,-Bstatic/-Wl,-Bdynamic (we only build static complibs).

Signed-off-by: Alexey Neyman <stilor@att.net>
2017-01-10 10:39:37 -08:00
Alexey Neyman
36bbcf4b4f For simple cross or native pick up both build/host flags.
Signed-off-by: Alexey Neyman <stilor@att.net>
2017-01-10 10:38:08 -08:00
Alexey Neyman
9f62ca8deb Select libintl from gettext we built.
Also, require gettext for NLS, and require iconv/ncurses for gettext.

Signed-off-by: Alexey Neyman <stilor@att.net>
2017-01-10 10:38:08 -08:00
Alexey Neyman
1f84e9caf4 Point FOR_BUILD flags to buildtools/{include,lib}.
Similarly to FOR_HOST; recent change in 100-gcc.sh that switched
FOR_HOST->FOR_BUILD broke simple cross configurations on macos.

Signed-off-by: Alexey Neyman <stilor@att.net>
2017-01-10 10:38:08 -08:00
Alexey Neyman
8e7ac5fcd9 Change when libiconv/gettext are built.
Make them configurable, default to y when build!=host (i.e.
canadian or cross-native) because we don't know what libraries the host
will provide. GLIBC, as previously, selects them explicitly.

Signed-off-by: Alexey Neyman <stilor@att.net>
2017-01-10 10:38:08 -08:00
Alexey Neyman
ca0700010e Simplify a bit, no functional changes.
Signed-off-by: Alexey Neyman <stilor@att.net>
2017-01-10 10:38:08 -08:00
Alexey Neyman
11f87cfa5d Kill CT_COMPLIBS_SHARED.
There is no such option so the check is always true.

Signed-off-by: Alexey Neyman <stilor@att.net>
2017-01-10 10:38:08 -08:00
Alastair D'Silva
14896a2600 Support building Newlib with Link Time Optimisation
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
2017-01-10 10:51:32 +11:00
Alastair D'Silva
2ac39621bc Add more newlib options 2017-01-10 09:47:35 +11:00
Alastair D'Silva
92c33fe46d Bump binutils to 2.27
Signed-off-by: Alastair D'Silva <alastair@d-silva.org>
2017-01-06 12:05:16 +11:00
Alexey Neyman
a2d49174df Merge pull request #512 from stilor/kill-install-dir
Kill CT_INSTALL_DIR.
2016-12-19 11:58:39 -08:00
Alexey Neyman
5c985041fd Kill CT_INSTALL_DIR.
We now use CT_PREFIX and expect the resulting toolchain to be relocatable.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-12-19 11:45:24 -08:00
Alexey Neyman
b30e779d8e Catch more make errors.
Some errors from make(1) do not include a file reference in brackets.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-12-18 10:14:40 -08:00
Alexey Neyman
cccb8d8481 Merge pull request #508 from stilor/drop-dmalloc
Drop dmalloc
2016-12-17 14:26:13 -08:00
Alexey Neyman
b1ac2e7a7d Pass original multi_os_dir to iterator.
This is needed for callbacks that use that directory to look inside
GCC internal directories, e.g. moving the libraries. This broke
when I made libexpat for target honor ${CT_SHARED_LIBS}.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-12-17 12:10:10 -08:00
Alexey Neyman
53758f34ef Avoid host libs when compiling gettext.
On Travis, old libxml2 is picked up from host and breaks the build.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-12-17 12:05:23 -08:00
Alexey Neyman
83d9e6a49a Kill dmalloc.
- No new releases in almost 10 year.
- No public bug tracker or VCS.
- No responses from maintainer over sent patches.

RIP, dmalloc.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-12-16 16:10:32 -08:00
Alexey Neyman
3dbb576c17 Make companion libs static.
This follows the trend set by 1*.sh scripts that configure ISL, GMP,
MPFR, CLooG, etc. Building with shared libraries presents all kinds
of problems:
- The shared libraries need to be installed into ${CT_PREFIX_DIR}.
- The binaries linked against companion libs need to have proper
RPATH, or they're looking for shared libs in
.build/${CT_PREFIX}/buildtools/lib.
- All libraries must agree as to whether they're built shared,
static, or both. Otherwise, gettext tries to link in static libncurses.a
into a shared library and fails (since libncurses was compiled without
the -fPIC switch and hence contains relocations that cannot be handled
in a shared library).

So this fixes the current mess. If we decide to re-enable building
the companion libs shared, we should probably make this dependent on
a separate suboption of CT_STATIC_TOOLCHAIN.

Add a config loosely based on one reported in the issue 274.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-12-11 00:46:06 -08:00
Alexey Neyman
7e44983388 Work around Cygwin idiosyncrasy.
Cygwin doesn't like directory names ending with a dot, e.g. "multilib_."

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-12-06 10:33:20 -08:00
Alexey Neyman
f5a375e407 Merge pull request #443 from KirillSmirnov/gdb-native
debug/gdb: properly link with expat
2016-12-05 18:24:05 -08:00
Kirill K. Smirnov
ee1c04378c debug/gdb: restore comments
There are two separate issues with gdb configure usage:
1) inspecting build system libraries while cross-compiling;
2) preferring a shared library over static one.

The first usage issue is described and fixed now.
The second issue was described but the notes were removed
for some reason. This patch restores those notes.

Suggested-by: Alexey Neyman <stilor@att.net>
Signed-off-by: Kirill K. Smirnov <kirill.k.smirnov@gmail.com>
2016-12-05 23:39:55 +03:00
Alexey Neyman
4042269de6 Merge pull request #487 from stilor/host-comp-tools
Allow for installation of companion tools for host
2016-12-02 19:18:56 -08:00
Alexey Neyman
cf86df688a Add 'companion tools for host' step.
Signed-off-by: Alexey Neyman <stilor@att.net>
2016-12-02 15:03:15 -08:00
Alexey Neyman
3f7fbd7bed Move companion tool build into a separate step.
Also, rename "build" -> "for_build", since we're going to have a "for_host"
as well.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-12-02 15:03:15 -08:00
Alexey Neyman
51a3606b17 Fix use of custom location if it is a directory.
In that case, CT_GetCustom just creates a symlink to the original.
In that case, 'cp -a <path> .' gives an error and 'cp -a <path> <newdir>'
creates <newdir> as a symlink (which will then run the build inside
the shared directory, .build/src/<package>).

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-12-02 15:02:58 -08:00
Alexey Neyman
2091c5dd2d Pass FOR_BUILD flags when building the pass-1/2 core GCC.
Current build passes {CFLAGS,LDFLAGS}_FOR_HOST - which breaks canadian cross
(e.g. tried building for x86_64-unknown-linux-uclibc host). This dates
back to the days of yore when CFLAGS were set directly in the do_gcc_core_backend
(and that function is used as the final gcc's backend).

do_gcc_core_backend is now passed with CFLAGS/LDFLAGS to use, so let
the pass-1/pass-2/final-for-build steps pass the appropriate flags.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-11-28 22:55:54 -08:00
Max Filippov
6c6829a061 xtensa: fix endianness support
To build uClibc correctly we need correct endianness selected in the
crosstool-NG. Xtensa cores may be little- or big-endian, but this
property is static. The toolchain knows the core endianness and doesn't
need options to select it.
Enable ARCH_SUPPORTS_BOTH_ENDIAN and select LE by default. Specify empty
CT_ARCH_ENDIAN_CFLAG so that -m{big,little}-endian don't get added to
the TARGET_CFLAGS, as it's not supported by gcc. Specify empty
CT_ARCH_ENDIAN_LDFLAG so that -EB/-EL don't get added to the
TARGET_LDFLAGS as they are ignored. Select big-endian in the example
xtensa-unknown-linux-uclibc configuration.

This fixes uClibc toolchain build for little-endian cores.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
2016-11-22 10:48:34 -08:00
Alexey Neyman
87bfd55b3b Give companion tools some love.
Allow selection of make/m4/... version. Support imports of new versions
via addToolVersion.sh. Import newest versions of the companion tools.

One non-trivial change is the handling of make versions. Existing code
was not handling make companion tool as described (see the previous
commit). However, since most modern systems have make 4.x, that previous
commit made crosstool-ng always build make as a companion tool.

This traces back to the commit dd15c93 from 2014. That commit's log message
says that actually it was 3.81 which broke the build for certain component
(it was originally breaking eglibc, but I noticed it was breaking current
glibc on powerpc64), and introduced an option to force using 3.81 by
"components that really need it". It looks like in 2.5 years we haven't
seen any such components that really need make 3.81, and (given that make
has already had a few releases since 3.81) we're unlikely to see them
in the future.

Hence, the configure check is changed from "exactly 3.81" to "3.81 or newer".
In its current form, configure will accept make 3.80+, and will not require
make as a companion tool for 3.81+. We might want to bump the latter check
to even newer version given the claim from dd15c93. Killed
COMP_TOOLS_make_3_81_NEEDED.

Anyway, I retained 3.81 just in case; ditto for m4 1.14.3, autoconf 2.65
and automake 1.11.1.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-11-21 23:03:03 -08:00
Alexey Neyman
488b27f58b Partially revert 6f8e89cb5c.
The referenced commit replaced 'make' with '${make}' everywhere. This is
wrong for at least the utilities that we may build as companion tools
(make, libtool): this will always invoke the version detected by configure
by supplying the absolute path. In other words, the wrappers in
.build/tools/bin are not fallbacks - they are either temporary (in case
a respective companion tool is built) or permanent redirectors.

This is the reason why the PATH= has .build/*/buildtools/bin at higher
precedence than .build/tools/bin; the latter has the versions detected by
configure and the former has the versions built as companion tools.

Revert the rest of the gang (grep/sed/...) for consistency. After all,
we may decide to supply some of them as well (awk, for instance).

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-11-20 23:50:17 -08:00
Bernhard Walle
6cb9e62f6c comptools/make: Fix CT_COMP_TOOLS_make_gmake option
Commit 6f8e89cb5c broke that option.
Since ${make} points to /usr/bin/make, making the symlink from gmake
to /usr/bin/make is obviously the wrong decision. gmake should link to
our (old-versioned) self-built make.

Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
2016-11-19 12:40:47 -08:00
Dmitry Pankratov
0d17d26005 Merge remote-tracking branch 'upstream/master' 2016-11-11 21:03:11 +01:00
Bryan Hundven
6a1bf36b48 Merge pull request #472 from stilor/unparallel-make-install
Do not run 'make install' in parallel in GCC.
2016-11-09 18:52:30 -08:00
Alexey Neyman
a76c549823 Merge pull request #452 from KirillSmirnov/janitorial
Janitorial: update patches
2016-11-09 17:35:27 -08:00
Alexey Neyman
f4c7688946 Do not run 'make install' in parallel in GCC.
Signed-off-by: Alexey Neyman <stilor@att.net>
2016-11-09 16:46:01 -08:00
Bryan Hundven
dc280e477d Merge branch 'master' into janitorial 2016-10-24 10:07:16 -07:00
Alexey Neyman
91575d02c4 Merge branch 'master' into static-libgcc-more-fixes 2016-10-12 11:58:28 -07:00
Alexey Neyman
3330ad7197 Fine-tune moving gcc libraries to sysroot.
1. Check if anything was installed outside sysroot; on some [baremetal only?]
configurations GCC doesn't install anything to ${CT_PREFIX_DIR}/${CT_TARGET}/lib.
2. We need to create <sysroot>/lib/<multilib> if it doesn't exist
(MUSL only installs in <sysroot>/usr/lib).
3. Do not move the linker scripts; elf2flt expects to find them
in gcc's dir, not sysroot.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-10-07 10:34:33 -07:00
Alexey Neyman
8121be5b21 Fix m68k with uClibc-ng >= 1.0.15.
1.0.15 only kept a single LINUXTHREADS option, and renamed it, making it
no longer option-compatible with uClibc.

The option for "1.0.14 or later" version of uClibc-ng is not currently
used; rename it to "1.0.15 or later" and use it to handle newer
uClibc-ng's linuxthreads.

m68k happens to be the only sample using linuxthreads.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-10-04 17:47:15 -07:00
Alexey Neyman
f35c62daf0 Add uClibc-ng 1.0.17.
Also, support uClibc-ng in addToolVersion.sh

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-10-04 17:47:15 -07:00
Kirill Smirnov
c7cb030fd5 Merge branch 'master' into janitorial 2016-10-05 02:59:48 +03:00
Alexey Neyman
33fccf9838 Merge branch 'master' into x86-musl 2016-10-04 11:43:42 -07:00
Alexey Neyman
96338beeca GCC uses multi_os_dir for libgcc, not multi_dir.
Signed-off-by: Alexey Neyman <stilor@att.net>
2016-10-02 18:50:41 -07:00
Alexey Neyman
75dee86653 Fix issue #449.
After building final gcc, place the libraries in non-sysroot libs
into sysroot.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-10-02 15:23:53 -07:00
Dmitry Pankratov
34ca68e3b0 Merge branch 'master' of https://github.com/crosstool-ng/crosstool-ng 2016-10-01 22:43:56 +02:00
Alexey Neyman
651567ff90 Add a checkbox for libmpx build.
Disable libmpx for musl builds.

Signed-off-by: Alexey Neyman <stilor@att.net>
2016-09-22 17:01:43 -07:00
Kirill Smirnov
8c04681a99 Merge branch 'master' into janitorial 2016-09-23 00:56:46 +03:00
Kirill K. Smirnov
3362272d40 elf2flt: do not treat warnings as errors
elf2flt is configured with -Werror flag by default. Disable it.

Signed-off-by: Kirill K. Smirnov <kirill.k.smirnov@gmail.com>
2016-09-20 23:28:29 +03:00
Kirill K. Smirnov
d84501b980 build/glibc: Improve confusing comment
Up until cset 4e2227e8a5 there was an 'if'
statement with a comment. The abovementioned changeset removed the
conditional statement but the comment survived.

Signed-off-by: Kirill K. Smirnov <kirill.k.smirnov@gmail.com>
2016-09-15 01:31:45 +03:00
Kirill K. Smirnov
10972baa20 binutils: make symlinks in a consistent way
On the stage "core gcc pass-2" the following layout is created:

1) buildtools/bin/TARGET-{ar,as,elf2flt,flthdr,ld,ld.bfd,ranlib,strip}
2) buildtools/TARGET/bin/{ar,as,elf2flt,flthdr,ld,ld.bfd,ranlib,strip}
3) x-tools/TARGET/bin/TARGET-{ar,as,elf2flt,flthdr,ld,ld.bfd,ranlib,strip}
4) x-tools/TARGET/TARGET/bin{ar,as,elf2flt,flthdr,ld,ld.bfd,ranlib,strip}

where both (1) and (2) are symlinks to (3). This effectively renders
core pass-2 gcc with elf2flt linker unusable.

Related elf2flt discussion:
https://github.com/crosstool-ng/crosstool-ng/pull/443

Signed-off-by: Kirill K. Smirnov <kirill.k.smirnov@gmail.com>
2016-09-13 22:07:14 +03:00
Kirill K. Smirnov
f64f561e6f debug/gdb: Add comments for untrivial flags.
The necessity of --without-libexpat-prefix is not
obvious and needs comments.

Signed-off-by: Kirill K. Smirnov <kirill.k.smirnov@gmail.com>
2016-09-12 01:13:55 +03:00
Kirill K. Smirnov
1a2024f96a internals: properly strip gdbserver
On mingw target gdbserver is suffixed with '.exe', thus
plain 'strip gdbserver' fails.

Signed-off-by: Kirill K. Smirnov <kirill.k.smirnov@gmail.com>
2016-09-10 12:48:35 +03:00
Kirill K. Smirnov
5fd69f7652 complibs: let mingw-gcc find target companion libs
mingw-gcc searches for include and libs in <sysroot>/mingw
directory while non-mingw-gcc uses <sysroot>/usr. This patch
sets an appropriate prefix for target companion libs.

Signed-off-by: Kirill K. Smirnov <kirill.k.smirnov@gmail.com>
2016-09-10 03:35:53 +03:00
Kirill Smirnov
5d5465307b debug/gdb: properly link with expat
This patch fixes libexpat detection for gdb-native and
gdb-cross static builds.

For gdb-native build configure should not touch system
/usr/{lib,include} directories while looking for libexpat.
To fix this we pass --without-libexpat-prefix flag
to configure script.

For gdb-cross build configure is allowed to investigate
system /usr/{lib,include} directories, but it does not
hurt to disable this behavior. In this case configure
falls back to -lexpat, which works as expected.

For more info:
http://marc.info/?l=gnulib-bug&m=129660262901148&w=2

Signed-off-by: Kirill Smirnov <kirill.k.smirnov@gmail.com>
2016-09-09 21:25:53 +03:00
Bryan Hundven
62331c9023 Merge pull request #435 from KirillSmirnov/uclibc
uClibc: improve managing shared libs
2016-08-30 17:12:09 -07:00
Bryan Hundven
a833c5596d Merge pull request #429 from pedronavf/patch-1
Update x86.sh
2016-08-30 17:09:50 -07:00
Kirill K. Smirnov
41cd6542a7 uClibc: propagate SHARED_LIBS option.
This patch synchronizes crosstool CT_SHARED_LIBS and uclibc
HAVE_SHARED options.

Signed-off-by: Kirill K. Smirnov <kirill.k.smirnov@gmail.com>
2016-08-30 01:54:08 +03:00
Kirill K. Smirnov
7120d81f48 uClibc: install native utils
This change adds native ldd and ldconfig utils to sysroot.
For glibc just 'make install' installs everything including utils.
For uclibc there exists a separate goal 'install_utils'. Make it.

Signed-off-by: Kirill K. Smirnov <kirill.k.smirnov@gmail.com>
2016-08-30 01:54:08 +03:00
Bryan Hundven
2b887e417a Merge pull request #431 from bhundven/fix_cross_build_tools
cross: Only make 'build tools' for the 'build'
2016-08-26 10:47:23 -07:00
Bryan Hundven
effd8be643 Update config.guess and config.sub
Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
2016-08-26 08:54:13 -07:00
Bryan Hundven
a7b8cb3f58 cross: Only make 'build tools' for the 'build'
For a cross-compiler, we only need to make the 'build tools' for the
'build'. We also build the 'build tools' for the 'host' when building a
cross-canadian toolchain.

Closes #430

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
2016-08-26 08:48:32 -07:00
Pedro Navarro
31c8645b37 Update x86.sh
Added additional x86 architectures, like core2, that also map to i686
2016-08-25 18:00:56 -07:00
Bryan Hundven
11cb2ddd43 Merge pull request #410 from jmlemetayer/fix_populate
populate: Fix undefined awk
2016-08-23 14:26:16 -07:00
Bryan Hundven
b18469054d Merge pull request #422 from datacom-teracom/master
scripts/functions: fix log level in call to CT_DoLog
2016-08-23 14:25:48 -07:00
Bryan Hundven
19fdf86ab6 Merge pull request #402 from lundmar/fix_elf2flt_repo
Update elf2flt git repository location
2016-08-23 14:25:22 -07:00
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
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
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
Carlos Santos
29df8cccf4 scripts/functions: fix log level in call to CT_DoLog
It must be "DEBUG", not "Debug"

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
2016-08-16 23:56:23 -03:00
Jean-Marie Lemetayer
a2d6572b45 populate: Fix undefined awk
Fix minor issue introduced by 6f8e89cb5c
2016-07-26 16:07:58 +02:00
Dmitry Pankratov
91b8280e8c Merge remote-tracking branch 'upstream/master' 2016-06-18 16:02:15 +02:00
Martin Lund
b06f5ab689 Update elf2flt git repository location
The elf2flt git repository has been moved to GitHub. Updated the script
accordingly.

Signed-off-by: Martin Lund <martin.lund@keep-it-simple.com>
2016-06-10 22:11:39 +02: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
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
Bryan Hundven
cd39285ff8 Merge pull request #373 from stilor/unbreak-ppc-uclibc
Unbreak samples
2016-05-12 20:34:42 -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
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
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
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
Dmitry Pankratov
f6d8dc4411 Merge remote-tracking branch 'upstream/master' 2016-03-30 05:41:36 +02:00