Commit Graph

1286 Commits

Author SHA1 Message Date
Ivan Kukhta
8b4373d4ee Extend CC_GCC_LIBSSP with manual state
Signed-off-by: Ivan Kukhta <Ivan.Kukhta@acronis.com>
2021-03-17 13:50:45 +03:00
Alexey Brodkin
5171b3033a newlib-nano: Create symlinks for nano-suffixed libs
If existing board's .specs are used for linking of a user's application,
then instead of normally used libs like libc.a & libstdc++.a might be
requested their "nano"-suffixed siblings: libc_nano.a, libstdc++_nano etc.

That way:
----------------------------->8---------------------------
%rename link_gcc_c_sequence	myboard_link_gcc_c_sequence

*myboard_libc:
%{!specs=nano.specs:-lc} %{specs=nano.specs:-lc_nano}

*link_gcc_c_sequence:
%(myboard_link_gcc_c_sequence) --start-group %G %(myboard_libc) --end-group
----------------------------->8---------------------------

Our companion newlib-nano libs are all built optimized for size, so we'd like
to use them for linking. But given linker will see "-lc_nano -lstdc++_nano"
on its command line non-suffixed libs will be ignored.

To solve it we create those "_nano"-suffixed libraries as simple symlinks to
existing libs..

Fixes https://github.com/crosstool-ng/crosstool-ng/issues/1458.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2021-02-19 19:25:12 +03:00
Chris Packham
30316cd27a
Merge pull request #1448 from dinuxbg/master
Add PRU target configuration
2021-01-25 12:40:31 +13:00
Dimitar Dimitrov
e7d0485ca2 Add package with PRU linker scripts and headers
Include the gnuprumcu package in PRU cross toolchain.
Toolchain is somewhat useless without device specs and
linker scripts for the various SoCs.

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2021-01-19 21:18:55 +02:00
Dimitar Dimitrov
c800bc8c82 Add PRU cross tool target
Add sample configuration for building cross toolchain for the TI PRU.
PRU cores are present in many of the BeagleBone single board computers.

More information about the PRU can be found in https://bbb.io/pru

Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
2021-01-19 21:18:55 +02:00
Keith Packard
beb587a271 newlib-nano: Build libstdc++ against newlib-nano if requested
This uses the gcc support for building libstdc++ using alternate lib
header files.

Signed-off-by: Keith Packard <keithp@keithp.com>
2021-01-14 15:05:10 -08:00
Keith Packard
15e053fdc4 Create nano.spec file that sits atop the existing nano build
Signed-off-by: Keith Packard <keithp@keithp.com>
2021-01-14 15:05:10 -08:00
Keith Packard
945b4c6436 Add newlib-nano as companion lib
This allows building newlib-nano in addition to newlib and picolibc,
allowing users to select between C libraries within the same toolchain.

Signed-off-by: Keith Packard <keithp@keithp.com>
2021-01-14 15:05:10 -08:00
Chris Packham
e64318656c Merge branches 'elijahr-dtc-1.6.0', 'elijahr-readme-typo', 'foss-for-synopsys-dwc-arc-processors-abrodkin-libgmp-for-mac' and 'keith-packard-picolibc-companion' 2021-01-13 19:50:23 +13:00
Keith Packard
27b18d2fc7 picolibc: Build libstdc++ against picolibc if requested
This uses the gcc support for building libstdc++ using alternate lib
header files.

Signed-off-by: Keith Packard <keithp@keithp.com>
2021-01-11 23:29:01 -08:00
Keith Packard
43f5079382 gcc: Add support for building libstdc++ with alternate libc
This adds another mode to do_gcc_core_backend that builds libstdc++
against an alternate libc implementation.

Signed-off-by: Keith Packard <keithp@keithp.com>
2021-01-11 22:48:46 -08:00
Keith Packard
7e457684ea picolibc: Convert to companion library
This allows configurations to include picolibc without excluding
another C library.

Signed-off-by: Keith Packard <keithp@keithp.com>
2021-01-08 17:48:33 -08:00
Alexey Brodkin
1a65041dc0 libgmp: Fix cross-canadian build for macOS
Currently when building cross-canadian toolchain for macOS
the folowing error happens when GCC is configured:
|ld: illegal text-relocation to '___gmp_binvert_limb_table' in
|... /.build/... /buildtools/complibs-host/lib/libgmp.a(mp_minv_tab.o) from '___gmpn_divexact_1' in
|... /.build/... /buildtools/complibs-host/lib/libgmp.a(dive_1.o)
|collect2: error: ld returned 1 exit status

Apparently this might be solved with GMP configured with "--with-pic",
even though we're talking about static library here.

