Commit Graph

5457 Commits

Author SHA1 Message Date
Christopher Friedt 5dfdb4b04f libc: add option for c11 threads
Add a config option for C11 threads.

Signed-off-by: Christopher Friedt <chris@friedt.co>
2024-03-27 21:23:27 +09:00
Chris Friedt 822807ab6b expat: Update to expat-2.5.0
- expat-2.4.1 is not available on sf.net due to vulnerabilities
- mark expat-2.4.1 as obsolte
- add expat-2.5.0 version info

Signed-off-by: Chris Friedt <cfriedt@meta.com>
(cherry picked from commit 4820c7f8d632639564284a9eda077dac5f955132)
2022-11-30 21:40:25 +09:00
Keith Packard 8621eab307 picolibc: Add 'objcopy' to list of target-specific binaries
The x86_64 build uses objcopy, and if that is run in a cross-build environment, the
native version will not work. Use the target-specific name instead.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-11-30 11:29:20 +09:00
Chris Packham c6d4008b05 zlib: Replace sourceforge mirror with github
New zlib versions aren't being published on sourceforge. Use the github
mirror instead.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
(cherry picked from commit 82346dd7dfe7ed20dc8ec71e193c2d3b1930e22d)
2022-11-23 17:24:14 +09:00
Chris Packham 16a7ca1926 zlib: Update to zlib-1.2.13
Brings in the following changes

- Fix a bug when getting a gzip header extra field with
  inflateGetHeader(). This remedies CVE-2022-37434.
- Fix a bug in block type selection when Z_FIXED used. Now the smallest
  block type is selected, for better compression.
- Fix a configure issue that discarded the provided CC definition.
- Correct incorrect inputs provided to the CRC functions. This mitigates
  a bug in Java.
- Repair prototypes and exporting of the new CRC functions.
- Fix inflateBack to detect invalid input with distances too far.

Mark zlib-1.2.12 as obsolete.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
(cherry picked from commit 878a16a13af1024356f2aa623ef7419ec82d4d76)
2022-11-23 17:24:14 +09:00
Keith Packard 1a542947f6 Strip picolibc libraries
As these are not installed in the usual lib directory, the library
stripping option doesn't catch them. Add explicit steps in the
picolibc build script to perform this task.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-08-22 17:01:55 +09:00
Keith Packard 360e38ea22 packages: Update picolibc to 1.7.8
Signed-off-by: Keith Packard <keithp@keithp.com>
2022-08-17 02:47:55 +09:00
Stephanos Ioannidis b6b22fd403 cross-gdb: Add Guile scripting support configuration
This commit adds a new configuration for enabling the GNU Guile
scripting support through the libguile.

Note that this configuration is not enabled by default because it is a
niche feature and requires the libguile, which is currently not built
by the crosstool-ng for the host (gdb also keeps this feature disabled
by default unless libguile is available for the host).

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-07-04 22:04:04 +09:00
Stephanos Ioannidis d464929918 cross-gdb: Add LZMA support configuration
This commit adds a new configuration for enabling the LZMA compression
support through the liblzma, which is required by the GDB's "mini
debuginfo" feature.

Note that this configuration is not enabled by default because it is a
niche feature and requires the liblzma, which is currently not built by
the crosstool-ng for the host (gdb also keeps this feature disabled by
default unless liblzma is available for the host).

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-07-04 22:04:04 +09:00
Stephanos Ioannidis 0a0c42d75a scripts: build: Discard more debug sections when stripping libraries
This commit updates the build script to strip additional debug sections
added by the Binutils 2.38 when stripping the target libraries.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-06-15 13:20:14 +09:00
Chris Packham bc3c514822 configure.ac: bison is required for kconf
Make the requirement for bison harder (but not strict). The system bison
will be used to build kconf. If the system bison is not GNU bison 2.7 or
later crosstool-ng will build GNU bison as a companion tool if necessary
(for glibc 2.29 or newer).

Fixes #1621
Signed-off-by: Chris Packham <judge.packham@gmail.com>
(cherry picked from commit a3e3d734a7d138d8bae6014a71cdda07a70901a5)
2022-06-13 19:04:50 +09:00
Chris Packham dcf088c420 gcc: Disable zstd for canadian builds
We don't currently bundle zstd so when performing a canadian build we
need to tell GCC not to enable zstd support for lto otherwise it might
decide to enable it based on the package being installed on the build
machine.

