📄 impdet39.htm
字号:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="GENERATOR" content="Quadralay WebWorks Publisher Professional Edition 6.0.5">
<meta name="TEMPLATEBASE" content="book_html">
<meta name="LASTUPDATED" content="12/04/03 16:06:26">
<title>13.17 C++ link failures caused by conditional symbols </title>
<STYLE TYPE="text/css">
<!--
span.Signal { text-transform: uppercase; font-family: Verdana }
-->
</STYLE>
</head>
<body link="#3366CC" vlink="#9999CC" text="#000000" alink="#0000CC" bgcolor="#FFFFFF"
background="images/backgrnd.gif">
<p><img src="images/stlogo.gif" width="106" height="83" align="left"
alt="logo here!"> </p>
<table width="331" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td><a href="a_refman.htm"><img src="images/navtoc.gif" width="84" height="23"
border="0" alt="TOC"> </a></td>
<td><a href="impdet38.htm"><img src="images/navprev.gif" width="80" height="23"
border="0" alt="PREV"> </a></td>
<td><a href="edglang.htm"><img src="images/navnext.gif" width="83" height="23"
border="0" alt="NEXT"> </a></td>
<td><a href="a_refmaa.htm"><img src="images/navidx.gif" width="84" height="23"
border="0" alt="INDEX"> </a></td>
</tr>
</table>
<p><br clear="all">
</p>
<hr align="left">
<blockquote>
<h2>
<a name="1215139"> </a><font color="#003366" face="Verdana, Arial, Helvetica, sans-serif">13.17 C++ link failures caused by conditional symbols </font>
</h2><hr>
<p>
<a name="1215140"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">Many C++ symbols may need to be commoned up at link time if created in multiple object files (for example <font size=2 face=Courier><strong>extern inline</strong></font> symbols and template statics). The EDG front end records these symbols (known as "conditional" symbols) and places them in unique sections (based upon their C++ mangled names).</font>
</p>
<p>
<a name="1215141"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">It is possible to override the <font size=2 face=Courier><strong>ST_section</strong></font> pragma that EDG applies and put symbols in different sections. There are risks involved with doing this.</font>
</p>
<ul>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1215142"> </a>If a user puts a conditional symbol named <font size=2 face=Courier><strong>fred</strong></font> in the same section as a non-conditional symbol named <font size=2 face=Courier><strong>elmo</strong></font>, <font size=2 face=Courier><strong>elmo</strong></font> may be lost because the linker throws away the whole of the section if another occurrence of <font size=2 face=Courier><strong>fred</strong></font> from another object file is encountered. In this situation, the linker will pick up on the error and report:<br><font size=2 face=Courier><strong>Fatal-st20link- threw away ST_conditional module containing "fred", which contained non-conditional and referenced symbols</strong></font>.</font></p>
<dl>
<dt> <a name="1215143"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">To correct this problem, ensure that all occurrences of the symbol <font size=2 face=Courier><strong>fred</strong></font> in the C++ source either do not have an <font size=2 face=Courier><strong>ST_section</strong></font> pragma applied in the C++ source, or that <font size=2 face=Courier><strong>fred</strong></font> is not in the same section as any other symbol.</font>
</dl>
<p> <font size=2 face="Verdana, Arial, Helvetica, sans-serif"><li ><a name="1215144"> </a>If two conditional symbols are put into the same section, this may result in missing symbols at link time. If <font size=2 face=Courier><strong>file1.cpp</strong></font> has symbol <font size=2 face=Courier><strong>cond1</strong></font>, and <font size=2 face=Courier><strong>file2.cpp</strong></font> has symbols <font size=2 face=Courier><strong>cond1</strong></font> and <font size=2 face=Courier><strong>cond2</strong></font> (all of which are conditional) and both symbols are put in the same section called <font size=2 face=Courier><strong>CONDITIONAL_SYMBOLS</strong></font>, then at link time the second occurrence of <font size=2 face=Courier><strong>cond1</strong></font> will cause the section from <font size=2 face=Courier><strong>file2.cpp</strong></font> to be discarded, which will result in <font size=2 face=Courier><strong>cond2</strong></font> being also discarded, and the link will fail.</font></p>
<dl>
<dt> <a name="1215145"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">The error message would look something like:<br><font size=2 face=Courier><strong>Error-st20link-file2.tco- symbol cond2 not found</strong></font></font>
<dt> <a name="1215146"> </a><font size=2 face="Verdana, Arial, Helvetica, sans-serif">To fix this, remove the <font size=2 face=Courier><strong>ST_section</strong></font> pragma from all occurrences of the symbol <font size=2 face=Courier><strong>cond2</strong></font>, or ensure that no other symbols share the same section.</font>
</dl>
</ul>
</blockquote>
<hr>
<table width="331" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td><a href="a_refman.htm"><img src="images/navtoc.gif" width="84" height="23"
border="0" alt="TOC"> </a></td>
<td><a href="impdet38.htm"><img src="images/navprev.gif" width="80" height="23"
border="0" alt="PREV"> </a></td>
<td><a href="edglang.htm"><img src="images/navnext.gif" width="83" height="23"
border="0" alt="NEXT"> </a></td>
<td><a href="a_refmaa.htm"><img src="images/navidx.gif" width="84" height="23"
border="0" alt="INDEX"> </a></td>
</tr>
</table>
<font size=1 face="Verdana, Arial, Helvetica, sans-serif"> © 2001, 2002, 2003 STMicroelectronics. All Rights Reserved.<br>
ADCS 7250966F</font>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -