[LTP] [PATCH] kvm: Fix init array symbol names

Martin Doucha mdoucha@suse.cz
Mon Oct 10 17:27:54 CEST 2022


Glibc expects __init_array_start symbol instead of __init_array_begin,
otherwise the KVM linker script check in configure will fail on some
Linux distributions. Change the symbol name to fix the issue.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---
 testcases/kernel/kvm/bootstrap_x86.S    | 4 ++--
 testcases/kernel/kvm/bootstrap_x86_64.S | 4 ++--
 testcases/kernel/kvm/linker/x86.lds     | 4 ++--
 testcases/kernel/kvm/linker/x86_64.lds  | 4 ++--
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/testcases/kernel/kvm/bootstrap_x86.S b/testcases/kernel/kvm/bootstrap_x86.S
index 6b079cd27..5ec4c0b7e 100644
--- a/testcases/kernel/kvm/bootstrap_x86.S
+++ b/testcases/kernel/kvm/bootstrap_x86.S
@@ -159,7 +159,7 @@ init_memlayout:
 	 * Do just enough of initialization to get to a working
 	 * -ffreestanding environment and call tst_main(void).
 	 */
-	lea __preinit_array_begin, %edi
+	lea __preinit_array_start, %edi
 	lea __preinit_array_end, %esi
 1:
 	cmp %edi, %esi
@@ -169,7 +169,7 @@ init_memlayout:
 	jmp 1b
 2:
 
-	lea __init_array_begin, %edi
+	lea __init_array_start, %edi
 	lea __init_array_end, %esi
 1:
 	cmp %edi, %esi
diff --git a/testcases/kernel/kvm/bootstrap_x86_64.S b/testcases/kernel/kvm/bootstrap_x86_64.S
index c9577e83f..9ddbd17ed 100644
--- a/testcases/kernel/kvm/bootstrap_x86_64.S
+++ b/testcases/kernel/kvm/bootstrap_x86_64.S
@@ -264,7 +264,7 @@ long_mode_entry:
 	 * Do just enough of initialization to get to a working
 	 * -ffreestanding environment and call tst_main(void).
 	 */
-	lea __preinit_array_begin, %rdi
+	lea __preinit_array_start, %rdi
 1:
 	lea __preinit_array_end, %rsi
 	cmp %rdi, %rsi
@@ -276,7 +276,7 @@ long_mode_entry:
 	jmp 1b
 2:
 
-	lea __init_array_begin, %rdi
+	lea __init_array_start, %rdi
 1:
 	lea __init_array_end, %rsi
 	cmp %rdi, %rsi
diff --git a/testcases/kernel/kvm/linker/x86.lds b/testcases/kernel/kvm/linker/x86.lds
index f1546dedb..95edb0be0 100644
--- a/testcases/kernel/kvm/linker/x86.lds
+++ b/testcases/kernel/kvm/linker/x86.lds
@@ -44,14 +44,14 @@ SECTIONS
 
 	.preinit_array :
 	{
-		PROVIDE_HIDDEN (__preinit_array_begin = .);
+		PROVIDE_HIDDEN (__preinit_array_start = .);
 		KEEP (*(.preinit_array))
 		PROVIDE_HIDDEN (__preinit_array_end = .);
 	}
 
 	.init_array :
 	{
-		PROVIDE_HIDDEN (__init_array_begin = .);
+		PROVIDE_HIDDEN (__init_array_start = .);
 		KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
 		KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
 		PROVIDE_HIDDEN (__init_array_end = .);
diff --git a/testcases/kernel/kvm/linker/x86_64.lds b/testcases/kernel/kvm/linker/x86_64.lds
index 000bb0338..ac372f863 100644
--- a/testcases/kernel/kvm/linker/x86_64.lds
+++ b/testcases/kernel/kvm/linker/x86_64.lds
@@ -44,14 +44,14 @@ SECTIONS
 
 	.preinit_array :
 	{
-		PROVIDE_HIDDEN (__preinit_array_begin = .);
+		PROVIDE_HIDDEN (__preinit_array_start = .);
 		KEEP (*(.preinit_array))
 		PROVIDE_HIDDEN (__preinit_array_end = .);
 	}
 
 	.init_array :
 	{
-		PROVIDE_HIDDEN (__init_array_begin = .);
+		PROVIDE_HIDDEN (__init_array_start = .);
 		KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))
 		KEEP (*(.init_array EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o ) .ctors))
 		PROVIDE_HIDDEN (__init_array_end = .);
-- 
2.37.3



More information about the ltp mailing list