Commit Graph

2147 Commits

Author SHA1 Message Date
Michał Zagórski
71cfd2d094 gdb/gdbserver: use -static --static for static build
Some checks failed
CI / crosstool (macos-13) (push) Has been cancelled
CI / crosstool (ubuntu-22.04) (push) Has been cancelled
CI / tarballs (ubuntu-22.04) (push) Has been cancelled
CI / toolchains (push) Has been cancelled
With gdb15.2 gdb uses libtool for linking, but gdbserver is not.
Should not break #2230 or #2053

Signed-off-by: Michał Zagórski <zagura6+github@gmail.com>
2024-12-16 08:37:33 +13:00
Michał Zagórski
9c444f4ca6 gdb: build native gdb with static libexpat
Use --with-libexpat-type=static to search for static libexpat in gdb
native. This should fix #2230.

Signed-off-by: Michał Zagórski <zagura6+github@gmail.com>
2024-12-16 08:37:33 +13:00
Mike Lundy
1c395b298d mold: tell cmake which compilers to use
The mold build was using gcc in the PATH, instead of the shiny gcc we
just built (the way the other companion libs/tools do)

Signed-off-by: Mike Lundy <mlundy@splunk.com>
2024-11-17 20:00:37 +13:00
jferreir
558d67ec0d initial support to build tricore gcc
Add support for Tricore architecture.
TriCore architecture is optimized for real-time embedded systems.
More information can be found at AURIX™ TC3xx Architecture vol 1

https://www.infineon.com/dgdl/Infineon-AURIX_TC3xx_Architecture_vol1-UserManual-v01_00-EN.pdf?fileId=5546d46276fb756a01771bc4c2e33bdd

Signed-off-by: jferreir <jesus.ferreira@gmail.com>
2024-11-10 20:14:52 +13:00
demin.han
6d1d61cbca gdb: fix GDB_CC_LD_LIBTOOL reference
GDB_CC_LD_LIBTOOL doesn't exist and so else branch always taken.
We should use CT_GDB_CC_LD_LIBTOOL.

Signed-off-by: demin.han <demin.han@starfivetech.com>
2024-10-16 14:54:04 +13:00
Stephanos Ioannidis
246f46c1cb gcc: Specify '--with-headers' when building final gcc
The final gcc build process was relying on `CT_CC_SYSROOT_ARG` to
provide the `--with-headers` argument pointing to the libc header
directory.

Since `CT_CC_SYSROOT_ARG` no longer provides `--with-headers`, this adds
one directly to the final gcc build invocation.

Without this, gcc build system will not copy all the required libc
headers into the `sys-include` directory.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2024-10-06 15:51:13 +13:00
Stephanos Ioannidis
9884db4c87 Specify header path in CT_CC_SYSROOT_ARG only for glibc
When building a non-sysrooted toolchain, `--with-headers` argument is
specified in `CT_CC_SYSROOT_ARG` as a hack, supposedly because "final
gcc will define disable_glibc while building libgcc, and you'll have no
profiling."

This, however, leads to `--with-headers` being specified multiple times
when building libstdc++ for additional libc variants (e.g. newlib-nano
and picolibc) and results in wrong libc headers being used by the
libstdc++ build under certain circumstances -- GCC does not use the last
specified `--with-headers` when building for macOS and Windows hosts.

Since the above hack is intended for glibc only, this commit adds a
check to ensure that `--with-headers` is added to `CT_CC_SYSROOT_ARG`
only when building glibc.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2024-10-06 15:51:13 +13:00
Chris Packham
902fab451b companion_libs: zstd: Build nomt configuration
We have been building the multi threaded zstd target. This requires that
anything that links with lzstd also links with lpthread. On more recent
systems this is fine because lpthread is part of GNU libc so the
-pthread option is a no-op but on other systems this will cause GCC to
either fail to build or to silently disable zstd compression. By
building the libzstd.a-nomt-release we can be compatible with older GCC
versions and ensure that support for zstd is not silently dropped.

