xref: /openbsd-src/gnu/usr.bin/binutils-2.17/bfd/doc/linker.texi (revision 3d8817e467ea46cf4772788d6804dd293abfb01a)
1*3d8817e4Smiod@section Linker Functions
2*3d8817e4Smiod@cindex Linker
3*3d8817e4SmiodThe linker uses three special entry points in the BFD target
4*3d8817e4Smiodvector.  It is not necessary to write special routines for
5*3d8817e4Smiodthese entry points when creating a new BFD back end, since
6*3d8817e4Smiodgeneric versions are provided.  However, writing them can
7*3d8817e4Smiodspeed up linking and make it use significantly less runtime
8*3d8817e4Smiodmemory.
9*3d8817e4Smiod
10*3d8817e4SmiodThe first routine creates a hash table used by the other
11*3d8817e4Smiodroutines.  The second routine adds the symbols from an object
12*3d8817e4Smiodfile to the hash table.  The third routine takes all the
13*3d8817e4Smiodobject files and links them together to create the output
14*3d8817e4Smiodfile.  These routines are designed so that the linker proper
15*3d8817e4Smioddoes not need to know anything about the symbols in the object
16*3d8817e4Smiodfiles that it is linking.  The linker merely arranges the
17*3d8817e4Smiodsections as directed by the linker script and lets BFD handle
18*3d8817e4Smiodthe details of symbols and relocs.
19*3d8817e4Smiod
20*3d8817e4SmiodThe second routine and third routines are passed a pointer to
21*3d8817e4Smioda @code{struct bfd_link_info} structure (defined in
22*3d8817e4Smiod@code{bfdlink.h}) which holds information relevant to the link,
23*3d8817e4Smiodincluding the linker hash table (which was created by the
24*3d8817e4Smiodfirst routine) and a set of callback functions to the linker
25*3d8817e4Smiodproper.
26*3d8817e4Smiod
27*3d8817e4SmiodThe generic linker routines are in @code{linker.c}, and use the
28*3d8817e4Smiodheader file @code{genlink.h}.  As of this writing, the only back
29*3d8817e4Smiodends which have implemented versions of these routines are
30*3d8817e4Smioda.out (in @code{aoutx.h}) and ECOFF (in @code{ecoff.c}).  The a.out
31*3d8817e4Smiodroutines are used as examples throughout this section.
32*3d8817e4Smiod
33*3d8817e4Smiod@menu
34*3d8817e4Smiod* Creating a Linker Hash Table::
35*3d8817e4Smiod* Adding Symbols to the Hash Table::
36*3d8817e4Smiod* Performing the Final Link::
37*3d8817e4Smiod@end menu
38*3d8817e4Smiod
39*3d8817e4Smiod@node Creating a Linker Hash Table, Adding Symbols to the Hash Table, Linker Functions, Linker Functions
40*3d8817e4Smiod@subsection Creating a linker hash table
41*3d8817e4Smiod@cindex _bfd_link_hash_table_create in target vector
42*3d8817e4Smiod@cindex target vector (_bfd_link_hash_table_create)
43*3d8817e4SmiodThe linker routines must create a hash table, which must be
44*3d8817e4Smiodderived from @code{struct bfd_link_hash_table} described in
45*3d8817e4Smiod@code{bfdlink.c}.  @xref{Hash Tables}, for information on how to
46*3d8817e4Smiodcreate a derived hash table.  This entry point is called using
47*3d8817e4Smiodthe target vector of the linker output file.
48*3d8817e4Smiod
49*3d8817e4SmiodThe @code{_bfd_link_hash_table_create} entry point must allocate
50*3d8817e4Smiodand initialize an instance of the desired hash table.  If the
51*3d8817e4Smiodback end does not require any additional information to be
52*3d8817e4Smiodstored with the entries in the hash table, the entry point may
53*3d8817e4Smiodsimply create a @code{struct bfd_link_hash_table}.  Most likely,
54*3d8817e4Smiodhowever, some additional information will be needed.
55*3d8817e4Smiod
56*3d8817e4SmiodFor example, with each entry in the hash table the a.out
57*3d8817e4Smiodlinker keeps the index the symbol has in the final output file
58*3d8817e4Smiod(this index number is used so that when doing a relocatable
59*3d8817e4Smiodlink the symbol index used in the output file can be quickly
60*3d8817e4Smiodfilled in when copying over a reloc).  The a.out linker code
61*3d8817e4Smioddefines the required structures and functions for a hash table
62*3d8817e4Smiodderived from @code{struct bfd_link_hash_table}.  The a.out linker
63*3d8817e4Smiodhash table is created by the function
64*3d8817e4Smiod@code{NAME(aout,link_hash_table_create)}; it simply allocates
65*3d8817e4Smiodspace for the hash table, initializes it, and returns a
66*3d8817e4Smiodpointer to it.
67*3d8817e4Smiod
68*3d8817e4SmiodWhen writing the linker routines for a new back end, you will
69*3d8817e4Smiodgenerally not know exactly which fields will be required until
70*3d8817e4Smiodyou have finished.  You should simply create a new hash table
71*3d8817e4Smiodwhich defines no additional fields, and then simply add fields
72*3d8817e4Smiodas they become necessary.
73*3d8817e4Smiod
74*3d8817e4Smiod@node Adding Symbols to the Hash Table, Performing the Final Link, Creating a Linker Hash Table, Linker Functions
75*3d8817e4Smiod@subsection Adding symbols to the hash table
76*3d8817e4Smiod@cindex _bfd_link_add_symbols in target vector
77*3d8817e4Smiod@cindex target vector (_bfd_link_add_symbols)
78*3d8817e4SmiodThe linker proper will call the @code{_bfd_link_add_symbols}
79*3d8817e4Smiodentry point for each object file or archive which is to be
80*3d8817e4Smiodlinked (typically these are the files named on the command
81*3d8817e4Smiodline, but some may also come from the linker script).  The
82*3d8817e4Smiodentry point is responsible for examining the file.  For an
83*3d8817e4Smiodobject file, BFD must add any relevant symbol information to
84*3d8817e4Smiodthe hash table.  For an archive, BFD must determine which
85*3d8817e4Smiodelements of the archive should be used and adding them to the
86*3d8817e4Smiodlink.
87*3d8817e4Smiod
88*3d8817e4SmiodThe a.out version of this entry point is
89*3d8817e4Smiod@code{NAME(aout,link_add_symbols)}.
90*3d8817e4Smiod
91*3d8817e4Smiod@menu
92*3d8817e4Smiod* Differing file formats::
93*3d8817e4Smiod* Adding symbols from an object file::
94*3d8817e4Smiod* Adding symbols from an archive::
95*3d8817e4Smiod@end menu
96*3d8817e4Smiod
97*3d8817e4Smiod@node Differing file formats, Adding symbols from an object file, Adding Symbols to the Hash Table, Adding Symbols to the Hash Table
98*3d8817e4Smiod@subsubsection Differing file formats
99*3d8817e4SmiodNormally all the files involved in a link will be of the same
100*3d8817e4Smiodformat, but it is also possible to link together different
101*3d8817e4Smiodformat object files, and the back end must support that.  The
102*3d8817e4Smiod@code{_bfd_link_add_symbols} entry point is called via the target
103*3d8817e4Smiodvector of the file to be added.  This has an important
104*3d8817e4Smiodconsequence: the function may not assume that the hash table
105*3d8817e4Smiodis the type created by the corresponding
106*3d8817e4Smiod@code{_bfd_link_hash_table_create} vector.  All the
107*3d8817e4Smiod@code{_bfd_link_add_symbols} function can assume about the hash
108*3d8817e4Smiodtable is that it is derived from @code{struct
109*3d8817e4Smiodbfd_link_hash_table}.
110*3d8817e4Smiod
111*3d8817e4SmiodSometimes the @code{_bfd_link_add_symbols} function must store
112*3d8817e4Smiodsome information in the hash table entry to be used by the
113*3d8817e4Smiod@code{_bfd_final_link} function.  In such a case the @code{creator}
114*3d8817e4Smiodfield of the hash table must be checked to make sure that the
115*3d8817e4Smiodhash table was created by an object file of the same format.
116*3d8817e4Smiod
117*3d8817e4SmiodThe @code{_bfd_final_link} routine must be prepared to handle a
118*3d8817e4Smiodhash entry without any extra information added by the
119*3d8817e4Smiod@code{_bfd_link_add_symbols} function.  A hash entry without
120*3d8817e4Smiodextra information will also occur when the linker script
121*3d8817e4Smioddirects the linker to create a symbol.  Note that, regardless
122*3d8817e4Smiodof how a hash table entry is added, all the fields will be
123*3d8817e4Smiodinitialized to some sort of null value by the hash table entry
124*3d8817e4Smiodinitialization function.
125*3d8817e4Smiod
126*3d8817e4SmiodSee @code{ecoff_link_add_externals} for an example of how to
127*3d8817e4Smiodcheck the @code{creator} field before saving information (in this
128*3d8817e4Smiodcase, the ECOFF external symbol debugging information) in a
129*3d8817e4Smiodhash table entry.
130*3d8817e4Smiod
131*3d8817e4Smiod@node Adding symbols from an object file, Adding symbols from an archive, Differing file formats, Adding Symbols to the Hash Table
132*3d8817e4Smiod@subsubsection Adding symbols from an object file
133*3d8817e4SmiodWhen the @code{_bfd_link_add_symbols} routine is passed an object
134*3d8817e4Smiodfile, it must add all externally visible symbols in that
135*3d8817e4Smiodobject file to the hash table.  The actual work of adding the
136*3d8817e4Smiodsymbol to the hash table is normally handled by the function
137*3d8817e4Smiod@code{_bfd_generic_link_add_one_symbol}.  The
138*3d8817e4Smiod@code{_bfd_link_add_symbols} routine is responsible for reading
139*3d8817e4Smiodall the symbols from the object file and passing the correct
140*3d8817e4Smiodinformation to @code{_bfd_generic_link_add_one_symbol}.
141*3d8817e4Smiod
142*3d8817e4SmiodThe @code{_bfd_link_add_symbols} routine should not use
143*3d8817e4Smiod@code{bfd_canonicalize_symtab} to read the symbols.  The point of
144*3d8817e4Smiodproviding this routine is to avoid the overhead of converting
145*3d8817e4Smiodthe symbols into generic @code{asymbol} structures.
146*3d8817e4Smiod
147*3d8817e4Smiod@findex _bfd_generic_link_add_one_symbol
148*3d8817e4Smiod@code{_bfd_generic_link_add_one_symbol} handles the details of
149*3d8817e4Smiodcombining common symbols, warning about multiple definitions,
150*3d8817e4Smiodand so forth.  It takes arguments which describe the symbol to
151*3d8817e4Smiodadd, notably symbol flags, a section, and an offset.  The
152*3d8817e4Smiodsymbol flags include such things as @code{BSF_WEAK} or
153*3d8817e4Smiod@code{BSF_INDIRECT}.  The section is a section in the object
154*3d8817e4Smiodfile, or something like @code{bfd_und_section_ptr} for an undefined
155*3d8817e4Smiodsymbol or @code{bfd_com_section_ptr} for a common symbol.
156*3d8817e4Smiod
157*3d8817e4SmiodIf the @code{_bfd_final_link} routine is also going to need to
158*3d8817e4Smiodread the symbol information, the @code{_bfd_link_add_symbols}
159*3d8817e4Smiodroutine should save it somewhere attached to the object file
160*3d8817e4SmiodBFD.  However, the information should only be saved if the
161*3d8817e4Smiod@code{keep_memory} field of the @code{info} argument is TRUE, so
162*3d8817e4Smiodthat the @code{-no-keep-memory} linker switch is effective.
163*3d8817e4Smiod
164*3d8817e4SmiodThe a.out function which adds symbols from an object file is
165*3d8817e4Smiod@code{aout_link_add_object_symbols}, and most of the interesting
166*3d8817e4Smiodwork is in @code{aout_link_add_symbols}.  The latter saves
167*3d8817e4Smiodpointers to the hash tables entries created by
168*3d8817e4Smiod@code{_bfd_generic_link_add_one_symbol} indexed by symbol number,
169*3d8817e4Smiodso that the @code{_bfd_final_link} routine does not have to call
170*3d8817e4Smiodthe hash table lookup routine to locate the entry.
171*3d8817e4Smiod
172*3d8817e4Smiod@node Adding symbols from an archive, , Adding symbols from an object file, Adding Symbols to the Hash Table
173*3d8817e4Smiod@subsubsection Adding symbols from an archive
174*3d8817e4SmiodWhen the @code{_bfd_link_add_symbols} routine is passed an
175*3d8817e4Smiodarchive, it must look through the symbols defined by the
176*3d8817e4Smiodarchive and decide which elements of the archive should be
177*3d8817e4Smiodincluded in the link.  For each such element it must call the
178*3d8817e4Smiod@code{add_archive_element} linker callback, and it must add the
179*3d8817e4Smiodsymbols from the object file to the linker hash table.
180*3d8817e4Smiod
181*3d8817e4Smiod@findex _bfd_generic_link_add_archive_symbols
182*3d8817e4SmiodIn most cases the work of looking through the symbols in the
183*3d8817e4Smiodarchive should be done by the
184*3d8817e4Smiod@code{_bfd_generic_link_add_archive_symbols} function.  This
185*3d8817e4Smiodfunction builds a hash table from the archive symbol table and
186*3d8817e4Smiodlooks through the list of undefined symbols to see which
187*3d8817e4Smiodelements should be included.
188*3d8817e4Smiod@code{_bfd_generic_link_add_archive_symbols} is passed a function
189*3d8817e4Smiodto call to make the final decision about adding an archive
190*3d8817e4Smiodelement to the link and to do the actual work of adding the
191*3d8817e4Smiodsymbols to the linker hash table.
192*3d8817e4Smiod
193*3d8817e4SmiodThe function passed to
194*3d8817e4Smiod@code{_bfd_generic_link_add_archive_symbols} must read the
195*3d8817e4Smiodsymbols of the archive element and decide whether the archive
196*3d8817e4Smiodelement should be included in the link.  If the element is to
197*3d8817e4Smiodbe included, the @code{add_archive_element} linker callback
198*3d8817e4Smiodroutine must be called with the element as an argument, and
199*3d8817e4Smiodthe elements symbols must be added to the linker hash table
200*3d8817e4Smiodjust as though the element had itself been passed to the
201*3d8817e4Smiod@code{_bfd_link_add_symbols} function.
202*3d8817e4Smiod
203*3d8817e4SmiodWhen the a.out @code{_bfd_link_add_symbols} function receives an
204*3d8817e4Smiodarchive, it calls @code{_bfd_generic_link_add_archive_symbols}
205*3d8817e4Smiodpassing @code{aout_link_check_archive_element} as the function
206*3d8817e4Smiodargument. @code{aout_link_check_archive_element} calls
207*3d8817e4Smiod@code{aout_link_check_ar_symbols}.  If the latter decides to add
208*3d8817e4Smiodthe element (an element is only added if it provides a real,
209*3d8817e4Smiodnon-common, definition for a previously undefined or common
210*3d8817e4Smiodsymbol) it calls the @code{add_archive_element} callback and then
211*3d8817e4Smiod@code{aout_link_check_archive_element} calls
212*3d8817e4Smiod@code{aout_link_add_symbols} to actually add the symbols to the
213*3d8817e4Smiodlinker hash table.
214*3d8817e4Smiod
215*3d8817e4SmiodThe ECOFF back end is unusual in that it does not normally
216*3d8817e4Smiodcall @code{_bfd_generic_link_add_archive_symbols}, because ECOFF
217*3d8817e4Smiodarchives already contain a hash table of symbols.  The ECOFF
218*3d8817e4Smiodback end searches the archive itself to avoid the overhead of
219*3d8817e4Smiodcreating a new hash table.
220*3d8817e4Smiod
221*3d8817e4Smiod@node Performing the Final Link, , Adding Symbols to the Hash Table, Linker Functions
222*3d8817e4Smiod@subsection Performing the final link
223*3d8817e4Smiod@cindex _bfd_link_final_link in target vector
224*3d8817e4Smiod@cindex target vector (_bfd_final_link)
225*3d8817e4SmiodWhen all the input files have been processed, the linker calls
226*3d8817e4Smiodthe @code{_bfd_final_link} entry point of the output BFD.  This
227*3d8817e4Smiodroutine is responsible for producing the final output file,
228*3d8817e4Smiodwhich has several aspects.  It must relocate the contents of
229*3d8817e4Smiodthe input sections and copy the data into the output sections.
230*3d8817e4SmiodIt must build an output symbol table including any local
231*3d8817e4Smiodsymbols from the input files and the global symbols from the
232*3d8817e4Smiodhash table.  When producing relocatable output, it must
233*3d8817e4Smiodmodify the input relocs and write them into the output file.
234*3d8817e4SmiodThere may also be object format dependent work to be done.
235*3d8817e4Smiod
236*3d8817e4SmiodThe linker will also call the @code{write_object_contents} entry
237*3d8817e4Smiodpoint when the BFD is closed.  The two entry points must work
238*3d8817e4Smiodtogether in order to produce the correct output file.
239*3d8817e4Smiod
240*3d8817e4SmiodThe details of how this works are inevitably dependent upon
241*3d8817e4Smiodthe specific object file format.  The a.out
242*3d8817e4Smiod@code{_bfd_final_link} routine is @code{NAME(aout,final_link)}.
243*3d8817e4Smiod
244*3d8817e4Smiod@menu
245*3d8817e4Smiod* Information provided by the linker::
246*3d8817e4Smiod* Relocating the section contents::
247*3d8817e4Smiod* Writing the symbol table::
248*3d8817e4Smiod@end menu
249*3d8817e4Smiod
250*3d8817e4Smiod@node Information provided by the linker, Relocating the section contents, Performing the Final Link, Performing the Final Link
251*3d8817e4Smiod@subsubsection Information provided by the linker
252*3d8817e4SmiodBefore the linker calls the @code{_bfd_final_link} entry point,
253*3d8817e4Smiodit sets up some data structures for the function to use.
254*3d8817e4Smiod
255*3d8817e4SmiodThe @code{input_bfds} field of the @code{bfd_link_info} structure
256*3d8817e4Smiodwill point to a list of all the input files included in the
257*3d8817e4Smiodlink.  These files are linked through the @code{link_next} field
258*3d8817e4Smiodof the @code{bfd} structure.
259*3d8817e4Smiod
260*3d8817e4SmiodEach section in the output file will have a list of
261*3d8817e4Smiod@code{link_order} structures attached to the @code{map_head.link_order}
262*3d8817e4Smiodfield (the @code{link_order} structure is defined in
263*3d8817e4Smiod@code{bfdlink.h}).  These structures describe how to create the
264*3d8817e4Smiodcontents of the output section in terms of the contents of
265*3d8817e4Smiodvarious input sections, fill constants, and, eventually, other
266*3d8817e4Smiodtypes of information.  They also describe relocs that must be
267*3d8817e4Smiodcreated by the BFD backend, but do not correspond to any input
268*3d8817e4Smiodfile; this is used to support -Ur, which builds constructors
269*3d8817e4Smiodwhile generating a relocatable object file.
270*3d8817e4Smiod
271*3d8817e4Smiod@node Relocating the section contents, Writing the symbol table, Information provided by the linker, Performing the Final Link
272*3d8817e4Smiod@subsubsection Relocating the section contents
273*3d8817e4SmiodThe @code{_bfd_final_link} function should look through the
274*3d8817e4Smiod@code{link_order} structures attached to each section of the
275*3d8817e4Smiodoutput file.  Each @code{link_order} structure should either be
276*3d8817e4Smiodhandled specially, or it should be passed to the function
277*3d8817e4Smiod@code{_bfd_default_link_order} which will do the right thing
278*3d8817e4Smiod(@code{_bfd_default_link_order} is defined in @code{linker.c}).
279*3d8817e4Smiod
280*3d8817e4SmiodFor efficiency, a @code{link_order} of type
281*3d8817e4Smiod@code{bfd_indirect_link_order} whose associated section belongs
282*3d8817e4Smiodto a BFD of the same format as the output BFD must be handled
283*3d8817e4Smiodspecially.  This type of @code{link_order} describes part of an
284*3d8817e4Smiodoutput section in terms of a section belonging to one of the
285*3d8817e4Smiodinput files.  The @code{_bfd_final_link} function should read the
286*3d8817e4Smiodcontents of the section and any associated relocs, apply the
287*3d8817e4Smiodrelocs to the section contents, and write out the modified
288*3d8817e4Smiodsection contents.  If performing a relocatable link, the
289*3d8817e4Smiodrelocs themselves must also be modified and written out.
290*3d8817e4Smiod
291*3d8817e4Smiod@findex _bfd_relocate_contents
292*3d8817e4Smiod@findex _bfd_final_link_relocate
293*3d8817e4SmiodThe functions @code{_bfd_relocate_contents} and
294*3d8817e4Smiod@code{_bfd_final_link_relocate} provide some general support for
295*3d8817e4Smiodperforming the actual relocations, notably overflow checking.
296*3d8817e4SmiodTheir arguments include information about the symbol the
297*3d8817e4Smiodrelocation is against and a @code{reloc_howto_type} argument
298*3d8817e4Smiodwhich describes the relocation to perform.  These functions
299*3d8817e4Smiodare defined in @code{reloc.c}.
300*3d8817e4Smiod
301*3d8817e4SmiodThe a.out function which handles reading, relocating, and
302*3d8817e4Smiodwriting section contents is @code{aout_link_input_section}.  The
303*3d8817e4Smiodactual relocation is done in @code{aout_link_input_section_std}
304*3d8817e4Smiodand @code{aout_link_input_section_ext}.
305*3d8817e4Smiod
306*3d8817e4Smiod@node Writing the symbol table, , Relocating the section contents, Performing the Final Link
307*3d8817e4Smiod@subsubsection Writing the symbol table
308*3d8817e4SmiodThe @code{_bfd_final_link} function must gather all the symbols
309*3d8817e4Smiodin the input files and write them out.  It must also write out
310*3d8817e4Smiodall the symbols in the global hash table.  This must be
311*3d8817e4Smiodcontrolled by the @code{strip} and @code{discard} fields of the
312*3d8817e4Smiod@code{bfd_link_info} structure.
313*3d8817e4Smiod
314*3d8817e4SmiodThe local symbols of the input files will not have been
315*3d8817e4Smiodentered into the linker hash table.  The @code{_bfd_final_link}
316*3d8817e4Smiodroutine must consider each input file and include the symbols
317*3d8817e4Smiodin the output file.  It may be convenient to do this when
318*3d8817e4Smiodlooking through the @code{link_order} structures, or it may be
319*3d8817e4Smioddone by stepping through the @code{input_bfds} list.
320*3d8817e4Smiod
321*3d8817e4SmiodThe @code{_bfd_final_link} routine must also traverse the global
322*3d8817e4Smiodhash table to gather all the externally visible symbols.  It
323*3d8817e4Smiodis possible that most of the externally visible symbols may be
324*3d8817e4Smiodwritten out when considering the symbols of each input file,
325*3d8817e4Smiodbut it is still necessary to traverse the hash table since the
326*3d8817e4Smiodlinker script may have defined some symbols that are not in
327*3d8817e4Smiodany of the input files.
328*3d8817e4Smiod
329*3d8817e4SmiodThe @code{strip} field of the @code{bfd_link_info} structure
330*3d8817e4Smiodcontrols which symbols are written out.  The possible values
331*3d8817e4Smiodare listed in @code{bfdlink.h}.  If the value is @code{strip_some},
332*3d8817e4Smiodthen the @code{keep_hash} field of the @code{bfd_link_info}
333*3d8817e4Smiodstructure is a hash table of symbols to keep; each symbol
334*3d8817e4Smiodshould be looked up in this hash table, and only symbols which
335*3d8817e4Smiodare present should be included in the output file.
336*3d8817e4Smiod
337*3d8817e4SmiodIf the @code{strip} field of the @code{bfd_link_info} structure
338*3d8817e4Smiodpermits local symbols to be written out, the @code{discard} field
339*3d8817e4Smiodis used to further controls which local symbols are included
340*3d8817e4Smiodin the output file.  If the value is @code{discard_l}, then all
341*3d8817e4Smiodlocal symbols which begin with a certain prefix are discarded;
342*3d8817e4Smiodthis is controlled by the @code{bfd_is_local_label_name} entry point.
343*3d8817e4Smiod
344*3d8817e4SmiodThe a.out backend handles symbols by calling
345*3d8817e4Smiod@code{aout_link_write_symbols} on each input BFD and then
346*3d8817e4Smiodtraversing the global hash table with the function
347*3d8817e4Smiod@code{aout_link_write_other_symbol}.  It builds a string table
348*3d8817e4Smiodwhile writing out the symbols, which is written to the output
349*3d8817e4Smiodfile at the end of @code{NAME(aout,final_link)}.
350*3d8817e4Smiod
351*3d8817e4Smiod@findex bfd_link_split_section
352*3d8817e4Smiod@subsubsection @code{bfd_link_split_section}
353*3d8817e4Smiod@strong{Synopsis}
354*3d8817e4Smiod@example
355*3d8817e4Smiodbfd_boolean bfd_link_split_section (bfd *abfd, asection *sec);
356*3d8817e4Smiod@end example
357*3d8817e4Smiod@strong{Description}@*
358*3d8817e4SmiodReturn nonzero if @var{sec} should be split during a
359*3d8817e4Smiodreloceatable or final link.
360*3d8817e4Smiod@example
361*3d8817e4Smiod#define bfd_link_split_section(abfd, sec) \
362*3d8817e4Smiod       BFD_SEND (abfd, _bfd_link_split_section, (abfd, sec))
363*3d8817e4Smiod
364*3d8817e4Smiod@end example
365*3d8817e4Smiod
366*3d8817e4Smiod@findex bfd_section_already_linked
367*3d8817e4Smiod@subsubsection @code{bfd_section_already_linked}
368*3d8817e4Smiod@strong{Synopsis}
369*3d8817e4Smiod@example
370*3d8817e4Smiodvoid bfd_section_already_linked (bfd *abfd, asection *sec);
371*3d8817e4Smiod@end example
372*3d8817e4Smiod@strong{Description}@*
373*3d8817e4SmiodCheck if @var{sec} has been already linked during a reloceatable
374*3d8817e4Smiodor final link.
375*3d8817e4Smiod@example
376*3d8817e4Smiod#define bfd_section_already_linked(abfd, sec) \
377*3d8817e4Smiod       BFD_SEND (abfd, _section_already_linked, (abfd, sec))
378*3d8817e4Smiod
379*3d8817e4Smiod@end example
380*3d8817e4Smiod
381