From 02516111dcbad54395c609667edd20236ec42240 Mon Sep 17 00:00:00 2001 From: Sebastian Poeplau Date: Thu, 23 Nov 2023 16:54:35 +0100 Subject: [PATCH] Prevent erroneous copying of the data section With __data_load declared outside the .data section, lld doesn't put __data_load and __data_start at the same address; they differ by 16 bytes. This tricks the runtime's initialization code into thinking that it needs to copy the data section, effectively breaking it. Issue: eng/toolchain/gnat-llvm#64 --- aarch64/morello/common.ld | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aarch64/morello/common.ld b/aarch64/morello/common.ld index 8b353f61..9c725b80 100644 --- a/aarch64/morello/common.ld +++ b/aarch64/morello/common.ld @@ -146,9 +146,9 @@ SECTIONS *(.got) } > REGION_DATA - __data_load = .; - .data : AT (__data_load) + .data : { + __data_load = .; __data = .; __data_start = .; *(.data .gnu.linkonce.d*)