elf/simple_cases: add hello world statically-linked to glibc
authorJacob Lifshay <programmerjake@gmail.com>
Sun, 3 Dec 2023 08:51:13 +0000 (00:51 -0800)
committerJacob Lifshay <programmerjake@gmail.com>
Wed, 13 Dec 2023 00:59:12 +0000 (16:59 -0800)
it errors when reaching stwcx.

src/openpower/test/elf/simple_cases.py

index 01bea29345e9667ef187a813c8ccc51b93f8f621..a79bd34c759d6c4dae28d39760f9a695ff9500a7 100644 (file)
@@ -61,6 +61,15 @@ void _start() {
 }
 """
 
+static_glibc = r"""
+#include <stdio.h>
+
+int main() {
+    printf("Hello World!\n");
+    return 0;
+}
+"""
+
 # we have to specify *all* sprs that our binary might possibly need to
 # read, because ISACaller is annoying like that...
 # https://bugs.libre-soc.org/show_bug.cgi?id=1226#c2
@@ -85,3 +94,9 @@ class SimpleCases(TestAccumulatorBase):
         prog = compile_elf(SYSCALL_DEF + just_exit)
         self.add_case(prog, initial_sprs=initial_sprs.copy(),
                       initial_msr=DEFAULT_USER_MSR)
+
+    def case_static_glibc(self):
+        compiler_args = '-Os', '-static', '-xc'
+        prog = compile_elf(static_glibc, compiler_args)
+        self.add_case(prog, initial_sprs=initial_sprs.copy(),
+                      initial_msr=DEFAULT_USER_MSR)