1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
Commit Graph

19 Commits

Author SHA1 Message Date
Marian Buschsieweke
2b2506c052
build system: Fix linker feature test with newlib 4.3.0
Before the build system used something like

    echo "int main(){} void _exit(int n) {(void)n;while(1);}" | LC_ALL=C $(LINK) -xc - -o /dev/null -lc -Wall -Wextra -pedantic <FLAGS_TO_TEST>

to check for flags supported by the compiler (used as linker frontend).
This however no longer works with newlib 4.3.0, which requires the
symbols `_sbrk_r`, `_close_r`, `_lseek_r`, `_read_r`, and `_write_r` to
be present. Instead, now a new file `minimal_linkable.c` was added that
adds all the missing symbols and is used in the linker feature tests
instead.
2023-02-02 20:47:37 +01:00
Marian Buschsieweke
0077e9ad70
makefiles/libc: fix wchar_t size warnings on LLVM
The test for the requirement of disabling wchar_t size warnings assumed
that $(CC) is used for linking, instead of $(LINK). With GCC $(LINK)
and $(CC) happen to be (in most cases) identical, but with LLVM they
are not. This results in issues with compiling with LLVM.
2022-11-07 15:02:03 +01:00
Gunar Schorcht
d6f86a9b7a makefiles/libc/newlibc: allow toolchains with nano version only
The check for `newlib-nano` assumes that a toolchain which provides `newlib-nano` provides both the normal version and the nano version of the `newlib`.The nano version of `newlib.h` is therefore stored in its own include directory. This is the case for toolchains which allow to use both the normal and the nano version, e.g. for ARM and RISC-V.
However, if the toolchain provides `newlib_nano` but only allows the use of the nano version, it will only have the nano version of `newlib.h` and no separate directory for it, e.g. for ESP32.
To still be able to use such toolchains with `newlib_nano`, the check is changed so that the setting of the `-isystem` option depends on the existence of the separate directory.
2022-01-23 10:48:26 +01:00
857019769f
make/newlib: remove use of export for LINKFLAGS 2020-01-02 09:51:40 +01:00
87326c7b77 make: newlib: check if newlib nano folder was found 2019-03-08 18:47:23 +01:00
Gaëtan Harter
3226918e17
newlib.mk: indent comments in conditionnal
Comments inside an if are usually also indented.
2018-08-02 17:06:54 +02:00
Gaëtan Harter
154d64ee47
newlib.mk: get NEWLIB_INCLUDE_DIR absolute and without trailing slash
It replaces

    make BOARD=iotlab-m3 info-debug-variable-NEWLIB_INCLUDE_DIR
    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include/

with

    make BOARD=iotlab-m3 info-debug-variable-NEWLIB_INCLUDE_DIR
    /usr/arm-none-eabi/include

Without trailing slash and without relative '..' everywhere.

It also uses `realpath` instead of `abspath` to support Mingw32.
2018-08-02 17:06:51 +02:00
Gaëtan Harter
37a92c4c5e
newlib.mk: Windows/MSYS Bash support: use realpath instead of abspath
Some versions of Mingw32 abspath implementation has trouble working with
windows formatted path.

    $(abspath "C:/A/B") returns "/C/CUR/DIR/C:/A/B" instead of "/C/A/B"

relpath does not have this problem, it does additional symlink resolution but is
not a problem.
Note: on windows it does not remove the trailing `/`.

https://github.com/zephyrproject-rtos/zephyr/issues/2061#issuecomment-331635063

Patched in

941059c69f
2018-08-02 17:06:46 +02:00
Gaëtan Harter
3a4538ee76
newlib.mk: sanitize output before getting include path
Only keep lines that are indeed include path.
It also keeps newlines as they do not matter.

It fixes Mingw32 support where `grep '^\s'` is not working the same way.
It also handles some mac `sed` that do not support `\s`.

Ouput tested with:

    make -C examples/hello-world BOARD=samr21-xpro info-debug-variable-COMPILER_INCLUDE_PATHS
    # by also putting newlines for readability

Now:

    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include
    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include-fixed
    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include

Before:

    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/cc1 -E -quiet -v -iprefix /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/ -isysroot /usr/bin/../arm-none-eabi -D__USES_INITFINI__ /dev/null
    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include
    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/include-fixed
    /usr/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/include
2018-08-02 17:05:17 +02:00
Gaëtan Harter
18a4ccf315
newlib.mk: fix NEWLIB_INCLUDE_DIR not being set by PATTERNS
As NEWLIB_INCLUDE_DIR has already been set here, with an empty value, it is not
overwriting it because of the '?='.
2018-08-02 17:05:13 +02:00
Gaëtan Harter
a946c2c5bd
newlib.mk: fix: do not require slash terminated NEWLIB_INCLUDE_DIR
When NEWLIB_INCLUDE_DIR is set from other parts than 'COMPILER_INCLUDE_PATHS' it
does not have a trailing slash.
Also, it makes it more problematic when supplying it from the command line.

And anyway having two '/' does not break anything.
2018-08-02 17:05:10 +02:00
Gaëtan Harter
f8e1419a31
newlib.mk: llvm, fix newlib-nano header not used
In the previous state, with llvm and arm for example, newlib-nano include dir
NEWLIB_NANO_INCLUDE_DIR is placed after NEWLIB_INCLUDES and so the default
'newlib.h' is used instead of the nano version.
2018-07-25 14:29:51 +02:00
Cenk Gündoğan
db6cb1ac65 newlib: include fixes for newlib-nano 2018-06-26 15:45:54 +02:00
Toon Stegen
f1c53794fa Revert "newlib-nano: add include directory"
This reverts commit 88aaa62364.
2018-05-30 17:41:21 +02:00
Toon Stegen
88aaa62364 newlib-nano: add include directory
The newlib-nano include directory can be named either newlib-nano or
nano, so we should make sure it is added in both cases.
2018-05-27 07:13:16 +02:00
Joakim Nohlgård
30f6f0033f newlib: No need to link with -lnosys 2018-03-18 09:58:17 +01:00
Martine Lenders
af5760977d newlib: use RIOT dependency system for _GNU_SOURCE instead 2017-10-24 16:01:24 +02:00
Neil Jones
6c54360bae makefiles: Don't link libnosys for mips and put back -fdata-sections 2017-06-28 12:55:54 +01:00
Joakim Nohlgård
b81b66672e newlib: Split newlib into one generic part and one default syscalls part 2017-04-05 13:55:38 +02:00