Fix annobin merge unresolved conflicts 84/210884/1 sandbox/mkashkarov/test-fix
authorMikhail Kashkarov <m.kashkarov@partner.samsung.com>
Thu, 25 Jul 2019 18:14:24 +0000 (21:14 +0300)
committerMikhail Kashkarov <m.kashkarov@partner.samsung.com>
Thu, 25 Jul 2019 18:20:24 +0000 (21:20 +0300)
Change-Id: If4169ae791fa6f3cdc1dec358cfdde80a2ae7b96

gcc/annobin.c
gcc/annobin.h
gcc/cp/decl.c

index f3d2a4d..a9a14de 100644 (file)
@@ -1795,58 +1795,40 @@ annobin_target_specific_loader_notes (char * ptr, size_t size)
 }
 
 void
-annobin_search_abi_declaration (tree decl)
+annobin_search_abi_declaration (tree decl, const char *name)
 {
   if (!annobin_dynamic_notes_p ())
     return;
-  tree NODE = decl;
-  const char *decl_str = NULL;
-  if (TREE_CODE (NODE) == FUNCTION_DECL) {
-    const char *decl_str = current_function_name ();
-    if (strstr(decl_str, "std::basic_string") != NULL)
-      {
-        annobin_gnu_compiler_flags &= ~GNU_PROPERTY_USECXX11_ABI;
-        annobin_gnu_compiler_flags_sets |= GNU_PROPERTY_USECXX11_ABI;
-      }
-  }
-  if (TREE_CODE (NODE) == VAR_DECL) {
-    if (!DECL_ASSEMBLER_NAME_SET_P (NODE)) {
+
+  if (!decl || !name)
+    {
+      annobin_inform(1, "Can't get the variable identifier");
       return;
     }
 
-    NODE = DECL_ASSEMBLER_NAME (NODE);
-    if (!NODE)
-      {
-        annobin_inform(1, "Can't get assembler name");
-        return;
-      }
-
-    decl_str = IDENTIFIER_POINTER(NODE);
-
-    if (!decl_str)
-      {
-        annobin_inform(1, "Can't get the variable identifier");
-        return;
-      }
-
-    /* Search the C++ standard usage */
-    char *std_list = strstr((char *)decl_str, "_List_base");
-    if (std_list)
-      {
-        /* search a prefix */
-        char *cxx_str = strstr((char *)decl_str, "__cxx11");
-        if (cxx_str && (cxx_str < std_list))
-          {
-            annobin_gnu_compiler_flags |= GNU_PROPERTY_USECXX11_ABI;
-            annobin_gnu_compiler_flags_sets |= GNU_PROPERTY_USECXX11_ABI;
-          }
-        else
-          {
-            annobin_gnu_compiler_flags &= ~GNU_PROPERTY_USECXX11_ABI;
-            annobin_gnu_compiler_flags_sets |= GNU_PROPERTY_USECXX11_ABI;
-          }
-      }
-  }
+  if (strstr(name, "std::basic_string") != NULL)
+    {
+      annobin_gnu_compiler_flags &= ~GNU_PROPERTY_USECXX11_ABI;
+      annobin_gnu_compiler_flags_sets |= GNU_PROPERTY_USECXX11_ABI;
+    }
+
+  /* Search the C++ standard usage */
+  char *std_list = strstr((char *)name, "_List_base");
+  if (std_list)
+    {
+      /* search a prefix */
+      char *cxx_str = strstr((char *)name, "__cxx11");
+      if (cxx_str && (cxx_str < std_list))
+       {
+         annobin_gnu_compiler_flags |= GNU_PROPERTY_USECXX11_ABI;
+         annobin_gnu_compiler_flags_sets |= GNU_PROPERTY_USECXX11_ABI;
+       }
+      else
+       {
+         annobin_gnu_compiler_flags &= ~GNU_PROPERTY_USECXX11_ABI;
+         annobin_gnu_compiler_flags_sets |= GNU_PROPERTY_USECXX11_ABI;
+       }
+    }
 }
 
 static void
@@ -1861,14 +1843,10 @@ annobin_prepare_dynamic_notes (void)
       annobin_gnu_compiler_flags |= GNU_PROPERTY_USECXX_VALIDATION;
       annobin_inform(1, "Enable cxxabi validation");
     }
-
-  /* CXX11 ABI is default value since GCC 5.x.  */
-  annobin_gnu_compiler_flags |= GNU_PROPERTY_USECXX11_ABI;
-
   /* Check sanitization options.  */
   /* Validation bit for linker.  */
 
-  if (ANNOBIN_SANITIZER_VALIDATION);
+  if (ANNOBIN_SANITIZER_VALIDATION)
     {
       annobin_gnu_compiler_flags |= GNU_PROPERTY_SANITIZE_VALIDATION;
       annobin_inform(1, "Enable sanitizer validation");
@@ -2063,6 +2041,10 @@ annobin_init (void)
   annobin_record_global_options ();
   if (annobin_static_notes_p())
     annobin_create_global_build_attributes ();
+
+  /* CXX11 ABI is default value since GCC 5.x.  */
+  if (annobin_dynamic_notes_p ())
+    annobin_gnu_compiler_flags |= GNU_PROPERTY_USECXX11_ABI;
 }
 
 void
index d34c0b7..63eb783 100644 (file)
@@ -123,7 +123,7 @@ extern void annobin_assemble_end_function_notes ();
 /* Generate final annobin annotations.  */
 extern void annobin_finish_file ();
 
-extern void annobin_search_abi_declaration (tree decl);
+extern void annobin_search_abi_declaration (tree decl, const char *name);
 
 /* Declare initial static sections for now, compute flags.  */
 extern void annobin_init ();
index 5b5505c..db892de 100644 (file)
@@ -7016,7 +7016,7 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
   if (was_readonly)
     TREE_READONLY (decl) = 1;
 
-  annobin_search_abi_declaration (decl);
+  annobin_search_abi_declaration (decl, decl_as_string(decl, 0));
   invoke_plugin_callbacks (PLUGIN_FINISH_DECL, decl);
 }