kernel-fxtec-pro1x/scripts/module-lto.lds.S
Sami Tolvanen 166a538d15 ANDROID: kbuild: ensure __cfi_check is correctly aligned
On modules with no executable code, LLVM generates a __cfi_check stub,
but won't align it to page size as expected. This change ensures the
function is at the beginning of the .text section and correctly aligned
for the CFI shadow.

Bug: 148458318
Change-Id: I85ea31fa851bc23988f649b021b3ac7e9d9dcb38
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
2020-04-06 20:34:01 +00:00

34 lines
972 B
ArmAsm

/* SPDX-License-Identifier: GPL-2.0 */
#include <asm/page.h>
/*
* With CONFIG_LTO_CLANG, LLD always enables -fdata-sections and
* -ffunction-sections, which increases the size of the final module.
* Merge the split sections in the final binary.
*/
SECTIONS {
/*
* LLVM may emit .eh_frame with CONFIG_CFI_CLANG despite
* -fno-asynchronous-unwind-tables. Discard the section.
*/
/DISCARD/ : {
*(.eh_frame)
}
.bss : { *(.bss .bss.[0-9a-zA-Z_]*) }
.data : { *(.data .data.[0-9a-zA-Z_]*) }
.rela.data : { *(.rela.data .rela.data.[0-9a-zA-Z_]*) }
.rela.rodata : { *(.rela.rodata .rela.rodata.[0-9a-zA-Z_]*) }
.rela.text : { *(.rela.text .rela.text.[0-9a-zA-Z_]*) }
.rodata : { *(.rodata .rodata.[0-9a-zA-Z_]*) }
/*
* With CFI_CLANG, ensure __cfi_check is at the beginning of the
* .text section, and that the section is aligned to page size.
*/
.text : ALIGN(PAGE_SIZE) {
*(.text.__cfi_check)
*(.text .text.[0-9a-zA-Z_]* .text..L.cfi*)
}
}