From 4deb454ebf4482aaf3fd7c008fb7a7add6266dff Mon Sep 17 00:00:00 2001 From: Quentin Perret Date: Wed, 7 Dec 2022 09:24:51 +0000 Subject: [PATCH] ANDROID: KVM: arm64: Include .note.gnu.property in .hyp.rodata Since .hyp.rodata sections of pKVM modules are emitted with SHT_MERGE, ld.ldd feels free to attempt merging it with other sections. Unfortunately, the pKVM module linker script doesn't always place them in output sections, hence causing link failures: ld.lld: error: drivers/misc/pkvm-pl011/hyp/kvm_nvhe.tmp.o:(.hyp.rodata): offset is outside the section In practice, ld.ldd only seems to attempt merging .note.gnu.property with .hyp.rodata. To work around the problem, make sure to explicitely place the .note.gnu.property in .hyp.rodata from the start, hence preventing ld.ldd from trying to optimize further. A preferable solution would be to teach ld.lld that merging pKVM modules sections is a bad idea, or to make sure the sections are not emitted with SHT_MERGE to begin with, but we couldn't find an obvious way to make that happen. This workaround is nothing more than a pratical compromise. Bug: 244543039 Reported-by: Will Deacon Suggested-by: Will Deacon Change-Id: Iae902bdfd21915f552e218515cd77881a95fef2d Signed-off-by: Quentin Perret --- arch/arm64/kvm/hyp/nvhe/module.lds.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kvm/hyp/nvhe/module.lds.S b/arch/arm64/kvm/hyp/nvhe/module.lds.S index d463a58f2197..696ab5408265 100644 --- a/arch/arm64/kvm/hyp/nvhe/module.lds.S +++ b/arch/arm64/kvm/hyp/nvhe/module.lds.S @@ -22,7 +22,7 @@ SECTIONS { .hyp.rodata : { HYP_SECTION_SYMBOL_NAME(.rodata) = .; __hypmod_rodata_start = .; - *(.rodata .rodata.*) + *(.rodata .rodata.* .note.gnu.property) BYTE(0) __hypmod_rodata_end = .; }