[PATCH] bfd: Require the plugin target for slim LTO IR object

H.J. Lu hjl.tools@gmail.com
Fri Aug 15 18:25:05 GMT 2025


	* format.c (bfd_check_format_matches): Require the plugin target
	for slim LTO IR object.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
---
 bfd/format.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/bfd/format.c b/bfd/format.c
index b74c6240f23..7616da0b60f 100644
--- a/bfd/format.c
+++ b/bfd/format.c
@@ -615,6 +615,15 @@ bfd_check_format_matches (bfd *abfd, bfd_format format, char ***matching)
 	      || (bfd_has_map (abfd)
 		  && bfd_get_error () != bfd_error_wrong_object_format))
 	    {
+	      if (abfd->format == bfd_object)
+		{
+		  /* Require the plugin target for slim LTO IR object.  */
+		  bfd_set_lto_type (abfd);
+		  if (abfd->lto_type == lto_slim_ir_object
+		      && !bfd_plugin_target_p (abfd->xvec))
+		    continue;
+		}
+
 	      /* If this is the default target, accept it, even if
 		 other targets might match.  People who want those
 		 other targets have to set the GNUTARGET variable.  */
-- 
2.50.1



More information about the Binutils mailing list