From 80d97187700bdfef0dd2fcf8dea0f7bf3ec89b71 Mon Sep 17 00:00:00 2001 From: CTCaer Date: Tue, 11 May 2021 09:51:08 +0300 Subject: [PATCH] GCC 11 fixes The array/stringop warning removals are undesirable. Consider removing them when a new GCC version moves back to saner checks for pointers. --- Makefile | 5 ++++- bootloader/link.ld | 4 ++-- loader/Makefile | 5 ++++- loader/link.ld | 6 +++--- loader/loader.c | 5 ----- nyx/Makefile | 5 ++++- nyx/nyx_gui/link.ld | 2 +- 7 files changed, 18 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 70a6392..c73216c 100755 --- a/Makefile +++ b/Makefile @@ -73,8 +73,11 @@ CUSTOMDEFINES += -DGFX_INC=$(GFX_INC) -DFFCFG_INC=$(FFCFG_INC) # DEBUG_UART_PORT - 0: UART_A, 1: UART_B, 2: UART_C. #CUSTOMDEFINES += -DDEBUG_UART_BAUDRATE=115200 -DDEBUG_UART_INVERT=0 -DDEBUG_UART_PORT=0 +#TODO: Considering reinstating some of these when pointer warnings have been fixed. +WARNINGS := -Wall -Wno-array-bounds -Wno-stringop-overread -Wno-stringop-overflow + ARCH := -march=armv4t -mtune=arm7tdmi -mthumb -mthumb-interwork -CFLAGS = $(ARCH) -O2 -g -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-inline -std=gnu11 -Wall $(CUSTOMDEFINES) +CFLAGS = $(ARCH) -O2 -g -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -fno-inline -std=gnu11 $(WARNINGS) $(CUSTOMDEFINES) LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections -Xlinker --defsym=IPL_LOAD_ADDR=$(IPL_LOAD_ADDR) MODULEDIRS := $(wildcard modules/*) diff --git a/bootloader/link.ld b/bootloader/link.ld index cd8b8a1..335be02 100644 --- a/bootloader/link.ld +++ b/bootloader/link.ld @@ -5,8 +5,8 @@ SECTIONS { . = __ipl_start; .text : { *(.text._start); - *(._boot_cfg); - *(._ipl_version); + KEEP(*(._boot_cfg)); + KEEP(*(._ipl_version)); *(.text._irq_setup); *(.text*); } diff --git a/loader/Makefile b/loader/Makefile index 2fcc110..d59ed08 100644 --- a/loader/Makefile +++ b/loader/Makefile @@ -29,8 +29,11 @@ OBJS = $(addprefix $(BUILDDIR)/$(TARGET)/, \ CUSTOMDEFINES := -DBL_MAGIC=$(IPL_MAGIC) CUSTOMDEFINES += -DBL_VER_MJ=$(BLVERSION_MAJOR) -DBL_VER_MN=$(BLVERSION_MINOR) -DBL_VER_HF=$(BLVERSION_HOTFX) -DBL_RESERVED=$(BLVERSION_RSVD) +#TODO: Considering reinstating some of these when pointer warnings have been fixed. +WARNINGS := -Wall -Wno-array-bounds -Wno-stringop-overflow + ARCH := -march=armv4t -mtune=arm7tdmi -mthumb-interwork -CFLAGS = $(ARCH) -O2 -g -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -std=gnu11 -Wall $(CUSTOMDEFINES) +CFLAGS = $(ARCH) -O2 -g -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -std=gnu11 $(WARNINGS) $(CUSTOMDEFINES) LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections -Xlinker --defsym=LDR_LOAD_ADDR=$(LDR_LOAD_ADDR) ################################################################################ diff --git a/loader/link.ld b/loader/link.ld index b275cf2..b217fd3 100644 --- a/loader/link.ld +++ b/loader/link.ld @@ -5,9 +5,9 @@ SECTIONS { . = __ipl_start; .text : { *(.text._start); - *(._boot_cfg); - *(._ipl_version); - *(._octopus); + KEEP(*(._boot_cfg)); + KEEP(*(._ipl_version)); + KEEP(*(._octopus)); *(.text*); } .data : { diff --git a/loader/loader.c b/loader/loader.c index 047d108..fc1a1f7 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -59,11 +59,6 @@ const volatile char __attribute__((section ("._octopus"))) octopus[] = void loader_main() { - // Preserve sections. - __asm__ ("" : : "" (b_cfg)); - __asm__ ("" : : "" (ipl_ver)); - __asm__ ("" : : "" (octopus[0])); - // Preliminary BPMP clocks init. CLOCK(CLK_RST_CONTROLLER_CLK_SYSTEM_RATE) = 0x10; // Set HCLK div to 2 and PCLK div to 1. CLOCK(CLK_RST_CONTROLLER_CLK_SOURCE_SYS) = 0; // Set SCLK div to 1. diff --git a/nyx/Makefile b/nyx/Makefile index efb734e..90870b3 100644 --- a/nyx/Makefile +++ b/nyx/Makefile @@ -89,8 +89,11 @@ CUSTOMDEFINES += -DNYX -DGFX_INC=$(GFX_INC) -DFFCFG_INC=$(FFCFG_INC) # LvGL UART LOG. #CUSTOMDEFINES += -DDEBUG_UART_LV_LOG +#TODO: Considering reinstating some of these when pointer warnings have been fixed. +WARNINGS := -Wall -Wno-array-bounds -Wno-stringop-overread -Wno-stringop-overflow + ARCH := -march=armv4t -mtune=arm7tdmi -mthumb-interwork -CFLAGS = $(ARCH) -O2 -g -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -std=gnu11 -Wall $(CUSTOMDEFINES) +CFLAGS = $(ARCH) -O2 -g -nostdlib -ffunction-sections -fdata-sections -fomit-frame-pointer -std=gnu11 $(WARNINGS) $(CUSTOMDEFINES) LDFLAGS = $(ARCH) -nostartfiles -lgcc -Wl,--nmagic,--gc-sections -Xlinker --defsym=NYX_LOAD_ADDR=$(NYX_LOAD_ADDR) ################################################################################ diff --git a/nyx/nyx_gui/link.ld b/nyx/nyx_gui/link.ld index bdf3dc0..9d8c015 100644 --- a/nyx/nyx_gui/link.ld +++ b/nyx/nyx_gui/link.ld @@ -5,7 +5,7 @@ SECTIONS { . = __ipl_start; .text : { *(.text._start); - *(._ipl_version); + KEEP(*(._ipl_version)); *(.text._irq_setup); *(.text*); }