Fixes #1718
Signed-off-by: Chris Packham <judge.packham@gmail.com>
(cherry picked from commit f6d3f498f06a8904dd49a82fc26567dd5a8ed60f)
2022-06-13 19:04:50 +09:00
Chris Packham 966588d13b glibc: rework GLIBC_ENABLE_WERROR
Use `depends on` conditions to enable/disable building glibc with
-Werror. Using `depends on` instead of `default if` means that when the
GCC/GLIBC selection changes GLIBC_ENABLE_WERROR will automatically
become n.

Fixes #1729, fixes #1712
Signed-off-by: Chris Packham <judge.packham@gmail.com>
(cherry picked from commit a321a0b892e3bc48d0f2ae559c2e763c55486e3e)
2022-06-13 19:04:50 +09:00
Chris Packham 1ac9874b5f gcc: drop libsanitizer patch for GCC12
For some reason GCC 12 ends up hitting the _MIPS_SIM_NABI32 case for
Linux's arch/mips/include/uapi/asm/stat.h when building libsanitizer.
This is basically the opposite of the problem from
commit 1b6ad7cd ("gcc: Bring in fix for libsanitizer on mips64").
Dropping the patch resolves the issue for GCC 12.

Fixes #1741
Signed-off-by: Chris Packham <judge.packham@gmail.com>
(cherry picked from commit 23580a86aaabe601539cb1470bdfbca5513a1ac4)
2022-06-13 19:04:50 +09:00
Chris Packham 64c142e57c gcc: Add 12.1
Add GCC 12.1 https://gcc.gnu.org/gcc-12/

The following patches from GCC 11.3.0 are no longer needed:
- 0005-arc-Update-ZOL-pattern.patch
- 0006-arc-Update-u-maddhisi4-patterns.patch
- 0007-arc-Fix-maddhisi-patterns.patch
- 0008-Darwin-aarch64-Initial-support-for-the-self-host-dri.patch
- 0009-libstdc-Check-for-TLS-support-on-mingw-cross-compile.patch

One new patch is needed to avoid issues building sh-unknown-elf:
- 0006-sh-Avoid-mb-m1-multilib-combination.patch

It is also necessary to build all-build-libcpp. This target exists as
far back as GCC 6 so has been done unconditionally.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
(cherry picked from commit db6f703f52e33a5791c5c2728fa1e3a330a08e98)
2022-06-13 19:04:50 +09:00
Chris Packham 2bdfd25f0e gdb: Add 12.1
Add gdb 12.1 release.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
(cherry picked from commit 5937024455082dd57f94d9b20c034907d3e9e545)
2022-06-13 19:04:50 +09:00
Derald D. Woods 828b511fc8 scripts/build/companion_libs: Fix missing directory with newlib-nano
With 'CT_NEWLIB_NANO_INSTALL_IN_TARGET=y', this build failure occurs:
----------------------------------------------------------------------
[...]
[INFO ]  Installing Newlib Nano library
[EXTRA]    Configuring Newlib Nano library
[EXTRA]    Building Newlib Nano C library
[EXTRA]    Installing Newlib Nano C library
[INFO ]  Installing Newlib Nano library: done in 110.66s (at 29:04)
[INFO ]  =================================================================
[INFO ]  Installing libstdc++ newlib-nano
[EXTRA]    Configuring libstdc++ for newlib-nano
[EXTRA]    Building libstdc++ newlib-nano library
[EXTRA]    Installing libstdc++ newlib-nano library
[EXTRA]    Housekeeping for core gcc compiler
[EXTRA]       '' --> lib (gcc)   lib (os)
[EXTRA]       ' -mthumb' --> lib/thumb (gcc)   lib/thumb (os)
[EXTRA]       ' -marm -mfpu=auto -march=armv5te+fp -mfloat-abi=hard' --> lib/arm/autofp/v5te/fpu (gcc)   lib/arm/autofp/v5te/fpu (os)
[EXTRA]       ' -mthumb -mfpu=auto -march=armv7+fp -mfloat-abi=hard' --> lib/thumb/autofp/v7/fpu (gcc)   lib/thumb/autofp/v7/fpu (os)
[INFO ]  Installing libstdc++ newlib-nano: done in 457.12s (at 36:42)
[ERROR]
[ERROR]  >>
[ERROR]  >>  Build failed in step '(top-level)'
[ERROR]  >>
[ERROR]  >>  Error happened in: CT_DoExecLog[scripts/functions@376]
[ERROR]  >>        called from: newlib_nano_copy_multilibs[scripts/build/companion_libs/350-newlib_nano.sh@270]
[ERROR]  >>        called from: CT_IterateMultilibs[scripts/functions@1608]
[ERROR]  >>        called from: do_newlib_nano_for_target[scripts/build/companion_libs/350-newlib_nano.sh@254]
[ERROR]  >>        called from: do_companion_libs_for_target[scripts/build/companion_libs.sh@43]
[ERROR]  >>        called from: main[scripts/crosstool-NG.sh@697]

