Report the actions that the plugin is taking. If invoked for a
second time on the command line the plugin will be very verbose.
+'function-verbose'
+ Report the generation of function specific notes. This indicates
+ that the named function was compiled with different options from
+ those that were globally enabled.
+
'no-dynamic-notes'
'dynamic-notes'
Do not, or do, record information for the dynamic loader. The
The 'version' note encodes the version of the Watermark specification
used and the version of the tool used to generate the notes. Typically
-these will both be 3.
+the protocol version will be 3 and the plugin version will be 5.
\1f
File: annobin.info, Node: The PIC Encoding, Next: The GOW Encoding, Prev: The Version Encoding, Up: Checking
Node: Top\7f706
Node: Introduction\7f1584
Node: Invocation\7f3686
-Node: Checking\7f7683
-Node: The Version Encoding\7f10027
-Node: The PIC Encoding\7f10372
-Node: The GOW Encoding\7f11001
-Node: The CF Encoding\7f12448
-Node: The CET Encoding\7f13518
-Node: Using\7f14286
-Node: Who Built Me\7f14801
-Node: ABI Checking\7f17579
-Node: Hardening Checks\7f19707
-Node: Checking Archives\7f23549
-Node: GNU FDL\7f25987
+Node: Checking\7f7883
+Node: The Version Encoding\7f10227
+Node: The PIC Encoding\7f10615
+Node: The GOW Encoding\7f11244
+Node: The CF Encoding\7f12691
+Node: The CET Encoding\7f13761
+Node: Using\7f14529
+Node: Who Built Me\7f15044
+Node: ABI Checking\7f17822
+Node: Hardening Checks\7f19950
+Node: Checking Archives\7f23792
+Node: GNU FDL\7f26230
\1f
End Tag Table
/* Internal variable, used by target specific parts of the annobin plugin as well
as this generic part. True if the object file being generated is for a 64-bit
target. */
-bool annobin_is_64bit = false;
+bool annobin_is_64bit = false;
+
+/* True if the creation of function specific notes should be reported. */
+static bool annobin_function_verbose = false;
/* True if notes in the .note.gnu.property section should be produced. */
static bool annobin_enable_dynamic_notes = true;
help Print out this information\n\
version Print out the version of the plugin\n\
verbose Be talkative about what is going on\n\
+ function-verbose Report the creation of function specific notes\n\
[no-]dynamic-notes Do [do not] create dynamic notes (default: do)\n\
[no-]static-notes Do [do not] create static notes (default: do)\n\
[no-]global-file-syms Create global [or local] file name symbols (default: local)\n\
if (asm_out_file == NULL)
return;
- if (type == FUNC
- || type == OPEN)
+ if (annobin_function_verbose && type == FUNC)
{
- fprintf (asm_out_file, "\t.pushsection %s\n", GNU_BUILD_ATTRS_SECTION_NAME);
+ if (desc_is_string)
+ annobin_inform (0, "create function specific note for: %s: %s", desc1, name_description);
}
+ if (type == FUNC || type == OPEN)
+ fprintf (asm_out_file, "\t.pushsection %s\n", GNU_BUILD_ATTRS_SECTION_NAME);
+
if (name == NULL)
{
if (namesz)
}
}
- if (type == FUNC
- || type == OPEN)
- {
- fprintf (asm_out_file, "\t.popsection\n");
- fflush (asm_out_file);
- }
+ if (type == FUNC || type == OPEN)
+ fprintf (asm_out_file, "\t.popsection\n");
fprintf (asm_out_file, "\n");
+ fflush (asm_out_file);
++ annobin_note_count;
}
{
unsigned i;
char buffer [32];
-
+
sprintf (buffer, "GA%c%c", NUMERIC, numeric_type);
if (value == 0)
else
val |= (debug_info_level << 4);
- if (dwarf_version < 0 || dwarf_version > 7)
- annobin_inform (0, "ICE: unknown dwarf version level %d\n", dwarf_version);
+ if (dwarf_version < 2)
+ {
+ /* Apparently it is possible for dwarf_version to be -1. Not sure how
+ this can happen, but handle it anyway. Since DWARF prior to v2 is
+ deprecated, we use 2 as the version level. */
+ val |= (2 << 6);
+ annobin_inform (1, "dwarf version level %d recorded as 2\n", dwarf_version);
+ }
+ else if (dwarf_version > 7)
+ {
+ /* FIXME: We only have 3 bits to record the debug level... */
+ val |= (7 << 6);
+ annobin_inform (1, "dwarf version level %d recorded as 7\n", dwarf_version);
+ }
else
val |= (dwarf_version << 6);
-
+
if (optimize > 3)
val |= (3 << 9);
else
if (! annobin_enable_static_notes)
return;
-
+
if (asm_out_file == NULL)
return;
aname = aname_end = NULL;
}
#endif
-
+
#ifdef flag_cf_protection
if (global_cf_option != flag_cf_protection)
{
aname = aname_end = NULL;
}
#endif
-
+
if (global_pic_option != compute_pic_option ())
{
annobin_inform (1, "Recording change in PIC status for %s", cname);
if (annobin_note_count > count)
{
- // /* FIXME: This assumes that the function is in the .text section... */
- // fprintf (asm_out_file, "\t.pushsection .text\n");
+ /* This push/pop is probably not necssary, but let's be paranoid. */
+ if (DECL_SECTION_NAME (current_function_decl) != NULL)
+ fprintf (asm_out_file, "\t.pushsection %s\n", DECL_SECTION_NAME (current_function_decl));
+
fprintf (asm_out_file, "%s:\n", saved_aname_end);
- // fprintf (asm_out_file, "\t.popsection\n");
+
+ if (DECL_SECTION_NAME (current_function_decl) != NULL)
+ fprintf (asm_out_file, "\t.popsection\n");
}
free ((void *) saved_aname_end);
/* Record optimization level, -W setting and -g setting */
record_GOW_settings (global_GOWall_options, false, NULL, NULL, NULL);
-
+
/* Record -fstack-protector option. */
annobin_output_numeric_note (GNU_BUILD_ATTRIBUTE_STACK_PROT, global_stack_prot_option,
"numeric: -fstack-protector status",
{
if (save_decoded_options[i].arg == NULL)
continue;
-
+
if (strncmp (save_decoded_options[i].arg, "_FORTIFY_SOURCE=", strlen ("_FORTIFY_SOURCE=")) == 0)
{
int level = atoi (save_decoded_options[i].arg + strlen ("_FORTIFY_SOURCE="));
if (! glibcxx_assertions_recorded)
record_glibcxx_assertions (false);
-
+
/* Record the PIC status. */
annobin_output_numeric_note (GNU_BUILD_ATTRIBUTE_PIC, global_pic_option,
"numeric: PIC", NULL, NULL, OPEN);
{
annobin_inform (1, "Recording total static usage of %ld", annobin_total_static_stack_usage);
- fprintf (asm_out_file, "\t.pushsection %s\n", GNU_BUILD_ATTRS_SECTION_NAME);
+ fprintf (asm_out_file, "\t.pushsection %s\n", GNU_BUILD_ATTRS_SECTION_NAME);
annobin_output_numeric_note (GNU_BUILD_ATTRIBUTE_STACK_SIZE, annobin_total_static_stack_usage,
"numeric: stack-size", NULL, NULL, OPEN);
fprintf (asm_out_file, "\t.popsection\n");
else if (strcmp (key, "verbose") == 0)
verbose_level ++;
+ else if (strcmp (key, "function-verbose") == 0)
+ annobin_function_verbose = true;
+
else if (strcmp (key, "global-file-syms") == 0)
global_file_name_symbols = true;
else if (strcmp (key, "no-global-file-syms") == 0)
annobin_enable_dynamic_notes = true;
else if (strcmp (key, "no-dynamic-notes") == 0)
annobin_enable_dynamic_notes = false;
-
+
else if (strcmp (key, "static-notes") == 0)
annobin_enable_static_notes = true;
else if (strcmp (key, "no-static-notes") == 0)
annobin_enable_static_notes = false;
-
+
else if (strcmp (key, "stack-threshold") == 0)
{
stack_threshold = strtoul (argv[argc].value, NULL, 0);
if ((unsigned long) ix86_isa_flags > max_x86_isa)
max_x86_isa = ix86_isa_flags;
}
-
+
#ifdef flag_cet
if (global_cet != flag_cet)
fprintf (stderr, "1\n");
fprintf (stderr, "3\n");
if (global_shstk != (ix86_isa_flags & OPTION_MASK_ISA_SHSTK))
fprintf (stderr, "4\n");
-
+
if ((global_cet != flag_cet)
|| (global_set_switch != flag_cet_switch)
|| (global_ibt != (ix86_isa_flags2 & OPTION_MASK_ISA_IBT))
|| (global_shstk != (ix86_isa_flags & OPTION_MASK_ISA_SHSTK)))
{
- annobin_inform (0, "CET values have changed from %d:%d:%lx:%lx to %d:%d:%lx:%lx",
+ annobin_inform (1, "CET values have changed from %d:%d:%lx:%lx to %d:%d:%lx:%lx",
global_cet, global_set_switch, global_ibt, global_shstk,
flag_cet, flag_cet_switch,
(ix86_isa_flags2 & OPTION_MASK_ISA_IBT),
if (annobin_is_64bit)
{
Elf64_32_loader_note note32;
-
+
note32.pr_datasz = sizeof (note32.pr_data);
note32.pr_pad = 0;
memcpy (ptr, & note64, sizeof note64);
ptr += sizeof (note64);
}
-
+
note32.pr_type = GNU_PROPERTY_X86_ISA_1_USED;
note32.pr_data = convert_gcc_isa_to_gnu_property_isa (max_x86_isa);
memcpy (ptr, & note32, sizeof note32);