[U-Boot] uboot 2014-04 + gcc7+ = crash in net_set_ip_header (ping/tftp)
Frank Wunderlich
frank-w at public-files.de
Mon Sep 30 06:45:28 UTC 2019
Hi,
i'm facing a problem in older uboot-code which may be fixed on newer, but i did not found the fixing commit yet. Maybe you can point me to it.
I need to use older code in this case because driver for mt7622 and other is not yet available for upstream uboot.
I have temporary changed optimization from -Os to -O1 which "fixes" the issue, currently i don't know why. Maybe you know more about it
I have found this Thread and tried to fix it with the packed-variant, but same crash happens again
http://u-boot.10912.n7.nabble.com/Data-Abort-with-gcc-7-1-td298217.html
my code (without last commit):
https://github.com/frank-w/u-boot/tree/bpi-r64
my try to fix:
diff --git a/Makefile b/Makefile
index fa9cbd50df..6c62f921a9 100755
--- a/Makefile
+++ b/Makefile
@@ -546,7 +546,7 @@ else
endif # $(dot-config)
-KBUILD_CFLAGS += -Os #-fomit-frame-pointer
+KBUILD_CFLAGS += -Os -mno-unaligned-access #-fomit-frame-pointer
ifdef BUILD_TAG
KBUILD_CFLAGS += -DBUILD_TAG='"$(BUILD_TAG)"'
diff --git a/include/net.h b/include/net.h
index 0802fad876..f16b44def6 100644
--- a/include/net.h
+++ b/include/net.h
@@ -273,7 +273,7 @@ struct ip_hdr {
/*
* Internet Protocol (IP) + UDP header.
*/
-struct ip_udp_hdr {
+struct __attribute__((__packed__)) ip_udp_hdr {
uchar ip_hl_v; /* header length and version */
uchar ip_tos; /* type of service */
ushort ip_len; /* total length */
board is Bananapi R64 v0.1 (with rtl8367), code works with gcc4.8, 5.5, 6.3, but not with 7.3 and 8.3
regards Frank
More information about the U-Boot
mailing list