}
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
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");
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