Commit Graph

1599 Commits

Author SHA1 Message Date
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
Chris Packham
5d2b316093 binutils: Allow gold for more architectures
Based on the configure.ac for binutils it appears that arm, loongarch,
mips, powerpc, s390, sparch and x86 are supported. Expand the list of
architectures that gold is allowed to be used on.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2024-07-29 13:12:59 +12:00
Chris Packham
a211eaefd1 gdb: Add gdb 15.1
https://sourceware.org/pipermail/gdb-announce/2024/000140.html

The release notes state that "Building GDB and GDBserver now requires a
C++17 compiler (for instance, GCC 9 or later)". Looks like we already
satisfy this requirement with GDB_DEP_NO_STD_FUTURE.

gdbserver now has a dependency on iconv.h, for uclibc configurations we
need to make sure this is satisfied.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2024-07-24 10:45:07 +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
Chris Packham
e58fd0a23e musl: Mark not EXPERIMENTAL
Musl was marked experimental in commit 08d91d41 ("musl: config is broken
for !EXPERIMENTAL"). Most of the reasoning for that change no longer
applies and as it's been about 8 years it's time to let musl loose on
the world. Drop the `depends on EXPERIMENTAL` and update the sample
configs for aarch64 and x86_64.

For powerpc64 the ABI needs to be elfv2. Enforce this via the powerpc
config.  Add a sample configuration for powerpc-unknown-linux-musl.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2024-05-24 10:14:13 +12:00
Chris Packham
2d9e263d1f glibc: Disable -Werror for GCC14
Current glibc versions don't compile without warnings with GCC14.
Disable -Werror for glibc when using GCC14.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2024-05-18 15:45:55 +12:00
Chris Packham
6d46c9e2c5 Remove configure time check for rsync
Now that we're checking for rsync in Kconfig we can remove the check
from ./configure.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2023-12-18 16:28:14 +13:00
Chris Packham
4442dc87dd config: Detect rsync presence at config time
Linux kernel versions newer than 5.3 require rsync in order to export
the UAPI headers. Commit f441a6bf ("linux: Add dependency on rsync for
Linux >= 5.3") attempted to address this with a check that runs when
crosstool-ng is built. That had the downside that if crosstool-ng was
built and packaged on a machine that had rsync then run on a machine
that didn't then the build would fail due to the missing rsync.
Conversely if the first machine didn't have rsync installed when
crosstool-ng was built then we would not offer newer kernel versions.

We can address this by checking for rsync when the toolchain
configuration is updated using some functionality in the newer Kconfig
that we've updated to previously.

Fixes #1940
Signed-off-by: Chris Packham <judge.packham@gmail.com>
2023-12-18 16:28:14 +13:00
Chris Packham
3758304b01 config/arch: Mark hppa/parisc as experimental
There are a number of things that don't currently work notably uClibc,
C++ and GDB. Mark this architecture as experimental.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
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
Chris Packham
12dd99421c m68k: Support MMU
Some m68k variants do have a MMU so the architecture can set
ARCH_USE_MMU. That means we can have a m68k-unknown-linux-gnu
configuration and that m68k-unknown-uclinux-uclibc needs to select
LIBC_UCLIBC_NG since it's no longer the default.

Fixes #2040
Signed-off-by: Chris Packham <judge.packham@gmail.com>
2023-09-24 16:15:09 +13:00
Chris Copeland
f22be3a625 allow plugins and LTO with static toolchains
This reverts commit 0841e2f820 from 2011,
which disabled plugin support in binutils for static toolchains, citing
build system problems. This problem seems to be resolved.

This also reverts part of 45512b003d from
2017, which disabled LTO in gcc for static toolchains, citing problems
on Arch Linux with loading the LTO plugin from a static binary.

Signed-off-by: Chris Copeland <chris@chrisnc.net>
2023-09-24 16:11:41 +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
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
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
Chris Packham
cd8a5b72b5 Revert "libc/uclibc: Require GCC12 or older"
This reverts commit 5427dac45c. The issues
that were causing this have been resolved with some updates so allow the
uclibc+gcc13 combination again.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2023-08-13 11:15:29 +12:00
Chris Packham
e63c40854c provide a workaround for a glibc and GNU make incompatibility
Versions of GNU make newer than 4.4 trigger a hang in versions of glibc
older than 2.31. As distros update to the newer GNU make version we'll
start seeing more and more reports of this hang. Fortunately we already
carry GNU make as a comp tool so all we need to do is select the right
version when needed.

Fixes #1946, #1932, #1975
Signed-off-by: Chris Packham <judge.packham@gmail.com>
2023-07-21 16:47:34 +12:00
Thomas Petazzoni
bedec42b53 Revert "Update requirements: autoconf==2.71 and automake>=1.16"
This reverts commit 658f5e574f, which
was made without any justification, and prevents using crosstool-ng
even in decently recent distributions like Ubuntu 20.04 (which has
autoconf 2.69).

We have tested that ./bootstrap && ./configure --enable-local works
fine on Ubuntu 18.04, which uses autoconf 2.69 and automake 1.15, so
the existing requirements were enough.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2023-07-21 16:46:59 +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
Chris Packham
227d99d7f3 newlib: add 4.3.0.20230120
Add the 4.3.0.20230120 and update the required patches. As of this
release the newlib-global-atexit is mandatory so set this to default y.
Included is an upstream patch to support older GCC versions.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2023-06-04 10:04:33 +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
Yuriy Kolerov
a8cef5773e gdb: Make native GDB 13+ dependent on MPFR
GDB 13+ depends on MPFR thus it must be selected.

Signed-off-by: Yuriy Kolerov <ykolerov@synopsys.com>
2023-05-19 15:54:16 +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
Chris Packham
584b25da7a glibc: Disable -Werror with GCC13 and glibc <2.37
GCC13 picks up some new errors on older glibc versions. Disable -Werror
automatically when these combinations are selected.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2023-05-14 10:35:14 +12:00
Chris Packham
5427dac45c libc/uclibc: Require GCC12 or older
Currently uclibc configurations fail to build with GCC13

 src/gcc/libstdc++-v3/src/c++17/floating_from_chars.cc: In function 'std::from_chars_result std::from_chars(const char*, const char*, _Float128&, chars_format)':
 src/gcc/libstdc++-v3/src/c++17/floating_from_chars.cc:1281:10: error: 'from_chars_strtod' was not declared in this scope
     1281 |   return from_chars_strtod(first, last, value, fmt);
          |          ^~~~~~~~~~~~~~~~~
    make[6]: *** [Makefile:587: floating_from_chars.lo] Error 1
    make[6]: *** Waiting for unfinished jobs....

For now require GCC older than 13 when using uclibc.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2023-05-14 10:35:14 +12: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
James Knight
b42079e92a config/arch/x86: enable libsanitizer
GCC's libsanitizer module does provide a subset of support for x86
targets (e.g. libasan). GCC's `libsanitizer/configure.tgt` file only
outlines flags for optional sanitizers.

Signed-off-by: James Knight <james.d.knight@live.com>
2023-04-13 11:15:49 +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
Joakim Nohlgård
1a362b5607 picolibc: Add configuration to select picolibc as the system libc
This moves the picolibc configuration values under C-library -> picolibc
so that they will be more easily discovered.

Signed-off-by: Joakim Nohlgård <joakim@nohlgard.se>
2023-03-08 16:54:12 +13:00
Keith Packard
287fccb8bc gcc: Don't set --enable-default-pie by default
This changes how existing crosstool-ng setups work, causing many of
the bare-metal ones to fail.

Signed-off-by: Keith Packard <keithp@keithp.com>
2023-02-27 16:31:18 +13:00
Quentin Boswank
4cba299460 Add zstd to the companion libs
Add zstd to the companion libs witch allows to use lto zstd compression
in a canadian or cross-native enviroment

Signed-off-by: QBos07 <62326551+QBos07@users.noreply.github.com>
Signed-off-by: Quentin Boswank <62326551+QBos07@users.noreply.github.com>
2023-02-08 17:13:42 +13:00
Bryan Hundven
aa6cc4d7f1
Merge pull request #1763 from cpackham/tarball
Add option to build toolchain tarball
2023-01-16 11:11:52 -08:00
Marc Poulhiès
cdae8d0559 Enable support for building libgccjit
libgccjit is still under development and, despite its name, may also be used for
ahead-of-time compilation.

Documentation can be found on the gcc website:
https://gcc.gnu.org/onlinedocs/jit/internals/index.html
https://gcc.gnu.org/wiki/JIT

With this change it's possible to enable the building of the libgccjit. It's
enabled as a language (with --enable-languages=jit) even if not a language
frontend at all.

The main changes are related to the requirement of having everything host side
built as Position Independent Code (PIC) with --enable-host-shared. GCC has the
needed logic for building its dependencies (mpc, gmp, mpfr, ...) correctly when
built "in-tree", which is not the case with crosstool-ng (see
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=05048fc29f0)

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2022-12-18 21:20:50 +13:00
Cupertino Miranda
db4b7179ed Add BPF architecture target support
BPF is a virtual machine and associated ISA that resides in the Linux
kernel.  Initially intended for user-level packet capture and filtering,
BPF is nowadays generalized to serve as a general-purpose infrastructure
also for non-networking purposes.

Signed-off-by: Cupertino Miranda <cupertino.miranda@oracle.com>
2022-12-14 17:11:02 +13:00
Joakim Nohlgård
4b60bea2e9 gcc: Disable CC_GCC_ENABLE_DEFAULT_PIE on RISC-V bare metal builds
-pie is not supported on riscv*-elf-ld

Signed-off-by: Joakim Nohlgård <joakim@nohlgard.se>
2022-12-11 18:41:51 +13:00
Marc Poulhiès
20e33c9ec9 Correct casing for Ada lang
Ada is a name, not an acronym, so it doesn't need to be upcased.

Signed-off-by: Marc Poulhiès <dkm@kataplop.net>
2022-11-09 20:35:46 +13:00
Bryan Hundven
658f5e574f Update requirements: autoconf==2.71 and automake>=1.16
Signed-off-by: Bryan Hundven <bryanhundven@gmail.com>
2022-10-27 21:28:42 +13:00
Dries Deschout
61c4ccac5c binutils: add option to build libopcodes for target
It provides functionality to disassemble executable binaries.

Signed-off-by: Dries Deschout <dries.deschout@dodeco.eu>
2022-10-02 13:07:42 +13:00
Dimitar Dimitrov
411b052361 avr,pru: Disable CT_CC_GCC_ENABLE_DEFAULT_PIE
PIE is not supported by PRU and AVR backends for GCC.

This fixes LD errors when trying to link user programs with a
crosstool-NG toolchain:

  /home/dinux/x-tools/avr/lib/gcc/avr/12.2.0/../../../../avr/bin/ld: -pie not supported
  collect2: error: ld returned 1 exit status

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2022-09-26 10:47:31 +13:00
Like Ma
a9f77be56f Add CC_GCC_ENABLE_DEFAULT_PIE
Enable Position Independent Executable as default

Pass --enable-default-pie to crossgcc's configure

Signed-off-by: Like Ma <likemartinma@gmail.com>
2022-08-19 22:02:11 +12:00
Jiajie Chen
e840986fa4 loongarch64: add initial loongarch support
This commit adds architecture support for LoongArch.

The toolchain currently only supports the 64-bit target
loongarch64-unknown-linux-gnu.

It has been tested to build with GCC 12.1, GDB 12.1, Glibc 2.36, Linux
5.19 and Binutils 2.39 as of Aug 2022.

Signed-off-by: Jiajie Chen <c@jia.je>
2022-08-19 22:01:34 +12:00
Like Ma
55d8c43333 Select KERNEL_SUPPORTS_SHARED_LIBS on Windows
Fix building MinGW only generating libstdc++.a

Signed-off-by: Like Ma <likemartinma@gmail.com>
2022-08-19 22:00:58 +12:00
Chris Packham
29b6e00368 binutils: Add binutils 2.39
https://sourceware.org/pipermail/binutils/2022-August/122246.html

Add binutils 2.39 and regenerate patches.
0008-binutils-2.38-vs.-ppc32-linux-kernel.patch is dropped as it has
been applied upstream. Add a milestone for 2.39 which will be handy for
Loongarch.

Binutils now requires bison >= 3.0.4 to build gprofng for x86/aarch64 so
we build our own bison when the host bison does not meet that
requirement (which appears to be the case on macOS).

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2022-08-14 10:15:17 +12:00
Norbert Lange
ee635cdf9a Fixes for libstdcxx-verbose option tristate
Make it proper "tristate" by not specifying the
option.

The config GCC_4_8_or_later was removed with
cc6b7fad46, so dont use it.
2022-07-11 19:50:29 +12:00
Chris Packham
f5e0d33ab4 Allow libsanitizer on architectures that support it
libsanitizer is only supported on selected architectures. Add
ARCH_SUPPORTS_LIBSANITIZER and have architectures select this option
based on the list of supported configurations from GCC's
libsanitizer/configure.tgt. Support for mips64 was added in GCC12 so
this is an additional condition for the mips architecture.

Fixes #1733

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2022-07-11 19:49:23 +12:00
Chen Tao
75c8a08a3a newlib: fix conflicting configure options
Configuring the newlib with "--enable-newlib-nano-formatted-io" and
"--enable-newlib-io-pos-args" would cause built GCC cannot compile some
IO functions like "std::cout".

And I added additional notes at Nano Formatted I/O config.

Signed-off-by: Chen Tao <t.clydechen@gmail.com>
2022-06-28 20:54:26 +12:00
Chen Tao
c368525d5b kconfig: modify rules for multilibs configuration
fix conflict options when compiling multilibs on ARM based architecture.
"--with-arch", "--with-cpu", "--with-fpu", "--with-float", and
"--with-mode" should not be configured with "--with-multilib-list=list"
when configuring multilibs.

Signed-off-by: Chen Tao <t.clydechen@gmail.com>
2022-06-28 20:53:01 +12:00
Guillermo E. Martinez
8a1ef66776 glibc: configure adding debug symbols in glibc build
After building the cross toolchain and compile a simple C program,
objdump reports debug information even though -g modifier was not
used. These debug segments are in glibc library and CRT files. So
a new config entry: CT_GLIBC_ENABLE_DEBUG was added to control when
we want to add debug information to glibc, by default is enabled.

Signed-off-by: Guillermo E. Martinez <guillermo.e.martinez@oracle.com>
2022-06-21 20:33:34 +12:00