diff options
author | Andrew Hsieh <andrewhsieh@google.com> | 2014-06-13 12:38:00 -0700 |
---|---|---|
committer | Andrew Hsieh <andrewhsieh@google.com> | 2014-06-13 12:38:00 -0700 |
commit | 54f1b3cf509cd889905287cb8ce6c5ae33911a21 (patch) | |
tree | e39b1a7fa04db86a8215b7f9d4656d74e394aec0 /binutils-2.25/ld/testsuite/ld-plugin | |
parent | 2a6558a8ecfb81d75215b4ec7dc61113e12cfd5f (diff) | |
download | toolchain_binutils-54f1b3cf509cd889905287cb8ce6c5ae33911a21.tar.gz toolchain_binutils-54f1b3cf509cd889905287cb8ce6c5ae33911a21.tar.bz2 toolchain_binutils-54f1b3cf509cd889905287cb8ce6c5ae33911a21.zip |
Add upstream binutils-2.25 snapshot 4/4 2014
For MIPS -mmsa support
Change-Id: I08c4f002fa7b33dec85ed75956e6ab551bb03c96
Diffstat (limited to 'binutils-2.25/ld/testsuite/ld-plugin')
113 files changed, 1603 insertions, 0 deletions
diff --git a/binutils-2.25/ld/testsuite/ld-plugin/dummy.c b/binutils-2.25/ld/testsuite/ld-plugin/dummy.c new file mode 100644 index 00000000..5c032873 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/dummy.c @@ -0,0 +1 @@ +/* An empty file. */ diff --git a/binutils-2.25/ld/testsuite/ld-plugin/dummy.s b/binutils-2.25/ld/testsuite/ld-plugin/dummy.s new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/dummy.s @@ -0,0 +1 @@ + diff --git a/binutils-2.25/ld/testsuite/ld-plugin/func.c b/binutils-2.25/ld/testsuite/ld-plugin/func.c new file mode 100644 index 00000000..8c668dbd --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/func.c @@ -0,0 +1,7 @@ + +extern int retval; + +int func (void) +{ + return retval; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/func1p.c b/binutils-2.25/ld/testsuite/ld-plugin/func1p.c new file mode 100644 index 00000000..917dcbbc --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/func1p.c @@ -0,0 +1,8 @@ +extern int retval; + +int +__attribute__ ((visibility ("protected"))) +func1 (void) +{ + return retval; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/func2i.c b/binutils-2.25/ld/testsuite/ld-plugin/func2i.c new file mode 100644 index 00000000..00d7cdd1 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/func2i.c @@ -0,0 +1,8 @@ +extern int retval; + +int +__attribute__ ((visibility ("internal"))) +func2 (void) +{ + return retval; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/func3h.c b/binutils-2.25/ld/testsuite/ld-plugin/func3h.c new file mode 100644 index 00000000..525de63e --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/func3h.c @@ -0,0 +1,8 @@ +extern int retval; + +int +__attribute__ ((visibility ("hidden"))) +func3 (void) +{ + return retval; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-11.out b/binutils-2.25/ld/testsuite/ld-plugin/lto-11.out new file mode 100644 index 00000000..899682ae --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-11.out @@ -0,0 +1,2 @@ +Hello from foo! +Hello from bar! diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-11a.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-11a.c new file mode 100644 index 00000000..5193972c --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-11a.c @@ -0,0 +1,9 @@ +extern void foo(void); +extern void bar(void); + +int main(void) +{ + foo(); + bar(); + return 0; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-11b.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-11b.c new file mode 100644 index 00000000..62d61ecf --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-11b.c @@ -0,0 +1,6 @@ +extern int printf(const char *, ...); + +void foo(void) +{ + printf("Hello from %s!\n", __FUNCTION__); +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-11c.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-11c.c new file mode 100644 index 00000000..8cd40b95 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-11c.c @@ -0,0 +1,6 @@ +extern int printf(const char *, ...); + +void bar(void) +{ + printf("Hello from %s!\n", __FUNCTION__); +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-12.out b/binutils-2.25/ld/testsuite/ld-plugin/lto-12.out new file mode 100644 index 00000000..d86bac9d --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-12.out @@ -0,0 +1 @@ +OK diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-12a.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-12a.c new file mode 100644 index 00000000..30ff3d93 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-12a.c @@ -0,0 +1,16 @@ +#include <stdio.h> +#include <stdlib.h> + +extern int value; + +int +main (int argc, char **argv) +{ + int n = 10 * (argc + 1); + char *p = malloc (n); + __builtin_memcpy (p, argv[0], n); + if (value != -1) + abort (); + printf ("OK\n"); + return 0; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-12b.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-12b.c new file mode 100644 index 00000000..c2b00e4c --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-12b.c @@ -0,0 +1 @@ +int value = -1; diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-12c.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-12c.c new file mode 100644 index 00000000..ecd1bd48 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-12c.c @@ -0,0 +1,15 @@ +#include <string.h> + +extern int value; + +void *memcpy(void *dest, const void *src, size_t n) +{ + char *d = (char *) dest; + const char *s = (const char *) src; + + while (n--) + *d++ = *s++; + + value = 1; + return dest; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-13.out b/binutils-2.25/ld/testsuite/ld-plugin/lto-13.out new file mode 100644 index 00000000..3bd1f0e2 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-13.out @@ -0,0 +1,2 @@ +foo +bar diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-13a.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-13a.c new file mode 100644 index 00000000..5193972c --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-13a.c @@ -0,0 +1,9 @@ +extern void foo(void); +extern void bar(void); + +int main(void) +{ + foo(); + bar(); + return 0; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-13b.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-13b.c new file mode 100644 index 00000000..7c87a5eb --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-13b.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +void +bar (void) +{ + printf ("bar\n"); +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-13c.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-13c.c new file mode 100644 index 00000000..48590190 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-13c.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +void +foo (void) +{ + printf ("foo\n"); +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-14.out b/binutils-2.25/ld/testsuite/ld-plugin/lto-14.out new file mode 100644 index 00000000..7ef22e9a --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-14.out @@ -0,0 +1 @@ +PASS diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-14a.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-14a.c new file mode 100644 index 00000000..d61437b1 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-14a.c @@ -0,0 +1,12 @@ +#include <stdio.h> + +extern void foo(void); +extern int i; + +int main() +{ + foo(); + if (i == 0x1234) + printf ("PASS\n"); + return 0; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-14b.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-14b.c new file mode 100644 index 00000000..5d3eb75c --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-14b.c @@ -0,0 +1,7 @@ +extern int bar(void); +extern int i; + +void foo(void) +{ + i = bar(); +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-14c.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-14c.c new file mode 100644 index 00000000..a01e0f9b --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-14c.c @@ -0,0 +1,6 @@ +int i; + +int bar(void) +{ + return 0x1234; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-15.out b/binutils-2.25/ld/testsuite/ld-plugin/lto-15.out new file mode 100644 index 00000000..7ef22e9a --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-15.out @@ -0,0 +1 @@ +PASS diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-15a.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-15a.c new file mode 100644 index 00000000..c4ce5e9d --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-15a.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main(int argc, char **argv) +{ + printf ("PASS\n"); + return (int) ((unsigned long long) argc / argv[0][0]); +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-15b.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-15b.c new file mode 100644 index 00000000..0ae748d2 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-15b.c @@ -0,0 +1,7 @@ +extern void abort (void); +unsigned long long +__udivdi3(unsigned long long n, unsigned long long d) +{ + abort (); + return n + d; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-16a.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-16a.c new file mode 100644 index 00000000..aa1cbe23 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-16a.c @@ -0,0 +1 @@ +void foo (void) { } diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-16a.d b/binutils-2.25/ld/testsuite/ld-plugin/lto-16a.d new file mode 100644 index 00000000..1d052c67 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-16a.d @@ -0,0 +1,3 @@ +#... +[0-9a-f]+ [DT] foo +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-16b.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-16b.c new file mode 100644 index 00000000..31781e83 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-16b.c @@ -0,0 +1,4 @@ +void +bar () +{ +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-16b.d b/binutils-2.25/ld/testsuite/ld-plugin/lto-16b.d new file mode 100644 index 00000000..c580e21a --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-16b.d @@ -0,0 +1,3 @@ +#... +[0-9a-f]+ [DT] bar +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-17a.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-17a.c new file mode 100644 index 00000000..7de81b31 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-17a.c @@ -0,0 +1,4 @@ +void +bar (void) +{ +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-17a.d b/binutils-2.25/ld/testsuite/ld-plugin/lto-17a.d new file mode 100644 index 00000000..c580e21a --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-17a.d @@ -0,0 +1,3 @@ +#... +[0-9a-f]+ [DT] bar +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-17b-1.d b/binutils-2.25/ld/testsuite/ld-plugin/lto-17b-1.d new file mode 100644 index 00000000..c8f43392 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-17b-1.d @@ -0,0 +1,4 @@ +#failif +#... +[0-9a-f]+ . bar +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-17b-2.d b/binutils-2.25/ld/testsuite/ld-plugin/lto-17b-2.d new file mode 100644 index 00000000..1d052c67 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-17b-2.d @@ -0,0 +1,3 @@ +#... +[0-9a-f]+ [DT] foo +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-17b.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-17b.c new file mode 100644 index 00000000..f129c90b --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-17b.c @@ -0,0 +1,6 @@ +extern void bar(void) __attribute__((__visibility__("hidden"))); + +void foo (void) +{ + bar (); +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-1a.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-1a.c new file mode 100644 index 00000000..b775d0a5 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-1a.c @@ -0,0 +1,4 @@ +unsigned long long bar (unsigned long long y) +{ + return 30 / y; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-1b.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-1b.c new file mode 100644 index 00000000..8a961ef1 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-1b.c @@ -0,0 +1,8 @@ +extern unsigned long long bar (unsigned long long); + +int +main (int argc, char **argv) +{ + unsigned long long d = bar ((unsigned long long) (argc + 1)); + return d; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-2.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-2.c new file mode 100644 index 00000000..f0eacf4e --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-2.c @@ -0,0 +1,11 @@ +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + +int +main (int argc, char **argv) +{ + int d = atoi (argv[1]); + printf ("%f\n", sin (d)); + return 0; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-3.d b/binutils-2.25/ld/testsuite/ld-plugin/lto-3.d new file mode 100644 index 00000000..c3a9a167 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-3.d @@ -0,0 +1,4 @@ +#failif +#... +[0-9a-f]+ T foo +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-3.out b/binutils-2.25/ld/testsuite/ld-plugin/lto-3.out new file mode 100644 index 00000000..a69f8f35 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-3.out @@ -0,0 +1,2 @@ +hello foo +hello bar diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-3a.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-3a.c new file mode 100644 index 00000000..5193972c --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-3a.c @@ -0,0 +1,9 @@ +extern void foo(void); +extern void bar(void); + +int main(void) +{ + foo(); + bar(); + return 0; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-3b.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-3b.c new file mode 100644 index 00000000..c24f6d47 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-3b.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +void foo(void) +{ + printf ("hello foo\n"); +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-3c.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-3c.c new file mode 100644 index 00000000..95b3bc0a --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-3c.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +void bar(void) +{ + printf ("hello bar\n"); +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-3r.d b/binutils-2.25/ld/testsuite/ld-plugin/lto-3r.d new file mode 100644 index 00000000..1d1befe9 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-3r.d @@ -0,0 +1,7 @@ +#ld: -r tmpdir/lto-3b.o +#source: dummy.s +#nm: -p + +#... +[0-9a-f]+ C __gnu_lto_v.* +#pass diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-5.d b/binutils-2.25/ld/testsuite/ld-plugin/lto-5.d new file mode 100644 index 00000000..c3a9a167 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-5.d @@ -0,0 +1,4 @@ +#failif +#... +[0-9a-f]+ T foo +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-5.out b/binutils-2.25/ld/testsuite/ld-plugin/lto-5.out new file mode 100644 index 00000000..dfbb2158 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-5.out @@ -0,0 +1 @@ +hello foo diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-5a.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-5a.c new file mode 100644 index 00000000..2d07cf58 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-5a.c @@ -0,0 +1,7 @@ +extern void foo(void); + +int main(void) +{ + foo(); + return 0; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-5b.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-5b.c new file mode 100644 index 00000000..c24f6d47 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-5b.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +void foo(void) +{ + printf ("hello foo\n"); +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-5r.d b/binutils-2.25/ld/testsuite/ld-plugin/lto-5r.d new file mode 100644 index 00000000..43e9a5c5 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-5r.d @@ -0,0 +1,7 @@ +#ld: -r tmpdir/lto-5a.o tmpdir/lto-5b.o +#source: dummy.s +#nm: -p + +#... +[0-9a-f]+ C __gnu_lto_v.* +#pass diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-6.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-6.c new file mode 100644 index 00000000..749e4e02 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-6.c @@ -0,0 +1,9 @@ +#include <stdio.h> + +extern char _etext[]; + +int main(void) +{ + printf ("%p: %d\n", _etext, _etext[0]); + return 0; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-7.out b/binutils-2.25/ld/testsuite/ld-plugin/lto-7.out new file mode 100644 index 00000000..d86bac9d --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-7.out @@ -0,0 +1 @@ +OK diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-7a.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-7a.c new file mode 100644 index 00000000..d277a43d --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-7a.c @@ -0,0 +1,14 @@ +#include <stdlib.h> +#include <stdio.h> + +int foo = -1; + +extern void bar (); + +int +main (int argc, char **argv) +{ + bar (); + printf ("OK\n"); + return 0; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-7b.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-7b.c new file mode 100644 index 00000000..17981300 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-7b.c @@ -0,0 +1,8 @@ +extern int foo; + +static void +__attribute__ ((unused, constructor)) +set_foo (void) +{ + foo = 30; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-7c.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-7c.c new file mode 100644 index 00000000..5236f576 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-7c.c @@ -0,0 +1,9 @@ +extern int foo; +extern int foo2; + +static void +__attribute__ ((unused, constructor)) +set_foo (void) +{ + foo = foo2; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-7d.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-7d.c new file mode 100644 index 00000000..7fc1ff1d --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-7d.c @@ -0,0 +1,11 @@ +#include <stdlib.h> + +extern int foo; +int foo2 = 2; + +void +bar (void) +{ + if (foo != 30) + abort (); +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-8.out b/binutils-2.25/ld/testsuite/ld-plugin/lto-8.out new file mode 100644 index 00000000..35c5d69a --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-8.out @@ -0,0 +1 @@ +baz: 42 diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-8a.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-8a.c new file mode 100644 index 00000000..0bdeb272 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-8a.c @@ -0,0 +1,14 @@ +#include <stdio.h> + +extern void foo(char); + +void baz(int i) +{ + printf ("baz: %d\n", i); +} + +int main(void) +{ + foo(42); + return 0; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-8b.c b/binutils-2.25/ld/testsuite/ld-plugin/lto-8b.c new file mode 100644 index 00000000..3b6db5fb --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-8b.c @@ -0,0 +1,14 @@ +extern int bar(void) __attribute__((__visibility__("hidden"), __const__)); +extern void baz(int); + +void foo(char c) +{ + int i; + + if (bar()) + i = c; + else + i = c; + + baz(i); +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-9.cc b/binutils-2.25/ld/testsuite/ld-plugin/lto-9.cc new file mode 100644 index 00000000..2a4dcde3 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-9.cc @@ -0,0 +1,9 @@ +struct Foooo { + virtual ~Foooo () { } +}; + +int main(void) +{ + Foooo t; + return 0; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto-9.d b/binutils-2.25/ld/testsuite/ld-plugin/lto-9.d new file mode 100644 index 00000000..4b5bcf8d --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto-9.d @@ -0,0 +1,4 @@ +#failif +#... +[0-9a-f]+ . .*Foooo::Foooo.* +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/lto.exp b/binutils-2.25/ld/testsuite/ld-plugin/lto.exp new file mode 100644 index 00000000..c5249f0d --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/lto.exp @@ -0,0 +1,354 @@ +# Expect script for ld-plugin LTO tests +# Copyright 2011, 2012, 2013 +# Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. + +# These tests require plugin and LTO. +if { ![check_plugin_api_available] + || ![check_lto_available] } { + return +} + +global CFLAGS +global CXXFLAGS +set saved_CFLAGS "$CFLAGS" +set saved_CXXFLAGS "$CXXFLAGS" +regsub -all "\\-Wp,-D_FORTIFY_SOURCE=\[0-9\]+" $CFLAGS "" CFLAGS +regsub -all "\\-Wp,-D_FORTIFY_SOURCE=\[0-9\]+" $CXXFLAGS "" CXXFLAGS + +proc restore_notify { } { + global saved_CFLAGS + global saved_CXXFLAGS + set CFLAGS "$saved_CFLAGS" + set CXXFLAGS "$saved_CXXFLAGS" +} + +# Simple LTO tests and generate input files for complex LTO tests. +set lto_link_tests { + {"LTO 1" + "-O2 -flto -fuse-linker-plugin" "-flto -fuse-linker-plugin" + {lto-1a.c lto-1b.c} {} "lto-1.exe"} + {"Build libdummy.a 2" + "" "-O2 -flto -fuse-linker-plugin" + {lto-2.c} {} "libdummy.a"} + {"LTO 2" + "-static -O2 -flto -fuse-linker-plugin tmpdir/lto-2.o -lm" "" + {dummy.c} {} "lto-2.exe"} + {"Build libdummy.a 3a" + "" "-flto" + {lto-3a.c} {} "libdummy.a"} + {"Build libdummy.a 3c" + "" "-O2" + {lto-3c.c} {} "libdummy.a"} + {"Build liblto-3.a" + "" "-flto" + {lto-3b.c} {} "liblto-3.a"} + {"Build libdummy.a 5a" + "" "-flto" + {lto-5a.c} {} "libdummy.a"} + {"Build libdummy.a 5b" + "" "-flto" + {lto-5b.c} {} "libdummy.a"} + {"LTO 6" + "-O2 -flto -fuse-linker-plugin" "" + {lto-6.c} {} "lto-6.exe" "c"} + {"Build libdummy.a 9" + "" "-O2 -finline -flto" + {lto-9.cc} {} "libdummy.a"} + {"Build libdummy.a 11a" + "" "-O -flto" + {lto-11a.c} {} "libdummy.a"} + {"Build libdummy.a 11b" + "" "-O -flto" + {lto-11b.c} {} "libdummy.a"} + {"Build libdummy.a 11c" + "" "-O" + {lto-11c.c} {} "libdummy.a"} + {"Build liblto-12.a" + "" "-O2 -flto" + {lto-12c.c} {} "liblto-12.a"} + {"Build libdummy.a 12" + "" "-O2 -flto" + {lto-12a.c lto-12b.c} {} "libdummy.a"} + {"Build libdummy.a 13" + "" "-O2 -flto" + {lto-13a.c lto-13b.c} {} "libdummy.a"} + {"Build liblto-13.a" + "" "-O2" + {lto-13c.c} {} "liblto-13.a"} + {"Build libdummy.a 14a" + "" "-flto" + {lto-14a.c lto-14b.c} {} "libdummy.a"} + {"Build liblto-14.a" + "" "-flto" + {lto-14c.c} {} "liblto-14.a"} + {"Build libdummy.a 15a" + "" "-flto" + {lto-15a.c} {} "libdummy.a"} + {"Build liblto-15.a" + "" "-flto" + {lto-15b.c} {} "liblto-15.a"} + {"PR ld/12696" + "-O2 -flto -fuse-linker-plugin -r -nostdlib" "-O2 -flto" + {pr12696-1.cc} {} "pr12696-1r.o" "c"} + {"Build libdummy.a PR ld/12758" + "" "" + {pr12758a.s} {} "libdummy.a"} + {"Build libpr12758.a" + "" "-flto -O2" + {pr12758b.c} {} "libpr12758.a"} + {"PR ld/12758" + "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12758a.o -Wl,--start-group tmpdir/libpr12758.a -Wl,--end-group" "" + {dummy.c} {} "pr12758.exe"} + {"Build libdummy.a PR ld/12760" + "" "" + {pr12760a.c} {} "libdummy.a"} + {"Build libpr12760.a" + "" "-flto -O2" + {pr12760b.c} {} "libpr12760.a"} + {"PR ld/12760" + "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin tmpdir/pr12760a.o -Wl,--start-group tmpdir/libpr12760.a -Wl,--end-group" "" + {dummy.c} {} "pr12760.exe" "c" "warning: Bad bar"} + {"Build libpr13183.a" + "-T" "-flto -O2" + {pr13183a.c} {} "libpr13183.a"} + {"Build libdummy.a PR ld/13183" + "" "-flto -O2" + {pr13183b.c} {} "libdummy.a"} + {"Build libdummy.a PR ld/13201" + "" "-flto -O2" + {pr13201.c} {} "libdummy.a"} + {"PR ld/13287" + "-flto -fuse-linker-plugin -Wl,--as-needed" "-flto" + {pr13287.cc} {} "pr13287.exe" "c++"} + {"PR ld/15323" + "" "-O2" + {pr15323a.c} {} "libdummy.a" "c"} +} + +if { [at_least_gcc_version 4 7] } { + set lto_link_tests [concat $lto_link_tests { + {"Build libdummy.a PR ld/12942 (1)" + "" "-flto -O2" + {pr12942a.cc pr12942c.cc} {} "libdummy.a" "c++"} + {"Build libdummy.a PR ld/12942 (2)" + "" "-O0" + {pr12942b.cc} {} "libdummy.a" "c++"} + }] +} + +# Generate input files for complex LTO tests for ELF. +set lto_link_elf_tests { + {"Build libdummy.a 7" + "" "-flto -O2" + {lto-7a.c lto-7b.c lto-7c.c} {} "libdummy.a"} + {"Build liblto-7.so" + "-shared" "-O2 -fpic" + {lto-7d.c} {} "liblto-7.so" "c"} + {"Build libdummy.a 8a" + "" "-O2" + {lto-8a.c} {} "libdummy.a"} + {"Build libdummy.a 8b" + "" "-flto -O2" + {lto-8b.c} {} "libdummy.a"} + {"Build liblto-17a.so" + "-shared -O2 -fpic -flto -fuse-linker-plugin" "-O2 -fpic -flto" + {lto-17a.c} {{"nm" {} "lto-17a.d"}} "liblto-17a.so" "c"} + {"Build liblto-17b.so 1" + "-shared -O2 -fpic -flto -fuse-linker-plugin tmpdir/lto-17a.o" "-O2 -fpic -flto" + {lto-17b.c} {{"nm" {} "lto-17b-1.d"}} "liblto-17b.so"} + {"Build liblto-17b.so 2" + "-shared -O2 -fpic -flto -fuse-linker-plugin tmpdir/lto-17a.o" "-O2 -fpic -flto" + {lto-17b.c} {{"nm" {} "lto-17b-2.d"}} "liblto-17b.so"} + {"PR ld/12982" + "-O2 -flto -fuse-linker-plugin" "-O2 -flto" + {pr12982.c} {{"readelf" {-l --wide} "pr12982.d"}} "pr12982.exe"} + {"PR ld/12975" + "-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib -Wl,-version-script,pr12975.t" "-O2 -flto" + {pr12975.c} {{"readelf" {-s --wide} "pr12975.d"}} "pr12975.so" "c"} + {"PR ld/13229" + "-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -finline -fno-early-inlining -flto" + {pr13229.cc} {{"readelf" {-s --wide} "pr13229.d"}} "pr13229.so" "c++"} + {"PR ld/13244" + "-shared -O2 -fPIC -flto -fuse-linker-plugin -nostdlib" "-O2 -fno-early-inlining -flto" + {pr13244.c} {{"readelf" {-s --wide} "pr13244.d"}} "pr13244.so" "c"} + {"Build libpr15146a.a" + "" "-flto -O2" + {pr15146a.c} {} "lib15146a.a"} + {"Build pr15146b.so" + "-shared" "-O2 -fpic" + {pr15146b.c} {} "pr15146b.so" "c"} + {"Build pr15146c.so" + "-shared -Wl,--no-as-needed tmpdir/pr15146b.so" "-O2 -fpic" + {pr15146c.c} {} "pr15146c.so" "c"} + {"PR ld/15146 (1)" + "-O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146a.o tmpdir/pr15146c.so" "" + {dummy.c} {{"readelf" {-d} "pr15146.d"}} "pr15146a.exe"} + {"Build libpr15146d.a" + "" "-flto -O2" + {pr15146d.c} {} "lib15146d.a"} + {"Build libpr15146d.a" + "" "-flto -O2" + {pr15146d.c} {} "lib15146d.a"} +} + +# Check final symbols in executables. +set lto_link_symbol_tests { + {"LTO 3 symbol" + "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o tmpdir/liblto-3.a" "" + {dummy.c} {{"nm" {} "lto-3.d"}} "lto-3.exe" "c"} + {"LTO 5 symbol" + "-O2 -flto -fuse-linker-plugin tmpdir/lto-5.o" "" + {dummy.c} {{"nm" {} "lto-5.d"}} "lto-5.exe" "c"} + {"LTO 9 symbol" + "-O2 -flto -fuse-linker-plugin tmpdir/lto-9.o" "" + {dummy.c} {{"nm" {-C} "lto-9.d"}} "lto-9.exe" "c++"} + {"LTO 16a symbol" + "-O2 -Wl,-e,foo -nostdlib -flto -fuse-linker-plugin" "-flto" + {lto-16a.c} {{"nm" {} "lto-16a.d"}} "lto-16.exe" "c"} + {"LTO 16b symbol" + "-O2 -Wl,-e,foo -u bar -nostdlib -flto -fuse-linker-plugin" "-flto" + {lto-16a.c lto-16b.c} {{"nm" {} "lto-16b.d"}} "lto-16b.exe" "c"} + {"PR ld/13183" + "-O2 -flto -fuse-linker-plugin tmpdir/pr13183b.o tmpdir/libpr13183.a" "" + {dummy.c} {{"nm" {} "pr13183.d"}} "pr13183.exe" "c"} +} + +# LTO run-time tests. +set lto_run_tests { + {"LTO 3a" + "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o tmpdir/liblto-3.a" "" + {dummy.c} "lto-3b.exe" "lto-3.out" "" "c"} + {"LTO 3b" + "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o tmpdir/lto-3.o" "" + {dummy.c} "lto-3c.exe" "lto-3.out" "" "c"} + {"LTO 3c" + "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o -Wl,--whole-archive tmpdir/liblto-3.a -Wl,--no-whole-archive tmpdir/liblto-3.a" "" + {dummy.c} "lto-3d.exe" "lto-3.out" "" "c"} + {"LTO 5" + "-O2 -flto -fuse-linker-plugin tmpdir/lto-5.o" "" + {dummy.c} "lto-5.exe" "lto-5.out" "" "c"} + {"LTO 11" + "-O -flto -fuse-linker-plugin tmpdir/liblto-11.a" "" + {dummy.c} "lto-11.exe" "lto-11.out" "" "c"} + {"LTO 12a" + "-O -flto -fuse-linker-plugin tmpdir/lto-12a.o tmpdir/liblto-12.a tmpdir/lto-12b.o" "" + {dummy.c} "lto-12a.exe" "lto-12.out" "" "c"} + {"LTO 12b" + "-O -flto -fuse-linker-plugin tmpdir/lto-12a.o tmpdir/lto-12b.o tmpdir/liblto-12.a" "" + {dummy.c} "lto-12b.exe" "lto-12.out" "" "c"} + {"LTO 13" + "-O -flto -fuse-linker-plugin tmpdir/lto-13a.o tmpdir/liblto-13.a tmpdir/lto-13b.o" "" + {dummy.c} "lto-13.exe" "lto-13.out" "" "c"} + {"LTO 14" + "-O2 -flto -fuse-linker-plugin tmpdir/lto-14a.o -Wl,--whole-archive tmpdir/liblto-14.a -Wl,--no-whole-archive tmpdir/lto-14b.o" "" + {dummy.c} "lto-14.exe" "lto-14.out" "" "c"} + {"LTO 15" + "-O2 -flto -fuse-linker-plugin -Wl,--start-group tmpdir/liblto-15.a tmpdir/lto-15a.o -Wl,--end-group" "" + {dummy.c} "lto-15.exe" "lto-15.out" "" "c"} + {"PR ld/13066" + "-O2 -flto -fuse-linker-plugin" "" + {pr13066.cc} "pr13066.exe" "pr13066.out" "" "c++"} + {"PR ld/13201" + "-O2 -flto -fuse-linker-plugin -Wl,--as-needed tmpdir/pr13201.o -lm" "" + {dummy.c} "pr13201.exe" "pr13201.out" "" "c"} + {"PR ld/15323" + "-O2 -flto -fuse-linker-plugin tmpdir/pr15323a.o" "" + {pr15323b.c} "pr15323.exe" "pr15323.out" "-flto -O2" "c"} +} + +if { [at_least_gcc_version 4 7] } { + set lto_run_tests [concat $lto_run_tests { + {"PR ld/12942 (1)" + "-O2 -flto -fuse-linker-plugin tmpdir/pr12942a.o tmpdir/pr12942b.o" "" + {dummy.c} "pr12942a.exe" "pr12942.out" "" "c++"} + {"PR ld/12942 (2)" + "-O2 -flto -fuse-linker-plugin tmpdir/pr12942a.o tmpdir/pr12942c.o" "" + {dummy.c} "pr12942c.exe" "pr12942.out" "" "c++"} + }] +} + +# LTO run-time tests for ELF +set lto_run_elf_tests { + {"LTO 7" + "-O2 -flto -fuse-linker-plugin tmpdir/lto-7b.o tmpdir/lto-7c.o tmpdir/lto-7a.o -Wl,--no-as-needed tmpdir/liblto-7.so" "" + {dummy.c} "lto-7.exe" "lto-7.out" "" "c"} + {"LTO 8" + "-O2 -flto -fuse-linker-plugin tmpdir/lto-8b.o tmpdir/lto-8a.o" "" + {dummy.c} "lto-8.exe" "lto-8.out" "" "c"} + {"LTO TLS IE" + "-O2 -flto -fuse-linker-plugin" "" + {run-ie.c} "run-ie.exe" "run-ie.out" "" "c"} +} + +run_cc_link_tests $lto_link_tests + +# Restrict these to ELF targets that support shared libs and PIC. +if { [is_elf_format] + && [run_host_cmd_yesno $CC "-shared -fPIC $srcdir/$subdir/dummy.c -o tmpdir/t.so"] } { + run_cc_link_tests $lto_link_elf_tests + set testname "PR ld/15146 (2)" + set exec_output [run_host_cmd "$CC" "$gcc_gas_flag $gcc_ld_flag -O2 -flto -fuse-linker-plugin -Wl,-rpath-link,. -Wl,--no-copy-dt-needed-entries -Wl,--no-as-needed tmpdir/pr15146d.o tmpdir/pr15146c.so"] + if { [ regexp "undefined reference to symbol 'xxx'" $exec_output ] } { + pass $testname + } { + fail $testname + } +} + +set testname "Build liblto-11.a" +remote_file host delete "tmpdir/liblto-11.a" +set catch_output [run_host_cmd "$ar" "rc tmpdir/liblto-11.a tmpdir/lto-11a.o tmpdir/lto-11b.o tmpdir/lto-11c.o"] +if {![string match "" $catch_output]} { + unresolved $testname + restore_notify + return +} + +if { [at_least_gcc_version 4 7] } { + # Check expected LTO linker errors. + set testname "PR ld/12942 (3)" + set exec_output [run_host_cmd "$CXX" "$gcc_gas_flag $gcc_ld_flag -O2 -flto -fuse-linker-plugin tmpdir/pr12942b.o tmpdir/pr12942a.o"] + if { [ regexp "undefined reference to `link_error\\(\\)'" $exec_output ] } { + pass $testname + } { + fail $testname + } +} + +# Run "ld -r" to generate inputs for complex LTO tests. +run_dump_test "lto-3r" +remote_exec host "mv" "tmpdir/dump tmpdir/lto-3.o" +run_dump_test "lto-5r" +remote_exec host "mv" "tmpdir/dump tmpdir/lto-5.o" + +run_cc_link_tests $lto_link_symbol_tests + +# The following tests require running the executable generated by ld. +if ![isnative] { + return +} + +run_ld_link_exec_tests [] $lto_run_tests + +if { [is_elf_format] } { + run_ld_link_exec_tests [] $lto_run_elf_tests +} + +restore_notify diff --git a/binutils-2.25/ld/testsuite/ld-plugin/main.c b/binutils-2.25/ld/testsuite/ld-plugin/main.c new file mode 100644 index 00000000..2d646171 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/main.c @@ -0,0 +1,13 @@ + +extern int printf (const char *fmt, ...); + +extern const char *text; +extern int func (void); + +int retval = 0; + +int main (int argc, const char **argv) +{ + printf ("%s\n", text); + return func (); +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/plugin-1.d b/binutils-2.25/ld/testsuite/ld-plugin/plugin-1.d new file mode 100644 index 00000000..49229f44 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/plugin-1.d @@ -0,0 +1,19 @@ +Hello from testplugin. +.*: LDPT_MESSAGE func@0x.* +.*: LDPT_API_VERSION value 0x1 \(1\) +.*: LDPT_GNU_LD_VERSION value 0x.* +.*: LDPT_LINKER_OUTPUT value 0x1 \(1\) +.*: LDPT_OUTPUT_NAME 'tmpdir/main.x' +.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +.*: LDPT_ADD_SYMBOLS func@0x.* +.*: LDPT_GET_INPUT_FILE func@0x.* +.*: LDPT_RELEASE_INPUT_FILE func@0x.* +.*: LDPT_GET_SYMBOLS func@0x.* +.*: LDPT_GET_SYMBOLS_V2 func@0x.* +.*: LDPT_ADD_INPUT_FILE func@0x.* +.*: LDPT_ADD_INPUT_LIBRARY func@0x.* +.*: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +.*: LDPT_NULL value 0x0 \(0\) +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/plugin-10.d b/binutils-2.25/ld/testsuite/ld-plugin/plugin-10.d new file mode 100644 index 00000000..37c9d9d0 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/plugin-10.d @@ -0,0 +1,37 @@ +Hello from testplugin. +.*: LDPT_MESSAGE func@0x.* +.*: LDPT_API_VERSION value 0x1 \(1\) +.*: LDPT_GNU_LD_VERSION value 0x.* +.*: LDPT_LINKER_OUTPUT value 0x1 \(1\) +.*: LDPT_OUTPUT_NAME 'tmpdir/main.x' +.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +.*: LDPT_ADD_SYMBOLS func@0x.* +.*: LDPT_GET_INPUT_FILE func@0x.* +.*: LDPT_RELEASE_INPUT_FILE func@0x.* +.*: LDPT_GET_SYMBOLS func@0x.* +.*: LDPT_GET_SYMBOLS_V2 func@0x.* +.*: LDPT_ADD_INPUT_FILE func@0x.* +.*: LDPT_ADD_INPUT_LIBRARY func@0x.* +.*: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +.*: LDPT_OPTION 'registerclaimfile' +.*: LDPT_OPTION 'registerallsymbolsread' +.*: LDPT_OPTION 'registercleanup' +.*: LDPT_OPTION 'claim:tmpdir/func.o' +.*: LDPT_OPTION 'sym:_?func::0:0:0' +.*: LDPT_OPTION 'sym:_?func2::0:0:0' +.*: LDPT_OPTION 'dumpresolutions' +.*: LDPT_OPTION 'add:tmpdir/func.o' +.*: LDPT_NULL value 0x0 \(0\) +#... +hook called: claim_file tmpdir/main.o \[@0/.* not claimed +hook called: claim_file tmpdir/func.o \[@0/.* CLAIMED +#... +hook called: claim_file tmpdir/libtext.a \[@.* not claimed +#... +hook called: all symbols read. +Sym: '_?func' Resolution: LDPR_PREVAILING_DEF +Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY +hook called: cleanup. +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/plugin-11.d b/binutils-2.25/ld/testsuite/ld-plugin/plugin-11.d new file mode 100644 index 00000000..b9204298 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/plugin-11.d @@ -0,0 +1,41 @@ +Hello from testplugin. +.*: LDPT_MESSAGE func@0x.* +.*: LDPT_API_VERSION value 0x1 \(1\) +.*: LDPT_GNU_LD_VERSION value 0x.* +.*: LDPT_LINKER_OUTPUT value 0x1 \(1\) +.*: LDPT_OUTPUT_NAME 'tmpdir/main.x' +.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +.*: LDPT_ADD_SYMBOLS func@0x.* +.*: LDPT_GET_INPUT_FILE func@0x.* +.*: LDPT_RELEASE_INPUT_FILE func@0x.* +.*: LDPT_GET_SYMBOLS func@0x.* +.*: LDPT_GET_SYMBOLS_V2 func@0x.* +.*: LDPT_ADD_INPUT_FILE func@0x.* +.*: LDPT_ADD_INPUT_LIBRARY func@0x.* +.*: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +.*: LDPT_OPTION 'registerclaimfile' +.*: LDPT_OPTION 'registerallsymbolsread' +.*: LDPT_OPTION 'registercleanup' +.*: LDPT_OPTION 'claim:tmpdir/func.o' +.*: LDPT_OPTION 'sym:_?func::0:0:0' +.*: LDPT_OPTION 'sym:_?func2::0:0:0' +.*: LDPT_OPTION 'dumpresolutions' +.*: LDPT_OPTION 'add:tmpdir/func.o' +.*: LDPT_OPTION 'claim:tmpdir/libtext.a' +.*: LDPT_OPTION 'sym:_?text::0:0:0' +.*: LDPT_OPTION 'add:tmpdir/text.o' +.*: LDPT_NULL value 0x0 \(0\) +#... +hook called: claim_file tmpdir/main.o \[@0/.* not claimed +hook called: claim_file tmpdir/func.o \[@0/.* CLAIMED +#... +hook called: claim_file tmpdir/libtext.a \[@.* CLAIMED +#... +hook called: all symbols read. +Sym: '_?func' Resolution: LDPR_PREVAILING_DEF +Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY +Sym: '_?text' Resolution: LDPR_PREVAILING_DEF +hook called: cleanup. +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/plugin-12.d b/binutils-2.25/ld/testsuite/ld-plugin/plugin-12.d new file mode 100644 index 00000000..10d77255 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/plugin-12.d @@ -0,0 +1,6 @@ +#... +.*: symbol `func' definition: 0, visibility: 0, resolution: 2 +.*: symbol `func1' definition: 0, visibility: 1, resolution: 3 +.*: symbol `func2' definition: 0, visibility: 2, resolution: 3 +.*: symbol `func3' definition: 0, visibility: 3, resolution: 3 +#pass diff --git a/binutils-2.25/ld/testsuite/ld-plugin/plugin-2.d b/binutils-2.25/ld/testsuite/ld-plugin/plugin-2.d new file mode 100644 index 00000000..d0190a75 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/plugin-2.d @@ -0,0 +1,22 @@ +Hello from testplugin. +.*: LDPT_MESSAGE func@0x.* +.*: LDPT_API_VERSION value 0x1 \(1\) +.*: LDPT_GNU_LD_VERSION value 0x.* +.*: LDPT_LINKER_OUTPUT value 0x1 \(1\) +.*: LDPT_OUTPUT_NAME 'tmpdir/main.x' +.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +.*: LDPT_ADD_SYMBOLS func@0x.* +.*: LDPT_GET_INPUT_FILE func@0x.* +.*: LDPT_RELEASE_INPUT_FILE func@0x.* +.*: LDPT_GET_SYMBOLS func@0x.* +.*: LDPT_GET_SYMBOLS_V2 func@0x.* +.*: LDPT_ADD_INPUT_FILE func@0x.* +.*: LDPT_ADD_INPUT_LIBRARY func@0x.* +.*: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +.*: LDPT_OPTION 'failonload' +.*: LDPT_NULL value 0x0 \(0\) +#... +.*ld.*:.*ldtestplug.*: plugin error: 3 +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/plugin-3.d b/binutils-2.25/ld/testsuite/ld-plugin/plugin-3.d new file mode 100644 index 00000000..a4b6a7fd --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/plugin-3.d @@ -0,0 +1,23 @@ +Hello from testplugin. +.*: LDPT_MESSAGE func@0x.* +.*: LDPT_API_VERSION value 0x1 \(1\) +.*: LDPT_GNU_LD_VERSION value 0x.* +.*: LDPT_LINKER_OUTPUT value 0x1 \(1\) +.*: LDPT_OUTPUT_NAME 'tmpdir/main.x' +.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +.*: LDPT_ADD_SYMBOLS func@0x.* +.*: LDPT_GET_INPUT_FILE func@0x.* +.*: LDPT_RELEASE_INPUT_FILE func@0x.* +.*: LDPT_GET_SYMBOLS func@0x.* +.*: LDPT_GET_SYMBOLS_V2 func@0x.* +.*: LDPT_ADD_INPUT_FILE func@0x.* +.*: LDPT_ADD_INPUT_LIBRARY func@0x.* +.*: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +.*: LDPT_OPTION 'registerallsymbolsread' +.*: LDPT_OPTION 'failallsymbolsread' +.*: LDPT_NULL value 0x0 \(0\) +#... +.*ld.*:.*ldtestplug.*: plugin reported error after all symbols read +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/plugin-4.d b/binutils-2.25/ld/testsuite/ld-plugin/plugin-4.d new file mode 100644 index 00000000..9f25fc68 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/plugin-4.d @@ -0,0 +1,24 @@ +Hello from testplugin. +.*: LDPT_MESSAGE func@0x.* +.*: LDPT_API_VERSION value 0x1 \(1\) +.*: LDPT_GNU_LD_VERSION value 0x.* +.*: LDPT_LINKER_OUTPUT value 0x1 \(1\) +.*: LDPT_OUTPUT_NAME 'tmpdir/main.x' +.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +.*: LDPT_ADD_SYMBOLS func@0x.* +.*: LDPT_GET_INPUT_FILE func@0x.* +.*: LDPT_RELEASE_INPUT_FILE func@0x.* +.*: LDPT_GET_SYMBOLS func@0x.* +.*: LDPT_GET_SYMBOLS_V2 func@0x.* +.*: LDPT_ADD_INPUT_FILE func@0x.* +.*: LDPT_ADD_INPUT_LIBRARY func@0x.* +.*: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +.*: LDPT_OPTION 'failcleanup' +.*: LDPT_OPTION 'registercleanup' +.*: LDPT_NULL value 0x0 \(0\) +#... +hook called: cleanup. +.*ld.*:.*ldtestplug.*: error in plugin cleanup: 3 \(ignored\) +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/plugin-5.d b/binutils-2.25/ld/testsuite/ld-plugin/plugin-5.d new file mode 100644 index 00000000..c0c55c27 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/plugin-5.d @@ -0,0 +1,30 @@ +Hello from testplugin. +.*: LDPT_MESSAGE func@0x.* +.*: LDPT_API_VERSION value 0x1 \(1\) +.*: LDPT_GNU_LD_VERSION value 0x.* +.*: LDPT_LINKER_OUTPUT value 0x1 \(1\) +.*: LDPT_OUTPUT_NAME 'tmpdir/main.x' +.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +.*: LDPT_ADD_SYMBOLS func@0x.* +.*: LDPT_GET_INPUT_FILE func@0x.* +.*: LDPT_RELEASE_INPUT_FILE func@0x.* +.*: LDPT_GET_SYMBOLS func@0x.* +.*: LDPT_GET_SYMBOLS_V2 func@0x.* +.*: LDPT_ADD_INPUT_FILE func@0x.* +.*: LDPT_ADD_INPUT_LIBRARY func@0x.* +.*: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +.*: LDPT_OPTION 'registerclaimfile' +.*: LDPT_OPTION 'registerallsymbolsread' +.*: LDPT_OPTION 'registercleanup' +.*: LDPT_NULL value 0x0 \(0\) +#... +hook called: claim_file tmpdir/main.o \[@0/.* +hook called: claim_file tmpdir/func.o \[@0/.* +hook called: claim_file tmpdir/text.o \[@0/.* +#... +hook called: all symbols read. +#... +hook called: cleanup. +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/plugin-6.d b/binutils-2.25/ld/testsuite/ld-plugin/plugin-6.d new file mode 100644 index 00000000..f3e13fe6 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/plugin-6.d @@ -0,0 +1,32 @@ +Hello from testplugin. +.*: LDPT_MESSAGE func@0x.* +.*: LDPT_API_VERSION value 0x1 \(1\) +.*: LDPT_GNU_LD_VERSION value 0x.* +.*: LDPT_LINKER_OUTPUT value 0x1 \(1\) +.*: LDPT_OUTPUT_NAME 'tmpdir/main.x' +.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +.*: LDPT_ADD_SYMBOLS func@0x.* +.*: LDPT_GET_INPUT_FILE func@0x.* +.*: LDPT_RELEASE_INPUT_FILE func@0x.* +.*: LDPT_GET_SYMBOLS func@0x.* +.*: LDPT_GET_SYMBOLS_V2 func@0x.* +.*: LDPT_ADD_INPUT_FILE func@0x.* +.*: LDPT_ADD_INPUT_LIBRARY func@0x.* +.*: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +.*: LDPT_OPTION 'registerclaimfile' +.*: LDPT_OPTION 'registerallsymbolsread' +.*: LDPT_OPTION 'registercleanup' +.*: LDPT_OPTION 'claim:tmpdir/func.o' +.*: LDPT_NULL value 0x0 \(0\) +#... +hook called: claim_file tmpdir/main.o \[@0/.* not claimed +hook called: claim_file tmpdir/func.o \[@0/.* CLAIMED +hook called: claim_file tmpdir/text.o \[@0/.* not claimed +#... +hook called: all symbols read. +tmpdir/main.o: In function `main': +.*main.c.*: undefined reference to `func' +hook called: cleanup. +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/plugin-7.d b/binutils-2.25/ld/testsuite/ld-plugin/plugin-7.d new file mode 100644 index 00000000..357a89b6 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/plugin-7.d @@ -0,0 +1,32 @@ +Hello from testplugin. +.*: LDPT_MESSAGE func@0x.* +.*: LDPT_API_VERSION value 0x1 \(1\) +.*: LDPT_GNU_LD_VERSION value 0x.* +.*: LDPT_LINKER_OUTPUT value 0x1 \(1\) +.*: LDPT_OUTPUT_NAME 'tmpdir/main.x' +.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +.*: LDPT_ADD_SYMBOLS func@0x.* +.*: LDPT_GET_INPUT_FILE func@0x.* +.*: LDPT_RELEASE_INPUT_FILE func@0x.* +.*: LDPT_GET_SYMBOLS func@0x.* +.*: LDPT_GET_SYMBOLS_V2 func@0x.* +.*: LDPT_ADD_INPUT_FILE func@0x.* +.*: LDPT_ADD_INPUT_LIBRARY func@0x.* +.*: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +.*: LDPT_OPTION 'registerclaimfile' +.*: LDPT_OPTION 'registerallsymbolsread' +.*: LDPT_OPTION 'registercleanup' +.*: LDPT_OPTION 'claim:tmpdir/func.o' +.*: LDPT_OPTION 'sym:_?func::0:0:0' +.*: LDPT_NULL value 0x0 \(0\) +#... +hook called: claim_file tmpdir/main.o \[@0/.* not claimed +hook called: claim_file tmpdir/func.o \[@0/.* CLAIMED +hook called: claim_file tmpdir/text.o \[@0/.* not claimed +#... +hook called: all symbols read. +`_?func' referenced in section `\.text.*' of tmpdir/main.o: defined in discarded section .* +hook called: cleanup. +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/plugin-8.d b/binutils-2.25/ld/testsuite/ld-plugin/plugin-8.d new file mode 100644 index 00000000..72c86c6b --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/plugin-8.d @@ -0,0 +1,36 @@ +Hello from testplugin. +.*: LDPT_MESSAGE func@0x.* +.*: LDPT_API_VERSION value 0x1 \(1\) +.*: LDPT_GNU_LD_VERSION value 0x.* +.*: LDPT_LINKER_OUTPUT value 0x1 \(1\) +.*: LDPT_OUTPUT_NAME 'tmpdir/main.x' +.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +.*: LDPT_ADD_SYMBOLS func@0x.* +.*: LDPT_GET_INPUT_FILE func@0x.* +.*: LDPT_RELEASE_INPUT_FILE func@0x.* +.*: LDPT_GET_SYMBOLS func@0x.* +.*: LDPT_GET_SYMBOLS_V2 func@0x.* +.*: LDPT_ADD_INPUT_FILE func@0x.* +.*: LDPT_ADD_INPUT_LIBRARY func@0x.* +.*: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +.*: LDPT_OPTION 'registerclaimfile' +.*: LDPT_OPTION 'registerallsymbolsread' +.*: LDPT_OPTION 'registercleanup' +.*: LDPT_OPTION 'claim:tmpdir/func.o' +.*: LDPT_OPTION 'sym:_?func::0:0:0' +.*: LDPT_OPTION 'sym:_?func2::0:0:0' +.*: LDPT_OPTION 'dumpresolutions' +.*: LDPT_NULL value 0x0 \(0\) +#... +hook called: claim_file tmpdir/main.o \[@0/.* not claimed +hook called: claim_file tmpdir/func.o \[@0/.* CLAIMED +hook called: claim_file tmpdir/text.o \[@0/.* not claimed +#... +hook called: all symbols read. +Sym: '_?func' Resolution: LDPR_PREVAILING_DEF +Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY +`_?func' referenced in section `\.text.*' of tmpdir/main.o: defined in discarded section .* +hook called: cleanup. +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/plugin-9.d b/binutils-2.25/ld/testsuite/ld-plugin/plugin-9.d new file mode 100644 index 00000000..c2ebc6b5 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/plugin-9.d @@ -0,0 +1,36 @@ +Hello from testplugin. +.*: LDPT_MESSAGE func@0x.* +.*: LDPT_API_VERSION value 0x1 \(1\) +.*: LDPT_GNU_LD_VERSION value 0x.* +.*: LDPT_LINKER_OUTPUT value 0x1 \(1\) +.*: LDPT_OUTPUT_NAME 'tmpdir/main.x' +.*: LDPT_REGISTER_CLAIM_FILE_HOOK func@0x.* +.*: LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK func@0x.* +.*: LDPT_REGISTER_CLEANUP_HOOK func@0x.* +.*: LDPT_ADD_SYMBOLS func@0x.* +.*: LDPT_GET_INPUT_FILE func@0x.* +.*: LDPT_RELEASE_INPUT_FILE func@0x.* +.*: LDPT_GET_SYMBOLS func@0x.* +.*: LDPT_GET_SYMBOLS_V2 func@0x.* +.*: LDPT_ADD_INPUT_FILE func@0x.* +.*: LDPT_ADD_INPUT_LIBRARY func@0x.* +.*: LDPT_SET_EXTRA_LIBRARY_PATH func@0x.* +.*: LDPT_OPTION 'registerclaimfile' +.*: LDPT_OPTION 'registerallsymbolsread' +.*: LDPT_OPTION 'registercleanup' +.*: LDPT_OPTION 'claim:tmpdir/func.o' +.*: LDPT_OPTION 'sym:_?func::0:0:0' +.*: LDPT_OPTION 'sym:_?func2::0:0:0' +.*: LDPT_OPTION 'dumpresolutions' +.*: LDPT_OPTION 'add:tmpdir/func.o' +.*: LDPT_NULL value 0x0 \(0\) +#... +hook called: claim_file tmpdir/main.o \[@0/.* not claimed +hook called: claim_file tmpdir/func.o \[@0/.* CLAIMED +hook called: claim_file tmpdir/text.o \[@0/.* not claimed +#... +hook called: all symbols read. +Sym: '_?func' Resolution: LDPR_PREVAILING_DEF +Sym: '_?func2' Resolution: LDPR_PREVAILING_DEF_IRONLY +hook called: cleanup. +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/plugin-vis-1.d b/binutils-2.25/ld/testsuite/ld-plugin/plugin-vis-1.d new file mode 100644 index 00000000..02c0e222 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/plugin-vis-1.d @@ -0,0 +1,9 @@ +#... +.*(PROTECTED.*func1|DEFAULT.*func|HIDDEN.*func3|INTERNAL.*func2) +#... +.*(PROTECTED.*func1|DEFAULT.*func|HIDDEN.*func3|INTERNAL.*func2) +#... +.*(PROTECTED.*func1|DEFAULT.*func|HIDDEN.*func3|INTERNAL.*func2) +#... +.*(PROTECTED.*func1|DEFAULT.*func|HIDDEN.*func3|INTERNAL.*func2) +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/plugin.exp b/binutils-2.25/ld/testsuite/ld-plugin/plugin.exp new file mode 100644 index 00000000..329d5116 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/plugin.exp @@ -0,0 +1,194 @@ +# Expect script for ld-plugin tests +# Copyright 2010 +# Free Software Foundation, Inc. +# +# This file is part of the GNU Binutils. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, +# MA 02110-1301, USA. + +# These tests require the plugin API to be configured in. +if ![check_plugin_api_available] { + return +} + +# And a compiler to be available. +set can_compile 1 +set failure_kind "unresolved" +if { [which $CC] == 0 } { + # Don't fail immediately, + set can_compile 0 + set failure_kind "unsupported" +} + +pass "plugin API enabled" + +global base_dir + +# Look for the name we can dlopen in the test plugin's libtool control script. +set plugin_name [file_contents "$base_dir/libldtestplug.la"] +set plugin_name [regsub "'.*" [regsub ".*dlname='" "$plugin_name" ""] ""] +verbose "plugin name is '$plugin_name'" + +# Use libtool to find full path to plugin rather than worrying +# about run paths or anything like that. +catch "exec $base_dir/libtool --config" lt_config +verbose "Full lt config: $lt_config" 3 +# Look for "objdir=.libs" +regexp -line "^objdir=.*$" "$lt_config" lt_objdir +verbose "lt_objdir line is '$lt_objdir'" 3 +set lt_objdir [regsub "objdir=" "$lt_objdir" ""] +set plugin_path "$base_dir/$lt_objdir/$plugin_name" +verbose "Full plugin path $plugin_path" 2 + +set regclm "-plugin-opt registerclaimfile" +set regas "-plugin-opt registerallsymbolsread" +set regcln "-plugin-opt registercleanup" + +if { [istarget m681*-*-*] || [istarget m68hc1*-*-*] || [istarget m9s12x*-*-*] } { + # otherwise get FAILS due to _.frame + set CFLAGS "$CFLAGS -fomit-frame-pointer" +} +# In order to define symbols in plugin options in the list of tests below, +# we need to know if the platform prepends an underscore to C symbols, +# which we find out by compiling the test objects now. If there is any +# error compiling, we defer reporting it until after the list of tests has +# been initialised, so that we can use the names in the list to report; +# otherwise, we scan one of the files with 'nm' and look for a known symbol +# in the output to see if it is prefixed or not. +set failed_compile 0 +set _ "" +set plugin_nm_output "" +if { $can_compile && \ + (![ld_compile "$CC $CFLAGS" $srcdir/$subdir/main.c tmpdir/main.o] \ + || ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/func.c tmpdir/func.o] \ + || ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/text.c tmpdir/text.o]) } { + # Defer fail until we have list of tests set. + set failed_compile 1 +} + +if { $can_compile && !$failed_compile } { + # Find out if symbols have prefix on this platform before setting tests. + catch "exec $NM tmpdir/func.o" plugin_nm_output + if { [regexp "_func" "$plugin_nm_output"] } { + set _ "_" + } +} + +set testobjfiles "tmpdir/main.o tmpdir/func.o tmpdir/text.o" +set testobjfiles_notext "tmpdir/main.o tmpdir/func.o" +# Rather than having libs we just define dummy values for anything +# we may need to link a target exe; we aren't going to run it anyway. +set libs "[ld_simple_link_defsyms] --defsym ${_}printf=${_}main --defsym ${_}puts=${_}main" + +set plugin_tests [list \ + [list "load plugin" "-plugin $plugin_path \ + $testobjfiles $libs" "" "" "" {{ld plugin-1.d}} "main.x" ] \ + [list "fail plugin onload" "-plugin $plugin_path -plugin-opt failonload \ + $testobjfiles $libs" "" "" "" {{ld plugin-2.d}} "main.x" ] \ + [list "fail plugin allsymbolsread" "-plugin $plugin_path $regas \ + -plugin-opt failallsymbolsread \ + $testobjfiles $libs" "" "" "" {{ld plugin-3.d}} "main.x" ] \ + [list "fail plugin cleanup" "-plugin $plugin_path -plugin-opt failcleanup \ + $regcln \ + $testobjfiles $libs" "" "" "" {{ld plugin-4.d}} "main.x" ] \ + [list "plugin all hooks" "-plugin $plugin_path $regclm $regas $regcln \ + $testobjfiles $libs" "" "" "" {{ld plugin-5.d}} "main.x" ] \ + [list "plugin claimfile lost symbol" "-plugin $plugin_path $regclm \ + $regas $regcln -plugin-opt claim:tmpdir/func.o \ + $testobjfiles $libs" "" "" "" {{ld plugin-6.d}} "main.x" ] \ + [list "plugin claimfile replace symbol" "-plugin $plugin_path $regclm \ + $regas $regcln -plugin-opt claim:tmpdir/func.o \ + -plugin-opt sym:${_}func::0:0:0 \ + $testobjfiles $libs" "" "" "" {{ld plugin-7.d}} "main.x" ] \ + [list "plugin claimfile resolve symbol" "-plugin $plugin_path $regclm \ + $regas $regcln -plugin-opt claim:tmpdir/func.o \ + -plugin-opt sym:${_}func::0:0:0 \ + -plugin-opt sym:${_}func2::0:0:0 \ + -plugin-opt dumpresolutions \ + $testobjfiles $libs" "" "" "" {{ld plugin-8.d}} "main.x" ] \ + [list "plugin claimfile replace file" "-plugin $plugin_path $regclm \ + $regas $regcln -plugin-opt claim:tmpdir/func.o \ + -plugin-opt sym:${_}func::0:0:0 \ + -plugin-opt sym:${_}func2::0:0:0 \ + -plugin-opt dumpresolutions \ + -plugin-opt add:tmpdir/func.o \ + $testobjfiles $libs" "" "" "" {{ld plugin-9.d}} "main.x" ] \ +] + +set plugin_lib_tests [list \ + [list "plugin ignore lib" "-plugin $plugin_path $regclm \ + $regas $regcln -plugin-opt claim:tmpdir/func.o \ + -plugin-opt sym:${_}func::0:0:0 \ + -plugin-opt sym:${_}func2::0:0:0 \ + -plugin-opt dumpresolutions \ + -plugin-opt add:tmpdir/func.o \ + $testobjfiles_notext -Ltmpdir -ltext $libs" "" "" "" {{ld plugin-10.d}} "main.x" ] \ + [list "plugin claimfile replace lib" "-plugin $plugin_path $regclm \ + $regas $regcln -plugin-opt claim:tmpdir/func.o \ + -plugin-opt sym:${_}func::0:0:0 \ + -plugin-opt sym:${_}func2::0:0:0 \ + -plugin-opt dumpresolutions \ + -plugin-opt add:tmpdir/func.o \ + -plugin-opt claim:tmpdir/libtext.a \ + -plugin-opt sym:${_}text::0:0:0 \ + -plugin-opt add:tmpdir/text.o \ + $testobjfiles_notext -Ltmpdir -ltext $libs" "" "" "" {{ld plugin-11.d}} "main.x" ] \ +] + +set plugin_extra_elf_tests [list \ + [list "plugin set symbol visibility" "-plugin $plugin_path $regclm \ + $regas $regcln -plugin-opt claim:tmpdir/func.o \ + -plugin-opt sym:${_}func::0:0:0 \ + -plugin-opt sym:${_}func1::0:1:0 \ + -plugin-opt sym:${_}func2::0:2:0 \ + -plugin-opt sym:${_}func3::0:3:0 \ + -plugin-opt dumpresolutions \ + -plugin-opt add:tmpdir/func.o \ + -plugin-opt add:tmpdir/func1p.o \ + -plugin-opt add:tmpdir/func2i.o \ + -plugin-opt add:tmpdir/func3h.o \ + $testobjfiles $libs --verbose=2" "" "" "" {{ld plugin-12.d} \ + {readelf -s plugin-vis-1.d}} "main.x" ] \ +] + +if { !$can_compile || $failed_compile } { + foreach testitem $plugin_tests { + $failure_kind [lindex $testitem 0] + } + if { [is_elf_format] } { + foreach testitem $plugin_extra_elf_tests { + $failure_kind [lindex $testitem 0] + } + } + return +} + +run_ld_link_tests $plugin_tests + +if { [is_elf_format] \ + && [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func1p.c tmpdir/func1p.o] \ + && [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func2i.c tmpdir/func2i.o] \ + && [ld_compile "$CC $CFLAGS" $srcdir/$subdir/func3h.c tmpdir/func3h.o] } { + run_ld_link_tests $plugin_extra_elf_tests +} + +if ![ar_simple_create $ar "" "tmpdir/libtext.a" "tmpdir/text.o"] { + foreach testitem $plugin_lib_tests { + unresolved [lindex $testitem 0] + } +} else { + run_ld_link_tests $plugin_lib_tests +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr12696-1.cc b/binutils-2.25/ld/testsuite/ld-plugin/pr12696-1.cc new file mode 100644 index 00000000..084c07f0 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr12696-1.cc @@ -0,0 +1,7 @@ +/* { dg-lto-do link } */ +/* { dg-lto-options {{-ftoplevel-reorder -flto -flto-partition=none} {-ftoplevel-reorder -flto -flto-partition=1to1}} } */ +/* { dg-extra-ld-options {-r -nostdlib} } */ + +struct Foo { virtual ~Foo(); }; +struct Bar:public Foo { Bar() { } }; +void Func() { new Bar(); } diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr12758a.s b/binutils-2.25/ld/testsuite/ld-plugin/pr12758a.s new file mode 100644 index 00000000..04409d09 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr12758a.s @@ -0,0 +1,4 @@ + .text + .globl foo +foo: + .dc.a memcmp diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr12758b.c b/binutils-2.25/ld/testsuite/ld-plugin/pr12758b.c new file mode 100644 index 00000000..5bcf116b --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr12758b.c @@ -0,0 +1,12 @@ +#include <string.h> + +int memcmp(const void *cs, const void *ct, size_t count) +{ + const unsigned char *su1, *su2; + int res = 0; + + for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--) + if ((res = *su1 - *su2) != 0) + break; + return res; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr12760a.c b/binutils-2.25/ld/testsuite/ld-plugin/pr12760a.c new file mode 100644 index 00000000..6169c267 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr12760a.c @@ -0,0 +1,7 @@ +extern void bar (); + +void +foo () +{ + bar (); +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr12760b.c b/binutils-2.25/ld/testsuite/ld-plugin/pr12760b.c new file mode 100644 index 00000000..29a9fd89 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr12760b.c @@ -0,0 +1,7 @@ +#define linker_warning(x, msg) \ + static const char __warn_##x[] \ + __attribute__((used, section(".gnu.warning." #x))) \ + = msg + +void bar (void) {} +linker_warning(bar, "Bad bar"); diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr12942.out b/binutils-2.25/ld/testsuite/ld-plugin/pr12942.out new file mode 100644 index 00000000..d86bac9d --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr12942.out @@ -0,0 +1 @@ +OK diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr12942a.cc b/binutils-2.25/ld/testsuite/ld-plugin/pr12942a.cc new file mode 100644 index 00000000..d5328dd3 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr12942a.cc @@ -0,0 +1,14 @@ +#include <stdio.h> +#include "pr12942a.h" + +test_t b(void); + +int +main(void) +{ + if (test != b ()) + __builtin_abort (); + + printf ("OK\n"); + return 0; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr12942a.h b/binutils-2.25/ld/testsuite/ld-plugin/pr12942a.h new file mode 100644 index 00000000..760929b1 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr12942a.h @@ -0,0 +1,12 @@ +extern void link_error (); + +inline int test (void) +{ + int exp = -1; + if ((exp < 2 ? 2U : (unsigned int) exp) != 2) + link_error (); + + return 0; +} + +typedef int (*test_t) (void); diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr12942b.cc b/binutils-2.25/ld/testsuite/ld-plugin/pr12942b.cc new file mode 100644 index 00000000..387954e4 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr12942b.cc @@ -0,0 +1,7 @@ +#include <stdio.h> +#include "pr12942a.h" + +test_t b(void) +{ + return test; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr12942c.cc b/binutils-2.25/ld/testsuite/ld-plugin/pr12942c.cc new file mode 100644 index 00000000..9b07231e --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr12942c.cc @@ -0,0 +1 @@ +#include "pr12942b.cc" diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr12975.c b/binutils-2.25/ld/testsuite/ld-plugin/pr12975.c new file mode 100644 index 00000000..909af976 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr12975.c @@ -0,0 +1,7 @@ +int foo() { return 42; } + +int bar() { return 0; } + +#pragma GCC visibility push(hidden) +int baz() { return 1; } +#pragma GCC visibility pop diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr12975.d b/binutils-2.25/ld/testsuite/ld-plugin/pr12975.d new file mode 100644 index 00000000..7fcff801 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr12975.d @@ -0,0 +1,4 @@ +#failif +#... + +[0-9]+: +[0-9a-f]+ +[0-9]+ +FUNC +LOCAL +DEFAULT +[1-9]+ bar +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr12975.t b/binutils-2.25/ld/testsuite/ld-plugin/pr12975.t new file mode 100644 index 00000000..902c1f70 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr12975.t @@ -0,0 +1,6 @@ +{ +global: + foo; +local: + *; +}; diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr12982.c b/binutils-2.25/ld/testsuite/ld-plugin/pr12982.c new file mode 100644 index 00000000..398ec675 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr12982.c @@ -0,0 +1,5 @@ +int +main (void) +{ + return 0; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr12982.d b/binutils-2.25/ld/testsuite/ld-plugin/pr12982.d new file mode 100644 index 00000000..9b01a58f --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr12982.d @@ -0,0 +1,4 @@ +#failif +#... + +GNU_STACK .* RWE .* +#pass diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr13066.cc b/binutils-2.25/ld/testsuite/ld-plugin/pr13066.cc new file mode 100644 index 00000000..b2c73f2d --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr13066.cc @@ -0,0 +1,85 @@ +#include <stdio.h> + +template <typename V> struct S +{ + V *f, *l; + __attribute__ ((noinline)) S (void) { f = 0, l = 0; } + void foo (V *x) + { + if (x->p != 0) + x->p->n = x->n; + else + f = x->n; + if (x->n != 0) + x->n->p = x->p; + else + l = x->p; + } + __attribute__ ((noinline)) void bar (V *x) + { + x->n = 0; + x->p = l; + if (l != 0) + l->n = x; + else + f = x; + l = x; + } +}; + +struct H; + +struct A +{ + S <H> k; +}; + +struct H +{ + A *a; + H *p, *n; + __attribute__ ((noinline)) H (void) { p = 0, n = 0, a = 0; } + __attribute__ ((noinline)) H (A *b) : a (b) + { + p = 0; + n = 0; + if (a != 0) + a->k.bar (this); + } + __attribute__ ((noinline)) H (const H &h) : a (h.a) + { + p = 0; + n = 0; + if (a != 0) + a->k.bar (this); + } + ~H (void) { if (a != 0) a->k.foo (this); } + H &operator= (const H &o) + { + if (a != 0 || &o == this) + __builtin_abort (); + a = o.a; + if (a != 0) + a->k.bar (this); + return *this; + } +}; + +__attribute__ ((noinline)) +H baz (void) +{ + return H (new A); +} + +H g; + +int +main (void) +{ + g = baz (); + if (g.a->k.f != &g) + __builtin_abort (); + printf ("OK\n"); + return 0; +} + diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr13066.out b/binutils-2.25/ld/testsuite/ld-plugin/pr13066.out new file mode 100644 index 00000000..d86bac9d --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr13066.out @@ -0,0 +1 @@ +OK diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr13183.d b/binutils-2.25/ld/testsuite/ld-plugin/pr13183.d new file mode 100644 index 00000000..a390282e --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr13183.d @@ -0,0 +1,4 @@ +#failif +#... +[0-9a-f]+ . foo +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr13183a.c b/binutils-2.25/ld/testsuite/ld-plugin/pr13183a.c new file mode 100644 index 00000000..c83d8569 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr13183a.c @@ -0,0 +1,4 @@ +int foo(void) +{ + return 0; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr13183b.c b/binutils-2.25/ld/testsuite/ld-plugin/pr13183b.c new file mode 100644 index 00000000..93d57b52 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr13183b.c @@ -0,0 +1,6 @@ +extern int foo(void); + +int main(void) +{ + return foo(); +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr13201.c b/binutils-2.25/ld/testsuite/ld-plugin/pr13201.c new file mode 100644 index 00000000..3bea10c8 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr13201.c @@ -0,0 +1,17 @@ +#include <math.h> +#include <stdio.h> +#include <stdlib.h> + +int +main(int argc, char **argv) +{ + double x; + if (argc > 1) + x = atof (argv[1]); + else + x = 3; + x = sin (x); + if (x > 0) + printf("OK\n"); + return 0; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr13201.out b/binutils-2.25/ld/testsuite/ld-plugin/pr13201.out new file mode 100644 index 00000000..d86bac9d --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr13201.out @@ -0,0 +1 @@ +OK diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr13229.cc b/binutils-2.25/ld/testsuite/ld-plugin/pr13229.cc new file mode 100644 index 00000000..14083624 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr13229.cc @@ -0,0 +1,15 @@ +void call_something (int); +inline void optimize_me_out (void) +{ + call_something(0); +} +__attribute__ ((visibility("hidden"))) +void optimize_me_out2 (int param) +{ + if ((void *)optimize_me_out != (void *)call_something) + call_something(0); +} +void test2 (void) +{ + optimize_me_out(); +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr13229.d b/binutils-2.25/ld/testsuite/ld-plugin/pr13229.d new file mode 100644 index 00000000..017a716d --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr13229.d @@ -0,0 +1,4 @@ +#failif +#... +.*optimize_me_out.* +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr13244.c b/binutils-2.25/ld/testsuite/ld-plugin/pr13244.c new file mode 100644 index 00000000..efe93bfc --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr13244.c @@ -0,0 +1,14 @@ +extern __attribute__ ((visibility("hidden"))) int fooblah; + +static void +do_nothing (int param) +{ + if (param) + fooblah = 1; +} + +void +bar () +{ + do_nothing (0); +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr13244.d b/binutils-2.25/ld/testsuite/ld-plugin/pr13244.d new file mode 100644 index 00000000..59bbe4d8 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr13244.d @@ -0,0 +1,4 @@ +#failif +#... +.*fooblah.* +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr13287.cc b/binutils-2.25/ld/testsuite/ld-plugin/pr13287.cc new file mode 100644 index 00000000..67e85062 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr13287.cc @@ -0,0 +1 @@ +int main() {return 0; } diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr15146.d b/binutils-2.25/ld/testsuite/ld-plugin/pr15146.d new file mode 100644 index 00000000..48d4b854 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr15146.d @@ -0,0 +1,4 @@ +#failif +#... + +0x[0-9a-f]+ +\(NEEDED\) +Shared library: +\[.*pr15146b.so\] +#... diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr15146a.c b/binutils-2.25/ld/testsuite/ld-plugin/pr15146a.c new file mode 100644 index 00000000..a22860af --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr15146a.c @@ -0,0 +1,13 @@ +extern int xxx; + +int +bar (void) +{ + return xxx; +} + +int +main () +{ + return 0; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr15146b.c b/binutils-2.25/ld/testsuite/ld-plugin/pr15146b.c new file mode 100644 index 00000000..90eb21ea --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr15146b.c @@ -0,0 +1 @@ +int xxx = 3; diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr15146c.c b/binutils-2.25/ld/testsuite/ld-plugin/pr15146c.c new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr15146c.c diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr15146d.c b/binutils-2.25/ld/testsuite/ld-plugin/pr15146d.c new file mode 100644 index 00000000..ba1e0abf --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr15146d.c @@ -0,0 +1,7 @@ +extern int xxx; + +int +main () +{ + return xxx; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr15323.out b/binutils-2.25/ld/testsuite/ld-plugin/pr15323.out new file mode 100644 index 00000000..d86bac9d --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr15323.out @@ -0,0 +1 @@ +OK diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr15323a.c b/binutils-2.25/ld/testsuite/ld-plugin/pr15323a.c new file mode 100644 index 00000000..02a365b5 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr15323a.c @@ -0,0 +1,14 @@ +#include <stdio.h> + +int x; + +__attribute__((weak)) +void foobar (void) { x++; } + +int main (void) +{ + foobar (); + if (x == -1) + printf ("OK\n"); + return 0; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/pr15323b.c b/binutils-2.25/ld/testsuite/ld-plugin/pr15323b.c new file mode 100644 index 00000000..3ce50633 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/pr15323b.c @@ -0,0 +1,3 @@ +extern int x; + +void foobar (void) { x--; } diff --git a/binutils-2.25/ld/testsuite/ld-plugin/run-ie.c b/binutils-2.25/ld/testsuite/ld-plugin/run-ie.c new file mode 100644 index 00000000..32afa0a2 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/run-ie.c @@ -0,0 +1,32 @@ +#include <stdio.h> + +extern void abort (void); + +__thread int tls_ie __attribute__((tls_model("initial-exec"))) = 4; + +int get_ie (void) +{ + return tls_ie; +} + +int *get_iep (void) +{ + return &tls_ie; +} + +int main (void) +{ + int val; + + val = get_ie (); + if (val != 4) + abort (); + + val = *get_iep (); + if (val != 4) + abort (); + + printf ("IE: %d\n", val); + + return 0; +} diff --git a/binutils-2.25/ld/testsuite/ld-plugin/run-ie.out b/binutils-2.25/ld/testsuite/ld-plugin/run-ie.out new file mode 100644 index 00000000..7edca6d3 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/run-ie.out @@ -0,0 +1 @@ +IE: 4 diff --git a/binutils-2.25/ld/testsuite/ld-plugin/text.c b/binutils-2.25/ld/testsuite/ld-plugin/text.c new file mode 100644 index 00000000..6d021146 --- /dev/null +++ b/binutils-2.25/ld/testsuite/ld-plugin/text.c @@ -0,0 +1,3 @@ + +const char *text = "Hello world!\n"; + |