On 5/20/23 22:55, Sam Edwards wrote:
This is not proper: A .text section is SHT_PROGBITS,
while the .dynamic section is SHT_DYNAMIC. Attempting to
combine them like this creates a section type mismatch.

It does seem that GNU ld does not complain, but LLVM's lld
considers this an error.

Signed-off-by: Sam Edwards <cfswo...@gmail.com>
Cc: Heinrich Schuchardt <heinrich.schucha...@canonical.com>
---

  arch/arm/lib/elf_aarch64_efi.lds | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/lib/elf_aarch64_efi.lds b/arch/arm/lib/elf_aarch64_efi.lds
index 5dd9809169..986f13936d 100644
--- a/arch/arm/lib/elf_aarch64_efi.lds
+++ b/arch/arm/lib/elf_aarch64_efi.lds
@@ -24,10 +24,9 @@ SECTIONS
                *(.gnu.linkonce.t.*)
                *(.srodata)
                *(.rodata*)
-               . = ALIGN(16);

.dynamic should be aligned. Structure Elf64_Dyn requires at least 8 byte
alignment.

-               *(.dynamic);
                . = ALIGN(512);

The symbol _etext below should be 512 aligned as in
arch/arm/lib/crt0_aarch64_efi.S we have set FileAlignment = 0x200.

Best regards

Heinrich

        }
+       .dynamic : { *(.dynamic) }
        .rela.dyn : { *(.rela.dyn) }
        .rela.plt : { *(.rela.plt) }
        .rela.got : { *(.rela.got) }

Reply via email to