public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
From: H.J. Lu <hjl@sourceware.org>
To: binutils-cvs@sourceware.org
Subject: [binutils-gdb] ld: Add PR ld/31615 tests
Date: Mon,  8 Apr 2024 12:20:54 +0000 (GMT)	[thread overview]
Message-ID: <20240408122054.B2C59384B06A@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d05e1a4a6d438c11af5a2b9b0ac88a74727b5f0f

commit d05e1a4a6d438c11af5a2b9b0ac88a74727b5f0f
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Sun Apr 7 19:52:49 2024 -0700

    ld: Add PR ld/31615 tests
    
    PR ld/31615
            * testsuite/ld-plugin/lto.exp: Run ld/31615 tests.
            * testsuite/ld-plugin/pr31615.ver: New file.
            * testsuite/ld-plugin/pr31615a.c: Likewise.
            * testsuite/ld-plugin/pr31615b.c: Likewise.
            * testsuite/ld-plugin/pr31615c.c: Likewise.
            * testsuite/ld-plugin/pr31615d.c: Likewise.

Diff:
---
 ld/testsuite/ld-plugin/lto.exp     | 34 ++++++++++++++++++++++++++++++++++
 ld/testsuite/ld-plugin/pr31615.ver |  4 ++++
 ld/testsuite/ld-plugin/pr31615a.c  |  8 ++++++++
 ld/testsuite/ld-plugin/pr31615b.c  |  7 +++++++
 ld/testsuite/ld-plugin/pr31615c.c  |  8 ++++++++
 ld/testsuite/ld-plugin/pr31615d.c  |  5 +++++
 6 files changed, 66 insertions(+)

diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp
index b56d71a668b..35ce38731d0 100644
--- a/ld/testsuite/ld-plugin/lto.exp
+++ b/ld/testsuite/ld-plugin/lto.exp
@@ -555,6 +555,30 @@ set lto_link_elf_tests [list \
    "" \
    "pr31482c.so" \
   ] \
+  [list \
+   "Build pr31615b.so" \
+   "-shared -Wl,--version-script=pr31615.ver" \
+   "-fPIC" \
+   {pr31615b.c} \
+   "" \
+   "pr31615b.so" \
+  ] \
+  [list \
+   "Build pr31615c.so" \
+   "-shared -Wl,--version-script=pr31615.ver" \
+   "-fPIC" \
+   {pr31615c.c} \
+   "" \
+   "pr31615c.so" \
+  ] \
+  [list \
+   "Build pr31615d.so" \
+   "-shared -Wl,--version-script=pr31615.ver" \
+   "-fPIC" \
+   {pr31615d.c} \
+   "" \
+   "pr31615d.so" \
+  ] \
 ]
 
 # PR 14918 checks that libgcc is not spuriously included in a shared link of
@@ -754,6 +778,16 @@ set lto_run_elf_shared_tests [list \
    {-Wl,--as-needed,-R,tmpdir} {} \
    {pr31482a.c} {pr31489b.exe} {pass1.out} {-flto} {c} {} \
    {tmpdir/pr31482c.so tmpdir/pr31482b.a}] \
+  [list {pr31615a} \
+   {-Wl,-R,tmpdir} {} \
+   {pr31615a.c} {pr31615a.exe} {pass.out} {-O3 -flto} {c} {} \
+   {-Wl,--as-needed tmpdir/pr31615b.so -Wl,--no-as-needed \
+    tmpdir/pr31615d.so}] \
+  [list {pr31615b} \
+   {-Wl,-R,tmpdir} {} \
+   {pr31615a.c} {pr31615b.exe} {pass.out} {-O3 -flto} {c} {} \
+   {-Wl,--as-needed tmpdir/pr31615c.so -Wl,--no-as-needed \
+    tmpdir/pr31615d.so}] \
 ]
 
 # LTO run-time tests for ELF
diff --git a/ld/testsuite/ld-plugin/pr31615.ver b/ld/testsuite/ld-plugin/pr31615.ver
new file mode 100644
index 00000000000..f1e1f9d5cd7
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr31615.ver
@@ -0,0 +1,4 @@
+BAR {
+global:
+  bar;
+};
diff --git a/ld/testsuite/ld-plugin/pr31615a.c b/ld/testsuite/ld-plugin/pr31615a.c
new file mode 100644
index 00000000000..450b2d5a5f9
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr31615a.c
@@ -0,0 +1,8 @@
+extern void bar ();
+
+int
+main()
+{
+  bar ();
+  return 0;
+}
diff --git a/ld/testsuite/ld-plugin/pr31615b.c b/ld/testsuite/ld-plugin/pr31615b.c
new file mode 100644
index 00000000000..973dc31611b
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr31615b.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+void
+bar (void)
+{
+  printf ("PASS\n");
+}
diff --git a/ld/testsuite/ld-plugin/pr31615c.c b/ld/testsuite/ld-plugin/pr31615c.c
new file mode 100644
index 00000000000..dbe07889760
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr31615c.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+__attribute__ ((weak))
+void
+bar (void)
+{
+  printf ("PASS\n");
+}
diff --git a/ld/testsuite/ld-plugin/pr31615d.c b/ld/testsuite/ld-plugin/pr31615d.c
new file mode 100644
index 00000000000..352f5987cc3
--- /dev/null
+++ b/ld/testsuite/ld-plugin/pr31615d.c
@@ -0,0 +1,5 @@
+__attribute__ ((weak))
+void
+bar (void)
+{
+}

                 reply	other threads:[~2024-04-08 12:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240408122054.B2C59384B06A@sourceware.org \
    --to=hjl@sourceware.org \
    --cc=binutils-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).