Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 1 | From df66efc0db9899c41632091db11bfe2c05eec1fa Mon Sep 17 00:00:00 2001 |
| 2 | From: Anton Antonov <Anton.Antonov@arm.com> |
| 3 | Date: Wed, 31 Aug 2022 17:55:21 +0100 |
| 4 | Subject: [PATCH] Allow to define additional partameters for newlib configure. |
| 5 | |
| 6 | Do not skip newlib and libgloss when crosscompiling |
| 7 | |
| 8 | Upstream-Status: Pending |
| 9 | Signed-off-by: Anton Antonov <Anton.Antonov@arm.com> |
| 10 | --- |
| 11 | ...-aarch64-linux-gcc-to-compile-bare-metal-lib.patch | 11 ++++++++++- |
| 12 | external/newlib/newlib.cmake | 6 ++++++ |
| 13 | 2 files changed, 16 insertions(+), 1 deletion(-) |
| 14 | |
| 15 | diff --git a/external/newlib/0001-Allow-aarch64-linux-gcc-to-compile-bare-metal-lib.patch b/external/newlib/0001-Allow-aarch64-linux-gcc-to-compile-bare-metal-lib.patch |
| 16 | index f87ed5a..7533ed0 100644 |
| 17 | --- a/external/newlib/0001-Allow-aarch64-linux-gcc-to-compile-bare-metal-lib.patch |
| 18 | +++ b/external/newlib/0001-Allow-aarch64-linux-gcc-to-compile-bare-metal-lib.patch |
| 19 | @@ -16,9 +16,18 @@ Signed-off-by: Gyorgy Szing <gyorgy.szing@arm.com> |
| 20 | 2 files changed, 2 insertions(+), 2 deletions(-) |
| 21 | |
| 22 | diff --git a/configure b/configure |
| 23 | -index 5db52701..1eb71a80 100755 |
| 24 | +index 5db527014..dce91609e 100755 |
| 25 | --- a/configure |
| 26 | +++ b/configure |
| 27 | +@@ -2886,7 +2886,7 @@ esac |
| 28 | + |
| 29 | + # Some are only suitable for cross toolchains. |
| 30 | + # Remove these if host=target. |
| 31 | +-cross_only="target-libgloss target-newlib target-opcodes" |
| 32 | ++cross_only="target-opcodes" |
| 33 | + |
| 34 | + case $is_cross_compiler in |
| 35 | + no) skipdirs="${skipdirs} ${cross_only}" ;; |
| 36 | @@ -3659,7 +3659,7 @@ case "${target}" in |
| 37 | *-*-freebsd*) |
| 38 | noconfigdirs="$noconfigdirs target-newlib target-libgloss" |
| 39 | diff --git a/external/newlib/newlib.cmake b/external/newlib/newlib.cmake |
| 40 | index 13eb78c..5ee99a5 100644 |
| 41 | --- a/external/newlib/newlib.cmake |
| 42 | +++ b/external/newlib/newlib.cmake |
| 43 | @@ -168,6 +168,10 @@ if (NOT NEWLIB_LIBC_PATH) |
| 44 | string(REPLACE ";" " -isystem " CFLAGS_FOR_TARGET "${_gcc_include_dirs}") |
| 45 | set(CFLAGS_FOR_TARGET "-isystem ${CFLAGS_FOR_TARGET} -fpic") |
| 46 | |
| 47 | + # Split a newlib extra build parameter into a list of parameters |
| 48 | + set(NEWLIB_EXTRAS ${NEWLIB_EXTRA}) |
| 49 | + separate_arguments(NEWLIB_EXTRAS) |
| 50 | + |
| 51 | # Newlib configure step |
| 52 | # CC env var must be unset otherwise configure will assume the cross compiler is the host |
| 53 | # compiler. |
| 54 | @@ -175,6 +179,7 @@ if (NOT NEWLIB_LIBC_PATH) |
| 55 | execute_process(COMMAND |
| 56 | ${CMAKE_COMMAND} -E env --unset=CC PATH=${COMPILER_PATH}:$ENV{PATH} ./configure |
| 57 | --target=${COMPILER_PREFIX} |
| 58 | + --host=${COMPILER_PREFIX} |
| 59 | --prefix=${NEWLIB_INSTALL_DIR} |
| 60 | --enable-newlib-nano-formatted-io |
| 61 | --enable-newlib-nano-malloc |
| 62 | @@ -182,6 +187,7 @@ if (NOT NEWLIB_LIBC_PATH) |
| 63 | --enable-newlib-reent-small |
| 64 | --enable-newlib-global-atexit |
| 65 | --disable-multilib |
| 66 | + ${NEWLIB_EXTRAS} |
| 67 | CFLAGS_FOR_TARGET=${CFLAGS_FOR_TARGET} |
| 68 | LDFLAGS_FOR_TARGET=-fpie |
| 69 | WORKING_DIRECTORY |
| 70 | -- |
| 71 | 2.25.1 |
| 72 | |