arm64: fix .data.rel.ro size assertion when CONFIG_LTO_CLANG
PATCH 1/1 arm64: fix .data.rel.ro size assertion when CONFIG_LTO_CLANG
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.
---
arch/arm64/kernel/vmlinux.lds.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm64/kernel/vmlinux.lds.S +3 -3
@@ -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"
Signature · 1 line
2.43.0
Quoted 32 lines · Masahiro Yamada
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_CLANGis enabled, because .data.rel.ro matches the .data.[0-9a-zA-Z_]* pattern in theDATA_MAINmacro.Move the
ASSERT()above theRW_DATA()line.Fixes be2881824ae9 ("arm64/build: Assert for unwanted sections")Signed-off-by Masahiro Yamada <[email protected]>---
arch/arm64/kernel/vmlinux.lds.S | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)arch/arm64/kernel/vmlinux.lds.S +3
-0@@ -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)
arch/arm64/kernel/vmlinux.lds.S SECTIONS · line 351
Quoted 9 lines
arch/arm64/kernel/vmlinux.lds.S +0
-3@@ -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"
Catalin, please can you pick this up for 6.13?
Will
Quoted 9 lines · Masahiro Yamada
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_CLANGis enabled, because .data.rel.ro matches the .data.[0-9a-zA-Z_]* pattern in theDATA_MAINmacro.[...]
Applied to arm64 (for-next/misc), thanks!
[1/1] arm64: fix .data.rel.ro size assertion when CONFIG_LTO_CLANG
https://git.kernel.org/arm64/c/340fd66c8566
Signature · 1 line
Catalin