.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "deb-src-symbols 5" .TH deb-src-symbols 5 "2022-09-01" "1.20.12" "dpkg suite" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" deb\-src\-symbols \- Debian's extended shared library template file .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBdebian/\fR\fIpackage\fR\fB.symbols.\fR\fIarch\fR, \&\fBdebian/symbols.\fR\fIarch\fR, \&\fBdebian/\fR\fIpackage\fR\fB.symbols\fR, \&\fBdebian/symbols\fR .SH "DESCRIPTION" .IX Header "DESCRIPTION" The symbol file templates are shipped in Debian source packages, and its format is a superset of the symbols files shipped in binary packages, see \fBdeb\-symbols\fR\|(5). .SS "Comments" .IX Subsection "Comments" Comments are supported in template symbol files. Any line with \(oq#\(cq as the first character is a comment except if it starts with \(oq#include\(cq (see section \fBUsing includes\fR). Lines starting with \(oq#MISSING:\(cq are special comments documenting symbols that have disappeared. .SS "Using #PACKAGE# substitution" .IX Subsection "Using #PACKAGE# substitution" In some rare cases, the name of the library varies between architectures. To avoid hardcoding the name of the package in the symbols file, you can use the marker \fI#PACKAGE#\fR. It will be replaced by the real package name during installation of the symbols files. Contrary to the \&\fI#MINVER#\fR marker, \fI#PACKAGE#\fR will never appear in a symbols file inside a binary package. .SS "Using symbol tags" .IX Subsection "Using symbol tags" Symbol tagging is useful for marking symbols that are special in some way. Any symbol can have an arbitrary number of tags associated with it. While all tags are parsed and stored, only some of them are understood by \&\fBdpkg-gensymbols\fR and trigger special handling of the symbols. See subsection \fBStandard symbol tags\fR for reference of these tags. .PP Tag specification comes right before the symbol name (no whitespace is allowed in between). It always starts with an opening bracket \fB(\fR, ends with a closing bracket \fB)\fR and must contain at least one tag. Multiple tags are separated by the \fB|\fR character. Each tag can optionally have a value which is separated form the tag name by the \fB=\fR character. Tag names and values can be arbitrary strings except they cannot contain any of the special \fB)\fR \&\fB|\fR \fB=\fR characters. Symbol names following a tag specification can optionally be quoted with either \fB'\fR or \fB"\fR characters to allow whitespaces in them. However, if there are no tags specified for the symbol, quotes are treated as part of the symbol name which continues up until the first space. .PP .Vb 3 \& (tag1=i am marked|tag name with space)"tagged quoted symbol"@Base 1.0 \& (optional)tagged_unquoted_symbol@Base 1.0 1 \& untagged_symbol@Base 1.0 .Ve .PP The first symbol in the example is named \fItagged quoted symbol\fR and has two tags: \fItag1\fR with value \fIi am marked\fR and \fItag name with space\fR that has no value. The second symbol named \fItagged_unquoted_symbol\fR is only tagged with the tag named \fIoptional\fR. The last symbol is an example of the normal untagged symbol. .PP Since symbol tags are an extension of the \fBdeb-symbols\fR(5) format, they can only be part of the symbols files used in source packages (those files should then be seen as templates used to build the symbols files that are embedded in binary packages). When \&\fBdpkg-gensymbols\fR is called without the \fB\-t\fR option, it will output symbols files compatible to the \fBdeb-symbols\fR(5) format: it fully processes symbols according to the requirements of their standard tags and strips all tags from the output. On the contrary, in template mode (\fB\-t\fR) all symbols and their tags (both standard and unknown ones) are kept in the output and are written in their original form as they were loaded. .SS "Standard symbol tags" .IX Subsection "Standard symbol tags" .IP "\fBoptional\fR" 4 .IX Item "optional" A symbol marked as optional can disappear from the library at any time and that will never cause \fBdpkg-gensymbols\fR to fail. However, disappeared optional symbols will continuously appear as \s-1MISSING\s0 in the diff in each new package revision. This behaviour serves as a reminder for the maintainer that such a symbol needs to be removed from the symbol file or readded to the library. When the optional symbol, which was previously declared as \s-1MISSING,\s0 suddenly reappears in the next revision, it will be upgraded back to the \(lqexisting\(rq status with its minimum version unchanged. .Sp This tag is useful for symbols which are private where their disappearance do not cause \s-1ABI\s0 breakage. For example, most of \*(C+ template instantiations fall into this category. Like any other tag, this one may also have an arbitrary value: it could be used to indicate why the symbol is considered optional. .IP "\fBarch=\fR\fIarchitecture-list\fR" 4 .IX Item "arch=architecture-list" .PD 0 .IP "\fBarch\-bits=\fR\fIarchitecture-bits\fR" 4 .IX Item "arch-bits=architecture-bits" .IP "\fBarch\-endian=\fR\fIarchitecture-endianness\fR" 4 .IX Item "arch-endian=architecture-endianness" .PD These tags allow one to restrict the set of architectures where the symbol is supposed to exist. The \fBarch-bits\fR and \fBarch-endian\fR tags are supported since dpkg 1.18.0. When the symbols list is updated with the symbols discovered in the library, all arch-specific symbols which do not concern the current host architecture are treated as if they did not exist. If an arch-specific symbol matching the current host architecture does not exist in the library, normal procedures for missing symbols apply and it may cause \fBdpkg-gensymbols\fR to fail. On the other hand, if the arch-specific symbol is found when it was not supposed to exist (because the current host architecture is not listed in the tag or does not match the endianness and bits), it is made arch neutral (i.e. the arch, arch-bits and arch-endian tags are dropped and the symbol will appear in the diff due to this change), but it is not considered as new. .Sp When operating in the default non-template mode, among arch-specific symbols only those that match the current host architecture are written to the symbols file. On the contrary, all arch-specific symbols (including those from foreign arches) are always written to the symbol file when operating in template mode. .Sp The format of \fIarchitecture-list\fR is the same as the one used in the \&\fBBuild-Depends\fR field of \fIdebian/control\fR (except the enclosing square brackets []). For example, the first symbol from the list below will be considered only on alpha, any\-amd64 and ia64 architectures, the second only on linux architectures, while the third one anywhere except on armel. .Sp .Vb 3 \& (arch=alpha any\-amd64 ia64)64bit_specific_symbol@Base 1.0 \& (arch=linux\-any)linux_specific_symbol@Base 1.0 \& (arch=!armel)symbol_armel_does_not_have@Base 1.0 .Ve .Sp The \fIarchitecture-bits\fR is either \fB32\fR or \fB64\fR. .Sp .Vb 2 \& (arch\-bits=32)32bit_specific_symbol@Base 1.0 \& (arch\-bits=64)64bit_specific_symbol@Base 1.0 .Ve .Sp The \fIarchitecture-endianness\fR is either \fBlittle\fR or \fBbig\fR. .Sp .Vb 2 \& (arch\-endian=little)little_endian_specific_symbol@Base 1.0 \& (arch\-endian=big)big_endian_specific_symbol@Base 1.0 .Ve .Sp Multiple restrictions can be chained. .Sp .Vb 1 \& (arch\-bits=32|arch\-endian=little)32bit_le_symbol@Base 1.0 .Ve .IP "\fBallow-internal\fR" 4 .IX Item "allow-internal" dpkg-gensymbols has a list of internal symbols that should not appear in symbols files as they are usually only side-effects of implementation details of the toolchain (since dpkg 1.20.1). If for some reason, you really want one of those symbols to be included in the symbols file, you should tag the symbol with \fBallow-internal\fR. It can be necessary for some low level toolchain libraries like \(lqlibgcc\(rq. .IP "\fBignore-blacklist\fR" 4 .IX Item "ignore-blacklist" A deprecated alias for \fBallow-internal\fR (since dpkg 1.20.1, supported since dpkg 1.15.3). .IP "\fBc++\fR" 4 .IX Item "c++" Denotes \fIc++\fR symbol pattern. See \fBUsing symbol patterns\fR subsection below. .IP "\fBsymver\fR" 4 .IX Item "symver" Denotes \fIsymver\fR (symbol version) symbol pattern. See \fBUsing symbol patterns\fR subsection below. .IP "\fBregex\fR" 4 .IX Item "regex" Denotes \fIregex\fR symbol pattern. See \fBUsing symbol patterns\fR subsection below. .SS "Using symbol patterns" .IX Subsection "Using symbol patterns" Unlike a standard symbol specification, a pattern may cover multiple real symbols from the library. \fBdpkg-gensymbols\fR will attempt to match each pattern against each real symbol that does \fInot\fR have a specific symbol counterpart defined in the symbol file. Whenever the first matching pattern is found, all its tags and properties will be used as a basis specification of the symbol. If none of the patterns matches, the symbol will be considered as new. .PP A pattern is considered lost if it does not match any symbol in the library. By default this will trigger a \fBdpkg-gensymbols\fR failure under \fB\-c1\fR or higher level. However, if the failure is undesired, the pattern may be marked with the \fIoptional\fR tag. Then if the pattern does not match anything, it will only appear in the diff as \s-1MISSING.\s0 Moreover, like any symbol, the pattern may be limited to the specific architectures with the \fIarch\fR tag. Please refer to \fBStandard symbol tags\fR subsection above for more information. .PP Patterns are an extension of the \fBdeb-symbols\fR(5) format hence they are only valid in symbol file templates. Pattern specification syntax is not any different from the one of a specific symbol. However, symbol name part of the specification serves as an expression to be matched against \fIname@version\fR of the real symbol. In order to distinguish among different pattern types, a pattern will typically be tagged with a special tag. .PP At the moment, \fBdpkg-gensymbols\fR supports three basic pattern types: .IP "\fBc++\fR" 4 .IX Item "c++" This pattern is denoted by the \fIc++\fR tag. It matches only \*(C+ symbols by their demangled symbol name (as emitted by \fBc++filt\fR(1) utility). This pattern is very handy for matching symbols which mangled names might vary across different architectures while their demangled names remain the same. One group of such symbols is \fInon-virtual thunks\fR which have architecture specific offsets embedded in their mangled names. A common instance of this case is a virtual destructor which under diamond inheritance needs a non-virtual thunk symbol. For example, even if _ZThn8_N3NSB6ClassDD1Ev@Base on 32bit architectures will probably be _ZThn16_N3NSB6ClassDD1Ev@Base on 64bit ones, it can be matched with a single \fIc++\fR pattern: .Sp .Vb 4 \& libdummy.so.1 libdummy1 #MINVER# \& [...] \& (c++)"non\-virtual thunk to NSB::ClassD::~ClassD()@Base" 1.0 \& [...] .Ve .Sp The demangled name above can be obtained by executing the following command: .Sp .Vb 1 \& $ echo \*(Aq_ZThn8_N3NSB6ClassDD1Ev@Base\*(Aq | c++filt .Ve .Sp Please note that while mangled name is unique in the library by definition, this is not necessarily true for demangled names. A couple of distinct real symbols may have the same demangled name. For example, that's the case with non-virtual thunk symbols in complex inheritance configurations or with most constructors and destructors (since g++ typically generates two real symbols for them). However, as these collisions happen on the \s-1ABI\s0 level, they should not degrade quality of the symbol file. .IP "\fBsymver\fR" 4 .IX Item "symver" This pattern is denoted by the \fIsymver\fR tag. Well maintained libraries have versioned symbols where each version corresponds to the upstream version where the symbol got added. If that's the case, you can use a \fIsymver\fR pattern to match any symbol associated to the specific version. For example: .Sp .Vb 5 \& libc.so.6 libc6 #MINVER# \& (symver)GLIBC_2.0 2.0 \& [...] \& (symver)GLIBC_2.7 2.7 \& access@GLIBC_2.0 2.2 .Ve .Sp All symbols associated with versions \s-1GLIBC_2.0\s0 and \s-1GLIBC_2.7\s0 will lead to minimal version of 2.0 and 2.7 respectively with the exception of the symbol access@GLIBC_2.0. The latter will lead to a minimal dependency on libc6 version 2.2 despite being in the scope of the \*(L"(symver)GLIBC_2.0\*(R" pattern because specific symbols take precedence over patterns. .Sp Please note that while old style wildcard patterns (denoted by \*(L"*@version\*(R" in the symbol name field) are still supported, they have been deprecated by new style syntax \*(L"(symver|optional)version\*(R". For example, \*(L"*@GLIBC_2.0 2.0\*(R" should be written as \*(L"(symver|optional)GLIBC_2.0 2.0\*(R" if the same behaviour is needed. .IP "\fBregex\fR" 4 .IX Item "regex" Regular expression patterns are denoted by the \fIregex\fR tag. They match by the perl regular expression specified in the symbol name field. A regular expression is matched as it is, therefore do not forget to start it with the \&\fI^\fR character or it may match any part of the real symbol \&\fIname@version\fR string. For example: .Sp .Vb 3 \& libdummy.so.1 libdummy1 #MINVER# \& (regex)"^mystack_.*@Base$" 1.0 \& (regex|optional)"private" 1.0 .Ve .Sp Symbols like \*(L"mystack_new@Base\*(R", \*(L"mystack_push@Base\*(R", \*(L"mystack_pop@Base\*(R" etc. will be matched by the first pattern while e.g. \*(L"ng_mystack_new@Base\*(R" won't. The second pattern will match all symbols having the string \*(L"private\*(R" in their names and matches will inherit \fIoptional\fR tag from the pattern. .PP Basic patterns listed above can be combined where it makes sense. In that case, they are processed in the order in which the tags are specified. For example, both: .PP .Vb 2 \& (c++|regex)"^NSA::ClassA::Private::privmethod\ed\e(int\e)@Base" 1.0 \& (regex|c++)N3NSA6ClassA7Private11privmethod\edEi@Base 1.0 .Ve .PP will match symbols \*(L"_ZN3NSA6ClassA7Private11privmethod1Ei@Base\*(R" and \&\*(L"_ZN3NSA6ClassA7Private11privmethod2Ei@Base\*(R". When matching the first pattern, the raw symbol is first demangled as \*(C+ symbol, then the demangled name is matched against the regular expression. On the other hand, when matching the second pattern, regular expression is matched against the raw symbol name, then the symbol is tested if it is \*(C+ one by attempting to demangle it. A failure of any basic pattern will result in the failure of the whole pattern. Therefore, for example, \*(L"_\|_N3NSA6ClassA7Private11privmethod\edEi@Base\*(R" will not match either of the patterns because it is not a valid \*(C+ symbol. .PP In general, all patterns are divided into two groups: aliases (basic \fIc++\fR and \fIsymver\fR) and generic patterns (\fIregex\fR, all combinations of multiple basic patterns). Matching of basic alias-based patterns is fast (O(1)) while generic patterns are O(N) (N \- generic pattern count) for each symbol. Therefore, it is recommended not to overuse generic patterns. .PP When multiple patterns match the same real symbol, aliases (first \fIc++\fR, then \fIsymver\fR) are preferred over generic patterns. Generic patterns are matched in the order they are found in the symbol file template until the first success. Please note, however, that manual reordering of template file entries is not recommended because \fBdpkg-gensymbols\fR generates diffs based on the alphanumerical order of their names. .SS "Using includes" .IX Subsection "Using includes" When the set of exported symbols differ between architectures, it may become inefficient to use a single symbol file. In those cases, an include directive may prove to be useful in a couple of ways: .IP "\(bu" 4 You can factorize the common part in some external file and include that file in your \fIpackage\fR.symbols.\fIarch\fR file by using an include directive like this: .Sp .Vb 1 \& #include "I.symbols.common" .Ve .IP "\(bu" 4 The include directive may also be tagged like any symbol: .Sp .Vb 1 \& (tag|...|tagN)#include "file\-to\-include" .Ve .Sp As a result, all symbols included from \fIfile-to-include\fR will be considered to be tagged with \fItag\fR ... \fItagN\fR by default. You can use this feature to create a common \fIpackage\fR.symbols file which includes architecture specific symbol files: .Sp .Vb 4 \& common_symbol1@Base 1.0 \& (arch=amd64 ia64 alpha)#include "package.symbols.64bit" \& (arch=!amd64 !ia64 !alpha)#include "package.symbols.32bit" \& common_symbol2@Base 1.0 .Ve .PP The symbols files are read line by line, and include directives are processed as soon as they are encountered. This means that the content of the included file can override any content that appeared before the include directive and that any content after the directive can override anything contained in the included file. Any symbol (or even another #include directive) in the included file can specify additional tags or override values of the inherited tags in its tag specification. However, there is no way for the symbol to remove any of the inherited tags. .PP An included file can repeat the header line containing the \s-1SONAME\s0 of the library. In that case, it overrides any header line previously read. However, in general it's best to avoid duplicating header lines. One way to do it is the following: .PP .Vb 2 \& #include "libsomething1.symbols.common" \& arch_specific_symbol@Base 1.0 .Ve .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBdeb-symbols\fR(5), \&\fBdpkg-shlibdeps\fR(1), \&\fBdpkg-gensymbols\fR(1).