]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
arm64: fix .data.rel.ro size assertion when CONFIG_LTO_CLANG
authorMasahiro Yamada <masahiroy@kernel.org>
Wed, 6 Nov 2024 16:18:42 +0000 (01:18 +0900)
committerCatalin Marinas <catalin.marinas@arm.com>
Thu, 7 Nov 2024 11:33:06 +0000 (11:33 +0000)
Commit be2881824ae9 ("arm64/build: Assert for unwanted sections")
introduced an assertion to ensure that the .data.rel.ro section does
not exist.

However, this check does not work when CONFIG_LTO_CLANG is enabled,
because .data.rel.ro matches the .data.[0-9a-zA-Z_]* pattern in the
DATA_MAIN macro.

Move the ASSERT() above the RW_DATA() line.

Fixes: be2881824ae9 ("arm64/build: Assert for unwanted sections")
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Will Deacon <will@kernel.org>
Link: https://lore.kernel.org/r/20241106161843.189927-1-masahiroy@kernel.org
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/kernel/vmlinux.lds.S

index 58d89d997d050fc1d9a897bba8f3d12429953c28..f84c71f04d9ea9fa1885869a2289c646b18f91a1 100644 (file)
@@ -287,6 +287,9 @@ SECTIONS
        __initdata_end = .;
        __init_end = .;
 
+       .data.rel.ro : { *(.data.rel.ro) }
+       ASSERT(SIZEOF(.data.rel.ro) == 0, "Unexpected RELRO detected!")
+
        _data = .;
        _sdata = .;
        RW_DATA(L1_CACHE_BYTES, PAGE_SIZE, THREAD_ALIGN)
@@ -343,9 +346,6 @@ SECTIONS
                *(.plt) *(.plt.*) *(.iplt) *(.igot .igot.plt)
        }
        ASSERT(SIZEOF(.plt) == 0, "Unexpected run-time procedure linkages detected!")
-
-       .data.rel.ro : { *(.data.rel.ro) }
-       ASSERT(SIZEOF(.data.rel.ro) == 0, "Unexpected RELRO detected!")
 }
 
 #include "image-vars.h"