Re: [PATCH v2 04/12] linker_lists: Rename sections to remove . prefix
On Tue, 17 May 2022 at 09:06, Heinrich Schuchardt wrote: > > On 4/14/22 15:59, Andrew Scull wrote: > > Rename the sections used to implement linker lists so they begin with > > '__u_boot_list' rather than '.u_boot_list'. The double underscore at the > > start is still distinct from the single underscore used by the symbol > > names. > > > > Having a '.' in the section names conflicts with clang's ASAN > > instrumentation which tries to add redzones between the linker list > > elements, causing expected accesses to fail. However, clang doesn't try > > to add redzones to user sections, which are names with all alphanumeric > > and underscore characters. > > > > Signed-off-by: Andrew Scull > > Reviewed-by: Simon Glass > > --- > > arch/arc/cpu/u-boot.lds | 4 ++-- > > arch/arm/config.mk| 4 ++-- > > arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds | 4 ++-- > > arch/arm/cpu/armv7/sunxi/u-boot-spl.lds | 4 ++-- > > arch/arm/cpu/armv8/u-boot-spl.lds | 4 ++-- > > arch/arm/cpu/armv8/u-boot.lds | 4 ++-- > > arch/arm/cpu/u-boot-spl.lds | 4 ++-- > > arch/arm/cpu/u-boot.lds | 6 ++--- > > arch/arm/mach-at91/arm926ejs/u-boot-spl.lds | 2 +- > > arch/arm/mach-at91/armv7/u-boot-spl.lds | 2 +- > > arch/arm/mach-omap2/u-boot-spl.lds| 4 ++-- > > arch/arm/mach-orion5x/u-boot-spl.lds | 4 ++-- > > arch/arm/mach-rockchip/u-boot-tpl-v8.lds | 4 ++-- > > arch/arm/mach-zynq/u-boot-spl.lds | 4 ++-- > > arch/arm/mach-zynq/u-boot.lds | 4 ++-- > > arch/m68k/cpu/u-boot.lds | 4 ++-- > > arch/microblaze/cpu/u-boot-spl.lds| 4 ++-- > > arch/microblaze/cpu/u-boot.lds| 4 ++-- > > arch/mips/config.mk | 2 +- > > arch/mips/cpu/u-boot-spl.lds | 4 ++-- > > arch/mips/cpu/u-boot.lds | 4 ++-- > > arch/nds32/cpu/n1213/u-boot.lds | 4 ++-- > > arch/nios2/cpu/u-boot.lds | 4 ++-- > > arch/powerpc/cpu/mpc83xx/u-boot.lds | 4 ++-- > > arch/powerpc/cpu/mpc85xx/u-boot-nand.lds | 4 ++-- > > arch/powerpc/cpu/mpc85xx/u-boot-nand_spl.lds | 4 ++-- > > arch/powerpc/cpu/mpc85xx/u-boot-spl.lds | 4 ++-- > > arch/powerpc/cpu/mpc85xx/u-boot.lds | 4 ++-- > > arch/riscv/cpu/u-boot-spl.lds | 4 ++-- > > arch/riscv/cpu/u-boot.lds | 4 ++-- > > arch/sandbox/config.mk| 4 ++-- > > arch/sandbox/cpu/u-boot-spl.lds | 4 ++-- > > arch/sandbox/cpu/u-boot.lds | 4 ++-- > > arch/sh/cpu/u-boot.lds| 4 ++-- > > arch/x86/cpu/u-boot-64.lds| 6 ++--- > > arch/x86/cpu/u-boot-spl.lds | 6 ++--- > > arch/x86/cpu/u-boot.lds | 6 ++--- > > arch/x86/lib/elf_ia32_efi.lds | 4 ++-- > > arch/x86/lib/elf_x86_64_efi.lds | 4 ++-- > > @Simon > > This looks inconsistent. > > Why should section u_boot_list exist in elf_x86_64_efi.lds and not in > elf_riscv64_efi.lds? For clarity, you don't mean this is a problem with this patch? But a problem with the riscv port not including linker lists in its linker script? > The sandbox is built and used on all architectures. The sandbox is built as its own "architecture" arch/sandbox that is based on something like a Linux environment rather than a hardware architecture, since sandbox runs in user space.
Re: [PATCH v2 04/12] linker_lists: Rename sections to remove . prefix
On 4/14/22 15:59, Andrew Scull wrote: Rename the sections used to implement linker lists so they begin with '__u_boot_list' rather than '.u_boot_list'. The double underscore at the start is still distinct from the single underscore used by the symbol names. Having a '.' in the section names conflicts with clang's ASAN instrumentation which tries to add redzones between the linker list elements, causing expected accesses to fail. However, clang doesn't try to add redzones to user sections, which are names with all alphanumeric and underscore characters. Signed-off-by: Andrew Scull Reviewed-by: Simon Glass --- arch/arc/cpu/u-boot.lds | 4 ++-- arch/arm/config.mk| 4 ++-- arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds | 4 ++-- arch/arm/cpu/armv7/sunxi/u-boot-spl.lds | 4 ++-- arch/arm/cpu/armv8/u-boot-spl.lds | 4 ++-- arch/arm/cpu/armv8/u-boot.lds | 4 ++-- arch/arm/cpu/u-boot-spl.lds | 4 ++-- arch/arm/cpu/u-boot.lds | 6 ++--- arch/arm/mach-at91/arm926ejs/u-boot-spl.lds | 2 +- arch/arm/mach-at91/armv7/u-boot-spl.lds | 2 +- arch/arm/mach-omap2/u-boot-spl.lds| 4 ++-- arch/arm/mach-orion5x/u-boot-spl.lds | 4 ++-- arch/arm/mach-rockchip/u-boot-tpl-v8.lds | 4 ++-- arch/arm/mach-zynq/u-boot-spl.lds | 4 ++-- arch/arm/mach-zynq/u-boot.lds | 4 ++-- arch/m68k/cpu/u-boot.lds | 4 ++-- arch/microblaze/cpu/u-boot-spl.lds| 4 ++-- arch/microblaze/cpu/u-boot.lds| 4 ++-- arch/mips/config.mk | 2 +- arch/mips/cpu/u-boot-spl.lds | 4 ++-- arch/mips/cpu/u-boot.lds | 4 ++-- arch/nds32/cpu/n1213/u-boot.lds | 4 ++-- arch/nios2/cpu/u-boot.lds | 4 ++-- arch/powerpc/cpu/mpc83xx/u-boot.lds | 4 ++-- arch/powerpc/cpu/mpc85xx/u-boot-nand.lds | 4 ++-- arch/powerpc/cpu/mpc85xx/u-boot-nand_spl.lds | 4 ++-- arch/powerpc/cpu/mpc85xx/u-boot-spl.lds | 4 ++-- arch/powerpc/cpu/mpc85xx/u-boot.lds | 4 ++-- arch/riscv/cpu/u-boot-spl.lds | 4 ++-- arch/riscv/cpu/u-boot.lds | 4 ++-- arch/sandbox/config.mk| 4 ++-- arch/sandbox/cpu/u-boot-spl.lds | 4 ++-- arch/sandbox/cpu/u-boot.lds | 4 ++-- arch/sh/cpu/u-boot.lds| 4 ++-- arch/x86/cpu/u-boot-64.lds| 6 ++--- arch/x86/cpu/u-boot-spl.lds | 6 ++--- arch/x86/cpu/u-boot.lds | 6 ++--- arch/x86/lib/elf_ia32_efi.lds | 4 ++-- arch/x86/lib/elf_x86_64_efi.lds | 4 ++-- @Simon This looks inconsistent. Why should section u_boot_list exist in elf_x86_64_efi.lds and not in elf_riscv64_efi.lds? The sandbox is built and used on all architectures. Best regards Heinrich arch/xtensa/cpu/u-boot.lds| 2 +- arch/xtensa/include/asm/ldscript.h| 4 ++-- board/compulab/cm_t335/u-boot.lds | 4 ++-- board/cssi/MCR3000/u-boot.lds | 4 ++-- .../davinci/da8xxevm/u-boot-spl-da850evm.lds | 2 +- board/qualcomm/dragonboard820c/u-boot.lds | 4 ++-- board/samsung/common/exynos-uboot-spl.lds | 4 ++-- board/synopsys/iot_devkit/u-boot.lds | 4 ++-- board/ti/am335x/u-boot.lds| 4 ++-- board/vscom/baltos/u-boot.lds | 4 ++-- doc/api/linker_lists.rst | 22 +-- doc/develop/commands.rst | 4 ++-- doc/develop/driver-model/of-plat.rst | 4 ++-- include/linker_lists.h| 18 +++ 53 files changed, 121 insertions(+), 121 deletions(-) diff --git a/arch/arc/cpu/u-boot.lds b/arch/arc/cpu/u-boot.lds index e12145c768..9f2973da65 100644 --- a/arch/arc/cpu/u-boot.lds +++ b/arch/arc/cpu/u-boot.lds @@ -39,8 +39,8 @@ SECTIONS } . = ALIGN(4); - .u_boot_list : { - KEEP(*(SORT(.u_boot_list*))); + __u_boot_list : { + KEEP(*(SORT(__u_boot_list*))); } . = ALIGN(4); diff --git a/arch/arm/config.mk b/arch/arm/config.mk index b107b1af27..b3548ce243 100644 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -141,11 +141,11 @@ endif # limit ourselves to the sections we want in the .bin. ifdef CONFIG_ARM64 OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .data \ - -j .u_boot_list -j .rela.dyn -j .got -j .got.plt \ + -j __u_boot_list -j .rela.dyn -j .got -j .got.plt \ -j .binman_sym_table -j .text_rest else OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .hash \ - -j
[PATCH v2 04/12] linker_lists: Rename sections to remove . prefix
Rename the sections used to implement linker lists so they begin with '__u_boot_list' rather than '.u_boot_list'. The double underscore at the start is still distinct from the single underscore used by the symbol names. Having a '.' in the section names conflicts with clang's ASAN instrumentation which tries to add redzones between the linker list elements, causing expected accesses to fail. However, clang doesn't try to add redzones to user sections, which are names with all alphanumeric and underscore characters. Signed-off-by: Andrew Scull Reviewed-by: Simon Glass --- arch/arc/cpu/u-boot.lds | 4 ++-- arch/arm/config.mk| 4 ++-- arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds | 4 ++-- arch/arm/cpu/armv7/sunxi/u-boot-spl.lds | 4 ++-- arch/arm/cpu/armv8/u-boot-spl.lds | 4 ++-- arch/arm/cpu/armv8/u-boot.lds | 4 ++-- arch/arm/cpu/u-boot-spl.lds | 4 ++-- arch/arm/cpu/u-boot.lds | 6 ++--- arch/arm/mach-at91/arm926ejs/u-boot-spl.lds | 2 +- arch/arm/mach-at91/armv7/u-boot-spl.lds | 2 +- arch/arm/mach-omap2/u-boot-spl.lds| 4 ++-- arch/arm/mach-orion5x/u-boot-spl.lds | 4 ++-- arch/arm/mach-rockchip/u-boot-tpl-v8.lds | 4 ++-- arch/arm/mach-zynq/u-boot-spl.lds | 4 ++-- arch/arm/mach-zynq/u-boot.lds | 4 ++-- arch/m68k/cpu/u-boot.lds | 4 ++-- arch/microblaze/cpu/u-boot-spl.lds| 4 ++-- arch/microblaze/cpu/u-boot.lds| 4 ++-- arch/mips/config.mk | 2 +- arch/mips/cpu/u-boot-spl.lds | 4 ++-- arch/mips/cpu/u-boot.lds | 4 ++-- arch/nds32/cpu/n1213/u-boot.lds | 4 ++-- arch/nios2/cpu/u-boot.lds | 4 ++-- arch/powerpc/cpu/mpc83xx/u-boot.lds | 4 ++-- arch/powerpc/cpu/mpc85xx/u-boot-nand.lds | 4 ++-- arch/powerpc/cpu/mpc85xx/u-boot-nand_spl.lds | 4 ++-- arch/powerpc/cpu/mpc85xx/u-boot-spl.lds | 4 ++-- arch/powerpc/cpu/mpc85xx/u-boot.lds | 4 ++-- arch/riscv/cpu/u-boot-spl.lds | 4 ++-- arch/riscv/cpu/u-boot.lds | 4 ++-- arch/sandbox/config.mk| 4 ++-- arch/sandbox/cpu/u-boot-spl.lds | 4 ++-- arch/sandbox/cpu/u-boot.lds | 4 ++-- arch/sh/cpu/u-boot.lds| 4 ++-- arch/x86/cpu/u-boot-64.lds| 6 ++--- arch/x86/cpu/u-boot-spl.lds | 6 ++--- arch/x86/cpu/u-boot.lds | 6 ++--- arch/x86/lib/elf_ia32_efi.lds | 4 ++-- arch/x86/lib/elf_x86_64_efi.lds | 4 ++-- arch/xtensa/cpu/u-boot.lds| 2 +- arch/xtensa/include/asm/ldscript.h| 4 ++-- board/compulab/cm_t335/u-boot.lds | 4 ++-- board/cssi/MCR3000/u-boot.lds | 4 ++-- .../davinci/da8xxevm/u-boot-spl-da850evm.lds | 2 +- board/qualcomm/dragonboard820c/u-boot.lds | 4 ++-- board/samsung/common/exynos-uboot-spl.lds | 4 ++-- board/synopsys/iot_devkit/u-boot.lds | 4 ++-- board/ti/am335x/u-boot.lds| 4 ++-- board/vscom/baltos/u-boot.lds | 4 ++-- doc/api/linker_lists.rst | 22 +-- doc/develop/commands.rst | 4 ++-- doc/develop/driver-model/of-plat.rst | 4 ++-- include/linker_lists.h| 18 +++ 53 files changed, 121 insertions(+), 121 deletions(-) diff --git a/arch/arc/cpu/u-boot.lds b/arch/arc/cpu/u-boot.lds index e12145c768..9f2973da65 100644 --- a/arch/arc/cpu/u-boot.lds +++ b/arch/arc/cpu/u-boot.lds @@ -39,8 +39,8 @@ SECTIONS } . = ALIGN(4); - .u_boot_list : { - KEEP(*(SORT(.u_boot_list*))); + __u_boot_list : { + KEEP(*(SORT(__u_boot_list*))); } . = ALIGN(4); diff --git a/arch/arm/config.mk b/arch/arm/config.mk index b107b1af27..b3548ce243 100644 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -141,11 +141,11 @@ endif # limit ourselves to the sections we want in the .bin. ifdef CONFIG_ARM64 OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .data \ - -j .u_boot_list -j .rela.dyn -j .got -j .got.plt \ + -j __u_boot_list -j .rela.dyn -j .got -j .got.plt \ -j .binman_sym_table -j .text_rest else OBJCOPYFLAGS += -j .text -j .secure_text -j .secure_data -j .rodata -j .hash \ - -j .data -j .got -j .got.plt -j .u_boot_list -j .rel.dyn \ + -j .data -j .got -j .got.plt -j __u_boot_list -j .rel.dyn \ -j .binman_sym_table -j .text_rest endif diff --git a/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds b/arch/arm/cpu/arm926ejs/sunxi/u-boot-spl.lds index