Update documentation to describe the global-file-sym option.
* Menu:
-* Introduction:: What is Binary Annotation ?
-* Invocation:: How to add Binary Annotations to your application.
-* Checking:: How to examine the information stored in the binary.
-* Using:: How to use the information stored in the binary.
-* GNU Free Documentation License:: GNU Free Documentation License
+* Introduction:: What is Binary Annotation ?
+* Invocation:: How to add Binary Annotations to your application.
+* Checking:: How to examine the information stored in the binary.
+* Using:: How to use the information stored in the binary.
+* GNU FDL:: GNU Free Documentation License
\1f
File: annobin.info, Node: Introduction, Next: Invocation, Prev: Top, Up: Top
required. On Fedora and RHEL based systems this is handled by the
'redhat-rpm-config' package.
- If necessary however the binary annotation plugin can be specifically
-added to the gcc command line by adding the '-fplugin=annobin' option.
-It may also be necessary to tell gcc where to find plugins by adding the
-'-iplugindir=' option, although this should only be necessary if the
-plugin is installed in a separate place from 'gcc'.
+ Currently the binary annotations are generated by a plugin to the
+'GCC' compiler called 'annobin'. This does mean that files that are not
+compiled with 'GCC' will not gain any binary annotations. Solving this
+problem is one of the future goals of the annobin project.
+
+ If the build system being used does not automatically enabled the
+'annobin' plugin then it can be specifically added to the gcc command
+line by adding the '-fplugin=annobin' option. It may also be necessary
+to tell gcc where to find plugins by adding the '-iplugindir=' option,
+although this should only be necessary if the plugin is installed in a
+separate place from 'gcc'.
If it is desired to disable the recording of binary annotations then
the '-fplugin-arg-annobin-disable' can be used, although this must be
bytes of static stack space will not have their requirements
recorded. If not set, then 'N' defaults to 1024.
+'global-file-syms'
+'no-global-file-syms'
+ If enabled the 'global-file-syms' option will create globally
+ visible, unique symbols to mark the start and end of the compiled
+ code. This can be desirable if a program consists of multiple
+ source files with the same name, or if it links to a library that
+ was built with source files of the same name as the program itself.
+ The disadvantage of this feature however is that the unique names
+ are based upon the time of the build, so repeated builds of the
+ same source will have different symbol names inside it. This
+ breaks the functionality of the build-id system which is meant to
+ identify similar builds created at different times. This feature
+ is disabled by default, and if enabled can be disabled again via
+ the 'no-global-file-syms' option.
+
\1f
File: annobin.info, Node: Checking, Next: Using, Prev: Invocation, Up: Top
2 (set).
\1f
-File: annobin.info, Node: Using, Next: GNU Free Documentation License, Prev: Checking, Up: Top
+File: annobin.info, Node: Using, Next: GNU FDL, Prev: Checking, Up: Top
4 How to use the information stored in the binary.
**************************************************
to be run with a program whoes name starts with a dash.
\1f
-File: annobin.info, Node: GNU Free Documentation License, Prev: Using, Up: Top
+File: annobin.info, Node: GNU FDL, Prev: Using, Up: Top
Appendix A GNU Free Documentation License
*****************************************
\1f
Tag Table:
Node: Top\7f706
-Node: Introduction\7f1616
-Node: Invocation\7f3718
-Node: Checking\7f6549
-Node: The Version Encoding\7f8836
-Node: The GOW Encoding\7f9181
-Node: The CF Encoding\7f10632
-Node: The CET Encoding\7f11702
-Node: Using\7f12470
-Node: Who Built Me\7f13008
-Node: ABI Checking\7f15786
-Node: Hardening Checks\7f17914
-Node: Checking Archives\7f21756
-Node: GNU Free Documentation License\7f24194
+Node: Introduction\7f1584
+Node: Invocation\7f3686
+Node: Checking\7f7683
+Node: The Version Encoding\7f9970
+Node: The GOW Encoding\7f10315
+Node: The CF Encoding\7f11766
+Node: The CET Encoding\7f12836
+Node: Using\7f13604
+Node: Who Built Me\7f14119
+Node: ABI Checking\7f16897
+Node: Hardening Checks\7f19025
+Node: Checking Archives\7f22867
+Node: GNU FDL\7f25305
\1f
End Tag Table
@c man begin INCLUDE
@set VERSION 3.2
@set VERSION_PACKAGE (Annobin)
-@set UPDATED January 2018
+@set UPDATED February 2018
@c man end
@ifnottex
in the section entitled ``GNU Free Documentation License''.
@menu
-* Introduction:: What is Binary Annotation ?
-* Invocation:: How to add Binary Annotations to your application.
-* Checking:: How to examine the information stored in the binary.
-* Using:: How to use the information stored in the binary.
-* GNU Free Documentation License:: GNU Free Documentation License
+* Introduction:: What is Binary Annotation ?
+* Invocation:: How to add Binary Annotations to your application.
+* Checking:: How to examine the information stored in the binary.
+* Using:: How to use the information stored in the binary.
+* GNU FDL:: GNU Free Documentation License
@end menu
@end ifnottex
is required. On Fedora and RHEL based systems this is handled by the
@samp{redhat-rpm-config} package.
-If necessary however the binary annotation plugin can be specifically
-added to the gcc command line by adding the @option{-fplugin=annobin}
-option. It may also be necessary to tell gcc where to find plugins by
-adding the @option{-iplugindir=} option, although this should only be
-necessary if the plugin is installed in a separate place from
-@code{gcc}.
+Currently the binary annotations are generated by a plugin to the
+@code{GCC} compiler called @samp{annobin}. This does mean that files
+that are not compiled with @code{GCC} will not gain any binary
+annotations. Solving this problem is one of the future goals of the
+annobin project.
+
+If the build system being used does not automatically enabled the
+@samp{annobin} plugin then it can be specifically added to the gcc
+command line by adding the @option{-fplugin=annobin} option. It may
+also be necessary to tell gcc where to find plugins by adding the
+@option{-iplugindir=} option, although this should only be necessary
+if the plugin is installed in a separate place from @code{gcc}.
If it is desired to disable the recording of binary annotations then
the @option{-fplugin-arg-annobin-disable} can be used, although this
@code{N} bytes of static stack space will not have their requirements
recorded. If not set, then @code{N} defaults to 1024.
+@item global-file-syms
+@itemx no-global-file-syms
+If enabled the @option{global-file-syms} option will create globally
+visible, unique symbols to mark the start and end of the compiled
+code. This can be desirable if a program consists of multiple source
+files with the same name, or if it links to a library that was built
+with source files of the same name as the program itself. The
+disadvantage of this feature however is that the unique names are
+based upon the time of the build, so repeated builds of the same
+source will have different symbol names inside it. This breaks the
+functionality of the build-id system which is meant to identify
+similar builds created at different times. This feature is disabled
+by default, and if enabled can be disabled again via the
+@option{no-global-file-syms} option.
+
@end table
@c -----------------------------------------------------------------
@end table
@c -----------------------------------------------------------------
-@node GNU Free Documentation License
+@node GNU FDL
@appendix GNU Free Documentation License
@include fdl.texi
Since there can be multiple input files, we choose the main output
filename (stripped of any path prefixes). Since filenames can
contain characters that symbol names do not (eg '-') we have to
- allocate our own name. */
+ allocate our own name.
+
+ FIXME: Currently we do not create symbols for other sections that
+ might contain generate code. Eg because of __attribute__((section)). */
static void
init_annobin_current_filename (void)
{
if (desc_is_string)
{
- /* The DESCRIPTION string is the name of a symbol. We want to produce
- a reference to this symbol of the appropriate size for the target
- architecture. */
if (annobin_is_64bit)
fprintf (asm_out_file, "\t.quad %s", (char *) desc1);
else
/* Create a symbol for this compilation unit. */
if (global_file_name_symbols)
fprintf (asm_out_file, ".global %s\n", annobin_current_filename);
- fprintf (asm_out_file, ".type %s STT_OBJECT\n", annobin_current_filename);
- fprintf (asm_out_file, ".size %s, %s - %s\n",annobin_current_filename, annobin_current_endname, annobin_current_filename);
+
+ /* Note - we used to set the type of the symbol to STT_OBJECT, but that is
+ incorrect because that type is for:
+ "A data object, such as a variable, an array, and so on".
+
+ There is no ELF symbol to represent a compilation unit, (STT_FILE only
+ covers a single source file and has special sematic requirements), so
+ instead we use STT_NOTYPE. (Ideally we could use STT_LOOS+n, but there
+ is a problem with the GAS assembler, which does not allow such values to
+ be set on symbols). */
+ fprintf (asm_out_file, ".type %s, STT_NOTYPE\n", annobin_current_filename);
fprintf (asm_out_file, "%s:\n", annobin_current_filename);
+ /* We explicitly set the size of the symbol to 0 so that it will not
+ confuse other tools (eg GDB, elfutils) which look for symbols that
+ cover an address range. */
+ fprintf (asm_out_file, ".size %s, 0\n", annobin_current_filename);
/* Create the static notes section. */
#ifdef OLD_GAS
/* FIXME: This assumes that functions are being placed into the .text section. */
fprintf (asm_out_file, "\t.pushsection .text\n");
fprintf (asm_out_file, "%s:\n", annobin_current_endname);
+ if (global_file_name_symbols)
+ fprintf (asm_out_file, ".global %s\n", annobin_current_endname);
+ fprintf (asm_out_file, ".type %s, STT_NOTYPE\n", annobin_current_endname);
+ fprintf (asm_out_file, ".size %s, 0\n", annobin_current_endname);
fprintf (asm_out_file, "\t.popsection\n");
if (! annobin_enable_dynamic_notes)
# FIXME: Add a test for merging notes...
+# FIXME: Add a test for examining archives...
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.