Unstripped binary trading
This indicates that Bazel is not responsible for making mylib. Linking to static or shared library On Unix: Headers in srcs must only be directly included from the files in hdrs and srcs of the library itself. When deciding whether to put a header into hdrs or srcs , you should ask whether you want consumers of this library to be able to directly include it.
This is roughly the same decision as between public and private visibility in programming languages. All headers that belong to the binary or test directly should be listed in the srcs.
The allowed direct inclusions in this example are listed in the table below. The inclusion checking rules only apply to direct inclusions. In the example above foo. Technically, the compilation of a. In this case the compiler may read baz. For that to be allowed, baz must be added to the deps of foo. Unfortunately Bazel currently cannot distinguish between direct and transitive inclusions, so it cannot detect error cases where a file illegally includes a header directly that is only allowed to be included transitively.
For example, Bazel would not complain if in the example above foo. This would be illegal, because foo does not directly depend on baz. Currently, no error is produced in that case, but such error checking may be added in the future.
This is the strongly preferred location for declaring header files that describe the interface for the library. These headers will be made available for inclusion by sources in this rule or in dependent rules. Headers not meant to be included by a client of this library should be listed in the srcs attribute instead, even if they are included by a published header.
When set, the headers in the hdrs attribute of this rule are accessible at is the value of this attribute prepended to their repository-relative path. When set, the headers in the hdrs attribute of this rule are accessible at their path with this prefix cut off.
If it's a relative path, it's taken as a package-relative one. If it's an absolute one, it's understood as a repository-relative path. This is the location for declaring header files that cannot be compiled on their own; that is, they always need to be textually included by other source files to build valid code.
Name ; required A unique name for this rule. List of labels ; optional The list of other libraries to be linked in to the binary target. Permitted srcs file types: Subject to "Make variable" substitution and Bourne shell tokenization.
List of strings; optional List of defines to add to the compile line. Subject to "Make" variable substitution and Bourne shell tokenization. Unlike copts , these flags are added for the target and every rule that depends on it! List of strings; optional List of include dirs to be added to the compile line. Subject to "Make" variable substitution, Bourne shell tokenization and label expansion.
Boolean; optional; nonconfigurable ; default is 0 Create a shared library. By default this option is off. If you enable it, you must name your binary lib foo. There are really three different ways to link an executable: This mode is enabled by specifying -static in the linkopts attribute. Subject to "Make" variable substitution. The value of this attribute is interpreted as a regular expression.
Any preexisting COPTS that match this regular expression including values explicitly specified in the rule's copts attribute will be removed from COPTS for purposes of compiling this rule. This attribute should rarely be needed. When this argument is used, only one objfile argument may be specified. Operate in deterministic mode. When copying archive members and writing the archive index, use zero for UIDs, GIDs, timestamps, and use consistent file modes for all files.
If binutils was configured with --enable-deterministic-archives , then this mode is on by default. Do not operate in deterministic mode. This is the inverse of the -D option, above: This is the default unless binutils was configured with --enable-deterministic-archives. Permit regular expressions in symbolname s used in other command line options. If the first character of the symbol name is the exclamation point! Remove compiler-generated local symbols.
When stripping a file, perhaps with --strip-debug or --strip-unneeded , retain any symbols specifying source file names, which would otherwise get stripped. Strip a file, emptying the contents of any sections that would not be stripped by --strip-debug and leaving the debugging sections intact.
In ELF files, this preserves all the note sections in the output as well. Note - the section headers of the stripped sections are preserved, including their sizes, but the contents of the section are discarded. The section headers are preserved so that other tools can match up the debuginfo file with the real executable, even if that executable has been relocated to a different address space. The intention is that this option will be used in conjunction with --add-gnu-debuglink to create a two part executable.
One a stripped binary which will occupy less space in RAM and in a distribution and the second a debugging information file which is only needed if debugging abilities are required.
The suggested procedure to create these files is as follows:. Also the --only-keep-debug step is optional. You could instead do this:.
It does not have to be a file created by the --only-keep-debug switch.