From 3312f67c0957196e41db149343d04ee7b30cdc65 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 26 Feb 2020 03:56:28 -0800 Subject: [PATCH] ld: Add PR ld/25593 tests PR ld/25593 * testsuite/ld-plugin/lto.exp: Run PR ld/25593 tests. * testsuite/ld-plugin/pr25593.d: New file. * testsuite/ld-plugin/pr25593a-1.c: Likewise. * testsuite/ld-plugin/pr25593a-2.c: Likewise. * testsuite/ld-plugin/pr25593b.c: Likewise. * testsuite/ld-plugin/pr25593c.c: Likewise. * testsuite/ld-plugin/pr25593d.c: Likewise. * testsuite/ld-plugin/pr25593e.c: Likewise. --- ld/ChangeLog | 12 ++++++++++++ ld/testsuite/ld-plugin/lto.exp | 26 ++++++++++++++++++++++++++ ld/testsuite/ld-plugin/pr25593.d | 5 +++++ ld/testsuite/ld-plugin/pr25593a-1.c | 12 ++++++++++++ ld/testsuite/ld-plugin/pr25593a-2.c | 1 + ld/testsuite/ld-plugin/pr25593b.c | 7 +++++++ ld/testsuite/ld-plugin/pr25593c.c | 4 ++++ ld/testsuite/ld-plugin/pr25593d.c | 4 ++++ ld/testsuite/ld-plugin/pr25593e.c | 4 ++++ 9 files changed, 75 insertions(+) create mode 100644 ld/testsuite/ld-plugin/pr25593.d create mode 100644 ld/testsuite/ld-plugin/pr25593a-1.c create mode 100644 ld/testsuite/ld-plugin/pr25593a-2.c create mode 100644 ld/testsuite/ld-plugin/pr25593b.c create mode 100644 ld/testsuite/ld-plugin/pr25593c.c create mode 100644 ld/testsuite/ld-plugin/pr25593d.c create mode 100644 ld/testsuite/ld-plugin/pr25593e.c diff --git a/ld/ChangeLog b/ld/ChangeLog index 9333dffbdf..56e84c13d2 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,15 @@ +2020-02-26 H.J. Lu + + PR ld/25593 + * testsuite/ld-plugin/lto.exp: Run PR ld/25593 tests. + * testsuite/ld-plugin/pr25593.d: New file. + * testsuite/ld-plugin/pr25593a-1.c: Likewise. + * testsuite/ld-plugin/pr25593a-2.c: Likewise. + * testsuite/ld-plugin/pr25593b.c: Likewise. + * testsuite/ld-plugin/pr25593c.c: Likewise. + * testsuite/ld-plugin/pr25593d.c: Likewise. + * testsuite/ld-plugin/pr25593e.c: Likewise. + 2020-02-26 Alan Modra * emultempl/cskyelf.em: Indent labels correctly. diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp index 1b44b0da3f..0243f09328 100644 --- a/ld/testsuite/ld-plugin/lto.exp +++ b/ld/testsuite/ld-plugin/lto.exp @@ -342,6 +342,32 @@ set lto_link_elf_tests [list \ [list "PR ld/24486" \ "-O2 -flto tmpdir/pr24486a.o tmpdir/pr24486c.so -Wl,--as-needed tmpdir/pr24486b.so" "" \ {dummy.c} {} "pr24486.exe"] \ + [list "Build pr25593a-1.o" \ + "$plug_opt" "-flto -O2" \ + {pr25593a-1.c} {} "" "c"] \ + [list "Build pr25593a-2.o" \ + "" "-O2" \ + {pr25593a-2.c} {} "" "c"] \ + [list "Build pr25593b.o" \ + "" "-O2" \ + {pr25593b.c} {} "" "c"] \ + [list "Build pr25593c.so" \ + "-shared" "-O2 -fpic" \ + {pr25593c.c} {} "pr25593c.so" "c"] \ + [list "Build pr25593d.so" \ + "-shared" "-O2 -fpic" \ + {pr25593d.c} {} "pr25593d.so" "c"] \ + [list "Build pr25593e.so" \ + "-shared" "-O2 -fpic" \ + {pr25593e.c} {} "pr25593e.so" "c"] \ + [list "PR ld/r25593 (LTO)" \ + "-O2 -flto -Wl,--as-needed tmpdir/pr25593a-1.o tmpdir/pr25593b.o \ + tmpdir/pr25593c.so tmpdir/pr25593d.so tmpdir/pr25593e.so" "" \ + {dummy.c} {{readelf {-d --wide} pr25593.d}} "pr25593a.exe"] \ + [list "PR ld/r25593" \ + "-O2 -flto -Wl,--as-needed tmpdir/pr25593a-2.o tmpdir/pr25593b.o \ + tmpdir/pr25593c.so tmpdir/pr25593d.so tmpdir/pr25593e.so" "" \ + {dummy.c} {{readelf {-d --wide} pr25593.d}} "pr25593b.exe"] \ ] # PR 14918 checks that libgcc is not spuriously included in a shared link of diff --git a/ld/testsuite/ld-plugin/pr25593.d b/ld/testsuite/ld-plugin/pr25593.d new file mode 100644 index 0000000000..77877674e4 --- /dev/null +++ b/ld/testsuite/ld-plugin/pr25593.d @@ -0,0 +1,5 @@ +#... + 0x0+1 \(NEEDED\) +Shared library: \[tmpdir/pr25593c\.so\] + 0x0+1 \(NEEDED\) +Shared library: \[tmpdir/pr25593d\.so\] + 0x0+1 \(NEEDED\) +Shared library: \[tmpdir/pr25593e\.so\] +#pass diff --git a/ld/testsuite/ld-plugin/pr25593a-1.c b/ld/testsuite/ld-plugin/pr25593a-1.c new file mode 100644 index 0000000000..13d53950c3 --- /dev/null +++ b/ld/testsuite/ld-plugin/pr25593a-1.c @@ -0,0 +1,12 @@ +extern void foo (void); +extern void bar (void); +extern void xxx (void); + +int +main (void) +{ + xxx (); + foo (); + bar (); + return 0; +} diff --git a/ld/testsuite/ld-plugin/pr25593a-2.c b/ld/testsuite/ld-plugin/pr25593a-2.c new file mode 100644 index 0000000000..bdc30dda6f --- /dev/null +++ b/ld/testsuite/ld-plugin/pr25593a-2.c @@ -0,0 +1 @@ +#include "pr25593a-1.c" diff --git a/ld/testsuite/ld-plugin/pr25593b.c b/ld/testsuite/ld-plugin/pr25593b.c new file mode 100644 index 0000000000..75b24193c7 --- /dev/null +++ b/ld/testsuite/ld-plugin/pr25593b.c @@ -0,0 +1,7 @@ +extern void xyz (); + +void +xxx (void) +{ + xyz (); +} diff --git a/ld/testsuite/ld-plugin/pr25593c.c b/ld/testsuite/ld-plugin/pr25593c.c new file mode 100644 index 0000000000..cd0130cacd --- /dev/null +++ b/ld/testsuite/ld-plugin/pr25593c.c @@ -0,0 +1,4 @@ +void +foo (void) +{ +} diff --git a/ld/testsuite/ld-plugin/pr25593d.c b/ld/testsuite/ld-plugin/pr25593d.c new file mode 100644 index 0000000000..7de81b31a4 --- /dev/null +++ b/ld/testsuite/ld-plugin/pr25593d.c @@ -0,0 +1,4 @@ +void +bar (void) +{ +} diff --git a/ld/testsuite/ld-plugin/pr25593e.c b/ld/testsuite/ld-plugin/pr25593e.c new file mode 100644 index 0000000000..831b10522b --- /dev/null +++ b/ld/testsuite/ld-plugin/pr25593e.c @@ -0,0 +1,4 @@ +void +xyz (void) +{ +} -- 2.34.1