LoongArch: Correct comments.
[binutils-gdb.git] / bfd / plugin.c
index c69fbd7b568ce49d63aa949d1a866c602a9f68f4..b798d3477aecbab760fc3262f7c37a49b3095316 100644 (file)
@@ -1,5 +1,5 @@
 /* Plugin support for BFD.
-   Copyright (C) 2009-2022 Free Software Foundation, Inc.
+   Copyright (C) 2009-2023 Free Software Foundation, Inc.
 
    This file is part of BFD, the Binary File Descriptor library.
 
@@ -83,6 +83,7 @@ dlerror (void)
 #define bfd_plugin_bfd_is_target_special_symbol              _bfd_bool_bfd_asymbol_false
 #define bfd_plugin_get_lineno                        _bfd_nosymbols_get_lineno
 #define bfd_plugin_find_nearest_line                 _bfd_nosymbols_find_nearest_line
+#define bfd_plugin_find_nearest_line_with_alt        _bfd_nosymbols_find_nearest_line_with_alt
 #define bfd_plugin_find_line                         _bfd_nosymbols_find_line
 #define bfd_plugin_find_inliner_info                 _bfd_nosymbols_find_inliner_info
 #define bfd_plugin_get_symbol_version_string         _bfd_nosymbols_get_symbol_version_string
@@ -128,6 +129,7 @@ struct plugin_list_entry
 {
   /* These must be initialized for each IR object with LTO wrapper.  */
   ld_plugin_claim_file_handler claim_file;
+  ld_plugin_claim_file_handler_v2 claim_file_v2;
   ld_plugin_all_symbols_read_handler all_symbols_read;
   ld_plugin_all_symbols_read_handler cleanup_handler;
   bool has_symbol_type;
@@ -158,6 +160,16 @@ register_claim_file (ld_plugin_claim_file_handler handler)
   return LDPS_OK;
 }
 
+
+/* Register a claim-file handler, version 2. */
+
+static enum ld_plugin_status
+register_claim_file_v2 (ld_plugin_claim_file_handler_v2 handler)
+{
+  current_plugin->claim_file_v2 = handler;
+  return LDPS_OK;
+}
+
 static enum ld_plugin_status
 add_symbols (void * handle,
             int nsyms,
@@ -336,7 +348,7 @@ try_load_plugin (const char *pname,
                 bool build_list_p)
 {
   void *plugin_handle;
-  struct ld_plugin_tv tv[5];
+  struct ld_plugin_tv tv[6];
   int i;
   ld_plugin_onload onload;
   enum ld_plugin_status status;
@@ -401,6 +413,10 @@ try_load_plugin (const char *pname,
   tv[i].tv_tag = LDPT_REGISTER_CLAIM_FILE_HOOK;
   tv[i].tv_u.tv_register_claim_file = register_claim_file;
 
+  ++i;
+  tv[i].tv_tag = LDPT_REGISTER_CLAIM_FILE_HOOK_V2;
+  tv[i].tv_u.tv_register_claim_file_v2 = register_claim_file_v2;
+
   ++i;
   tv[i].tv_tag = LDPT_ADD_SYMBOLS;
   tv[i].tv_u.tv_add_symbols = add_symbols;
@@ -438,7 +454,7 @@ try_load_plugin (const char *pname,
 /* There may be plugin libraries in lib/bfd-plugins.  */
 static int has_plugin_list = -1;
 
-static bfd_cleanup (*ld_plugin_object_p) (bfd *);
+static bfd_cleanup (*ld_plugin_object_p) (bfd *, bool);
 
 static const char *plugin_name;
 
@@ -462,7 +478,7 @@ bool
 bfd_link_plugin_object_p (bfd *abfd)
 {
   if (ld_plugin_object_p)
-    return ld_plugin_object_p (abfd) != NULL;
+    return ld_plugin_object_p (abfd, false) != NULL;
   return false;
 }
 
@@ -479,7 +495,7 @@ bfd_plugin_target_p (const bfd_target *target)
 /* Register OBJECT_P to be used by bfd_plugin_object_p.  */
 
 void
-register_ld_plugin_object_p (bfd_cleanup (*object_p) (bfd *))
+register_ld_plugin_object_p (bfd_cleanup (*object_p) (bfd *, bool))
 {
   ld_plugin_object_p = object_p;
 }
@@ -571,7 +587,7 @@ static bfd_cleanup
 bfd_plugin_object_p (bfd *abfd)
 {
   if (ld_plugin_object_p)
-    return ld_plugin_object_p (abfd);
+    return ld_plugin_object_p (abfd, false);
 
   if (abfd->plugin_format == bfd_plugin_unknown && !load_plugin (abfd))
     return NULL;