That solution was found here:
    https://github.com/Homebrew/homebrew-core/pull/25470

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2020-12-23 18:34:08 +03:00
Alexey Brodkin
b833f45259 gcc: Make it aware of Newlib nano IO feature
Even though GCC as a compiler has nothing to do with a C library
being used it still makes sense to know about Newlib's compact
implementation of IO functions:

 * For targets like MSP430 which require to have such a tuned
   Newlib if "-mtiny-printf" is passed to the GCC's command-line [1]

 * For correct compilation of the following GCC's own DejaGnu tests [2]:
     - gcc/testsuite/gcc.c-torture/execute/920501-8.c
     - gcc/testsuite/gcc.c-torture/execute/930513-1.c
     - gcc/testsuite/gcc.dg/torture/builtin-sprintf.c
     - gcc/testsuite/gcc.c-torture/execute/ieee/920810-1.x

[1] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=02afb6a9321fbfb435452636cedc2cd43f0c4fd2
[2] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=571bbd0d48d5872eacbd0b681fce6e1ae754520b

So we add that missing cross-dependency now.

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2020-12-23 17:54:03 +03:00
Chris Packham
a4231a555a
Merge pull request #1342 from DspHack/feature/add_support_for_ti_c6x
Experimental: Add support for the Texas Instruments C6X (TMS320C6000 …
2020-11-10 20:29:25 +13:00
Dan Tejada
3a3e645245 c6x: Remove multilib requirement
Restore tuple config check
     Add sample configuration

Signed-off-by: Dan Tejada <dan.tejada@cantada.com>
2020-11-02 16:21:26 -05:00
Chris Packham
beae27d87b arm: Disable context functions for Thumb
Similar to commit 57679b5e ("Disable context functions for Thumb") when
building for thumb we need to unset UCLIBC_HAS_CONTEXT_FUNCS.

Fixes #1397

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2020-11-01 21:17:50 +13:00
Chris Packham
827b42336e Merge branch 'xlocale' of git://github.com/lancethepants/crosstool-ng into lancethepants-xlocale 2020-11-01 20:01:58 +13:00
lancethepants
bc5798a8ea Don't remove XLOCALE support unconditionally.
Signed-off-by: Lance Fredrickson <lancethepants@gmail.com>
2020-10-15 13:59:04 -06:00
Alexey Brodkin
57f5909285 binutils: Disable glob for better portability
Since glibc 2.27 glob interface was changed [1]  and so
"glob" & "glob64" symbols require glibc 2.27+.

For us that means if we build Binutils on a machine with glibc 2.27+
produced binaries won't be any longer usable on machines with older
glibc.

As an example [2]: build on Ubuntu 18.04 (with glibc 2.27) and try to run
on CentOS 7.x (with glibc 2.17), you'll see this:
---------------------->8-------------------
ldd ld
ld: /lib64/libc.so.6: version `GLIBC_2.27' not found (required by ld)
---------------------->8-------------------

Now given glob is not really used by Binutils itself (only needed by GDB)
and we build Binutils & GDB separately let's make at least Binutils
more portable.

In theory we may even try to do the same hack for GDB forcing it to use
imported glob implementation. But since GDB is now built strictly by C++
compiler we'll get waaay to many incompatibilities due to multiple changes
of C++ ABI in between GCC 7.5 of Ubuntu 18.04 and GCC 4.8.5 of CentOS 7.x,
so there's no point to even try.

[1] https://sourceware.org/git/?p=glibc.git;a=commit;h=ccf970c7a77e86f4f5ef8ecc5e637114b1c0136a
[2] https://github.com/zephyrproject-rtos/sdk-ng/issues/280

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2020-10-14 23:10:47 +03:00
Chris Packham
99ce9d3861
Merge pull request #1400 from fvalette/fix-m4-build-for-mingw32-host
m4: fix build for mingw32 host
2020-10-07 20:03:16 +13:00
Florent Valette
1c93176e05 m4: fix build for mingw32 host
While building a canadian toolchain for windows host (any target),
the build failed for m4 host companion_tool with a recent mingw-w64
(at least 7.0.0).
m4 needs stack smashing protection which is not part of mingw-w64 c
library and an explicit trigger to link w/ libssp is needed.

Signed-off-by: Florent Valette <florent.valette@gmail.com>
2020-10-06 09:32:40 +02:00
Hans-Christian Noren Egtvedt
60e782fdec glibc: set glibc build system default_cflags empty
By setting glibc build system default_cflags to be empty before
building, we will enforce the build system to only use the crosstool-ng
CFLAGS when building glibc.

Properly solves the issue identified in #1396.

Signed-off-by: Hans-Christian Noren Egtvedt <hegtvedt@cisco.com>
2020-10-05 15:37:19 +02:00
Keith Packard
e802686d86 picolibc: Use target architecture to drive picolibc configuration
This selects code matching the target architecture within picolibc.

Signed-off-by: Keith Packard <keithp@keithp.com>
2020-09-16 16:04:51 -07:00
Keith Packard
c1c475d0a0 Map picolibc to suitable CT_TARGET_SYS values
picolibc is another bare-metal C library, and so should be mapped
to CT_TARGET_SYS just like newlib does.

Signed-off-by: Keith Packard <keithp@keithp.com>
2020-09-16 11:52:58 -07:00
Keith Packard
c15de32ec6 Add picolibc support [v2]
This adds support for using picolibc instead of newlib on embedded
systems.

Signed-off-by: Keith Packard <keithp@keithp.com>

v2:
	Add check for meson and ninja
	Sync option default values with current picolibc defaults
	Remove xtensa sys header file install as those aren't in picolibc
2020-09-01 09:42:53 -07:00
Stephanos Ioannidis
041427aec9 Enable static libgcc when CT_GDB_NATIVE_STATIC_LIBSTDCXX is set
This commit updates the GDB build script to specify `-static-libgcc`
when `CT_GDB_NATIVE_STATIC_LIBSTDCXX` is enabled. Both libgcc and
libstdc++ are considered to be part of the "standard libraries," and
should be specified by the same flag (the configuration symbol could
potentially use a better name and/or further indirection).

This also semantically aligns the `CT_GDB_NATIVE_STATIC_LIBSTDCXX`
with the equivalent GCC configuration `CT_CC_GCC_STATIC_LIBSTDCXX`,
which also enables static linking of both libgcc and libstdc++.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-05-26 16:34:31 +09:00
Stephanos Ioannidis
b07da3bb69 Fix CT_GDB_NATIVE_STATIC_LIBSTDCXX reference
This commit fixes an incorrect reference to the configuration
`CT_GDB_NATIVE_STATIC_LIBSTDCXX` in the GDB build script.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2020-05-26 16:25:20 +09:00
Dan Tejada
d532f02542 Experimental: Add support for the Texas Instruments C6X (TMS320C6000 series) DSPs
-- c6x: Add support for c6x product families to pass on to uClibC-ng
  -- c6x: Fix multilib support
  -- c6x: Add patch fix internal instruction error (GCC 57295)

Signed-off-by: Dan Tejada <dan.tejada@cantada.com>
2020-05-20 21:16:14 -04:00
Alexey Neyman
8606251585 Add --with-cpu= on 32-bit SPARC
... if building for GLIBC 2.31+.

Signed-off-by: Alexey Neyman <stilor@att.net>
2020-03-03 16:40:33 -08:00
Alexey Neyman
d978290f39 Set --with-cpu-{32,64} for multilib builds
GLIBC 2.31 needs --with-cpu=ultrasparc for both 32/64-bits now, and
--with-cpu only sets the CPU model for the "primary" bitness.

Signed-off-by: Alexey Neyman <stilor@att.net>
2020-02-26 11:05:19 -08:00
Alexey Neyman
4fa0ba100b
Merge pull request #1270 from nolange/prevent_glibc_cflags_override
prevent the glibc build from overwriting flags
2020-02-16 15:22:44 -08:00
Alexey Neyman
be04d50510
Merge pull request #1303 from stilor/wip
Update docker to ubuntu 19.10
2020-02-09 13:26:47 -08:00
Alexey Neyman
c317f57b40 Suppress YAML support in DTC
... which fails to build if pkg-config is not installed.

Signed-off-by: Alexey Neyman <stilor@att.net>
2020-02-03 16:12:38 -08:00
Alexey Neyman
a152d61313
Merge pull request #1257 from nolange/fix_binutils_typo
fixup typo in bitutils.sh
2020-01-21 16:56:17 -08:00
Alexey Neyman
90947b3166
Merge pull request #1274 from maxmorozov/master
CT_LIBC_NEWLIB_REGISTER_FINI is processed correctly
2020-01-21 16:44:29 -08:00
Alexey Neyman
66c2932053
Merge pull request #1259 from nolange/add_binutils_deterministic_archives
enable option for binutils deterministic-archives
2019-12-23 15:19:24 -08:00
Alexey Neyman
be5d0317d2
Merge pull request #1201 from abrodkin/topic-glibc-multilib
ARC: Support building of multi-lib Glibc toolchain
2019-12-23 15:17:34 -08:00
Alexey Neyman
e0a63b8546
Merge pull request #1280 from dimkr/musl-cflags
Resepct CT_TARGET_{C,LD}FLAGS when building musl
2019-12-23 14:58:45 -08:00
Stephanos Ioannidis
bb1d687e1d Add newlib retargetable locking configuration
This commit adds support for the newlib configuration option
'--enable-newlib-retargetable-locking'.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2019-12-20 11:18:46 +09:00
Dima Krasner
de0d1dbe02 Resepct CT_TARGET_{C,LD}FLAGS when building musl
I was trying to build static binaries for a range of Broadcom soft-float ARMv7
SoCs and kept getting SIGILL, although I was targeting Cortex A7 (and A5,
later), even on A9 and A15.

I found out that once I add -msoft-float, +mp+sec is to blame:

   Attribute Section: aeabi
   File Attributes
  -  Tag_CPU_name: "7VE"
  +  Tag_CPU_name: "7"
     Tag_CPU_arch: v7
  -  Tag_CPU_arch_profile: Application
  -  Tag_ARM_ISA_use: Yes
     Tag_THUMB_ISA_use: Thumb-2
     Tag_ABI_PCS_wchar_t: 4
     Tag_ABI_FP_rounding: Needed
  @@ -12,8 +10,5 @@ File Attributes
     Tag_ABI_FP_number_model: IEEE 754
     Tag_ABI_align_needed: 8-byte
     Tag_ABI_enum_size: int
     Tag_ABI_optimization_goals: Aggressive Size
     Tag_CPU_unaligned_access: v6
  -  Tag_MPextension_use: Allowed
  -  Tag_DIV_use: Allowed in v7-A with integer division extension
  -  Tag_Virtualization_use: TrustZone and Virtualization Extensions

(This is the readelf -A diff, before and after armv7-a+nofp -> armv7+nofp).

I kept getting SIGILL even after building my application with a toolchain built
with the correct CFLAGS and found out that crosstool-ng doesn't pass the host
CFLAGS when building musl, which pollutes my binary with these ARMv7 extensions.

Signed-off-by: Dima Krasner <dima@dimakrasner.com>
2019-12-04 16:55:20 +02:00
Morozov Max
2260dcfff6 CT_LIBC_NEWLIB_FSEEK_OPTIMIZATION and CT_LIBC_NEWLIB_FVWRITE_IN_STREAMIO are took into account now 2019-11-04 10:11:04 +04:00
Morozov Max
21483c6dbb CT_LIBC_NEWLIB_REGISTER_FINI is processed correctly 2019-11-04 03:40:45 +04:00
Norbert Lange
bd0ea7ed21 prevent the glibc build from overwriting flags
The glibc will append the content of the CFLAGS variable,
overriding previous flags.
If unset, the CFLAGS variable is not empty, so explicitly set it.
Instead prepend the default CFLAGS flags.

Signed-off-by: Norbert Lange <nolange79@gmail.com>
2019-10-27 23:12:25 +01:00
Norbert Lange
605805b3dd fix nonfunctional --enable-relro option
Signed-off-by: Norbert Lange <nolange79@gmail.com>
2019-10-15 11:19:34 +02:00
Norbert Lange
7469bc8a73 enable option for binutils deterministic-archives
Signed-off-by: Norbert Lange <nolange79@gmail.com>
2019-10-10 21:39:29 +02:00
Chris Packham
8ad4a8b83f build/internals.sh: Handle pie executables
Fixes: #887

On some systems the file command identifies a pie executable as a shared
object. Update do_finish() to handle this case so that they are stripped
as well.

Signed-off-by: Chris Packham <judge.packham@gmail.com>
2019-09-14 22:21:11 +12:00
Alexey Brodkin
de76f7cc82 ARC: Support building of multi-lib Glibc toolchain
From GCC's standpoint ARC's multilib items are defined by "mcpu" values
which we have quite a few and for all of them might be built optimized
cross-toolchain.

From Glibc's standpoint multilib is just multi-ABI [1] and so very limited
versions are supposed to co-exist (e.g. arc700 & archs).

Here we force Glibc to install libraries in GCC's multilib folder to create
a universal cross-toolchain that has libs optimized for multiple CPU types.

But note we only need to mess with installation paths in case of real
multilib, otherwise we keep default "lib/" paths so that GCC finds default
(the one and only) libs where it expects them to be.

Also here we add a sample which allows to build universal Glibc Linux
toolchain for ARC.

[1] https://sourceware.org/ml/libc-alpha/2019-06/msg00018.html

Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
2019-06-14 17:50:46 +03:00
Alexey Neyman
51f1db5c0a
Merge pull request #1178 from stilor/master
Last fixes for 1.24.0
2019-04-05 14:09:48 -07:00
Alexey Neyman
693d3943b1 Rename JOBSFLAGS -> CT_JOBSFLAGS
... so that it is saved/restored when restarting the build.

Signed-off-by: Alexey Neyman <stilor@att.net>
2019-04-04 18:57:42 -07:00