From: Alexander Gordeev Date: Wed, 21 Feb 2024 10:51:55 +0000 (+0100) Subject: s390/boot: simplify GOT handling X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=3334fda639cfa7bb27a457f85f4ce06d622e0511;p=people%2Faperard%2Flinux.git s390/boot: simplify GOT handling The end of GOT is calculated dynamically on boot. The size of GOT is calculated on build from the start and end of GOT. Avoid both calculations and use the end of GOT directly. Acked-by: Sumanth Korikkar Acked-by: Heiko Carstens Signed-off-by: Alexander Gordeev Signed-off-by: Heiko Carstens --- diff --git a/arch/s390/boot/boot.h b/arch/s390/boot/boot.h index 8943d5be7ca28..cebf9feba6b1c 100644 --- a/arch/s390/boot/boot.h +++ b/arch/s390/boot/boot.h @@ -30,8 +30,8 @@ struct vmlinux_info { unsigned long rela_dyn_start; unsigned long rela_dyn_end; #else - unsigned long got_off; - unsigned long got_size; + unsigned long got_start; + unsigned long got_end; #endif unsigned long amode31_size; unsigned long init_mm_off; diff --git a/arch/s390/boot/startup.c b/arch/s390/boot/startup.c index cb0d89801c43a..c1a758921b7a1 100644 --- a/arch/s390/boot/startup.c +++ b/arch/s390/boot/startup.c @@ -221,11 +221,8 @@ static void kaslr_adjust_got(unsigned long offset) * Even without -fPIE, Clang still uses a global offset table for some * reason. Adjust the GOT entries. */ - for (entry = (u64 *)vmlinux.got_off; - entry < (u64 *)(vmlinux.got_off + vmlinux.got_size); - entry++) { + for (entry = (u64 *)vmlinux.got_start; entry < (u64 *)vmlinux.got_end; entry++) *entry += offset; - } } #endif @@ -366,7 +363,8 @@ static void kaslr_adjust_vmlinux_info(unsigned long offset) vmlinux.rela_dyn_end += offset; vmlinux.dynsym_start += offset; #else - vmlinux.got_off += offset; + vmlinux.got_start += offset; + vmlinux.got_end += offset; #endif vmlinux.init_mm_off += offset; vmlinux.swapper_pg_dir_off += offset; diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S index 9c59715d17456..48de296e8905c 100644 --- a/arch/s390/kernel/vmlinux.lds.S +++ b/arch/s390/kernel/vmlinux.lds.S @@ -244,8 +244,8 @@ SECTIONS QUAD(__rela_dyn_start) /* rela_dyn_start */ QUAD(__rela_dyn_end) /* rela_dyn_end */ #else - QUAD(__got_start) /* got_off */ - QUAD(__got_end - __got_start) /* got_size */ + QUAD(__got_start) /* got_start */ + QUAD(__got_end) /* got_end */ #endif QUAD(_eamode31 - _samode31) /* amode31_size */ QUAD(init_mm)