Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: armv5 userland broken



On 2021/06/22 13:50, Martin Husemann wrote:
On Tue, Jun 22, 2021 at 06:28:27AM +0900, Rin Okuyama wrote:
Oops... Is this v5 or v5hf? Also, does userland fail even if
only kernel is compiled by GCC9?

This is v5 (one of the machines is the one running regular tests, see
https://www.NetBSD.org/~martin/evbarm-atf/dmesg.txt)

I double checked with multiple clean builds and it is exactly reproducable.

It works when I use base.tgz from a HAVE_GCC=9 build (kernel and everything
else still from the gcc 10 build).

I have a sh and core from the failing build, but it is note very helpfull,
the crash seems to happen in ld.elf_so.

On WZERO3 (xscale), userland works if compiled for earmv4 even by GCC10.

One of the major differences b/w armv5 and armv4 is presence of LDRD and
STRD instructions, for which memory operands should be placed to 8-byte
boundaries.

GCC10 seems to use LDRD/STRD for unaligned operands (this is legal for
armv6 and later). Actually, if LDRD/STRD are forcibly disabled for armv5
with this patch,

----
Index: external/gpl3/gcc/dist/gcc/config/arm/arm.h
===================================================================
RCS file: /home/netbsd/src/external/gpl3/gcc/dist/gcc/config/arm/arm.h,v
retrieving revision 1.23
diff -p -u -r1.23 arm.h
--- external/gpl3/gcc/dist/gcc/config/arm/arm.h	29 Apr 2021 01:51:39 -0000	1.23
+++ external/gpl3/gcc/dist/gcc/config/arm/arm.h	22 Jun 2021 10:29:48 -0000
@@ -173,7 +173,8 @@ emission of floating point pcs attribute
 #define TARGET_THUMB1_ONLY		(TARGET_THUMB1 && !arm_arch_notm)
#define TARGET_LDRD (arm_arch5te && ARM_DOUBLEWORD_ALIGN \
-                                         && !TARGET_THUMB1)
+                                         && !TARGET_THUMB1 \
+					 && unaligned_access /* XXX */)
#define TARGET_CRC32 (arm_arch_crc) ----

init(8) and sh(1) do not crash.

Also, as Martin pointed out, the crash is due to ld.elf_so(1); if only
ld.elf_so(1) is replaced by ``hacked GCC10 version'', userland built by
original GCC10 seems to work fine.

So, my conclusions at the moment are:

(1) GCC10 emits LDRD/STRD for unaligned memory operand for armv5,
(2) at least for -O3 (only used for ld.elf_so(1) in our tree).

I've not figured out yet which change in GCC10 causes this.

It would be nice if we have a tiny testcase which reproduces the problem.
However, I've still not found it...

Thanks,
rin


Home | Main Index | Thread Index | Old Index