Current command:
   'cp' '-f' '/build/toolchain/arm-none-eabi/newlib-nano/arm-none-eabi/lib/thumb/libc.a' '/build/toolchain/arm-none-eabi/arm-none-eabi/lib/thumb/libc_nano.a'
exited with error code: 1
Please fix it up and finish by exiting the shell with one of these values:
    1  fixed, continue with next build command
    2  repeat this build command
    3  abort build
----------------------------------------------------------------------

This commit calls 'mkdir -p' to create the destination path before
copying.

Signed-off-by: Derald D. Woods <woods.technical@gmail.com>
(cherry picked from commit 396f23d3dee16a55e0da0ed985dab1c94c2e57a9)
2022-06-13 19:04:50 +09:00
Joel Holdsworth 08455989d7 cc/gcc: Create liblto_plugin symbolic link with correct extension
Previously, cc/gcc.sh assumed that liblto_plugin would always be
installed with the ".so" file extension. However, this assumption is
incorrect when the host machine is Windows (".dll") or MacOS (".dylib").

This patch corrects this issue by probing the file extension in similar
fashion to the way adjacent code determines the file extension of
executable binaries.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
(cherry picked from commit fd694dde63635183a0496600e40e7930060f1cb0)
2022-06-13 19:04:50 +09:00
Joel Holdsworth 27d664dca1 cc/gcc: Ensure value of ext is always set
The "ext" variable is set with the file extension of executable binaries
for a given platform. To improve tidiness, this patch ensures the
variable is always set even when there is no file path.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
(cherry picked from commit d10a4318ace8f0e668e23b919195d63a9478171c)
2022-06-13 19:04:50 +09:00
Joel Holdsworth 278f9e6761 cc/gcc: Declare "file" and "ext" variables local
In do_gcc_core_backend and do_gcc_backend, variables "file" and "ext"
are used to store intermediate values. Previously, these were not
declared local. This patch corrects this issue.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
(cherry picked from commit d8249832033d63756c902b50594084df58d73c65)
2022-06-13 19:04:50 +09:00
Joel Holdsworth dde60c30f8 cc/gcc: Remove -lstdc++ and -lm from gcc LDFLAGS
In Bryan Hundven's patch 1ad439907 from 2010, the author added -lstdc++
and -lm to the host gcc build's LDFLAGS, because at the time the linker
did not correctly include these libraries causing the build to fail.

In modern builds, this causes a problem for canadian gcc builds where
the host machine is mingw32-w64 Windows.

Within the gcc build there is the liblto_plugin module. On Windows this
must be built as the "liblto_plugin.dll" dynamic library. However,
libtool cannot produce a dynamic library unless every library dependency
is also a dynamic library, and falls back to producing a libstdc++.a
static library. liblto_plugin does not require libstdc++ - it
does not contain any C++ code, and the dependency would usually be
elided by the linker.

Unfortunately, in this case, crosstool-ng will never build a
libstdc++.dll dynamic library - only a libstdc++.a static library.
Therefore, there will never be a dynamic library version of stdc++ for
libtool to load and then discard.

This patch corrects the issue by removing "-lstdc++" from LDFLAGS,
because modern versions of gcc are able to correctly include libstdc++
where necessary. It also remove "-lm" for similar reasons.

Signed-off-by: Joel Holdsworth <jholdsworth@nvidia.com>
(cherry picked from commit da1ffd041276ad87787be0c5cbcd7841082e3619)
2022-06-13 19:04:50 +09:00
Chris Packham 897307b971 mpfr: Update vcs URL
The mpfr project is now using git. Update the repository field
accordingly.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
(cherry picked from commit fcea8e33acd39caa9f3a5cf33986d893ee641177)
2022-06-13 19:04:50 +09:00
Chris Packham 18a5659f64 gcc: Update vcs URL
The GCC project has been using git for a while now. Update the
repository field accordingly.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
(cherry picked from commit aa46366fc3e074d6aaba2aa9c590c2e67ca01d98)
2022-06-13 19:04:50 +09:00
Stephanos Ioannidis 60ccacd17f gdb: Build additional Python scripting-capable variant
This commit adds an option to build an additional gdb variant (gdb-py)
that supports Python scripting.

When this option is enabled, the default gdb variant (gdb) does not
link against libpython; instead, an additional Python-capable gdb
variant executable (gdb-py) that links against libpython is built.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-06-13 03:29:13 +09:00
Stephanos Ioannidis af24333e70 gdb: Refactor cross GDB build step
This commit moves the cross GDB build step out to a separate function
so that it can be invoked more than once.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-06-13 03:29:13 +09:00
Stephanos Ioannidis 50f8639849 newlib-nano: Fix include path for CT_NEWLIB_NANO_INSTALL_IN_TARGET
When `CT_NEWLIB_NANO_INSTALL_IN_TARGET=y`, the `nano.specs` file
emitted by the newlib-nano build script contains an invalid include
path, resulting in the full `newlib.h` being included instead of the
nano `newlib.h` by the application.

`=/include/newlib-nano` is not a valid path (`=` does not mean anything
and that string is taken as an include path as-is) and GCC ignores this
include path, resulting in application including the `newlib.h` from
`include/` which contains the newlib build configurations for the full
newlib.

This commit modifies the newlib-nano build script to emit a proper
newlib-nano include path relative to the `GCC_EXEC_PREFIX`.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-05-11 15:27:02 +09:00
Stephanos Ioannidis 3651504288 gdb: Add CT_GDB_CROSS_STATIC_LIBSTDCXX configuration
This commit adds a new configuration `CT_GDB_CROSS_STATIC_LIBSTDCXX`,
which enables static linking of libstdc++ and libgcc for the cross-gdb
running on the host.

This configuration is enabled by default because using shared "standard
libraries" can often cause compatibility problems when distributing
toolchain binaries and it is therefore highly desirable to always
static-link them.

Note that this behaviour aligns with other similar symbols such as
`CT_CC_GCC_STATIC_LIBSTDCXX` and `CT_GDB_NATIVE_STATIC_LIBSTDCXX`.

For macOS, GDB is built using the Clang compiler, which is the default
compiler for the macOS hosts, and `libstdc++` and `libgcc` are not
applicable for obvious reasons.

Since macOS provides a fairly well known and controlled execution
environment, there is little point in static linking the C++ runtime
library.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-05-11 15:25:11 +09:00
Alexey Brodkin bc1f47c603 ARC64: Add support for arc64 target
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-05-11 14:47:22 +09:00
Stephanos Ioannidis ee3d85da49 scripts: build: Discard locals when stripping target libraries
Some target libraries (e.g. newlib for RISC-V) may contain local
symbol information when built with the `-g` flag.

This commit adds the `--discard-locals` flag to discard all the
unnecessary local symbols from the object files.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-05-11 14:47:22 +09:00
Stephanos Ioannidis b29c14814e scripts: Allow stripping target toolchain libraries
This commit adds an option to strip the target toolchain libraries
(e.g. libc, libstdc++) of any unneeded or debugging information.

Stripping is enabled by default as it is often desirable to reduce the
overall toolchain size when producing a release.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-05-11 14:47:19 +09:00
Johan Levin 8fa98eeeff populate: Include dependencies of PIE executables
Modern versions of the 'file' utility give different output for position
dependent and position independent executables. The populate tool should
consider both types.

Signed-off-by: Johan Levin <johan13@gmail.com>
2022-05-08 09:48:44 +12:00
Dima Krasner b6887d346f scripts/functions: collect license files named COPYRIGHT*
Signed-off-by: Dima Krasner <dima@dimakrasner.com>
2022-05-03 20:53:36 +12:00
Chris Packham 7e21141973 glibc: Enable -Werror for more combinations of GCC/GLIBC
Newer GCC versions trigger warnings on older GLIBC versions. GLIBC 2.29
is warning free with GCC9. GLIBC 2.31 is warning free with GCC10. GLIBC
2.34 is warning free with GCC11.

Add milestones for 2.31 and 2.34 and use those to set the default value
for GLIBC_ENABLE_WERROR based on the GCC version.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2022-05-01 12:02:54 +12:00
Chris Packham dd4d19fce2 zlib: Update to zlib-1.2.12
Bring in the following changes

- Fix a deflate bug when using the Z_FIXED strategy that can result in
  out-of-bound accesses.
- Fix a deflate bug when the window is full in deflate_stored().
- Speed up CRC-32 computations by a factor of 1.5 to 3.
- Use the hardware CRC-32 instruction on ARMv8 processors.
- Speed up crc32_combine() with powers of x tables.
- Add crc32_combine_gen() and crc32_combine_op() for fast combines.

