diff options
Diffstat (limited to 'ld')
-rw-r--r-- | ld/testsuite/ld-elf/linux-x86.exp | 15 | ||||
-rw-r--r-- | ld/testsuite/ld-elf/pr29797.c | 21 |
2 files changed, 36 insertions, 0 deletions
diff --git a/ld/testsuite/ld-elf/linux-x86.exp b/ld/testsuite/ld-elf/linux-x86.exp index 0637905..7822bd2 100644 --- a/ld/testsuite/ld-elf/linux-x86.exp +++ b/ld/testsuite/ld-elf/linux-x86.exp @@ -203,6 +203,21 @@ run_ld_link_exec_tests [list \ ] \ ] +# Run-time tests which require working ifunc attribute support. +if { [check_ifunc_attribute_available] } { + run_ld_link_exec_tests [list \ + [list \ + "Run pr29797" \ + "-s" \ + "" \ + { pr29797.c } \ + "pr29797" \ + "pass.out" \ + "-O0" \ + ] \ + ] +} + # Old gcc silently ignores __attribute__ ((aligned())) with too big alignment. proc compiler_honours_aligned { } { global CC_FOR_TARGET READELF srcdir subdir diff --git a/ld/testsuite/ld-elf/pr29797.c b/ld/testsuite/ld-elf/pr29797.c new file mode 100644 index 0000000..9e3113f --- /dev/null +++ b/ld/testsuite/ld-elf/pr29797.c @@ -0,0 +1,21 @@ +#include <stdio.h> + +static int foo (int x) __attribute__ ((ifunc ("resolve_foo"))); + +static int foo_impl(int x) +{ + return x; +} + +static void *resolve_foo (void) +{ + return (void *) foo_impl; +} + +int +main () +{ + foo (0); + puts ("PASS"); + return 0; +} |