-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
glibc-based OpenWrt fails to boot on ARC700 in nSIM #400
Comments
This may not be glibc related see CONFIG_HARDENED_USERCOPY detects kernel memory overwrite attempt to kernel text Try disabling CONFIG_HARDENED_USERCOPY in kernel config |
Well, tried to disable
FWIW here's the disassembly of the failing code:
|
No they are unrelated - i see same failure as first even with mainline 5.11-rc3 + HARDENED_COPY with otherwise perfectly fine booting userspace. Anyways lets not cross post issues - the one u post is THE problem with glibc and needs to be investigated further |
This is not a kernel issue, moving to toolchain issues ! |
So it's been a year and again I'm seeing the same problem. Tried up-to-date OpenWrt with GCC 11.2, glibc 2.33 & kernel 5.10.88. For the record, I used https://patchwork.ozlabs.org/project/openwrt/patch/mailman.11570.1635883327.1923571.openwrt-devel@lists.openwrt.org/ to bump the kernel to 5.10.y. And the following fix of @geomatsi (applied to OpenWrt git treee) to accommodate ABI fix-up in GCC: diff --git a/toolchain/glibc/patches/300-arc.patch b/toolchain/glibc/patches/300-arc.patch
index 66f7aeb3ef..0082b60b25 100644
--- a/toolchain/glibc/patches/300-arc.patch
+++ b/toolchain/glibc/patches/300-arc.patch
@@ -1,3 +1,54 @@
+From db7300bd43925f85fb57f351179c650f5a86a416 Mon Sep 17 00:00:00 2001
+From: Sergey Matyukevich <sergey.matyukevich@synopsys.com>
+Date: Thu, 23 Dec 2021 10:20:34 +0300
+Subject: [PATCH] ARC: Synopsys ARC700 support
+
+Synopsys ARC700 processors are not supported by glibc out of the box.
+Meanwhile ARC700 glibc port is very similar to ARCv2 port. Original
+glibc patch included both ARC700 and ARCv2:
+- https://sourceware.org/pipermail/libc-alpha/2020-March/111855.html
+
+For ARC700 specific changes see patches 5 and 8 from that series:
+- https://sourceware.org/pipermail/libc-alpha/2020-March/111851.html
+- https://sourceware.org/pipermail/libc-alpha/2020-March/111858.html
+
+However ARC700 changes have been dropped from the later revisions of
+ARCv2 glibc patch series. So they have not been added to mainline
+glibc together with ARCv2 port.
+
+This patch is based on the original ARC700 glibc work. It adds all
+the missing pieces required to make glibc work on ARC700. Besides,
+this patch adds specific loader name according to Linux target
+triplet for ARC700.
+
+Signed-off-by: Sergey Matyukevich <sergey.matyukevich@synopsys.com>
+---
+ config.h.in | 3 +++
+ sysdeps/arc/atomic-machine.h | 4 +++
+ sysdeps/arc/configure | 29 ++++++++++++++++++++++
+ sysdeps/arc/configure.ac | 11 ++++++++
+ sysdeps/unix/sysv/linux/arc/ldconfig.h | 8 +++---
+ sysdeps/unix/sysv/linux/arc/shlib-versions | 8 ++++++
+ sysdeps/unix/sysv/linux/arc/syscall.S | 5 ++++
+ sysdeps/unix/sysv/linux/arc/sysdep.h | 8 ++++++
+ 8 files changed, 73 insertions(+), 3 deletions(-)
+
+diff --git a/config.h.in b/config.h.in
+index 82ade1cec4..56783e3cb3 100644
+--- a/config.h.in
++++ b/config.h.in
+@@ -123,6 +123,9 @@
+ /* ARC big endian ABI */
+ #undef HAVE_ARC_BE
+
++/* ARC 700 */
++#undef HAVE_ARC700
++
+ /* C-SKY ABI version. */
+ #undef CSKYABI
+
+diff --git a/sysdeps/arc/atomic-machine.h b/sysdeps/arc/atomic-machine.h
+index 4cffc97f20..1056ef1176 100644
--- a/sysdeps/arc/atomic-machine.h
+++ b/sysdeps/arc/atomic-machine.h
@@ -64,6 +64,10 @@ typedef uintmax_t uatomic_max_t;
@@ -11,6 +62,103 @@
+#endif
#endif /* _ARC_BITS_ATOMIC_H */
+diff --git a/sysdeps/arc/configure b/sysdeps/arc/configure
+index bce7d3c377..d751beade0 100644
+--- a/sysdeps/arc/configure
++++ b/sysdeps/arc/configure
+@@ -180,3 +180,32 @@ else
+ config_vars="$config_vars
+ default-abi = arcle"
+ fi
++
++# For ARC700 ABI, generate a symbol for shlib-versions
++{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for arc700" >&5
++$as_echo_n "checking for arc700... " >&6; }
++if ${libc_cv_arc700+:} false; then :
++ $as_echo_n "(cached) " >&6
++else
++ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
++/* end confdefs.h. */
++#ifdef __ARC700__
++ yes
++ #endif
++
++_ACEOF
++if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
++ $EGREP "yes" >/dev/null 2>&1; then :
++ libc_cv_arc700=yes
++else
++ libc_cv_arc700=no
++fi
++rm -f conftest*
++
++fi
++{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_arc700" >&5
++$as_echo "$libc_cv_arc700" >&6; }
++if test $libc_cv_arc700 = yes; then
++ $as_echo "#define HAVE_ARC700 1" >>confdefs.h
++
++fi
+diff --git a/sysdeps/arc/configure.ac b/sysdeps/arc/configure.ac
+index cb490e47b3..7d04dff255 100644
+--- a/sysdeps/arc/configure.ac
++++ b/sysdeps/arc/configure.ac
+@@ -24,3 +24,14 @@ if test $libc_cv_arc_be = yes; then
+ else
+ LIBC_CONFIG_VAR([default-abi], [arcle])
+ fi
++
++# For ARC700 ABI, generate a symbol for shlib-versions
++AC_CACHE_CHECK([for arc700],
++ [libc_cv_arc700],
++ [AC_EGREP_CPP(yes,[#ifdef __ARC700__
++ yes
++ #endif
++ ], libc_cv_arc700=yes, libc_cv_arc700=no)])
++if test $libc_cv_arc700 = yes; then
++ AC_DEFINE(HAVE_ARC700)
++fi
+diff --git a/sysdeps/unix/sysv/linux/arc/ldconfig.h b/sysdeps/unix/sysv/linux/arc/ldconfig.h
+index 8c776fca9e..cc0b31de6d 100644
+--- a/sysdeps/unix/sysv/linux/arc/ldconfig.h
++++ b/sysdeps/unix/sysv/linux/arc/ldconfig.h
+@@ -18,9 +18,11 @@
+
+ #include <sysdeps/generic/ldconfig.h>
+
+-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
+- { "/lib/ld-linux-arc.so.2", FLAG_ELF_LIBC6 }, \
+- { "/lib/ld-linux-arceb.so.2", FLAG_ELF_LIBC6 },
++#define SYSDEP_KNOWN_INTERPRETER_NAMES \
++ { "/lib/ld-linux-arc.so.2", FLAG_ELF_LIBC6 }, \
++ { "/lib/ld-linux-arceb.so.2", FLAG_ELF_LIBC6 }, \
++ { "/lib/ld-linux-arc700.so.2", FLAG_ELF_LIBC6 }, \
++ { "/lib/ld-linux-arc700eb.so.2", FLAG_ELF_LIBC6 },
+
+ #define SYSDEP_KNOWN_LIBRARY_NAMES \
+ { "libc.so.6", FLAG_ELF_LIBC6 }, \
+diff --git a/sysdeps/unix/sysv/linux/arc/shlib-versions b/sysdeps/unix/sysv/linux/arc/shlib-versions
+index 343c0a0450..ab263bf2fb 100644
+--- a/sysdeps/unix/sysv/linux/arc/shlib-versions
++++ b/sysdeps/unix/sysv/linux/arc/shlib-versions
+@@ -1,7 +1,15 @@
+ DEFAULT GLIBC_2.32
+
++%ifdef HAVE_ARC700
++%ifdef HAVE_ARC_BE
++ld=ld-linux-arc700eb.so.2
++%else
++ld=ld-linux-arc700.so.2
++%endif
++%else
+ %ifdef HAVE_ARC_BE
+ ld=ld-linux-arceb.so.2
+ %else
+ ld=ld-linux-arc.so.2
+ %endif
++%endif
+diff --git a/sysdeps/unix/sysv/linux/arc/syscall.S b/sysdeps/unix/sysv/linux/arc/syscall.S
+index 17b59590b6..452e47c666 100644
--- a/sysdeps/unix/sysv/linux/arc/syscall.S
+++ b/sysdeps/unix/sysv/linux/arc/syscall.S
@@ -24,8 +24,13 @@ ENTRY (syscall)
@@ -27,6 +175,8 @@
ARC_TRAP_INSN
brhi r0, -4096, L (call_syscall_err)
+diff --git a/sysdeps/unix/sysv/linux/arc/sysdep.h b/sysdeps/unix/sysv/linux/arc/sysdep.h
+index 6b70ccc687..8010adb06e 100644
--- a/sysdeps/unix/sysv/linux/arc/sysdep.h
+++ b/sysdeps/unix/sysv/linux/arc/sysdep.h
@@ -128,7 +128,11 @@ L (call_syscall_err): ASM_LINE_SEP \
@@ -41,7 +191,7 @@
#else /* !__ASSEMBLER__ */
-@@ -139,7 +143,11 @@ extern long int __syscall_error (long in
+@@ -139,7 +143,11 @@ extern long int __syscall_error (long int);
hidden_proto (__syscall_error)
# endif
@@ -53,3 +203,6 @@
# undef INTERNAL_SYSCALL_NCS
# define INTERNAL_SYSCALL_NCS(number, nr_args, args...) \
+--
+2.25.1
+ Interestingly, OpenWrt image as it builds fails quite silently:
And only once Busybox gets build statically (in OpenWrt's
|
Adding @geomatsi to just show that there're more issues with glibc tools for ARC700 and we may want to think twice what do do with that: fix this one (and possible others) or ... ;) |
The arc700 target is not booting up since some time, see here: foss-for-synopsys-dwc-arc-processors/toolchain#400 It looks like there is a problem in the toolchain when using glibc. Currently no one is working on fixing this problem, remove the target instead. This target also does not have many users we are aware of. If someone wants to have this target back, feel free to add a fixed version of this target again. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Acked-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Acked-by: Stijn Tintel <stijn@linux-ipv6.be>
The arc700 target is not booting up since some time, see here: foss-for-synopsys-dwc-arc-processors/toolchain#400 It looks like there is a problem in the toolchain when using glibc. Currently no one is working on fixing this problem, remove the target instead. This target also does not have many users we are aware of. If someone wants to have this target back, feel free to add a fixed version of this target again. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Acked-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Acked-by: Stijn Tintel <stijn@linux-ipv6.be>
The arc700 target is not booting up since some time, see here: foss-for-synopsys-dwc-arc-processors/toolchain#400 It looks like there is a problem in the toolchain when using glibc. Currently no one is working on fixing this problem, remove the target instead. This target also does not have many users we are aware of. If someone wants to have this target back, feel free to add a fixed version of this target again. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Acked-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Acked-by: Stijn Tintel <stijn@linux-ipv6.be>
The arc700 target is not booting up since some time, see here: foss-for-synopsys-dwc-arc-processors/toolchain#400 It looks like there is a problem in the toolchain when using glibc. Currently no one is working on fixing this problem, remove the target instead. This target also does not have many users we are aware of. If someone wants to have this target back, feel free to add a fixed version of this target again. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Acked-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Acked-by: Stijn Tintel <stijn@linux-ipv6.be>
With removal of uClibc from OpenWrt and availability of glibc for ARCv2 processors (starting from v2.32) we're trying to use glibc for ARC700 (AKA "ARcompact ISA" processors) instead of dropping ARC700 support entirely from OpenWrt.
This seems to be quite a simple task, requiring just a very minor change for the glibc itself for ARCompact support, see https://patchwork.ozlabs.org/project/openwrt/patch/20201225003616.11895-1-rosenp@gmail.com/.
Apparently
init
process fails in that configuration that way:That's a basic image for "Synopsys DesignWare ARC770" processors built from openwrt/openwrt@c625c82 plus a patch from the Patchwork link above.
Full bootlog is here: 2021.01.12-arc770-glibc.txt.
Built Elf (vmlinux with built-in initramfs) is here: openwrt-arc770-generic-nsim-initramfs.zip.
Linux kernel configuration is here: linux-config.txt
Exactly the same behavior is observed with both GCC 8.4 & 9.3 so I'd assume it is not related to the compiler at least.
The text was updated successfully, but these errors were encountered: