From: "H.J. Lu" <hjl.tools@gmail.com>
To: Howard Chu <hyc@symas.com>
Cc: Nick Clifton <nickc@redhat.com>,
Cary Coutant <ccoutant@gmail.com>,
Binutils <binutils@sourceware.org>
Subject: [PATCH] ld: Skip libdep plugin if not all plugin hooks are available
Date: Wed, 16 Dec 2020 11:11:30 -0800 [thread overview]
Message-ID: <CAMe9rOq0V3sP92GzS=TMCsathLmVhc6PPBhorPTbr6qf4cabqQ@mail.gmail.com> (raw)
In-Reply-To: <f2189b7a-25b3-c7f3-f7d9-a0edbee8b31b@symas.com>
[-- Attachment #1: Type: text/plain, Size: 1336 bytes --]
On Wed, Dec 16, 2020 at 11:06 AM Howard Chu <hyc@symas.com> wrote:
>
> H.J. Lu wrote:
> > On Wed, Dec 16, 2020 at 10:34 AM Howard Chu <hyc@symas.com> wrote:
> >>
> >> H.J. Lu wrote:
> >>> On Wed, Dec 16, 2020 at 3:16 AM Nick Clifton via Binutils
> >>> <binutils@sourceware.org> wrote:
> >>>>
> >>>> Hi Howard,
> >>>>
> >>>>>> Why not just make the new plugin disable itself if the host tool
> >>>>>> doesn't provide the all_symbols_read entry point?
> >>>>>
> >>>>> Yeah, that'd be fine too. Just noop/silently exit if entry points are missing.
> >>>>> I can write that up if folks agree it's better.
> >>>>
> >>>> Please do.
> >>>>
>
> >> The plugin shouldn't register any hooks at all, if any of these aren't available.
> >> There's no point in doing the register_claim_file, that will just be wasted work.
> >
> > My branch has a testcase which fails today:
> >
> > https://gitlab.com/x86-binutils/binutils-gdb/-/commits/users/hjl/pr27081/master
> >
> > Please send me a patch on top of mine to fix the testcase.
> >
> Our emails crossed in flight; this is the same patch I just sent, but
> based off your branch.
This is the patch I am checking in. Thanks.
> I don't know which testcases failed for you. "make check" for me fails
> large numbers of cases.
>
There should be no "make check" failures on Linux/x86-64.
--
H.J.
[-- Attachment #2: 0001-ld-Skip-libdep-plugin-if-not-all-plugin-hooks-are-av.patch --]
[-- Type: text/x-patch, Size: 3318 bytes --]
From f88e5a994ffa8bb058aff46fb96f35bf72c3707d Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Wed, 16 Dec 2020 06:22:46 -0800
Subject: [PATCH] ld: Skip libdep plugin if not all plugin hooks are available
Skip plugin if not all required plugin hooks are available.
2020-12-16 Howard Chu <hyc@symas.com>
H.J. Lu <hongjiu.lu@intel.com>
PR ld/27081
* libdep_plugin.c (onload): Skip if not all required plugin hooks
are available.
* testsuite/config/default.exp (dep_plug_opt): New.
* testsuite/ld-elf/elf.exp: Pass $dep_plug_opt to nm.
* testsuite/ld-elf/pr26391.fd: New file.
---
ld/libdep_plugin.c | 25 ++++++-------------------
ld/testsuite/config/default.exp | 8 ++++++++
ld/testsuite/ld-elf/elf.exp | 5 ++++-
ld/testsuite/ld-elf/pr26391.fd | 4 ++++
4 files changed, 22 insertions(+), 20 deletions(-)
create mode 100644 ld/testsuite/ld-elf/pr26391.fd
diff --git a/ld/libdep_plugin.c b/ld/libdep_plugin.c
index 2a7fdc4d0b..b81364fdca 100644
--- a/ld/libdep_plugin.c
+++ b/ld/libdep_plugin.c
@@ -339,27 +339,14 @@ onload (struct ld_plugin_tv *tv)
while ((tv++)->tv_tag != LDPT_NULL);
/* Register hooks. */
- if (!tv_register_claim_file)
+ if (tv_register_claim_file
+ && tv_register_all_symbols_read
+ && tv_register_cleanup)
{
- TV_MESSAGE (LDPL_FATAL, "No register_claim_file hook");
- fflush (NULL);
- return LDPS_ERR;
- }
- (*tv_register_claim_file) (onclaim_file);
- if (!tv_register_all_symbols_read)
- {
- TV_MESSAGE (LDPL_FATAL, "No register_all_symbols_read hook");
- fflush (NULL);
- return LDPS_ERR;
- }
- (*tv_register_all_symbols_read) (onall_symbols_read);
- if (!tv_register_cleanup)
- {
- TV_MESSAGE (LDPL_FATAL, "No register_cleanup hook");
- fflush (NULL);
- return LDPS_ERR;
+ (*tv_register_claim_file) (onclaim_file);
+ (*tv_register_all_symbols_read) (onall_symbols_read);
+ (*tv_register_cleanup) (oncleanup);
}
- (*tv_register_cleanup) (oncleanup);
fflush (NULL);
return LDPS_OK;
}
diff --git a/ld/testsuite/config/default.exp b/ld/testsuite/config/default.exp
index f711fb792e..a8ad1fdb6f 100644
--- a/ld/testsuite/config/default.exp
+++ b/ld/testsuite/config/default.exp
@@ -443,3 +443,11 @@ if { [check_compiler_available] } {
}
}
}
+
+if {[file exists .libs/libdep.so]} {
+ set dep_plug_opt "--plugin .libs/libdep.so"
+} elseif {[file exists .libs/libdep.dll]} {
+ set dep_plug_opt "--plugin .libs/libdep.dll"
+} else {
+ set dep_plug_opt ""
+}
diff --git a/ld/testsuite/ld-elf/elf.exp b/ld/testsuite/ld-elf/elf.exp
index e08a6f5feb..a58b17b512 100644
--- a/ld/testsuite/ld-elf/elf.exp
+++ b/ld/testsuite/ld-elf/elf.exp
@@ -415,7 +415,10 @@ run_ld_link_tests [list \
"" \
"" \
{pr26391a.c pr26391b.c pr26391c.c pr26391d.c} \
- {{nm "" pr26391.nd}} \
+ [list \
+ [list "nm" "$dep_plug_opt" "pr26391.nd"] \
+ [list "nm" "$dep_plug_opt" "pr26391.fd"] \
+ ] \
"pr26391-5.o" \
"-fno-function-sections" \
] \
diff --git a/ld/testsuite/ld-elf/pr26391.fd b/ld/testsuite/ld-elf/pr26391.fd
new file mode 100644
index 0000000000..1921cd6c70
--- /dev/null
+++ b/ld/testsuite/ld-elf/pr26391.fd
@@ -0,0 +1,4 @@
+#failif
+#...
+bfd plugin: No register_all_symbols_read hook
+#...
--
2.29.2
next prev parent reply other threads:[~2020-12-16 19:12 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-19 15:49 dependency list for static libraries Howard Chu
2017-09-19 15:52 ` Simon Richter
[not found] ` <WM!bae999665f49907786872b93f01ac98d53e7b97e29b4228399d8baadf9ec0ab33db74467d73c998225b250ba1d00a4c0!@mailstronghold-3.zmailcloud.com>
2017-09-19 16:04 ` Howard Chu
2017-09-20 1:42 ` R0b0t1
2017-09-19 16:54 ` Joseph Myers
[not found] ` <WM!83b6ad7285aa96ce69fcd1944d4eae8f20e5f19dfbf161f45313f5393bcffe1b77231520b8f4e24145a3f85eeafb39ed!@mailstronghold-1.zmailcloud.com>
2017-09-19 22:01 ` Howard Chu
2017-09-20 0:20 ` Joseph Myers
2020-09-03 20:42 ` Howard Chu
2020-09-22 10:39 ` Nick Clifton
2020-09-22 11:42 ` Howard Chu
2020-09-22 13:12 ` Nick Clifton
2020-09-22 16:23 ` [PATCH] " Howard Chu
2020-09-22 17:16 ` Fangrui Song
2020-09-22 17:55 ` Howard Chu
2020-09-22 20:46 ` Howard Chu
2020-09-23 11:52 ` Nick Clifton
2020-09-23 15:29 ` Howard Chu
2020-09-24 5:21 ` Fangrui Song
2020-09-24 9:19 ` Howard Chu
2020-09-24 9:30 ` Howard Chu
2020-09-28 11:07 ` Howard Chu
2020-10-28 14:56 ` Howard Chu
2020-11-03 15:14 ` Nick Clifton
2020-11-03 15:31 ` Howard Chu
2020-11-08 1:39 ` Alan Modra
2020-11-08 15:07 ` Howard Chu
2020-11-09 0:01 ` Alan Modra
2020-11-10 2:44 ` Howard Chu
2020-11-10 11:07 ` Alan Modra
2020-11-11 14:57 ` Howard Chu
2020-11-11 14:59 ` Howard Chu
2020-11-17 14:01 ` Nick Clifton
2020-11-04 0:33 ` Howard Chu
2020-11-04 11:01 ` Nick Clifton
2020-11-04 14:50 ` Howard Chu
2020-11-06 12:38 ` Nick Clifton
2020-11-13 14:40 ` Howard Chu
2020-11-24 17:49 ` Howard Chu
2020-11-25 11:17 ` Nick Clifton
2020-12-01 0:08 ` Howard Chu
2020-12-14 14:28 ` Nick Clifton
2020-12-15 16:17 ` Jim Wilson
2020-12-15 16:22 ` Jeff Law
2020-12-15 16:50 ` Nick Clifton
2020-12-15 19:11 ` Jeff Law
2020-12-15 20:04 ` Jim Wilson
2020-12-15 20:22 ` Cary Coutant
2020-12-15 20:51 ` Howard Chu
2020-12-16 11:16 ` Nick Clifton
2020-12-16 14:49 ` [PATCH] ld: Call plugin hooks only if they are available H.J. Lu
2020-12-16 18:34 ` Howard Chu
2020-12-16 18:40 ` H.J. Lu
2020-12-16 19:06 ` Howard Chu
2020-12-16 19:11 ` H.J. Lu [this message]
2020-12-16 21:26 ` [PATCH] ld: Skip libdep plugin if not all plugin hooks " Howard Chu
2020-12-16 21:47 ` H.J. Lu
2020-12-16 18:44 ` [PATCH] ld: Call plugin hooks only if they " Howard Chu
2020-12-15 20:33 ` [PATCH] dependency list for static libraries Cary Coutant
2020-12-15 20:53 ` Howard Chu
2020-12-16 11:18 ` Nick Clifton
2020-12-23 13:27 ` Matthias Klose
2020-12-23 18:23 ` Howard Chu
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='CAMe9rOq0V3sP92GzS=TMCsathLmVhc6PPBhorPTbr6qf4cabqQ@mail.gmail.com' \
--to=hjl.tools@gmail.com \
--cc=binutils@sourceware.org \
--cc=ccoutant@gmail.com \
--cc=hyc@symas.com \
--cc=nickc@redhat.com \
/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).