Drop two patches that have been applied upstream and regenerate the
remaining two.

Fixes #1708

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2022-04-22 10:15:41 +12:00
Elliot Saba 7f84b9ab92 [scripts/functions]: Fix quoting issue in comparison
On my Ubuntu machine (with `dash` version `0.5.10` and `bash` version `5.0.17`),
I would get errors such as the following:

```
crosstool-ng/scripts/functions: line 730: [: !=: unary operator expected
```

This is generally because a variable is not set, and expands to an empty string
causing the test operator to mis-parse the expression.  To fix this, I have
added quotes around the variable.

Signed-off-by: Elliot Saba <staticfloat@gmail.com>
2022-04-22 10:15:04 +12:00
Chris Packham 429e6d8e88 testing/docker: Add meson and ninja to containers
meson and ninja are needed to build picolibc.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2022-04-21 15:12:31 +12:00
Keith Packard 6ddf9e8dbf Update picolibc to 1.7.6
* Fixes 1.7.4 issue with recent meson versions which error on
  'descrption' typo.

* Positional parameters (%$1d) in printf/scanf

* Lots (and lots) of math library exception/errno fixes; now tested against
  glibc test suite.

Signed-off-by: Keith Packard <keithp@keithp.com>
2022-04-02 13:31:28 +13:00
Anton Maklakov 06120b97ff xtensa: Remove obsoleted CT_ARCH_XTENSA_CUSTOM_NAME 2022-04-02 13:31:07 +13:00
Chris Packham a8d2c2e1fa Enable posix threads in i686-w64-mingw32
Posix threads are enabled in the x86_64-w64-mingw32 sample having them
enabled in i686-w64-mingw32 makes things consistent for these targets.

Fixes #1696

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2022-04-02 13:30:46 +13:00
Anton Maklakov 6cd16639b9 gcc: add fixes for GCC 11.2. Anon and aggregated struct access 2022-03-28 21:01:58 +13:00
Anton Maklakov bfda65e00e gcc: rename patches to order 2022-03-28 21:01:58 +13:00
Chris Packham 1e47ca1e70 gcc: powerpc: Fix asm machine directive for some CPUs
Bring in upstream fix for gcc outputting an incorrect .machine
directive.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2022-02-28 20:59:33 +13:00
Chris Packham 0822a8a2e4 binutils: Bring in upstream fix for powerpc
Some versions of GCC emit a .machine directive near the start of the
compiler's assembly output that overrides the CPU passed on the command
line. Bring in an upstream change for binutils that works around the
problem.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2022-02-28 20:59:33 +13:00
Chris Packham 8ee3089202 kconfig: Use ncurses location determined by ./configure
Prior to commit bbc4db13 ("kconfig: Sync with upstream v4.18") we used
the macros CURSES_LOC and MENU_LOC to tell us where curses.h and menu.h
were installed. Restore this behaviour so that we can deal with some of
the odd places that the curses headers end up.

Fixes #1403

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2022-02-28 20:59:14 +13:00
ivanka2012 76d9b8c15c Fix MinGW libstdc++ TLS functionality
Backport of cc1e28878a

Signed-off-by: Kittenberger Iván <ivanka2012@gmail.com>
2022-02-28 20:58:55 +13:00
Norbert Lange ad3996a483 gcc: add gcc libstdcxx-verbose option
Rather important option for arm cortex toolchains supporting c++,
avoids pulling in all printf/iostream code by default.

Signed-off-by: Norbert Lange <nolange79@gmail.com>
2022-02-23 20:21:16 +13:00
Norbert Lange 2a856608e1 update mpc to 1.2.1
Signed-off-by: Norbert Lange <nolange79@gmail.com>
2022-02-23 20:20:55 +13:00
Norbert Lange 3300c879f8 Add isl 0.23
Signed-off-by: Norbert Lange <nolange79@gmail.com>
2022-02-23 20:20:55 +13:00
Norbert Lange c638767162 Update isl to 0.22.1
Signed-off-by: Norbert Lange <nolange79@gmail.com>
2022-02-23 20:20:55 +13:00
Chris Packham e2eb7d8587 binutils: Disable libdebuginfod when producing a static toolchain
libdebuginfod is incompatible with static linking so pass
--without-debuginfod when CT_STATIC_TOOLCHAIN is selected.

Fixes #1683

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2022-02-23 20:20:34 +13:00