ANDROID: module: cfi: ensure __cfi_check alignment
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. Also discard the .eh_frame section, which LLD may emit with CFI_CLANG. Bug: 145210207 Change-Id: I08923febb549aa64454282cc864ac80dadd717b9 Link: https://bugs.llvm.org/show_bug.cgi?id=46293 Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
This commit is contained in:

committed by
Alistair Delva

parent
6010ce3442
commit
08f67ef189
@@ -3,10 +3,17 @@
|
||||
* Archs are free to supply their own linker scripts. ld will
|
||||
* combine them automatically.
|
||||
*/
|
||||
#include <asm/page.h>
|
||||
|
||||
SECTIONS {
|
||||
/DISCARD/ : {
|
||||
*(.discard)
|
||||
*(.discard.*)
|
||||
/*
|
||||
* LLD may emit .eh_frame with CONFIG_CFI_CLANG despite
|
||||
* -fno-asynchronous-unwind-tables. Discard the section.
|
||||
*/
|
||||
*(.eh_frame)
|
||||
}
|
||||
|
||||
__ksymtab 0 : { *(SORT(___ksymtab+*)) }
|
||||
@@ -46,7 +53,16 @@ SECTIONS {
|
||||
*(.rodata..L*)
|
||||
}
|
||||
|
||||
.text : { *(.text .text.[0-9a-zA-Z_]*) }
|
||||
#ifdef CONFIG_CFI_CLANG
|
||||
/*
|
||||
* 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*)
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* bring in arch-specific sections */
|
||||
|
Reference in New Issue
Block a user