Fixes: #2198
Signed-off-by: Chris Packham <judge.packham@gmail.com>
2024-09-09 08:59:38 +12:00
Chris Packham
5a1dc8d95d scripts: Save toolchain config as regular file
Since commit 16c6cc99 ("Save the toolchain configuration to its own
file, as an auto-extracting shell script:") we've been saving the
configuration as a self extracting script. This is a little non-obvious
as it looks like it should be a regular file but the bzipped payload
means it can be easily inspected. It may also cause alarm for users who
should rightly be suspicious of unexpected binaries that get shipped
along with packaged toolchains. It also assumes that bzip2 (or at least
bzcat) is available on the machine running the toolchain.

Instead of the self extracting shell script save the config as a regular
compressed file with an obvious file extension.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2024-07-29 13:13:26 +12:00
Chris Packham
b6a4766d22 binutils: Allow gold to be statically linked
gold uses g++ to link which doesn't recognise -all-static. It appears as
if -static should work for both libtool and g++ but for some reason it
doesn't. Remove the restriction that gold can't be included in a static
toolchain. When a static toolchain is requested pass
--with-gold-ldflags=--static to configure. Finally build gold separately
so it does not get the extra_make_flags which may contain -all-static.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2024-07-29 13:12:59 +12:00
Quentin Boswank
067d7743b6 Optimize zstd we build
- multithreading enabled
- release mode

Signed-off-by: Quentin Boswank <qubos@outlook.de>
2024-06-17 13:36:49 +12:00
Chris Packham
b82f532f0b scripts/functions: Update sourceware mirrors
Add https mirror for sourceware.org. Use https instead of http for
kernel.org and gnu.org.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2024-06-05 19:32:16 +12:00
Arnaud Vrac
f9ab04b63a Add mold linker build
Allows building the #mold linker, which can then be used in the
cross-toolchain by passing the -fuse-ld=mold to the gcc flags. It is
much faster than ld or gold.

This requires a C++20 compiler and cmake.

Initially implemented by Arnaud, and HC added configure check for cmake.

Outstanding task to validate compiler is C++20 compatible.

Signed-off-by: Arnaud Vrac <avrac@freebox.fr>
Signed-off-by: Hans-Christian Noren Egtvedt <egtvedt@samfundet.no>
2024-06-05 19:31:45 +12:00
Marc Poulhiès
d4953677cd Allow for Runtime-less build of GDC and GNAT
Both D and GNAT have their own runtimes (resp. libphotos and libada).
It is still possible to build the compiler proper without any runtime,
and have an external runtime installed later. This is most commonly
found in embedded systems.

An example for D is: https://github.com/KitsunebiGames/tinyd-rt
An example for Ada: https://github.com/Fabien-Chouteau/bare_runtime

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2024-06-05 19:30:31 +12:00
Nik Konyuchenko
c5a17024a9 Disable implicit-function-declaration error for newlib
GCC14 will treat implicit-function-declaration as an error by default.
See https://gcc.gnu.org/gcc-14/porting_to.html for details.

Some libc function like __trap34 are defined in assembly and break this GCC diagnostic.

Signed-off-by: Nik Konyuchenko <spaun2002mobile@gmail.com>
2024-05-18 15:45:55 +12:00
Mateusz Mikuła
810021d912 mingw-w64: enable wildcard
Wildcard is an opt-in (disabled by the default) feature that is used by many GNU tools like Binutils.

Signed-off-by: Mateusz Mikuła <mati865@gmail.com>
2024-04-24 18:14:12 +12:00
Chris Packham
6c54b50336 scripts/functions: Use CT_Abort when paths.sh is missing
Code added to deal with --enable-local used the non-existent CT_Error
instead of CT_Abort. Use the correct function so the build aborts with a
useful error message.

Fixes #2141
Signed-off-by: Chris Packham <judge.packham@gmail.com>
2024-04-24 18:13:48 +12:00
Chris Packham
6ad7b96903 gdb: Use correct libexpat for native build
The native gdb needs the version of libexpat built for the target. On
some systems gdb's configure will find the one from the build machine.
Use --with-expat= to point at the correct one for the target.

Fixes: 2092

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2024-03-13 17:03:23 +13:00
Dimitar Dimitrov
c64500d94b gnuprumcu: Pass host sysroot to build toolchain
In canadian builds, the target toolchain running on the build
machine is not compiling and installing target Newlib.  Thus it
cannot by itself link target executables.  This results in
errors for gnuprumcu package when its configure script attempts
to test the compiler:

     .../ld: cannot find crt0.o: No such file or directory
     configure:3738: error: C compiler cannot create executables

Fix by passing the host toolchains's sysroot in target CFLAGS.

While at it, also add a missing passing of target LDFLAGS.

Successfully tested the following canadian builds:
  x86_64-unknown-linux-gnu,pru
  x86_64-w64-mingw32,pru
  arm-unknown-linux-gnueabihf,pru

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2024-03-11 17:29:13 +13:00
Hao Li
ace8d69df0 glibc: fix the broken build for glibc 2.19 with gcc 13.
macos silicon SDK does not contain stat64 (and other LFS extension), and glibc 2.19 makes use of it.

Signed-off-by: Hao Li <hayatelee@gmail.com>
2024-03-01 14:48:49 +13:00
Chris Packham
d75c8c3b0f gdb: Fix extra config variable name for cross GDB
Similar to commit 65e5960a ("gdb: Fix extra config variable name for
native GDB") we need to use cross_extra_config for the options we're
passing to the gdb build when cross compiling.

Fixes: 5463ab4b ("gdb: Add gdb-10.2")
Signed-off-by: Chris Packham <judge.packham@gmail.com>
2024-03-01 14:48:05 +13:00
Chris Packham
e7a88ff52d Revert "binutils: Disable glob for better portability"
This reverts commit 57f5909285. This was
originally added so that a toolchain could be built on a newer system but
run on an older one. With the benefit of hindsight that is probably the
wrong approach. The best way of achieving that goal would be to use
docker/podman container to provide an environment that is the same as
the oldest supported system and build inside that. The resulting
toolchain should be compatible with the old system and the new one.

Closes #2094

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2024-03-01 14:45:27 +13:00
Quentin Boswank
aa6a6c3a34 Ignore a bad id command to allow docker
Signed-off-by: Quentin Boswank <qubos@outlook.de>
2024-02-18 10:56:54 +13:00
Bryan Hundven
4d660cff7d Update config.{guess,sub}
from: git://git.savannah.gnu.org/config.git

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
2024-02-02 15:15:29 +13:00
Alexey Brodkin
44208730a6 gdb: Explicitly point to target's libgmp for native build
Starting from GDB 11.x, gmp is needed as a dependency to build full gdb.
And by default build system of native GDB will try to link with libgmp
of the build host. And to make sure that doesn't happen we need to
specify location of the target's sysroot so that library search starts
from there. Which we do in that change.

Fixes [1] & [1].

[1] https://github.com/crosstool-ng/crosstool-ng/issues/2084
[2] https://github.com/crosstool-ng/crosstool-ng/issues/1656

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2024-01-30 11:04:56 +13:00
Quentin Boswank
6cf65db329 Fix zlib build on win32 near enviroments
We set some variables for linking zlib to '' which we shouldn't do. Let
the Makefile sort these things out.

Signed-off-by: Quentin Boswank <qubos@outlook.de>
2023-12-18 16:28:45 +13:00
Chris Packham
d91732672e scripts/build/binutils: Update path for libbfd
As of binutils 2.41 libbfd.a is not placed directly in the output
directory. Fortunately the libtool .libs location seems to have been
in place for some time so we can update the path without worrying about
backwards compatibility.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2023-12-08 12:19:38 +13:00
John David Anglin
70c6e877fa Adjust GUESS tuple for PA-RISC linux.
64-bit kernels can support running both 32 and 64-bit user code. Select
hppa-unknown-linux-$LIBC or hppa64-unknown-linux-$LIBC depending on
whether compiler defines LP64 or not.

Always select hppa-unknown-linux-$LIBC with 32-bit kernel. This will
generate 32-bit PA 1.1 code. If PA 2.0 code is desired, user can use a
compiler option to select it.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
2023-11-25 15:41:47 +13:00
John David Anglin
1ea6e309e5 Map parisc64 to hppa64 in config.sub.
Debian and Gentoo use hppa/hppa64 for the PA-RISC ports. These are the
proper CPU designations for configuring most packages.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
2023-11-25 15:41:47 +13:00
John David Anglin
5f3a1ef166 Add support for 32 and 64-bit PA-RISC linux build targets.
Note: The 64-bit target lacks a glibc port and doesn't build. Also,
there is no uclibc support.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
2023-11-25 15:41:47 +13:00
Chris Packham
daf19e1761 gdb: Use correct arguments for static linking
As of version 13.x GDB uses libtool for linking instead of g++ these
take different arguments for static linking.  Commit 6146b5a6 ("use
-all-static when building a static gdb") attempted to deal with this but
had the effect of causing older GDB versions to fail to build
statically. Add a new internal flag GDB_CC_LD_LIBTOOL and use this to
decide whether to pass `-static` or `-all-static`.

Fixes #2053
Signed-off-by: Chris Packham <judge.packham@gmail.com>
2023-11-02 20:49:26 +13:00
c-grant
f11d4d9c1e Add gnatls & gnatlink
add gnatls and gnatlink to list of tools since it is needed to support Ada just like gnatmake and gnatbind

Update crosstool-NG.sh & TODO

Signed-off-by: c-grant <60671494+c-grant@users.noreply.github.com>
2023-11-02 20:48:03 +13:00
Quentin Boswank
cf6b1740a1 Add more caching to the CI
more specificaly to the tarballs download. The function CT_Fetch now
touches the already existing files to be comparable to the not used ones
that can araise when a package is updated.
This comparsion is needed because if it would not exist the tarball
would grow in size due to not used but still cached packages.
This would take time but is definitly something to worry about.

Signed-off-by: Quentin Boswank <qubos@outlook.de>
2023-10-04 16:12:23 +13:00
Chris Copeland
6146b5a640 use -all-static when building a static gdb
gdb is linked with libtool, which has a different meaning
for -static, and -all-static must be used to get a static executable.

The binutils build script already uses this option for static builds.

Also remove unnecessary -static from cflags for the gdb build.

Signed-off-by: Chris Copeland <chris@chrisnc.net>
2023-09-24 16:12:58 +13:00
Norbert Lange
dc82a2bfac Add a musl variable LIBC_MUSC_EXTRA_CFLAGS
Signed-off-by: Norbert Lange <nolange79@gmail.com>
2023-09-24 16:10:02 +13:00
Norbert Lange
c91133acc1 fix toolchain build with linker plugins
older binutils dont automatically pick up plugins,
but need to manually use wrappers like gcc-ar.
This fix allows to compile the host toolchain with -ftlo
on debian stretch.

Signed-off-by: Norbert Lange <nolange79@gmail.com>
2023-09-24 16:08:25 +13:00
Chris Packham
9473e7a481 glibc: Add option for building libcrypt
As of glibc-2.38 libcrypt is not built by default. Add an option to
allow building libcrypt support into glibc.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2023-08-25 18:13:06 +12:00
Kirill K. Smirnov
fab9efd8fa gdb: fix build with recent ncurses
For mingw host a special macro NCURSES_STATIC must be defined.

Signed-off-by: Kirill K. Smirnov <kirill.k.smirnov@gmail.com>
2023-08-15 16:26:10 +12:00
Quentin Boswank
fd04f43617 Add option to re-enable ˋlibstdc++ˋ on avr targets.
Due to the small flash space on AVR devices the library containing the
standard types in C++ (ˋlibstdc++ˋ) does not get built normally when
enabling the C++ language support.

This option is an easy way to go back to the PC-way where ˋlibstdc++ˋ is
built.

Signed-off-by: Quentin Boswank <qubos@outlook.de>
2023-08-14 16:12:12 +12:00
Kirill K. Smirnov
ada71ff2a0 Properly build multilib bare-metal RISC-V
To build multilib RISC-V toolchain one should use --with-multilib-generator
option instead of --with-multilib-list.

Add corresponding example configuration file.

Signed-off-by: Kirill K. Smirnov <kirill.k.smirnov@gmail.com>
2023-07-14 14:01:08 +12:00
Timo Rothenpieler
0160064f00 Add default msvcrt options for mingw-w64
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2023-06-04 10:03:32 +12:00
Maksim Morozov
e9cd702a9f gdb: Static cross GDB is linked statically with std c++ library
If static cross GDB configuration is selected, cross GDB will be linked
statically with std c++ library, because there is no separate option for
static std c++ library for cross GDB.
The use of not existing variable CT_GDB_NATIVE_STATIC_LIBSTDC has been
replaced with CT_GDB_NATIVE_STATIC_LIBSTDCXX.

Signed-off-by: Maksim Morozov <maxim.morozov.a@gmail.com>
2023-05-31 20:20:32 +12:00
Yuriy Kolerov
1f1107feff gdb: Use a relative includedir for native gdb and gdbserver
Use a relative path for include directory if gdb or gdbserver
is being built and installed for a target. Otherwise headers
are installed in ${destdir}${CT_HEADERS_DIR} - a concatenation
of ${destdir} and an absolute path to sysroot's include directory.
As a result debug-root may contain wrong paths for includes.

Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
2023-05-28 09:29:36 +12:00
Yuriy Kolerov
f283bb6b1a mpfr: Add support of building MPFR for target
It's necessary for building native GDB 13+. It depends
on MPFR but it hasn't presented in scripts yet for building
for target.

Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
2023-05-19 15:54:16 +12:00
Yuriy Kolerov
65e5960a39 gdb: Fix extra config variable name for native GDB
Variable native_extra_config must be used for configuration
options instead for extra_config for native GDB.

Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
2023-05-19 15:53:17 +12:00
Yuriy Kolerov
ce6467faa1 newlib: Add missing linker options for nano.specs
Old options %(newlib_nano_link) for the linker must be passed
otherwise linking may fail. E.g., in case of multilib
configurations a correct emulation mode may be not passed.

Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
2023-05-10 17:30:15 +04:00
Keith Packard
c33c2bf04e picolibc: Allow default memory layout values to be configured
These values are used when constructing the default linker scripts
used with picolibc. Setting reasonable defaults allows simple test
applications to be compiled without additional configuration.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-19 15:13:55 +12:00
Keith Packard
06faf2002e picolibc: Don't disable libstdc++ wchar_t for 1.8.1 or newer
Picolibc 1.8.1 has wchar_t stdio support, so libstdc++ can include
it.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-04-19 15:13:55 +12:00
Bryan Hundven
db942c3d0d Add option for experimental bundled patches
This adds 3 new options to patch order:
* bundled + bundled_exp
* bundled + bundled_exp + local
* local + bundled + bundled_exp

The path for bundled experimental patches is: ${CT_LIB_DIR}/packages/${pkg_dir}/experimental
and patches that are still being reviewed, but not yet applied upstream
may be toggled with ENABLE_EXPERIMENTAL_BUNDLED_PATCHES.

Also fix modelines for editors on bootstrap and scripts/functions, and
fix mix whitespace in scripts/functions.

Closes: #1916

Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
2023-03-16 16:54:22 +13:00
Chris Packham
711e7bc114 binutils: Add binutils 2.40
https://sourceware.org/pipermail/binutils/2023-January/125671.html

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2023-03-08 16:54:34 +13:00