1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>
Autoconf Macro: klm_sys_weak_alias
</title>
<link rel="stylesheet" type="text/css" href="autoconf-archive.css">
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body>
<table summary="web navigation" style="width:100%;">
<tbody>
<tr>
<td style="width:33%;" align="center" valign="top">
<a href="macros-by-category.html">Macros by Category</a>
</td>
<td style="width:33%;" align="center" valign="top">
<a href=
"http://git.cryp.to/autoconf-archive/history/master:/klm_sys_weak_alias.m4">
Revision History</a>
</td>
<td style="width:33%;" align="center" valign="top">
<form method="get" action="http://www.google.com/search">
<div>
<input name="sitesearch" value="autoconf-archive.cryp.to" type=
"hidden">Search: <input name="q" maxlength="255" type="text">
</div>
</form>
</td>
</tr>
</tbody>
</table>
<hr>
<h1>
klm_sys_weak_alias
</h1>
<h2>
SYNOPSIS
</h2>
<p class="indent" style="white-space:nowrap;">
<code>KLM_SYS_WEAK_ALIAS</code>
</p>
<h2>
DESCRIPTION
</h2>
<div class="indent">
<p>
Determines whether weak aliases are supported on the system, and if so,
what scheme is used to declare them. Also checks to see if aliases can
cross object file boundaries, as some systems don't permit them to.
</p>
<p>
Most systems permit something called a "weak alias" or "weak symbol." These
aliases permit a library to provide a stub form of a routine defined in
another library, thus allowing the first library to operate even if the
other library is not linked. This macro will check for support of weak
aliases, figure out what schemes are available, and determine some
characteristics of the weak alias support -- primarily, whether a weak
alias declared in one object file may be referenced from another object
file.
</p>
<p>
There are four known schemes of declaring weak symbols; each scheme is
checked in turn, and the first one found is prefered. Note that only one of
the mentioned preprocessor macros will be defined!
</p>
<p>
1. Function attributes
</p>
<p>
This scheme was first introduced by the GNU C compiler, and attaches
attributes to particular functions. It is among the easiest to use, and so
is the first one checked. If this scheme is detected, the preprocessor
macro HAVE_SYS_WEAK_ALIAS_ATTRIBUTE will be defined to 1. This scheme is
used as in the following code fragment:
</p>
<pre>
void __weakf(int c)
{
/* Function definition... */
}
void weakf(int c) __attribute__((weak, alias("__weakf")));
</pre>
<p>
2. #pragma weak
</p>
<p>
This scheme is in use by many compilers other than the GNU C compiler. It
is also particularly easy to use, and fairly portable -- well, as portable
as these things get. If this scheme is detected first, the preprocessor
macro HAVE_SYS_WEAK_ALIAS_PRAGMA will be defined to 1. This scheme is used
as in the following code fragment:
</p>
<pre>
extern void weakf(int c);
#pragma weak weakf = __weakf
void __weakf(int c)
{
/* Function definition... */
}
</pre>
<p>
3. #pragma _HP_SECONDARY_DEF
</p>
<p>
This scheme appears to be in use by the HP compiler. As it is rather
specialized, this is one of the last schemes checked. If it is the first
one detected, the preprocessor macro HAVE_SYS_WEAK_ALIAS_HPSECONDARY will
be defined to 1. This scheme is used as in the following code fragment:
</p>
<pre>
extern void weakf(int c);
#pragma _HP_SECONDARY_DEF __weakf weakf
void __weakf(int c)
{
/* Function definition... */
}
</pre>
<p>
4. #pragma _CRI duplicate
</p>
<p>
This scheme appears to be in use by the Cray compiler. As it is rather
specialized, it too is one of the last schemes checked. If it is the first
one detected, the preprocessor macro HAVE_SYS_WEAK_ALIAS_CRIDUPLICATE will
be defined to 1. This scheme is used as in the following code fragment:
</p>
<pre>
extern void weakf(int c);
#pragma _CRI duplicate weakf as __weakf
void __weakf(int c)
{
/* Function definition... */
}
</pre>
<p>
In addition to the preprocessor macros listed above, if any scheme is
found, the preprocessor macro HAVE_SYS_WEAK_ALIAS will also be defined to
1.
</p>
<p>
Once a weak aliasing scheme has been found, a check will be performed to
see if weak aliases are honored across object file boundaries. If they are,
the HAVE_SYS_WEAK_ALIAS_CROSSFILE preprocessor macro is defined to 1.
</p>
<p>
This Autoconf macro also makes two substitutions. The first, WEAK_ALIAS,
contains the name of the scheme found (one of "attribute", "pragma",
"hpsecondary", or "criduplicate"), or "no" if no weak aliasing scheme was
found. The second, WEAK_ALIAS_CROSSFILE, is set to "yes" or "no" depending
on whether or not weak aliases may cross object file boundaries.
</p>
</div>
<h2>
SOURCE CODE
</h2>
<p class="indent">
<a href=
"http://autoconf-archive.cryp.to/klm_sys_weak_alias.m4">http://autoconf-archive.cryp.to/klm_sys_weak_alias.m4</a>
</p>
<h2>
LICENSE
</h2>
<div class="indent">
<p style="white-space:nowrap;">
Copyright © 2008 Kevin L. Mitchell <klmitch@mit.edu>
</p>
<p>
Copying and distribution of this file, with or without modification, are
permitted in any medium without royalty provided the copyright notice and
this notice are preserved.
</p>
</div>
</body>
</html>
|