From f121217cee8d3d59c869b4f9837fcb78cc348537 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 10 Jun 2015 08:12:46 -0500 Subject: [PATCH] add the ability to build uClibc-ng toolchain for microblaze (only static binaries are working for now) --- target/config/Config.in.cpu | 4 ++- target/microblaze/uclibc-ng.config | 12 +++------ .../gcc/patches/4.9.2/microblaze-uclibc.patch | 29 ++++++++++++++++++++++ 3 files changed, 36 insertions(+), 9 deletions(-) create mode 100644 toolchain/gcc/patches/4.9.2/microblaze-uclibc.patch diff --git a/target/config/Config.in.cpu b/target/config/Config.in.cpu index 4599ad06e..716bbba94 100644 --- a/target/config/Config.in.cpu +++ b/target/config/Config.in.cpu @@ -470,8 +470,10 @@ config ADK_CPU_MIPS64R2 config ADK_CPU_MICROBLAZE bool + select ADK_TARGET_WITHOUT_THREADS if ADK_TARGET_LIB_UCLIBC_NG + select ADK_TARGET_WITHOUT_CXX if ADK_TARGET_LIB_UCLIBC_NG select ADK_TARGET_WITH_MMU if !ADK_LINUX_UCLINUX - select ADK_TARGET_WITH_NPTL if ADK_TARGET_LIBC_GLIBC || ADK_TARGET_LIBC_MUSL + select ADK_TARGET_WITH_NPTL if ADK_TARGET_LIB_GLIBC || ADK_TARGET_LIB_MUSL config ADK_CPU_NIOS2 bool diff --git a/target/microblaze/uclibc-ng.config b/target/microblaze/uclibc-ng.config index f3e903a19..a34b538a1 100644 --- a/target/microblaze/uclibc-ng.config +++ b/target/microblaze/uclibc-ng.config @@ -22,7 +22,6 @@ TARGET_microblaze=y # TARGET_nios2 is not set # TARGET_powerpc is not set # TARGET_sh is not set -# TARGET_sh64 is not set # TARGET_sparc is not set # TARGET_v850 is not set # TARGET_x86_64 is not set @@ -43,9 +42,9 @@ ARCH_HAS_MMU=y ARCH_USE_MMU=y UCLIBC_HAS_FLOATS=y UCLIBC_HAS_FPU=y -# DO_C99_MATH is not set +DO_C99_MATH=y # DO_XSI_MATH is not set -# UCLIBC_HAS_FENV is not set +UCLIBC_HAS_FENV=y KERNEL_HEADERS="" HAVE_DOT_CONFIG=y @@ -75,11 +74,11 @@ HAS_NO_THREADS=y # UCLIBC_HAS_LINUXTHREADS is not set UCLIBC_HAS_SYSLOG=y UCLIBC_HAS_LFS=y -MALLOC=y -MALLOC_GLIBC_COMPAT=y UCLIBC_HAS_OBSTACK=y UCLIBC_DYNAMIC_ATEXIT=y # COMPAT_ATEXIT is not set +UCLIBC_HAS_UTMPX=y +UCLIBC_HAS_UTMP=y UCLIBC_SUSV2_LEGACY=y UCLIBC_SUSV3_LEGACY=y # UCLIBC_SUSV3_LEGACY_MACROS is not set @@ -159,7 +158,6 @@ UCLIBC_HAS_WCHAR=y # UCLIBC_HAS_HEXADECIMAL_FLOATS is not set # UCLIBC_HAS_GLIBC_CUSTOM_PRINTF is not set UCLIBC_PRINTF_SCANF_POSITIONAL_ARGS=9 -# UCLIBC_HAS_STDIO_BUFSIZ_NONE is not set # UCLIBC_HAS_STDIO_BUFSIZ_256 is not set # UCLIBC_HAS_STDIO_BUFSIZ_512 is not set # UCLIBC_HAS_STDIO_BUFSIZ_1024 is not set @@ -197,8 +195,6 @@ UCLIBC_HAS_FTW=y UCLIBC_HAS_FTS=y UCLIBC_HAS_GLOB=y UCLIBC_HAS_GNU_GLOB=y -UCLIBC_HAS_UTMP=y -UCLIBC_HAS_UTMPX=y # # Library Installation Options diff --git a/toolchain/gcc/patches/4.9.2/microblaze-uclibc.patch b/toolchain/gcc/patches/4.9.2/microblaze-uclibc.patch new file mode 100644 index 000000000..06dfddcd7 --- /dev/null +++ b/toolchain/gcc/patches/4.9.2/microblaze-uclibc.patch @@ -0,0 +1,29 @@ +diff -Nur gcc-4.9.2.orig/gcc/config/microblaze/linux.h gcc-4.9.2/gcc/config/microblaze/linux.h +--- gcc-4.9.2.orig/gcc/config/microblaze/linux.h 2014-01-02 16:23:26.000000000 -0600 ++++ gcc-4.9.2/gcc/config/microblaze/linux.h 2015-06-07 09:32:24.621501374 -0500 +@@ -25,10 +25,23 @@ + #undef TLS_NEEDS_GOT + #define TLS_NEEDS_GOT 1 + +-#define DYNAMIC_LINKER "/lib/ld.so.1" ++#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2" ++#define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0" ++#if DEFAULT_LIBC == LIBC_UCLIBC ++#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}" ++#elif DEFAULT_LIBC == LIBC_GLIBC ++#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}" ++#else ++#error "Unsupported DEFAULT_LIBC" ++#endif ++#define GNU_USER_DYNAMIC_LINKER \ ++ CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER) ++ ++#define ELF_DYNAMIC_LINKER GNU_USER_DYNAMIC_LINKER ++ + #undef SUBTARGET_EXTRA_SPECS + #define SUBTARGET_EXTRA_SPECS \ +- { "dynamic_linker", DYNAMIC_LINKER } ++ { "dynamic_linker", ELF_DYNAMIC_LINKER } + + #undef LINK_SPEC + #define LINK_SPEC "%{shared:-shared} \ -- 2.11.4.GIT