mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2025-08-14 19:26:58 +02:00
Merge patch series "Various toolchain compatibility fixes/improvements"
Sam Edwards <cfsworks@gmail.com> says: This is v2 of my "misc. fixes" series, sent to prepare the codebase for more direct LLVM support in the near future. This series contains several fixes that I found in the process of preparing that support and which address issues independent of any future feature or enhancement. I am sending these now, both so that their inclusion is not delayed by discussion on my upcoming series and to make the latter more manageable. Link: https://lore.kernel.org/r/20250315221813.1265193-1-CFSworks@gmail.com
This commit is contained in:
commit
8b0fe584ae
14
Makefile
14
Makefile
@ -406,6 +406,7 @@ LDR = $(CROSS_COMPILE)ldr
|
|||||||
STRIP = $(CROSS_COMPILE)strip
|
STRIP = $(CROSS_COMPILE)strip
|
||||||
OBJCOPY = $(CROSS_COMPILE)objcopy
|
OBJCOPY = $(CROSS_COMPILE)objcopy
|
||||||
OBJDUMP = $(CROSS_COMPILE)objdump
|
OBJDUMP = $(CROSS_COMPILE)objdump
|
||||||
|
READELF = $(CROSS_COMPILE)readelf
|
||||||
LEX = flex
|
LEX = flex
|
||||||
YACC = bison
|
YACC = bison
|
||||||
AWK = awk
|
AWK = awk
|
||||||
@ -820,6 +821,7 @@ KBUILD_AFLAGS += $(KAFLAGS)
|
|||||||
KBUILD_CFLAGS += $(KCFLAGS)
|
KBUILD_CFLAGS += $(KCFLAGS)
|
||||||
|
|
||||||
KBUILD_LDFLAGS += -z noexecstack
|
KBUILD_LDFLAGS += -z noexecstack
|
||||||
|
KBUILD_LDFLAGS += -z norelro
|
||||||
KBUILD_LDFLAGS += $(call ld-option,--no-warn-rwx-segments)
|
KBUILD_LDFLAGS += $(call ld-option,--no-warn-rwx-segments)
|
||||||
|
|
||||||
KBUILD_HOSTCFLAGS += $(if $(CONFIG_TOOLS_DEBUG),-g)
|
KBUILD_HOSTCFLAGS += $(if $(CONFIG_TOOLS_DEBUG),-g)
|
||||||
@ -1065,7 +1067,7 @@ quiet_cmd_objcopy = OBJCOPY $@
|
|||||||
cmd_objcopy = $(OBJCOPY) --gap-fill=0xff $(OBJCOPYFLAGS) \
|
cmd_objcopy = $(OBJCOPY) --gap-fill=0xff $(OBJCOPYFLAGS) \
|
||||||
$(OBJCOPYFLAGS_$(@F)) $< $@
|
$(OBJCOPYFLAGS_$(@F)) $< $@
|
||||||
|
|
||||||
# Provide a version which does not do this, for use by EFI
|
# Provide a version which does not do this, for use by EFI and hex/srec
|
||||||
quiet_cmd_zobjcopy = OBJCOPY $@
|
quiet_cmd_zobjcopy = OBJCOPY $@
|
||||||
cmd_zobjcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
|
cmd_zobjcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
|
||||||
|
|
||||||
@ -1280,7 +1282,7 @@ OBJCOPYFLAGS_u-boot.hex := -O ihex
|
|||||||
OBJCOPYFLAGS_u-boot.srec := -O srec
|
OBJCOPYFLAGS_u-boot.srec := -O srec
|
||||||
|
|
||||||
u-boot.hex u-boot.srec: u-boot FORCE
|
u-boot.hex u-boot.srec: u-boot FORCE
|
||||||
$(call if_changed,objcopy)
|
$(call if_changed,zobjcopy)
|
||||||
|
|
||||||
OBJCOPYFLAGS_u-boot-elf.srec := $(OBJCOPYFLAGS_u-boot.srec)
|
OBJCOPYFLAGS_u-boot-elf.srec := $(OBJCOPYFLAGS_u-boot.srec)
|
||||||
|
|
||||||
@ -1294,12 +1296,12 @@ OBJCOPYFLAGS_u-boot-elf.srec += --change-addresses=0x50000000
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
u-boot-elf.srec: u-boot.elf FORCE
|
u-boot-elf.srec: u-boot.elf FORCE
|
||||||
$(call if_changed,objcopy)
|
$(call if_changed,zobjcopy)
|
||||||
|
|
||||||
OBJCOPYFLAGS_u-boot-spl.srec = $(OBJCOPYFLAGS_u-boot.srec)
|
OBJCOPYFLAGS_u-boot-spl.srec = $(OBJCOPYFLAGS_u-boot.srec)
|
||||||
|
|
||||||
spl/u-boot-spl.srec: spl/u-boot-spl FORCE
|
spl/u-boot-spl.srec: spl/u-boot-spl FORCE
|
||||||
$(call if_changed,objcopy)
|
$(call if_changed,zobjcopy)
|
||||||
|
|
||||||
%.scif: %.srec
|
%.scif: %.srec
|
||||||
$(Q)$(MAKE) $(build)=arch/arm/mach-renesas $@
|
$(Q)$(MAKE) $(build)=arch/arm/mach-renesas $@
|
||||||
@ -1434,7 +1436,7 @@ OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex
|
|||||||
OBJCOPYFLAGS_u-boot.ldr.srec := -I binary -O srec
|
OBJCOPYFLAGS_u-boot.ldr.srec := -I binary -O srec
|
||||||
|
|
||||||
u-boot.ldr.hex u-boot.ldr.srec: u-boot.ldr FORCE
|
u-boot.ldr.hex u-boot.ldr.srec: u-boot.ldr FORCE
|
||||||
$(call if_changed,objcopy)
|
$(call if_changed,zobjcopy)
|
||||||
|
|
||||||
ifdef CONFIG_SPL_LOAD_FIT
|
ifdef CONFIG_SPL_LOAD_FIT
|
||||||
MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
|
MKIMAGEFLAGS_u-boot.img = -f auto -A $(ARCH) -T firmware -C none -O u-boot \
|
||||||
@ -2175,7 +2177,7 @@ System.map: u-boot
|
|||||||
# ARM relocations should all be R_ARM_RELATIVE (32-bit) or
|
# ARM relocations should all be R_ARM_RELATIVE (32-bit) or
|
||||||
# R_AARCH64_RELATIVE (64-bit).
|
# R_AARCH64_RELATIVE (64-bit).
|
||||||
checkarmreloc: u-boot
|
checkarmreloc: u-boot
|
||||||
@RELOC="`$(CROSS_COMPILE)readelf -r -W $< | cut -d ' ' -f 4 | \
|
@RELOC="`$(READELF) -r -W $< | cut -d ' ' -f 4 | \
|
||||||
grep R_A | sort -u`"; \
|
grep R_A | sort -u`"; \
|
||||||
if test "$$RELOC" != "R_ARM_RELATIVE" -a \
|
if test "$$RELOC" != "R_ARM_RELATIVE" -a \
|
||||||
"$$RELOC" != "R_AARCH64_RELATIVE"; then \
|
"$$RELOC" != "R_AARCH64_RELATIVE"; then \
|
||||||
|
@ -169,15 +169,6 @@ SECTIONS
|
|||||||
_end = .;
|
_end = .;
|
||||||
_image_binary_end = .;
|
_image_binary_end = .;
|
||||||
|
|
||||||
/*
|
|
||||||
* Deprecated: this MMU section is used by pxa at present but
|
|
||||||
* should not be used by new boards/CPUs.
|
|
||||||
*/
|
|
||||||
. = ALIGN(4096);
|
|
||||||
.mmutable : {
|
|
||||||
*(.mmutable)
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These sections occupy the same memory, but their lifetimes do
|
* These sections occupy the same memory, but their lifetimes do
|
||||||
* not overlap: U-Boot initializes .bss only after applying dynamic
|
* not overlap: U-Boot initializes .bss only after applying dynamic
|
||||||
@ -190,14 +181,14 @@ SECTIONS
|
|||||||
__bss_end = .;
|
__bss_end = .;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dynsym _image_binary_end : { *(.dynsym) }
|
/DISCARD/ : { *(.dynsym) }
|
||||||
.dynbss : { *(.dynbss) }
|
/DISCARD/ : { *(.dynbss) }
|
||||||
.dynstr : { *(.dynstr*) }
|
/DISCARD/ : { *(.dynstr*) }
|
||||||
.dynamic : { *(.dynamic*) }
|
/DISCARD/ : { *(.dynamic*) }
|
||||||
.plt : { *(.plt*) }
|
/DISCARD/ : { *(.plt*) }
|
||||||
.interp : { *(.interp*) }
|
/DISCARD/ : { *(.interp*) }
|
||||||
.gnu.hash : { *(.gnu.hash) }
|
/DISCARD/ : { *(.gnu.hash) }
|
||||||
.gnu : { *(.gnu*) }
|
/DISCARD/ : { *(.gnu*) }
|
||||||
.ARM.exidx : { *(.ARM.exidx*) }
|
/DISCARD/ : { *(.ARM.exidx*) }
|
||||||
.gnu.linkonce.armexidx : { *(.gnu.linkonce.armexidx.*) }
|
/DISCARD/ : { *(.gnu.linkonce.armexidx.*) }
|
||||||
}
|
}
|
||||||
|
@ -92,6 +92,7 @@ obj-$(CONFIG_GENERATE_ACPI_TABLE) += acpi_table.o
|
|||||||
# For EABI conformant tool chains, provide eabi_compat()
|
# For EABI conformant tool chains, provide eabi_compat()
|
||||||
ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
|
ifneq (,$(findstring -mabi=aapcs-linux,$(PLATFORM_CPPFLAGS)))
|
||||||
extra-y += eabi_compat.o
|
extra-y += eabi_compat.o
|
||||||
|
CFLAGS_REMOVE_eabi_compat.o := $(LTO_CFLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# some files can only build in ARM or THUMB2, not THUMB1
|
# some files can only build in ARM or THUMB2, not THUMB1
|
||||||
|
@ -150,7 +150,8 @@ _start:
|
|||||||
adr r1, .L_DYNAMIC
|
adr r1, .L_DYNAMIC
|
||||||
ldr r0, [r1]
|
ldr r0, [r1]
|
||||||
add r1, r0, r1
|
add r1, r0, r1
|
||||||
adrl r0, image_base
|
sub r0, pc, #((.+8-image_base) & 0xff)
|
||||||
|
sub r0, r0, #((.+4-image_base) & 0xff00)
|
||||||
bl _relocate
|
bl _relocate
|
||||||
teq r0, #0
|
teq r0, #0
|
||||||
bne 0f
|
bne 0f
|
||||||
|
@ -33,7 +33,24 @@ void __aeabi_memcpy(void *dest, const void *src, size_t n)
|
|||||||
(void) memcpy(dest, src, n);
|
(void) memcpy(dest, src, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void __aeabi_memcpy4(void *dest, const void *src, size_t n) __alias(__aeabi_memcpy);
|
||||||
|
|
||||||
|
void __aeabi_memcpy8(void *dest, const void *src, size_t n) __alias(__aeabi_memcpy);
|
||||||
|
|
||||||
void __aeabi_memset(void *dest, size_t n, int c)
|
void __aeabi_memset(void *dest, size_t n, int c)
|
||||||
{
|
{
|
||||||
(void) memset(dest, c, n);
|
(void) memset(dest, c, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void __aeabi_memset4(void *dest, size_t n, int c) __alias(__aeabi_memset);
|
||||||
|
|
||||||
|
void __aeabi_memset8(void *dest, size_t n, int c) __alias(__aeabi_memset);
|
||||||
|
|
||||||
|
void __aeabi_memclr(void *dest, size_t n)
|
||||||
|
{
|
||||||
|
(void) memset(dest, 0, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
void __aeabi_memclr4(void *dest, size_t n) __alias(__aeabi_memclr);
|
||||||
|
|
||||||
|
void __aeabi_memclr8(void *dest, size_t n) __alias(__aeabi_memclr);
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include <asm/processor-flags.h>
|
#include <asm/processor-flags.h>
|
||||||
|
|
||||||
.code32
|
.code32
|
||||||
.section .text_call64
|
.section .text_call64, "ax"
|
||||||
.globl cpu_call64
|
.globl cpu_call64
|
||||||
cpu_call64:
|
cpu_call64:
|
||||||
/*
|
/*
|
||||||
|
@ -397,7 +397,7 @@ static int spl_fit_append_fdt(struct spl_image_info *spl_image,
|
|||||||
* Use the address following the image as target address for the
|
* Use the address following the image as target address for the
|
||||||
* device tree.
|
* device tree.
|
||||||
*/
|
*/
|
||||||
image_info.load_addr = spl_image->load_addr + spl_image->size;
|
image_info.load_addr = ALIGN(spl_image->load_addr + spl_image->size, 8);
|
||||||
|
|
||||||
/* Figure out which device tree the board wants to use */
|
/* Figure out which device tree the board wants to use */
|
||||||
node = spl_fit_get_image_node(ctx, FIT_FDT_PROP, index++);
|
node = spl_fit_get_image_node(ctx, FIT_FDT_PROP, index++);
|
||||||
|
@ -57,6 +57,11 @@ void __noreturn spl_invoke_opensbi(struct spl_image_info *spl_image)
|
|||||||
hang();
|
hang();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!IS_ALIGNED((uintptr_t)spl_image->fdt_addr, 8)) {
|
||||||
|
pr_err("SPL image loaded an improperly-aligned device tree\n");
|
||||||
|
hang();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Originally, u-boot-spl will place DTB directly after the kernel,
|
* Originally, u-boot-spl will place DTB directly after the kernel,
|
||||||
* but the size of the kernel did not include the BSS section, which
|
* but the size of the kernel did not include the BSS section, which
|
||||||
|
Loading…
Reference in New Issue
Block a user