OLD | NEW |
1 /* plugin-api.h -- External linker plugin API. */ | 1 /* plugin-api.h -- External linker plugin API. */ |
2 | 2 |
3 /* Copyright 2008 Free Software Foundation, Inc. | 3 /* Copyright 2009 Free Software Foundation, Inc. |
4 Written by Cary Coutant <ccoutant@google.com>. | 4 Written by Cary Coutant <ccoutant@google.com>. |
5 | 5 |
6 This file is part of binutils. | 6 This file is part of binutils. |
7 | 7 |
8 This program is free software; you can redistribute it and/or modify | 8 This program is free software; you can redistribute it and/or modify |
9 it under the terms of the GNU General Public License as published by | 9 it under the terms of the GNU General Public License as published by |
10 the Free Software Foundation; either version 3 of the License, or | 10 the Free Software Foundation; either version 3 of the License, or |
11 (at your option) any later version. | 11 (at your option) any later version. |
12 | 12 |
13 This program is distributed in the hope that it will be useful, | 13 This program is distributed in the hope that it will be useful, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 LDPV_PROTECTED, | 104 LDPV_PROTECTED, |
105 LDPV_INTERNAL, | 105 LDPV_INTERNAL, |
106 LDPV_HIDDEN | 106 LDPV_HIDDEN |
107 }; | 107 }; |
108 | 108 |
109 /* How a symbol is resolved. */ | 109 /* How a symbol is resolved. */ |
110 | 110 |
111 enum ld_plugin_symbol_resolution | 111 enum ld_plugin_symbol_resolution |
112 { | 112 { |
113 LDPR_UNKNOWN = 0, | 113 LDPR_UNKNOWN = 0, |
| 114 |
| 115 /* Symbol is still undefined at this point. */ |
114 LDPR_UNDEF, | 116 LDPR_UNDEF, |
| 117 |
| 118 /* This is the prevailing definition of the symbol, with references from |
| 119 regular object code. */ |
115 LDPR_PREVAILING_DEF, | 120 LDPR_PREVAILING_DEF, |
| 121 |
| 122 /* This is the prevailing definition of the symbol, with no |
| 123 references from regular objects. It is only referenced from IR |
| 124 code. */ |
116 LDPR_PREVAILING_DEF_IRONLY, | 125 LDPR_PREVAILING_DEF_IRONLY, |
| 126 |
| 127 /* This definition was pre-empted by a definition in a regular |
| 128 object file. */ |
117 LDPR_PREEMPTED_REG, | 129 LDPR_PREEMPTED_REG, |
| 130 |
| 131 /* This definition was pre-empted by a definition in another IR file. */ |
118 LDPR_PREEMPTED_IR, | 132 LDPR_PREEMPTED_IR, |
| 133 |
| 134 /* This symbol was resolved by a definition in another IR file. */ |
119 LDPR_RESOLVED_IR, | 135 LDPR_RESOLVED_IR, |
| 136 |
| 137 /* This symbol was resolved by a definition in a regular object |
| 138 linked into the main executable. */ |
120 LDPR_RESOLVED_EXEC, | 139 LDPR_RESOLVED_EXEC, |
| 140 |
| 141 /* This symbol was resolved by a definition in a shared object. */ |
121 LDPR_RESOLVED_DYN | 142 LDPR_RESOLVED_DYN |
122 }; | 143 }; |
123 | 144 |
124 /* The plugin library's "claim file" handler. */ | 145 /* The plugin library's "claim file" handler. */ |
125 | 146 |
126 typedef | 147 typedef |
127 enum ld_plugin_status | 148 enum ld_plugin_status |
128 (*ld_plugin_claim_file_handler) ( | 149 (*ld_plugin_claim_file_handler) ( |
129 const struct ld_plugin_input_file *file, int *claimed); | 150 const struct ld_plugin_input_file *file, int *claimed); |
130 | 151 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 enum ld_plugin_status | 207 enum ld_plugin_status |
187 (*ld_plugin_get_symbols) (const void *handle, int nsyms, | 208 (*ld_plugin_get_symbols) (const void *handle, int nsyms, |
188 struct ld_plugin_symbol *syms); | 209 struct ld_plugin_symbol *syms); |
189 | 210 |
190 /* The linker's interface for adding a compiled input file. */ | 211 /* The linker's interface for adding a compiled input file. */ |
191 | 212 |
192 typedef | 213 typedef |
193 enum ld_plugin_status | 214 enum ld_plugin_status |
194 (*ld_plugin_add_input_file) (char *pathname); | 215 (*ld_plugin_add_input_file) (char *pathname); |
195 | 216 |
| 217 /* The linker's interface for adding a library that should be searched. */ |
| 218 |
| 219 typedef |
| 220 enum ld_plugin_status |
| 221 (*ld_plugin_add_input_library) (char *libname); |
| 222 |
196 /* The linker's interface for issuing a warning or error message. */ | 223 /* The linker's interface for issuing a warning or error message. */ |
197 | 224 |
198 typedef | 225 typedef |
199 enum ld_plugin_status | 226 enum ld_plugin_status |
200 (*ld_plugin_message) (int level, const char *format, ...); | 227 (*ld_plugin_message) (int level, const char *format, ...); |
201 | 228 |
202 enum ld_plugin_level | 229 enum ld_plugin_level |
203 { | 230 { |
204 LDPL_INFO, | 231 LDPL_INFO, |
205 LDPL_WARNING, | 232 LDPL_WARNING, |
(...skipping 11 matching lines...) Expand all Loading... |
217 LDPT_LINKER_OUTPUT, | 244 LDPT_LINKER_OUTPUT, |
218 LDPT_OPTION, | 245 LDPT_OPTION, |
219 LDPT_REGISTER_CLAIM_FILE_HOOK, | 246 LDPT_REGISTER_CLAIM_FILE_HOOK, |
220 LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK, | 247 LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK, |
221 LDPT_REGISTER_CLEANUP_HOOK, | 248 LDPT_REGISTER_CLEANUP_HOOK, |
222 LDPT_ADD_SYMBOLS, | 249 LDPT_ADD_SYMBOLS, |
223 LDPT_GET_SYMBOLS, | 250 LDPT_GET_SYMBOLS, |
224 LDPT_ADD_INPUT_FILE, | 251 LDPT_ADD_INPUT_FILE, |
225 LDPT_MESSAGE, | 252 LDPT_MESSAGE, |
226 LDPT_GET_INPUT_FILE, | 253 LDPT_GET_INPUT_FILE, |
227 LDPT_RELEASE_INPUT_FILE | 254 LDPT_RELEASE_INPUT_FILE, |
| 255 LDPT_ADD_INPUT_LIBRARY |
228 }; | 256 }; |
229 | 257 |
230 /* The plugin transfer vector. */ | 258 /* The plugin transfer vector. */ |
231 | 259 |
232 struct ld_plugin_tv | 260 struct ld_plugin_tv |
233 { | 261 { |
234 enum ld_plugin_tag tv_tag; | 262 enum ld_plugin_tag tv_tag; |
235 union | 263 union |
236 { | 264 { |
237 int tv_val; | 265 int tv_val; |
238 const char *tv_string; | 266 const char *tv_string; |
239 ld_plugin_register_claim_file tv_register_claim_file; | 267 ld_plugin_register_claim_file tv_register_claim_file; |
240 ld_plugin_register_all_symbols_read tv_register_all_symbols_read; | 268 ld_plugin_register_all_symbols_read tv_register_all_symbols_read; |
241 ld_plugin_register_cleanup tv_register_cleanup; | 269 ld_plugin_register_cleanup tv_register_cleanup; |
242 ld_plugin_add_symbols tv_add_symbols; | 270 ld_plugin_add_symbols tv_add_symbols; |
243 ld_plugin_get_symbols tv_get_symbols; | 271 ld_plugin_get_symbols tv_get_symbols; |
244 ld_plugin_add_input_file tv_add_input_file; | 272 ld_plugin_add_input_file tv_add_input_file; |
245 ld_plugin_message tv_message; | 273 ld_plugin_message tv_message; |
246 ld_plugin_get_input_file tv_get_input_file; | 274 ld_plugin_get_input_file tv_get_input_file; |
247 ld_plugin_release_input_file tv_release_input_file; | 275 ld_plugin_release_input_file tv_release_input_file; |
| 276 ld_plugin_add_input_library tv_add_input_library; |
248 } tv_u; | 277 } tv_u; |
249 }; | 278 }; |
250 | 279 |
251 /* The plugin library's "onload" entry point. */ | 280 /* The plugin library's "onload" entry point. */ |
252 | 281 |
253 typedef | 282 typedef |
254 enum ld_plugin_status | 283 enum ld_plugin_status |
255 (*ld_plugin_onload) (struct ld_plugin_tv *tv); | 284 (*ld_plugin_onload) (struct ld_plugin_tv *tv); |
256 | 285 |
257 #ifdef __cplusplus | 286 #ifdef __cplusplus |
258 } | 287 } |
259 #endif | 288 #endif |
260 | 289 |
261 #endif /* !defined(PLUGIN_API_H) */ | 290 #endif /* !defined(PLUGIN_API_H) */ |
OLD | NEW |