Add another test for PR ld/18841
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 18 Aug 2015 17:43:19 +0000 (10:43 -0700)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 18 Aug 2015 17:43:47 +0000 (10:43 -0700)
PR ld/18841
* ld-ifunc/ifunc.exp: Add another test for PR ld/18841.
* ld-ifunc/pr18841c.c: New file.

ld/testsuite/ChangeLog
ld/testsuite/ld-ifunc/ifunc.exp
ld/testsuite/ld-ifunc/pr18841c.c [new file with mode: 0644]

index b8546d0b42adadf19b5f7e40afa0585fbc90ff22..ce3b310d348e6e2501c9dee241ed26ac0d648745 100644 (file)
@@ -1,3 +1,9 @@
+2015-08-18  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/18841
+       * ld-ifunc/ifunc.exp: Add another test for PR ld/18841.
+       * ld-ifunc/pr18841c.c: New file.
+
 2015-08-18  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/18841
index b0f6de07a161414da93b7c274359e8876363a129..d3bebdd4072e3bbbf1cd827fbd95154e97ad0feb 100644 (file)
@@ -473,12 +473,20 @@ run_cc_link_tests [list \
        "libpr18808.so" \
     ] \
     [list \
-       "Build libpr18841.so" \
+       "Build libpr18841b.so" \
        "-shared" \
        "-fPIC -O0 -g" \
        { pr18841b.c } \
        {} \
-       "libpr18841.so" \
+       "libpr18841b.so" \
+    ] \
+    [list \
+       "Build libpr18841c.so" \
+       "-shared" \
+       "-fPIC -O0 -g" \
+       { pr18841c.c } \
+       {} \
+       "libpr18841c.so" \
     ] \
 ]
 
@@ -492,11 +500,19 @@ run_ld_link_exec_tests [] [list \
        "pr18808.out" \
     ] \
     [list \
-       "Run pr18841" \
-       "tmpdir/libpr18841.so" \
+       "Run pr18841 with libpr18841b.so" \
+       "tmpdir/libpr18841b.so" \
+       "" \
+       { pr18841a.c } \
+       "pr18841b" \
+       "pr18841.out" \
+    ] \
+    [list \
+       "Run pr18841 with libpr18841c.so" \
+       "tmpdir/libpr18841c.so" \
        "" \
        { pr18841a.c } \
-       "pr18841" \
+       "pr18841c" \
        "pr18841.out" \
     ] \
 ]
diff --git a/ld/testsuite/ld-ifunc/pr18841c.c b/ld/testsuite/ld-ifunc/pr18841c.c
new file mode 100644 (file)
index 0000000..03a6354
--- /dev/null
@@ -0,0 +1,17 @@
+void foo() __attribute__((ifunc("resolve_foo")));
+
+static void foo_impl() {}
+extern void zoo(void);
+void (*pz)(void) = zoo;
+
+void test()
+{
+  void (*pg)(void) = foo;
+  pg();
+}
+
+static void* resolve_foo()
+{
+  pz();
+  return foo_impl;
+}