diff --git a/libports/src/test/ldso/main.cc b/libports/src/test/ldso/main.cc index 105f365fe..a922e7eea 100644 --- a/libports/src/test/ldso/main.cc +++ b/libports/src/test/ldso/main.cc @@ -111,6 +111,27 @@ static void exception() { throw 666; } extern void __ldso_raise_exception(); +/************************************* + ** Helpers to test stack alignment ** + *************************************/ + +static void test_stack_align(char const *fmt, ...) __attribute__((noinline)); +static void test_stack_align(char const *fmt, ...) +{ + va_list list; + va_start(list, fmt); + + vprintf(fmt, list); + + va_end(list); +} + +struct Test_stack_align_thread : Thread<0x2000> +{ + Test_stack_align_thread() : Thread<0x2000>("test_stack_align") { } + void entry() { test_stack_align("%f\n%g\n", 3.142, 2.718); } +}; + /** * Main function of LDSO test */ @@ -167,6 +188,14 @@ int main(int argc, char **argv) lib_1_test(); + printf("test stack alignment\n"); + printf("--------------------\n"); + test_stack_align("%f\n%g\n", 3.142, 2.718); + Test_stack_align_thread t; + t.start(); + t.join(); + printf("\n"); + /* test if return value is propagated correctly by dynamic linker */ return 123; } diff --git a/os/run/ldso.run b/os/run/ldso.run index 7c523f1f8..757f930fb 100644 --- a/os/run/ldso.run +++ b/os/run/ldso.run @@ -98,6 +98,13 @@ compare_output_to { [init -> test-ldso] exception in lib: caught [init -> test-ldso] exception in another shared lib: caught [init -> test-ldso] +[init -> test-ldso] test stack alignment +[init -> test-ldso] -------------------- +[init -> test-ldso] +[init -> test-ldso] +[init -> test-ldso] +[init -> test-ldso] +[init -> test-ldso] [init -> test-ldso] ~Lib_2_local 55667785 [init -> test-ldso] ~Lib_1_local_2 1020303d [init -> test-ldso] ~Lib_1_local_1 5060707d