About: Weak symbol

An Entity of Type: Thing, from Named Graph: http://dbpedia.org, within Data Space: dbpedia.org

A weak symbol denotes a specially annotated symbol during linking of Executable and Linkable Format (ELF) object files. By default, without any annotation, a symbol in an object file is strong. During linking, a strong symbol can override a weak symbol of the same name. In contrast, in the presence of two strong symbols by the same name, the linker resolves the symbol in favor of the first one found. This behavior allows an executable to override standard library functions, such as malloc(3). When linking a binary executable, a weakly declared symbol does not need a definition. In comparison, (by default) a declared strong symbol without a definition triggers an undefined symbol link error.

Property Value
dbo:abstract
  • A weak symbol denotes a specially annotated symbol during linking of Executable and Linkable Format (ELF) object files. By default, without any annotation, a symbol in an object file is strong. During linking, a strong symbol can override a weak symbol of the same name. In contrast, in the presence of two strong symbols by the same name, the linker resolves the symbol in favor of the first one found. This behavior allows an executable to override standard library functions, such as malloc(3). When linking a binary executable, a weakly declared symbol does not need a definition. In comparison, (by default) a declared strong symbol without a definition triggers an undefined symbol link error. Weak symbols are not mentioned by the C or C++ language standards; as such, inserting them into code is not very portable. Even if two platforms support the same or similar syntax for marking symbols as weak, the semantics may differ in subtle points, e.g. whether weak symbols during dynamic linking at runtime lose their semantics or not. (en)
  • 弱符号(Weak symbol)是链接器在生成ELF文件的过程中使用的一种特殊属性符号。默认情况下,如果没有特别声明,目标文件里面的符号都是强符号。在链接过程中,一个强符号会优先于一个同名的弱符号。相比之下,两个同名强符号一起链接会出现链接错误。当链接一个可执行文件,弱符号可以不定义。但对于强符号,如果没有定义,连接器会产生一个“符号未定义”错误 (undefined symbol)。使用弱符号的目的是,当不确定这个符号是否被定义的情况下,链接器也可以成功链接出ELF文件,适用于某些模块还未实现的情况下,其他模块的先行调试。 弱符号在C语言和C++语言的规范里面没有被提及,所以使用弱符号的代码,移植性不是非常好。 (zh)
dbo:wikiPageID
  • 7177568 (xsd:integer)
dbo:wikiPageLength
  • 11843 (xsd:nonNegativeInteger)
dbo:wikiPageRevisionID
  • 1113254237 (xsd:integer)
dbo:wikiPageWikiLink
dbp:wikiPageUsesTemplate
dcterms:subject
rdfs:comment
  • 弱符号(Weak symbol)是链接器在生成ELF文件的过程中使用的一种特殊属性符号。默认情况下,如果没有特别声明,目标文件里面的符号都是强符号。在链接过程中,一个强符号会优先于一个同名的弱符号。相比之下,两个同名强符号一起链接会出现链接错误。当链接一个可执行文件,弱符号可以不定义。但对于强符号,如果没有定义,连接器会产生一个“符号未定义”错误 (undefined symbol)。使用弱符号的目的是,当不确定这个符号是否被定义的情况下,链接器也可以成功链接出ELF文件,适用于某些模块还未实现的情况下,其他模块的先行调试。 弱符号在C语言和C++语言的规范里面没有被提及,所以使用弱符号的代码,移植性不是非常好。 (zh)
  • A weak symbol denotes a specially annotated symbol during linking of Executable and Linkable Format (ELF) object files. By default, without any annotation, a symbol in an object file is strong. During linking, a strong symbol can override a weak symbol of the same name. In contrast, in the presence of two strong symbols by the same name, the linker resolves the symbol in favor of the first one found. This behavior allows an executable to override standard library functions, such as malloc(3). When linking a binary executable, a weakly declared symbol does not need a definition. In comparison, (by default) a declared strong symbol without a definition triggers an undefined symbol link error. (en)
rdfs:label
  • Weak symbol (en)
  • 弱符号 (zh)
owl:sameAs
prov:wasDerivedFrom
foaf:isPrimaryTopicOf
is dbo:wikiPageWikiLink of
is foaf:primaryTopic of
Powered by OpenLink Virtuoso    This material is Open Knowledge     W3C Semantic Web Technology     This material is Open Knowledge    Valid XHTML + RDFa
This content was extracted from Wikipedia and is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License