|
@@ -97,9 +97,6 @@
|
97
|
97
|
* necessary to satisfy the reference. However, the undefined symbol
|
98
|
98
|
* is not referenced in any relocations, so the link can still succeed
|
99
|
99
|
* if no file contains it.
|
100
|
|
- *
|
101
|
|
- * A symbol passed to this macro may not be referenced anywhere
|
102
|
|
- * else in the file. If you want to do that, see IMPORT_SYMBOL().
|
103
|
100
|
*/
|
104
|
101
|
#ifdef ASSEMBLY
|
105
|
102
|
#define REQUEST_SYMBOL( _sym ) \
|
|
@@ -109,51 +106,6 @@
|
109
|
106
|
__asm__ ( ".equ\t__need_" #_sym ", " #_sym )
|
110
|
107
|
#endif /* ASSEMBLY */
|
111
|
108
|
|
112
|
|
-/** Set up a symbol to be usable in another file by IMPORT_SYMBOL()
|
113
|
|
- *
|
114
|
|
- * The symbol must already be marked as global.
|
115
|
|
- */
|
116
|
|
-#define EXPORT_SYMBOL( _sym ) PROVIDE_SYMBOL ( __export_ ## _sym )
|
117
|
|
-
|
118
|
|
-/** Make a symbol usable to this file if available at link time
|
119
|
|
- *
|
120
|
|
- * If no file passed to the linker contains the symbol, it will have
|
121
|
|
- * @c NULL value to future uses. Keep in mind that the symbol value is
|
122
|
|
- * really the @e address of a variable or function; see the code
|
123
|
|
- * snippet below.
|
124
|
|
- *
|
125
|
|
- * In C using IMPORT_SYMBOL, you must specify the declaration as the
|
126
|
|
- * second argument, for instance
|
127
|
|
- *
|
128
|
|
- * @code
|
129
|
|
- * IMPORT_SYMBOL ( my_func, int my_func ( int arg ) );
|
130
|
|
- * IMPORT_SYMBOL ( my_var, int my_var );
|
131
|
|
- *
|
132
|
|
- * void use_imports ( void ) {
|
133
|
|
- * if ( my_func && &my_var )
|
134
|
|
- * my_var = my_func ( my_var );
|
135
|
|
- * }
|
136
|
|
- * @endcode
|
137
|
|
- *
|
138
|
|
- * GCC considers a weak declaration to override a strong one no matter
|
139
|
|
- * which comes first, so it is safe to include a header file declaring
|
140
|
|
- * the imported symbol normally, but providing the declaration to
|
141
|
|
- * IMPORT_SYMBOL is still required.
|
142
|
|
- *
|
143
|
|
- * If no EXPORT_SYMBOL declaration exists for the imported symbol in
|
144
|
|
- * another file, the behavior will be most likely be identical to that
|
145
|
|
- * for an unavailable symbol.
|
146
|
|
- */
|
147
|
|
-#ifdef ASSEMBLY
|
148
|
|
-#define IMPORT_SYMBOL( _sym ) \
|
149
|
|
- REQUEST_SYMBOL ( __export_ ## _sym ) ; \
|
150
|
|
- .weak _sym
|
151
|
|
-#else /* ASSEMBLY */
|
152
|
|
-#define IMPORT_SYMBOL( _sym, _decl ) \
|
153
|
|
- REQUEST_SYMBOL ( __export_ ## _sym ) ; \
|
154
|
|
- extern _decl __attribute__ (( weak ))
|
155
|
|
-#endif
|
156
|
|
-
|
157
|
109
|
/** @} */
|
158
|
110
|
|
159
|
111
|
/**
|