]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
xen/riscv: add explicit check that .got{.plt} is empty
authorOleksii Kurochko <oleksii.kurochko@gmail.com>
Tue, 18 Apr 2023 06:25:50 +0000 (08:25 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 18 Apr 2023 06:25:50 +0000 (08:25 +0200)
The GOT sections usage should be avoided in the hypervisor
so to catch such use cases earlier when GOT things are
produced the patch introduces .got and .got.plt sections
and adds asserts that they're empty.

The sections won't be created until they remain
empty otherwise the asserts would cause early failure.

Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Alistair Francis <alistair.francis@wdc.com>
xen/arch/riscv/xen.lds.S

index 2ed70eccc62a16e58d2b147bc94f39c0bab346c5..31e0d3576ca29a9a817fae6dbee741d9b5365df9 100644 (file)
@@ -124,6 +124,15 @@ SECTIONS
         *(SORT(.init_array.*))
         __ctors_end = .;
     } :text
+
+    .got : {
+        *(.got)
+    } : text
+
+    .got.plt : {
+        *(.got.plt)
+    } : text
+
     . = ALIGN(POINTER_ALIGN);
     __init_end = .;
 
@@ -160,3 +169,6 @@ SECTIONS
 
 ASSERT(IS_ALIGNED(__bss_start,      POINTER_ALIGN), "__bss_start is misaligned")
 ASSERT(IS_ALIGNED(__bss_end,        POINTER_ALIGN), "__bss_end is misaligned")
+
+ASSERT(!SIZEOF(.got),      ".got non-empty")
+ASSERT(!SIZEOF(.got.plt),  ".got.plt non-empty")