[gold,commit] Fix failing aarch64 test case for PR 23870

Message ID CAJimCsGmRRPkV1+Q8kg80LP+M=S-S8BZuU-vf6aHK2H0r_QgHA@mail.gmail.com
State New
Headers show
Series
  • [gold,commit] Fix failing aarch64 test case for PR 23870
Related show

Commit Message

Mike Frysinger via Binutils March 20, 2021, 1:01 a.m.
The test case was returning from main with a random return value.
(Well, not so random -- it's returning the value in x0, which is
the function pointer originally passed to foo.) Fix the code to
check that the call to the shared library was successful, and
return 0 if so.

I've committed the following patch to fix this test case.

-cary


2021-03-19  Cary Coutant  <ccoutant@gmail.com>

gold/
        PR gold/pr23870
        * testsuite/aarch64_pr23870_bar.c: Return a magic value.
        * testsuite/aarch64_pr23870_foo.c: Check the magic value and return
        success or failure.

Patch

diff --git a/gold/testsuite/aarch64_pr23870_bar.c
b/gold/testsuite/aarch64_pr23870_bar.c
index 9e19767f33b..bfbd3c5f5fd 100644
--- a/gold/testsuite/aarch64_pr23870_bar.c
+++ b/gold/testsuite/aarch64_pr23870_bar.c
@@ -1,6 +1,6 @@ 
-void bar (void);
+int bar (void);

-void bar ()
+int bar ()
 {
-  return;
+  return 0x55;
 }
diff --git a/gold/testsuite/aarch64_pr23870_foo.c
b/gold/testsuite/aarch64_pr23870_foo.c
index ade3ee6329d..220fd572367 100644
--- a/gold/testsuite/aarch64_pr23870_foo.c
+++ b/gold/testsuite/aarch64_pr23870_foo.c
@@ -1,6 +1,6 @@ 
-void foo (void (*bar)(void));
+int foo (int (*bar)(void));

-void foo (void (*bar)(void))
+int foo (int (*bar)(void))
 {
-  bar();
+  return bar() == 0x55 ? 0 : 1;
 }