PATCH: Add ifunc-main IFUNC tests
H.J. Lu
hongjiu.lu@intel.com
Thu Nov 20 19:33:00 GMT 2014
On Thu, Nov 20, 2014 at 10:50:31AM -0800, H.J. Lu wrote:
> Hi,
>
> I checked in this patch to add ifunc-main IFUNC tests.
>
> H.J.
> ---
> diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
> index f8478bd..555d6bf 100644
> --- a/ld/testsuite/ChangeLog
> +++ b/ld/testsuite/ChangeLog
> @@ -1,5 +1,12 @@
> 2014-11-20 H.J. Lu <hongjiu.lu@intel.com>
>
> + * ld-ifunc/ifunc.exp: Run ifunc-main.
> + * ld-ifunc/ifunc-lib.c: New file.
> + * ld-ifunc/ifunc-main.c: Likewise.
> + * ld-ifunc/ifunc-main.out: Likewise.
> +
> +2014-11-20 H.J. Lu <hongjiu.lu@intel.com>
> +
> * lib/ld-lib.exp (check_ifunc_available): New.
> * ld-ifunc/ifunc.exp: Run IFUNC run-time tests only if IFUNC
I checked in this patch to make sure that compiler won't optimize out
loading function into a local variable.
H.J.
--
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 555d6bf..63f145e 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2014-11-20 H.J. Lu <hongjiu.lu@intel.com>
+ * ld-ifunc/ifunc-main.c (get_bar): New function.
+ (main): Use it.
+
+2014-11-20 H.J. Lu <hongjiu.lu@intel.com>
+
* ld-ifunc/ifunc.exp: Run ifunc-main.
* ld-ifunc/ifunc-lib.c: New file.
* ld-ifunc/ifunc-main.c: Likewise.
diff --git a/ld/testsuite/ld-ifunc/ifunc-main.c b/ld/testsuite/ld-ifunc/ifunc-main.c
index a320cfb..61e9934 100644
--- a/ld/testsuite/ld-ifunc/ifunc-main.c
+++ b/ld/testsuite/ld-ifunc/ifunc-main.c
@@ -3,12 +3,21 @@
extern int foo(void);
extern int bar(void);
-int (*foo_ptr)(void) = foo;
+typedef int (*func_p) (void);
+
+func_p foo_ptr = foo;
+
+func_p
+__attribute__((noinline))
+get_bar (void)
+{
+ return bar;
+}
int
main (void)
{
- int (*bar_ptr)(void) = bar;
+ func_p bar_ptr = get_bar ();
if (bar_ptr != bar)
__builtin_abort ();
if (bar_ptr() != -1)
More information about the Binutils
mailing list