xref: /dflybsd-src/contrib/gcc-8.0/include/plugin-api.h (revision 38fd149817dfbff97799f62fcb70be98c4e32523)
1*38fd1498Szrj /* plugin-api.h -- External linker plugin API.  */
2*38fd1498Szrj 
3*38fd1498Szrj /* Copyright (C) 2009-2018 Free Software Foundation, Inc.
4*38fd1498Szrj    Written by Cary Coutant <ccoutant@google.com>.
5*38fd1498Szrj 
6*38fd1498Szrj    This file is part of binutils.
7*38fd1498Szrj 
8*38fd1498Szrj    This program is free software; you can redistribute it and/or modify
9*38fd1498Szrj    it under the terms of the GNU General Public License as published by
10*38fd1498Szrj    the Free Software Foundation; either version 3 of the License, or
11*38fd1498Szrj    (at your option) any later version.
12*38fd1498Szrj 
13*38fd1498Szrj    This program is distributed in the hope that it will be useful,
14*38fd1498Szrj    but WITHOUT ANY WARRANTY; without even the implied warranty of
15*38fd1498Szrj    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16*38fd1498Szrj    GNU General Public License for more details.
17*38fd1498Szrj 
18*38fd1498Szrj    You should have received a copy of the GNU General Public License
19*38fd1498Szrj    along with this program; if not, write to the Free Software
20*38fd1498Szrj    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21*38fd1498Szrj    MA 02110-1301, USA.  */
22*38fd1498Szrj 
23*38fd1498Szrj /* This file defines the interface for writing a linker plugin, which is
24*38fd1498Szrj    described at < http://gcc.gnu.org/wiki/whopr/driver >.  */
25*38fd1498Szrj 
26*38fd1498Szrj #ifndef PLUGIN_API_H
27*38fd1498Szrj #define PLUGIN_API_H
28*38fd1498Szrj 
29*38fd1498Szrj #ifdef HAVE_STDINT_H
30*38fd1498Szrj #include <stdint.h>
31*38fd1498Szrj #elif defined(HAVE_INTTYPES_H)
32*38fd1498Szrj #include <inttypes.h>
33*38fd1498Szrj #endif
34*38fd1498Szrj #include <sys/types.h>
35*38fd1498Szrj #if !defined(HAVE_STDINT_H) && !defined(HAVE_INTTYPES_H) && \
36*38fd1498Szrj     !defined(UINT64_MAX) && !defined(uint64_t)
37*38fd1498Szrj #error can not find uint64_t type
38*38fd1498Szrj #endif
39*38fd1498Szrj 
40*38fd1498Szrj #ifdef __cplusplus
41*38fd1498Szrj extern "C"
42*38fd1498Szrj {
43*38fd1498Szrj #endif
44*38fd1498Szrj 
45*38fd1498Szrj /* Status code returned by most API routines.  */
46*38fd1498Szrj 
47*38fd1498Szrj enum ld_plugin_status
48*38fd1498Szrj {
49*38fd1498Szrj   LDPS_OK = 0,
50*38fd1498Szrj   LDPS_NO_SYMS,         /* Attempt to get symbols that haven't been added. */
51*38fd1498Szrj   LDPS_BAD_HANDLE,      /* No claimed object associated with given handle. */
52*38fd1498Szrj   LDPS_ERR
53*38fd1498Szrj   /* Additional Error codes TBD.  */
54*38fd1498Szrj };
55*38fd1498Szrj 
56*38fd1498Szrj /* The version of the API specification.  */
57*38fd1498Szrj 
58*38fd1498Szrj enum ld_plugin_api_version
59*38fd1498Szrj {
60*38fd1498Szrj   LD_PLUGIN_API_VERSION = 1
61*38fd1498Szrj };
62*38fd1498Szrj 
63*38fd1498Szrj /* The type of output file being generated by the linker.  */
64*38fd1498Szrj 
65*38fd1498Szrj enum ld_plugin_output_file_type
66*38fd1498Szrj {
67*38fd1498Szrj   LDPO_REL,
68*38fd1498Szrj   LDPO_EXEC,
69*38fd1498Szrj   LDPO_DYN,
70*38fd1498Szrj   LDPO_PIE
71*38fd1498Szrj };
72*38fd1498Szrj 
73*38fd1498Szrj /* An input file managed by the plugin library.  */
74*38fd1498Szrj 
75*38fd1498Szrj struct ld_plugin_input_file
76*38fd1498Szrj {
77*38fd1498Szrj   const char *name;
78*38fd1498Szrj   int fd;
79*38fd1498Szrj   off_t offset;
80*38fd1498Szrj   off_t filesize;
81*38fd1498Szrj   void *handle;
82*38fd1498Szrj };
83*38fd1498Szrj 
84*38fd1498Szrj /* A symbol belonging to an input file managed by the plugin library.  */
85*38fd1498Szrj 
86*38fd1498Szrj struct ld_plugin_symbol
87*38fd1498Szrj {
88*38fd1498Szrj   char *name;
89*38fd1498Szrj   char *version;
90*38fd1498Szrj   int def;
91*38fd1498Szrj   int visibility;
92*38fd1498Szrj   uint64_t size;
93*38fd1498Szrj   char *comdat_key;
94*38fd1498Szrj   int resolution;
95*38fd1498Szrj };
96*38fd1498Szrj 
97*38fd1498Szrj /* An object's section.  */
98*38fd1498Szrj 
99*38fd1498Szrj struct ld_plugin_section
100*38fd1498Szrj {
101*38fd1498Szrj   const void* handle;
102*38fd1498Szrj   unsigned int shndx;
103*38fd1498Szrj };
104*38fd1498Szrj 
105*38fd1498Szrj /* Whether the symbol is a definition, reference, or common, weak or not.  */
106*38fd1498Szrj 
107*38fd1498Szrj enum ld_plugin_symbol_kind
108*38fd1498Szrj {
109*38fd1498Szrj   LDPK_DEF,
110*38fd1498Szrj   LDPK_WEAKDEF,
111*38fd1498Szrj   LDPK_UNDEF,
112*38fd1498Szrj   LDPK_WEAKUNDEF,
113*38fd1498Szrj   LDPK_COMMON
114*38fd1498Szrj };
115*38fd1498Szrj 
116*38fd1498Szrj /* The visibility of the symbol.  */
117*38fd1498Szrj 
118*38fd1498Szrj enum ld_plugin_symbol_visibility
119*38fd1498Szrj {
120*38fd1498Szrj   LDPV_DEFAULT,
121*38fd1498Szrj   LDPV_PROTECTED,
122*38fd1498Szrj   LDPV_INTERNAL,
123*38fd1498Szrj   LDPV_HIDDEN
124*38fd1498Szrj };
125*38fd1498Szrj 
126*38fd1498Szrj /* How a symbol is resolved.  */
127*38fd1498Szrj 
128*38fd1498Szrj enum ld_plugin_symbol_resolution
129*38fd1498Szrj {
130*38fd1498Szrj   LDPR_UNKNOWN = 0,
131*38fd1498Szrj 
132*38fd1498Szrj   /* Symbol is still undefined at this point.  */
133*38fd1498Szrj   LDPR_UNDEF,
134*38fd1498Szrj 
135*38fd1498Szrj   /* This is the prevailing definition of the symbol, with references from
136*38fd1498Szrj      regular object code.  */
137*38fd1498Szrj   LDPR_PREVAILING_DEF,
138*38fd1498Szrj 
139*38fd1498Szrj   /* This is the prevailing definition of the symbol, with no
140*38fd1498Szrj      references from regular objects.  It is only referenced from IR
141*38fd1498Szrj      code.  */
142*38fd1498Szrj   LDPR_PREVAILING_DEF_IRONLY,
143*38fd1498Szrj 
144*38fd1498Szrj   /* This definition was pre-empted by a definition in a regular
145*38fd1498Szrj      object file.  */
146*38fd1498Szrj   LDPR_PREEMPTED_REG,
147*38fd1498Szrj 
148*38fd1498Szrj   /* This definition was pre-empted by a definition in another IR file.  */
149*38fd1498Szrj   LDPR_PREEMPTED_IR,
150*38fd1498Szrj 
151*38fd1498Szrj   /* This symbol was resolved by a definition in another IR file.  */
152*38fd1498Szrj   LDPR_RESOLVED_IR,
153*38fd1498Szrj 
154*38fd1498Szrj   /* This symbol was resolved by a definition in a regular object
155*38fd1498Szrj      linked into the main executable.  */
156*38fd1498Szrj   LDPR_RESOLVED_EXEC,
157*38fd1498Szrj 
158*38fd1498Szrj   /* This symbol was resolved by a definition in a shared object.  */
159*38fd1498Szrj   LDPR_RESOLVED_DYN,
160*38fd1498Szrj 
161*38fd1498Szrj   /* This is the prevailing definition of the symbol, with no
162*38fd1498Szrj      references from regular objects.  It is only referenced from IR
163*38fd1498Szrj      code, but the symbol is exported and may be referenced from
164*38fd1498Szrj      a dynamic object (not seen at link time).  */
165*38fd1498Szrj   LDPR_PREVAILING_DEF_IRONLY_EXP
166*38fd1498Szrj };
167*38fd1498Szrj 
168*38fd1498Szrj /* The plugin library's "claim file" handler.  */
169*38fd1498Szrj 
170*38fd1498Szrj typedef
171*38fd1498Szrj enum ld_plugin_status
172*38fd1498Szrj (*ld_plugin_claim_file_handler) (
173*38fd1498Szrj   const struct ld_plugin_input_file *file, int *claimed);
174*38fd1498Szrj 
175*38fd1498Szrj /* The plugin library's "all symbols read" handler.  */
176*38fd1498Szrj 
177*38fd1498Szrj typedef
178*38fd1498Szrj enum ld_plugin_status
179*38fd1498Szrj (*ld_plugin_all_symbols_read_handler) (void);
180*38fd1498Szrj 
181*38fd1498Szrj /* The plugin library's cleanup handler.  */
182*38fd1498Szrj 
183*38fd1498Szrj typedef
184*38fd1498Szrj enum ld_plugin_status
185*38fd1498Szrj (*ld_plugin_cleanup_handler) (void);
186*38fd1498Szrj 
187*38fd1498Szrj /* The linker's interface for registering the "claim file" handler.  */
188*38fd1498Szrj 
189*38fd1498Szrj typedef
190*38fd1498Szrj enum ld_plugin_status
191*38fd1498Szrj (*ld_plugin_register_claim_file) (ld_plugin_claim_file_handler handler);
192*38fd1498Szrj 
193*38fd1498Szrj /* The linker's interface for registering the "all symbols read" handler.  */
194*38fd1498Szrj 
195*38fd1498Szrj typedef
196*38fd1498Szrj enum ld_plugin_status
197*38fd1498Szrj (*ld_plugin_register_all_symbols_read) (
198*38fd1498Szrj   ld_plugin_all_symbols_read_handler handler);
199*38fd1498Szrj 
200*38fd1498Szrj /* The linker's interface for registering the cleanup handler.  */
201*38fd1498Szrj 
202*38fd1498Szrj typedef
203*38fd1498Szrj enum ld_plugin_status
204*38fd1498Szrj (*ld_plugin_register_cleanup) (ld_plugin_cleanup_handler handler);
205*38fd1498Szrj 
206*38fd1498Szrj /* The linker's interface for adding symbols from a claimed input file.  */
207*38fd1498Szrj 
208*38fd1498Szrj typedef
209*38fd1498Szrj enum ld_plugin_status
210*38fd1498Szrj (*ld_plugin_add_symbols) (void *handle, int nsyms,
211*38fd1498Szrj                           const struct ld_plugin_symbol *syms);
212*38fd1498Szrj 
213*38fd1498Szrj /* The linker's interface for getting the input file information with
214*38fd1498Szrj    an open (possibly re-opened) file descriptor.  */
215*38fd1498Szrj 
216*38fd1498Szrj typedef
217*38fd1498Szrj enum ld_plugin_status
218*38fd1498Szrj (*ld_plugin_get_input_file) (const void *handle,
219*38fd1498Szrj                              struct ld_plugin_input_file *file);
220*38fd1498Szrj 
221*38fd1498Szrj typedef
222*38fd1498Szrj enum ld_plugin_status
223*38fd1498Szrj (*ld_plugin_get_view) (const void *handle, const void **viewp);
224*38fd1498Szrj 
225*38fd1498Szrj /* The linker's interface for releasing the input file.  */
226*38fd1498Szrj 
227*38fd1498Szrj typedef
228*38fd1498Szrj enum ld_plugin_status
229*38fd1498Szrj (*ld_plugin_release_input_file) (const void *handle);
230*38fd1498Szrj 
231*38fd1498Szrj /* The linker's interface for retrieving symbol resolution information.  */
232*38fd1498Szrj 
233*38fd1498Szrj typedef
234*38fd1498Szrj enum ld_plugin_status
235*38fd1498Szrj (*ld_plugin_get_symbols) (const void *handle, int nsyms,
236*38fd1498Szrj                           struct ld_plugin_symbol *syms);
237*38fd1498Szrj 
238*38fd1498Szrj /* The linker's interface for adding a compiled input file.  */
239*38fd1498Szrj 
240*38fd1498Szrj typedef
241*38fd1498Szrj enum ld_plugin_status
242*38fd1498Szrj (*ld_plugin_add_input_file) (const char *pathname);
243*38fd1498Szrj 
244*38fd1498Szrj /* The linker's interface for adding a library that should be searched.  */
245*38fd1498Szrj 
246*38fd1498Szrj typedef
247*38fd1498Szrj enum ld_plugin_status
248*38fd1498Szrj (*ld_plugin_add_input_library) (const char *libname);
249*38fd1498Szrj 
250*38fd1498Szrj /* The linker's interface for adding a library path that should be searched.  */
251*38fd1498Szrj 
252*38fd1498Szrj typedef
253*38fd1498Szrj enum ld_plugin_status
254*38fd1498Szrj (*ld_plugin_set_extra_library_path) (const char *path);
255*38fd1498Szrj 
256*38fd1498Szrj /* The linker's interface for issuing a warning or error message.  */
257*38fd1498Szrj 
258*38fd1498Szrj typedef
259*38fd1498Szrj enum ld_plugin_status
260*38fd1498Szrj (*ld_plugin_message) (int level, const char *format, ...);
261*38fd1498Szrj 
262*38fd1498Szrj /* The linker's interface for retrieving the number of sections in an object.
263*38fd1498Szrj    The handle is obtained in the claim_file handler.  This interface should
264*38fd1498Szrj    only be invoked in the claim_file handler.   This function sets *COUNT to
265*38fd1498Szrj    the number of sections in the object.  */
266*38fd1498Szrj 
267*38fd1498Szrj typedef
268*38fd1498Szrj enum ld_plugin_status
269*38fd1498Szrj (*ld_plugin_get_input_section_count) (const void* handle, unsigned int *count);
270*38fd1498Szrj 
271*38fd1498Szrj /* The linker's interface for retrieving the section type of a specific
272*38fd1498Szrj    section in an object.  This interface should only be invoked in the
273*38fd1498Szrj    claim_file handler.  This function sets *TYPE to an ELF SHT_xxx value.  */
274*38fd1498Szrj 
275*38fd1498Szrj typedef
276*38fd1498Szrj enum ld_plugin_status
277*38fd1498Szrj (*ld_plugin_get_input_section_type) (const struct ld_plugin_section section,
278*38fd1498Szrj                                      unsigned int *type);
279*38fd1498Szrj 
280*38fd1498Szrj /* The linker's interface for retrieving the name of a specific section in
281*38fd1498Szrj    an object. This interface should only be invoked in the claim_file handler.
282*38fd1498Szrj    This function sets *SECTION_NAME_PTR to a null-terminated buffer allocated
283*38fd1498Szrj    by malloc.  The plugin must free *SECTION_NAME_PTR.  */
284*38fd1498Szrj 
285*38fd1498Szrj typedef
286*38fd1498Szrj enum ld_plugin_status
287*38fd1498Szrj (*ld_plugin_get_input_section_name) (const struct ld_plugin_section section,
288*38fd1498Szrj                                      char **section_name_ptr);
289*38fd1498Szrj 
290*38fd1498Szrj /* The linker's interface for retrieving the contents of a specific section
291*38fd1498Szrj    in an object.  This interface should only be invoked in the claim_file
292*38fd1498Szrj    handler.  This function sets *SECTION_CONTENTS to point to a buffer that is
293*38fd1498Szrj    valid until clam_file handler returns.  It sets *LEN to the size of the
294*38fd1498Szrj    buffer.  */
295*38fd1498Szrj 
296*38fd1498Szrj typedef
297*38fd1498Szrj enum ld_plugin_status
298*38fd1498Szrj (*ld_plugin_get_input_section_contents) (const struct ld_plugin_section section,
299*38fd1498Szrj                                          const unsigned char **section_contents,
300*38fd1498Szrj                                          size_t* len);
301*38fd1498Szrj 
302*38fd1498Szrj /* The linker's interface for specifying the desired order of sections.
303*38fd1498Szrj    The sections should be specifed using the array SECTION_LIST in the
304*38fd1498Szrj    order in which they should appear in the final layout.  NUM_SECTIONS
305*38fd1498Szrj    specifies the number of entries in each array.  This should be invoked
306*38fd1498Szrj    in the all_symbols_read handler.  */
307*38fd1498Szrj 
308*38fd1498Szrj typedef
309*38fd1498Szrj enum ld_plugin_status
310*38fd1498Szrj (*ld_plugin_update_section_order) (const struct ld_plugin_section *section_list,
311*38fd1498Szrj 				   unsigned int num_sections);
312*38fd1498Szrj 
313*38fd1498Szrj /* The linker's interface for specifying that reordering of sections is
314*38fd1498Szrj    desired so that the linker can prepare for it.  This should be invoked
315*38fd1498Szrj    before update_section_order, preferably in the claim_file handler.  */
316*38fd1498Szrj 
317*38fd1498Szrj typedef
318*38fd1498Szrj enum ld_plugin_status
319*38fd1498Szrj (*ld_plugin_allow_section_ordering) (void);
320*38fd1498Szrj 
321*38fd1498Szrj /* The linker's interface for specifying that a subset of sections is
322*38fd1498Szrj    to be mapped to a unique segment.  If the plugin wants to call
323*38fd1498Szrj    unique_segment_for_sections, it must call this function from a
324*38fd1498Szrj    claim_file_handler or when it is first loaded.  */
325*38fd1498Szrj 
326*38fd1498Szrj typedef
327*38fd1498Szrj enum ld_plugin_status
328*38fd1498Szrj (*ld_plugin_allow_unique_segment_for_sections) (void);
329*38fd1498Szrj 
330*38fd1498Szrj /* The linker's interface for specifying that a specific set of sections
331*38fd1498Szrj    must be mapped to a unique segment.  ELF segments do not have names
332*38fd1498Szrj    and the NAME is used as the name of the newly created output section
333*38fd1498Szrj    that is then placed in the unique PT_LOAD segment.  FLAGS is used to
334*38fd1498Szrj    specify if any additional segment flags need to be set.  For instance,
335*38fd1498Szrj    a specific segment flag can be set to identify this segment.  Unsetting
336*38fd1498Szrj    segment flags that would be set by default is not possible.  The
337*38fd1498Szrj    parameter SEGMENT_ALIGNMENT when non-zero will override the default.  */
338*38fd1498Szrj 
339*38fd1498Szrj typedef
340*38fd1498Szrj enum ld_plugin_status
341*38fd1498Szrj (*ld_plugin_unique_segment_for_sections) (
342*38fd1498Szrj     const char* segment_name,
343*38fd1498Szrj     uint64_t segment_flags,
344*38fd1498Szrj     uint64_t segment_alignment,
345*38fd1498Szrj     const struct ld_plugin_section * section_list,
346*38fd1498Szrj     unsigned int num_sections);
347*38fd1498Szrj 
348*38fd1498Szrj /* The linker's interface for retrieving the section alignment requirement
349*38fd1498Szrj    of a specific section in an object.  This interface should only be invoked in the
350*38fd1498Szrj    claim_file handler.  This function sets *ADDRALIGN to the ELF sh_addralign
351*38fd1498Szrj    value of the input section.  */
352*38fd1498Szrj 
353*38fd1498Szrj typedef
354*38fd1498Szrj enum ld_plugin_status
355*38fd1498Szrj (*ld_plugin_get_input_section_alignment) (const struct ld_plugin_section section,
356*38fd1498Szrj                                           unsigned int *addralign);
357*38fd1498Szrj 
358*38fd1498Szrj /* The linker's interface for retrieving the section size of a specific section
359*38fd1498Szrj    in an object.  This interface should only be invoked in the claim_file handler.
360*38fd1498Szrj    This function sets *SECSIZE to the ELF sh_size
361*38fd1498Szrj    value of the input section.  */
362*38fd1498Szrj 
363*38fd1498Szrj typedef
364*38fd1498Szrj enum ld_plugin_status
365*38fd1498Szrj (*ld_plugin_get_input_section_size) (const struct ld_plugin_section section,
366*38fd1498Szrj                                      uint64_t *secsize);
367*38fd1498Szrj 
368*38fd1498Szrj typedef
369*38fd1498Szrj enum ld_plugin_status
370*38fd1498Szrj (*ld_plugin_new_input_handler) (const struct ld_plugin_input_file *file);
371*38fd1498Szrj 
372*38fd1498Szrj /* The linker's interface for registering the "new_input" handler. This handler
373*38fd1498Szrj    will be notified when a new input file has been added after the
374*38fd1498Szrj    all_symbols_read event, allowing the plugin to, for example, set a unique
375*38fd1498Szrj    segment for sections in plugin-generated input files. */
376*38fd1498Szrj 
377*38fd1498Szrj typedef
378*38fd1498Szrj enum ld_plugin_status
379*38fd1498Szrj (*ld_plugin_register_new_input) (ld_plugin_new_input_handler handler);
380*38fd1498Szrj 
381*38fd1498Szrj 
382*38fd1498Szrj enum ld_plugin_level
383*38fd1498Szrj {
384*38fd1498Szrj   LDPL_INFO,
385*38fd1498Szrj   LDPL_WARNING,
386*38fd1498Szrj   LDPL_ERROR,
387*38fd1498Szrj   LDPL_FATAL
388*38fd1498Szrj };
389*38fd1498Szrj 
390*38fd1498Szrj /* Values for the tv_tag field of the transfer vector.  */
391*38fd1498Szrj 
392*38fd1498Szrj enum ld_plugin_tag
393*38fd1498Szrj {
394*38fd1498Szrj   LDPT_NULL = 0,
395*38fd1498Szrj   LDPT_API_VERSION = 1,
396*38fd1498Szrj   LDPT_GOLD_VERSION = 2,
397*38fd1498Szrj   LDPT_LINKER_OUTPUT = 3,
398*38fd1498Szrj   LDPT_OPTION = 4,
399*38fd1498Szrj   LDPT_REGISTER_CLAIM_FILE_HOOK = 5,
400*38fd1498Szrj   LDPT_REGISTER_ALL_SYMBOLS_READ_HOOK = 6,
401*38fd1498Szrj   LDPT_REGISTER_CLEANUP_HOOK = 7,
402*38fd1498Szrj   LDPT_ADD_SYMBOLS = 8,
403*38fd1498Szrj   LDPT_GET_SYMBOLS = 9,
404*38fd1498Szrj   LDPT_ADD_INPUT_FILE = 10,
405*38fd1498Szrj   LDPT_MESSAGE = 11,
406*38fd1498Szrj   LDPT_GET_INPUT_FILE = 12,
407*38fd1498Szrj   LDPT_RELEASE_INPUT_FILE = 13,
408*38fd1498Szrj   LDPT_ADD_INPUT_LIBRARY = 14,
409*38fd1498Szrj   LDPT_OUTPUT_NAME = 15,
410*38fd1498Szrj   LDPT_SET_EXTRA_LIBRARY_PATH = 16,
411*38fd1498Szrj   LDPT_GNU_LD_VERSION = 17,
412*38fd1498Szrj   LDPT_GET_VIEW = 18,
413*38fd1498Szrj   LDPT_GET_INPUT_SECTION_COUNT = 19,
414*38fd1498Szrj   LDPT_GET_INPUT_SECTION_TYPE = 20,
415*38fd1498Szrj   LDPT_GET_INPUT_SECTION_NAME = 21,
416*38fd1498Szrj   LDPT_GET_INPUT_SECTION_CONTENTS = 22,
417*38fd1498Szrj   LDPT_UPDATE_SECTION_ORDER = 23,
418*38fd1498Szrj   LDPT_ALLOW_SECTION_ORDERING = 24,
419*38fd1498Szrj   LDPT_GET_SYMBOLS_V2 = 25,
420*38fd1498Szrj   LDPT_ALLOW_UNIQUE_SEGMENT_FOR_SECTIONS = 26,
421*38fd1498Szrj   LDPT_UNIQUE_SEGMENT_FOR_SECTIONS = 27,
422*38fd1498Szrj   LDPT_GET_SYMBOLS_V3 = 28,
423*38fd1498Szrj   LDPT_GET_INPUT_SECTION_ALIGNMENT = 29,
424*38fd1498Szrj   LDPT_GET_INPUT_SECTION_SIZE = 30,
425*38fd1498Szrj   LDPT_REGISTER_NEW_INPUT_HOOK = 31
426*38fd1498Szrj };
427*38fd1498Szrj 
428*38fd1498Szrj /* The plugin transfer vector.  */
429*38fd1498Szrj 
430*38fd1498Szrj struct ld_plugin_tv
431*38fd1498Szrj {
432*38fd1498Szrj   enum ld_plugin_tag tv_tag;
433*38fd1498Szrj   union
434*38fd1498Szrj   {
435*38fd1498Szrj     int tv_val;
436*38fd1498Szrj     const char *tv_string;
437*38fd1498Szrj     ld_plugin_register_claim_file tv_register_claim_file;
438*38fd1498Szrj     ld_plugin_register_all_symbols_read tv_register_all_symbols_read;
439*38fd1498Szrj     ld_plugin_register_cleanup tv_register_cleanup;
440*38fd1498Szrj     ld_plugin_add_symbols tv_add_symbols;
441*38fd1498Szrj     ld_plugin_get_symbols tv_get_symbols;
442*38fd1498Szrj     ld_plugin_add_input_file tv_add_input_file;
443*38fd1498Szrj     ld_plugin_message tv_message;
444*38fd1498Szrj     ld_plugin_get_input_file tv_get_input_file;
445*38fd1498Szrj     ld_plugin_get_view tv_get_view;
446*38fd1498Szrj     ld_plugin_release_input_file tv_release_input_file;
447*38fd1498Szrj     ld_plugin_add_input_library tv_add_input_library;
448*38fd1498Szrj     ld_plugin_set_extra_library_path tv_set_extra_library_path;
449*38fd1498Szrj     ld_plugin_get_input_section_count tv_get_input_section_count;
450*38fd1498Szrj     ld_plugin_get_input_section_type tv_get_input_section_type;
451*38fd1498Szrj     ld_plugin_get_input_section_name tv_get_input_section_name;
452*38fd1498Szrj     ld_plugin_get_input_section_contents tv_get_input_section_contents;
453*38fd1498Szrj     ld_plugin_update_section_order tv_update_section_order;
454*38fd1498Szrj     ld_plugin_allow_section_ordering tv_allow_section_ordering;
455*38fd1498Szrj     ld_plugin_allow_unique_segment_for_sections tv_allow_unique_segment_for_sections;
456*38fd1498Szrj     ld_plugin_unique_segment_for_sections tv_unique_segment_for_sections;
457*38fd1498Szrj     ld_plugin_get_input_section_alignment tv_get_input_section_alignment;
458*38fd1498Szrj     ld_plugin_get_input_section_size tv_get_input_section_size;
459*38fd1498Szrj     ld_plugin_register_new_input tv_register_new_input;
460*38fd1498Szrj   } tv_u;
461*38fd1498Szrj };
462*38fd1498Szrj 
463*38fd1498Szrj /* The plugin library's "onload" entry point.  */
464*38fd1498Szrj 
465*38fd1498Szrj typedef
466*38fd1498Szrj enum ld_plugin_status
467*38fd1498Szrj (*ld_plugin_onload) (struct ld_plugin_tv *tv);
468*38fd1498Szrj 
469*38fd1498Szrj #ifdef __cplusplus
470*38fd1498Szrj }
471*38fd1498Szrj #endif
472*38fd1498Szrj 
473*38fd1498Szrj #endif /* !defined(PLUGIN_API_H) */
474