OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [insight/] [bfd/] [doc/] [section.texi] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 578 markom
@section Sections
2
The raw data contained within a BFD is maintained through the
3
section abstraction.  A single BFD may have any number of
4
sections.  It keeps hold of them by pointing to the first;
5
each one points to the next in the list.
6
 
7
Sections are supported in BFD in @code{section.c}.
8
 
9
@menu
10
* Section Input::
11
* Section Output::
12
* typedef asection::
13
* section prototypes::
14
@end menu
15
 
16
@node Section Input, Section Output, Sections, Sections
17
@subsection Section input
18
When a BFD is opened for reading, the section structures are
19
created and attached to the BFD.
20
 
21
Each section has a name which describes the section in the
22
outside world---for example, @code{a.out} would contain at least
23
three sections, called @code{.text}, @code{.data} and @code{.bss}.
24
 
25
Names need not be unique; for example a COFF file may have several
26
sections named @code{.data}.
27
 
28
Sometimes a BFD will contain more than the ``natural'' number of
29
sections. A back end may attach other sections containing
30
constructor data, or an application may add a section (using
31
@code{bfd_make_section}) to the sections attached to an already open
32
BFD. For example, the linker creates an extra section
33
@code{COMMON} for each input file's BFD to hold information about
34
common storage.
35
 
36
The raw data is not necessarily read in when
37
the section descriptor is created. Some targets may leave the
38
data in place until a @code{bfd_get_section_contents} call is
39
made. Other back ends may read in all the data at once.  For
40
example, an S-record file has to be read once to determine the
41
size of the data. An IEEE-695 file doesn't contain raw data in
42
sections, but data and relocation expressions intermixed, so
43
the data area has to be parsed to get out the data and
44
relocations.
45
 
46
@node Section Output, typedef asection, Section Input, Sections
47
@subsection Section output
48
To write a new object style BFD, the various sections to be
49
written have to be created. They are attached to the BFD in
50
the same way as input sections; data is written to the
51
sections using @code{bfd_set_section_contents}.
52
 
53
Any program that creates or combines sections (e.g., the assembler
54
and linker) must use the @code{asection} fields @code{output_section} and
55
@code{output_offset} to indicate the file sections to which each
56
section must be written.  (If the section is being created from
57
scratch, @code{output_section} should probably point to the section
58
itself and @code{output_offset} should probably be zero.)
59
 
60
The data to be written comes from input sections attached
61
(via @code{output_section} pointers) to
62
the output sections.  The output section structure can be
63
considered a filter for the input section: the output section
64
determines the vma of the output data and the name, but the
65
input section determines the offset into the output section of
66
the data to be written.
67
 
68
E.g., to create a section "O", starting at 0x100, 0x123 long,
69
containing two subsections, "A" at offset 0x0 (i.e., at vma
70
0x100) and "B" at offset 0x20 (i.e., at vma 0x120) the @code{asection}
71
structures would look like:
72
 
73
@example
74
   section name          "A"
75
     output_offset   0x00
76
     size            0x20
77
     output_section ----------->  section name    "O"
78
                             |    vma             0x100
79
   section name          "B" |    size            0x123
80
     output_offset   0x20    |
81
     size            0x103   |
82
     output_section  --------|
83
@end example
84
 
85
@subsection Link orders
86
The data within a section is stored in a @dfn{link_order}.
87
These are much like the fixups in @code{gas}.  The link_order
88
abstraction allows a section to grow and shrink within itself.
89
 
90
A link_order knows how big it is, and which is the next
91
link_order and where the raw data for it is; it also points to
92
a list of relocations which apply to it.
93
 
94
The link_order is used by the linker to perform relaxing on
95
final code.  The compiler creates code which is as big as
96
necessary to make it work without relaxing, and the user can
97
select whether to relax.  Sometimes relaxing takes a lot of
98
time.  The linker runs around the relocations to see if any
99
are attached to data which can be shrunk, if so it does it on
100
a link_order by link_order basis.
101
 
102
 
103
@node typedef asection, section prototypes, Section Output, Sections
104
@subsection typedef asection
105
Here is the section structure:
106
 
107
 
108
@example
109
 
110
/* This structure is used for a comdat section, as in PE.  A comdat
111
   section is associated with a particular symbol.  When the linker
112
   sees a comdat section, it keeps only one of the sections with a
113
   given name and associated with a given symbol.  */
114
 
115
struct bfd_comdat_info
116
@{
117
  /* The name of the symbol associated with a comdat section.  */
118
  const char *name;
119
 
120
  /* The local symbol table index of the symbol associated with a
121
     comdat section.  This is only meaningful to the object file format
122
     specific code; it is not an index into the list returned by
123
     bfd_canonicalize_symtab.  */
124
  long symbol;
125
@};
126
 
127
typedef struct sec
128
@{
129
  /* The name of the section; the name isn't a copy, the pointer is
130
     the same as that passed to bfd_make_section.  */
131
 
132
  const char *name;
133
 
134
  /* A unique sequence number.  */
135
 
136
  int id;
137
 
138
  /* Which section is it; 0..nth.  */
139
 
140
  int index;
141
 
142
  /* The next section in the list belonging to the BFD, or NULL.  */
143
 
144
  struct sec *next;
145
 
146
  /* The field flags contains attributes of the section. Some
147
     flags are read in from the object file, and some are
148
     synthesized from other information.  */
149
 
150
  flagword flags;
151
 
152
#define SEC_NO_FLAGS   0x000
153
 
154
  /* Tells the OS to allocate space for this section when loading.
155
     This is clear for a section containing debug information only.  */
156
#define SEC_ALLOC      0x001
157
 
158
  /* Tells the OS to load the section from the file when loading.
159
     This is clear for a .bss section.  */
160
#define SEC_LOAD       0x002
161
 
162
  /* The section contains data still to be relocated, so there is
163
     some relocation information too.  */
164
#define SEC_RELOC      0x004
165
 
166
#if 0   /* Obsolete ? */
167
#define SEC_BALIGN     0x008
168
#endif
169
 
170
  /* A signal to the OS that the section contains read only data.  */
171
#define SEC_READONLY   0x010
172
 
173
  /* The section contains code only.  */
174
#define SEC_CODE       0x020
175
 
176
  /* The section contains data only.  */
177
#define SEC_DATA       0x040
178
 
179
  /* The section will reside in ROM.  */
180
#define SEC_ROM        0x080
181
 
182
  /* The section contains constructor information. This section
183
     type is used by the linker to create lists of constructors and
184
     destructors used by @code{g++}. When a back end sees a symbol
185
     which should be used in a constructor list, it creates a new
186
     section for the type of name (e.g., @code{__CTOR_LIST__}), attaches
187
     the symbol to it, and builds a relocation. To build the lists
188
     of constructors, all the linker has to do is catenate all the
189
     sections called @code{__CTOR_LIST__} and relocate the data
190
     contained within - exactly the operations it would peform on
191
     standard data.  */
192
#define SEC_CONSTRUCTOR 0x100
193
 
194
  /* The section is a constructor, and should be placed at the
195
     end of the text, data, or bss section(?).  */
196
#define SEC_CONSTRUCTOR_TEXT 0x1100
197
#define SEC_CONSTRUCTOR_DATA 0x2100
198
#define SEC_CONSTRUCTOR_BSS  0x3100
199
 
200
  /* The section has contents - a data section could be
201
     @code{SEC_ALLOC} | @code{SEC_HAS_CONTENTS}; a debug section could be
202
     @code{SEC_HAS_CONTENTS}  */
203
#define SEC_HAS_CONTENTS 0x200
204
 
205
  /* An instruction to the linker to not output the section
206
     even if it has information which would normally be written.  */
207
#define SEC_NEVER_LOAD 0x400
208
 
209
  /* The section is a COFF shared library section.  This flag is
210
     only for the linker.  If this type of section appears in
211
     the input file, the linker must copy it to the output file
212
     without changing the vma or size.  FIXME: Although this
213
     was originally intended to be general, it really is COFF
214
     specific (and the flag was renamed to indicate this).  It
215
     might be cleaner to have some more general mechanism to
216
     allow the back end to control what the linker does with
217
     sections.  */
218
#define SEC_COFF_SHARED_LIBRARY 0x800
219
 
220
  /* The section has GOT references.  This flag is only for the
221
     linker, and is currently only used by the elf32-hppa back end.
222
     It will be set if global offset table references were detected
223
     in this section, which indicate to the linker that the section
224
     contains PIC code, and must be handled specially when doing a
225
     static link.  */
226
#define SEC_HAS_GOT_REF 0x4000
227
 
228
  /* The section contains common symbols (symbols may be defined
229
     multiple times, the value of a symbol is the amount of
230
     space it requires, and the largest symbol value is the one
231
     used).  Most targets have exactly one of these (which we
232
     translate to bfd_com_section_ptr), but ECOFF has two.  */
233
#define SEC_IS_COMMON 0x8000
234
 
235
  /* The section contains only debugging information.  For
236
     example, this is set for ELF .debug and .stab sections.
237
     strip tests this flag to see if a section can be
238
     discarded.  */
239
#define SEC_DEBUGGING 0x10000
240
 
241
  /* The contents of this section are held in memory pointed to
242
     by the contents field.  This is checked by bfd_get_section_contents,
243
     and the data is retrieved from memory if appropriate.  */
244
#define SEC_IN_MEMORY 0x20000
245
 
246
  /* The contents of this section are to be excluded by the
247
     linker for executable and shared objects unless those
248
     objects are to be further relocated.  */
249
#define SEC_EXCLUDE 0x40000
250
 
251
  /* The contents of this section are to be sorted by the
252
     based on the address specified in the associated symbol
253
     table.  */
254
#define SEC_SORT_ENTRIES 0x80000
255
 
256
  /* When linking, duplicate sections of the same name should be
257
     discarded, rather than being combined into a single section as
258
     is usually done.  This is similar to how common symbols are
259
     handled.  See SEC_LINK_DUPLICATES below.  */
260
#define SEC_LINK_ONCE 0x100000
261
 
262
  /* If SEC_LINK_ONCE is set, this bitfield describes how the linker
263
     should handle duplicate sections.  */
264
#define SEC_LINK_DUPLICATES 0x600000
265
 
266
  /* This value for SEC_LINK_DUPLICATES means that duplicate
267
     sections with the same name should simply be discarded.  */
268
#define SEC_LINK_DUPLICATES_DISCARD 0x0
269
 
270
  /* This value for SEC_LINK_DUPLICATES means that the linker
271
     should warn if there are any duplicate sections, although
272
     it should still only link one copy.  */
273
#define SEC_LINK_DUPLICATES_ONE_ONLY 0x200000
274
 
275
  /* This value for SEC_LINK_DUPLICATES means that the linker
276
     should warn if any duplicate sections are a different size.  */
277
#define SEC_LINK_DUPLICATES_SAME_SIZE 0x400000
278
 
279
  /* This value for SEC_LINK_DUPLICATES means that the linker
280
     should warn if any duplicate sections contain different
281
     contents.  */
282
#define SEC_LINK_DUPLICATES_SAME_CONTENTS 0x600000
283
 
284
  /* This section was created by the linker as part of dynamic
285
     relocation or other arcane processing.  It is skipped when
286
     going through the first-pass output, trusting that someone
287
     else up the line will take care of it later.  */
288
#define SEC_LINKER_CREATED 0x800000
289
 
290
  /* This section should not be subject to garbage collection.  */
291
#define SEC_KEEP 0x1000000
292
 
293
  /* This section contains "short" data, and should be placed
294
     "near" the GP.  */
295
#define SEC_SMALL_DATA 0x2000000
296
 
297
  /* This section contains data which may be shared with other
298
     executables or shared objects.  */
299
#define SEC_SHARED 0x4000000
300
 
301
  /* When a section with this flag is being linked, then if the size of
302
     the input section is less than a page, it should not cross a page
303
     boundary.  If the size of the input section is one page or more, it
304
     should be aligned on a page boundary.  */
305
#define SEC_BLOCK 0x8000000
306
 
307
  /* Conditionally link this section; do not link if there are no
308
     references found to any symbol in the section.  */
309
#define SEC_CLINK 0x10000000
310
 
311
  /* Attempt to merge identical entities in the section.
312
     Entity size is given in the entsize field.  */
313
#define SEC_MERGE 0x20000000
314
 
315
  /* If given with SEC_MERGE, entities to merge are zero terminated
316
     strings where entsize specifies character size instead of fixed
317
     size entries.  */
318
#define SEC_STRINGS 0x40000000
319
 
320
  /*  End of section flags.  */
321
 
322
  /* Some internal packed boolean fields.  */
323
 
324
  /* See the vma field.  */
325
  unsigned int user_set_vma : 1;
326
 
327
  /* Whether relocations have been processed.  */
328
  unsigned int reloc_done : 1;
329
 
330
  /* A mark flag used by some of the linker backends.  */
331
  unsigned int linker_mark : 1;
332
 
333
  /* Another mark flag used by some of the linker backends.  Set for
334
     output sections that have a input section.  */
335
  unsigned int linker_has_input : 1;
336
 
337
  /* A mark flag used by some linker backends for garbage collection.  */
338
  unsigned int gc_mark : 1;
339
 
340
  /* Used by the ELF code to mark sections which have been allocated to segments.  */
341
  unsigned int segment_mark : 1;
342
 
343
  /* End of internal packed boolean fields.  */
344
 
345
  /*  The virtual memory address of the section - where it will be
346
      at run time.  The symbols are relocated against this.  The
347
      user_set_vma flag is maintained by bfd; if it's not set, the
348
      backend can assign addresses (for example, in @code{a.out}, where
349
      the default address for @code{.data} is dependent on the specific
350
      target and various flags).  */
351
 
352
  bfd_vma vma;
353
 
354
  /*  The load address of the section - where it would be in a
355
      rom image; really only used for writing section header
356
      information. */
357
 
358
  bfd_vma lma;
359
 
360
  /* The size of the section in octets, as it will be output.
361
     Contains a value even if the section has no contents (e.g., the
362
     size of @code{.bss}).  This will be filled in after relocation.  */
363
 
364
  bfd_size_type _cooked_size;
365
 
366
  /* The original size on disk of the section, in octets.  Normally this
367
     value is the same as the size, but if some relaxing has
368
     been done, then this value will be bigger.  */
369
 
370
  bfd_size_type _raw_size;
371
 
372
  /* If this section is going to be output, then this value is the
373
     offset in *bytes* into the output section of the first byte in the
374
     input section (byte ==> smallest addressable unit on the
375
     target).  In most cases, if this was going to start at the
376
     100th octet (8-bit quantity) in the output section, this value
377
     would be 100.  However, if the target byte size is 16 bits
378
     (bfd_octets_per_byte is "2"), this value would be 50.  */
379
 
380
  bfd_vma output_offset;
381
 
382
  /* The output section through which to map on output.  */
383
 
384
  struct sec *output_section;
385
 
386
  /* The alignment requirement of the section, as an exponent of 2 -
387
     e.g., 3 aligns to 2^3 (or 8).  */
388
 
389
  unsigned int alignment_power;
390
 
391
  /* If an input section, a pointer to a vector of relocation
392
     records for the data in this section.  */
393
 
394
  struct reloc_cache_entry *relocation;
395
 
396
  /* If an output section, a pointer to a vector of pointers to
397
     relocation records for the data in this section.  */
398
 
399
  struct reloc_cache_entry **orelocation;
400
 
401
  /* The number of relocation records in one of the above  */
402
 
403
  unsigned reloc_count;
404
 
405
  /* Information below is back end specific - and not always used
406
     or updated.  */
407
 
408
  /* File position of section data.  */
409
 
410
  file_ptr filepos;
411
 
412
  /* File position of relocation info.  */
413
 
414
  file_ptr rel_filepos;
415
 
416
  /* File position of line data.  */
417
 
418
  file_ptr line_filepos;
419
 
420
  /* Pointer to data for applications.  */
421
 
422
  PTR userdata;
423
 
424
  /* If the SEC_IN_MEMORY flag is set, this points to the actual
425
     contents.  */
426
  unsigned char *contents;
427
 
428
  /* Attached line number information.  */
429
 
430
  alent *lineno;
431
 
432
  /* Number of line number records.  */
433
 
434
  unsigned int lineno_count;
435
 
436
  /* Entity size for merging purposes.  */
437
 
438
  unsigned int entsize;
439
 
440
  /* Optional information about a COMDAT entry; NULL if not COMDAT.  */
441
 
442
  struct bfd_comdat_info *comdat;
443
 
444
  /* Points to the kept section if this section is a link-once section,
445
     and is discarded.  */
446
  struct sec *kept_section;
447
 
448
  /* When a section is being output, this value changes as more
449
     linenumbers are written out.  */
450
 
451
  file_ptr moving_line_filepos;
452
 
453
  /* What the section number is in the target world.  */
454
 
455
  int target_index;
456
 
457
  PTR used_by_bfd;
458
 
459
  /* If this is a constructor section then here is a list of the
460
     relocations created to relocate items within it.  */
461
 
462
  struct relent_chain *constructor_chain;
463
 
464
  /* The BFD which owns the section.  */
465
 
466
  bfd *owner;
467
 
468
  /* A symbol which points at this section only */
469
  struct symbol_cache_entry *symbol;
470
  struct symbol_cache_entry **symbol_ptr_ptr;
471
 
472
  struct bfd_link_order *link_order_head;
473
  struct bfd_link_order *link_order_tail;
474
@} asection ;
475
 
476
/* These sections are global, and are managed by BFD.  The application
477
   and target back end are not permitted to change the values in
478
   these sections.  New code should use the section_ptr macros rather
479
   than referring directly to the const sections.  The const sections
480
   may eventually vanish.  */
481
#define BFD_ABS_SECTION_NAME "*ABS*"
482
#define BFD_UND_SECTION_NAME "*UND*"
483
#define BFD_COM_SECTION_NAME "*COM*"
484
#define BFD_IND_SECTION_NAME "*IND*"
485
 
486
/* the absolute section */
487
extern const asection bfd_abs_section;
488
#define bfd_abs_section_ptr ((asection *) &bfd_abs_section)
489
#define bfd_is_abs_section(sec) ((sec) == bfd_abs_section_ptr)
490
/* Pointer to the undefined section */
491
extern const asection bfd_und_section;
492
#define bfd_und_section_ptr ((asection *) &bfd_und_section)
493
#define bfd_is_und_section(sec) ((sec) == bfd_und_section_ptr)
494
/* Pointer to the common section */
495
extern const asection bfd_com_section;
496
#define bfd_com_section_ptr ((asection *) &bfd_com_section)
497
/* Pointer to the indirect section */
498
extern const asection bfd_ind_section;
499
#define bfd_ind_section_ptr ((asection *) &bfd_ind_section)
500
#define bfd_is_ind_section(sec) ((sec) == bfd_ind_section_ptr)
501
 
502
extern const struct symbol_cache_entry * const bfd_abs_symbol;
503
extern const struct symbol_cache_entry * const bfd_com_symbol;
504
extern const struct symbol_cache_entry * const bfd_und_symbol;
505
extern const struct symbol_cache_entry * const bfd_ind_symbol;
506
#define bfd_get_section_size_before_reloc(section) \
507
     ((section)->reloc_done ? (abort (), (bfd_size_type) 1) \
508
                            : (section)->_raw_size)
509
#define bfd_get_section_size_after_reloc(section) \
510
     ((section)->reloc_done ? (section)->_cooked_size \
511
                            : (abort (), (bfd_size_type) 1))
512
@end example
513
 
514
@node section prototypes,  , typedef asection, Sections
515
@subsection Section prototypes
516
These are the functions exported by the section handling part of BFD.
517
 
518
@findex bfd_get_section_by_name
519
@subsubsection @code{bfd_get_section_by_name}
520
@strong{Synopsis}
521
@example
522
asection *bfd_get_section_by_name(bfd *abfd, const char *name);
523
@end example
524
@strong{Description}@*
525
Run through @var{abfd} and return the one of the
526
@code{asection}s whose name matches @var{name}, otherwise @code{NULL}.
527
@xref{Sections}, for more information.
528
 
529
This should only be used in special cases; the normal way to process
530
all sections of a given name is to use @code{bfd_map_over_sections} and
531
@code{strcmp} on the name (or better yet, base it on the section flags
532
or something else) for each section.
533
 
534
@findex bfd_get_unique_section_name
535
@subsubsection @code{bfd_get_unique_section_name}
536
@strong{Synopsis}
537
@example
538
char *bfd_get_unique_section_name(bfd *abfd,
539
    const char *templat,
540
    int *count);
541
@end example
542
@strong{Description}@*
543
Invent a section name that is unique in @var{abfd} by tacking
544
a dot and a digit suffix onto the original @var{templat}.  If
545
@var{count} is non-NULL, then it specifies the first number
546
tried as a suffix to generate a unique name.  The value
547
pointed to by @var{count} will be incremented in this case.
548
 
549
@findex bfd_make_section_old_way
550
@subsubsection @code{bfd_make_section_old_way}
551
@strong{Synopsis}
552
@example
553
asection *bfd_make_section_old_way(bfd *abfd, const char *name);
554
@end example
555
@strong{Description}@*
556
Create a new empty section called @var{name}
557
and attach it to the end of the chain of sections for the
558
BFD @var{abfd}. An attempt to create a section with a name which
559
is already in use returns its pointer without changing the
560
section chain.
561
 
562
It has the funny name since this is the way it used to be
563
before it was rewritten....
564
 
565
Possible errors are:
566
@itemize @bullet
567
 
568
@item
569
@code{bfd_error_invalid_operation} -
570
If output has already started for this BFD.
571
@item
572
@code{bfd_error_no_memory} -
573
If memory allocation fails.
574
@end itemize
575
 
576
@findex bfd_make_section_anyway
577
@subsubsection @code{bfd_make_section_anyway}
578
@strong{Synopsis}
579
@example
580
asection *bfd_make_section_anyway(bfd *abfd, const char *name);
581
@end example
582
@strong{Description}@*
583
Create a new empty section called @var{name} and attach it to the end of
584
the chain of sections for @var{abfd}.  Create a new section even if there
585
is already a section with that name.
586
 
587
Return @code{NULL} and set @code{bfd_error} on error; possible errors are:
588
@itemize @bullet
589
 
590
@item
591
@code{bfd_error_invalid_operation} - If output has already started for @var{abfd}.
592
@item
593
@code{bfd_error_no_memory} - If memory allocation fails.
594
@end itemize
595
 
596
@findex bfd_make_section
597
@subsubsection @code{bfd_make_section}
598
@strong{Synopsis}
599
@example
600
asection *bfd_make_section(bfd *, const char *name);
601
@end example
602
@strong{Description}@*
603
Like @code{bfd_make_section_anyway}, but return @code{NULL} (without calling
604
bfd_set_error ()) without changing the section chain if there is already a
605
section named @var{name}.  If there is an error, return @code{NULL} and set
606
@code{bfd_error}.
607
 
608
@findex bfd_set_section_flags
609
@subsubsection @code{bfd_set_section_flags}
610
@strong{Synopsis}
611
@example
612
boolean bfd_set_section_flags(bfd *abfd, asection *sec, flagword flags);
613
@end example
614
@strong{Description}@*
615
Set the attributes of the section @var{sec} in the BFD
616
@var{abfd} to the value @var{flags}. Return @code{true} on success,
617
@code{false} on error. Possible error returns are:
618
 
619
@itemize @bullet
620
 
621
@item
622
@code{bfd_error_invalid_operation} -
623
The section cannot have one or more of the attributes
624
requested. For example, a .bss section in @code{a.out} may not
625
have the @code{SEC_HAS_CONTENTS} field set.
626
@end itemize
627
 
628
@findex bfd_map_over_sections
629
@subsubsection @code{bfd_map_over_sections}
630
@strong{Synopsis}
631
@example
632
void bfd_map_over_sections(bfd *abfd,
633
    void (*func) (bfd *abfd,
634
    asection *sect,
635
    PTR obj),
636
    PTR obj);
637
@end example
638
@strong{Description}@*
639
Call the provided function @var{func} for each section
640
attached to the BFD @var{abfd}, passing @var{obj} as an
641
argument. The function will be called as if by
642
 
643
@example
644
       func(abfd, the_section, obj);
645
@end example
646
 
647
This is the prefered method for iterating over sections; an
648
alternative would be to use a loop:
649
 
650
@example
651
          section *p;
652
          for (p = abfd->sections; p != NULL; p = p->next)
653
             func(abfd, p, ...)
654
@end example
655
 
656
@findex bfd_set_section_size
657
@subsubsection @code{bfd_set_section_size}
658
@strong{Synopsis}
659
@example
660
boolean bfd_set_section_size(bfd *abfd, asection *sec, bfd_size_type val);
661
@end example
662
@strong{Description}@*
663
Set @var{sec} to the size @var{val}. If the operation is
664
ok, then @code{true} is returned, else @code{false}.
665
 
666
Possible error returns:
667
@itemize @bullet
668
 
669
@item
670
@code{bfd_error_invalid_operation} -
671
Writing has started to the BFD, so setting the size is invalid.
672
@end itemize
673
 
674
@findex bfd_set_section_contents
675
@subsubsection @code{bfd_set_section_contents}
676
@strong{Synopsis}
677
@example
678
boolean bfd_set_section_contents
679
   (bfd *abfd,
680
    asection *section,
681
    PTR data,
682
    file_ptr offset,
683
    bfd_size_type count);
684
@end example
685
@strong{Description}@*
686
Sets the contents of the section @var{section} in BFD
687
@var{abfd} to the data starting in memory at @var{data}. The
688
data is written to the output section starting at offset
689
@var{offset} for @var{count} octets.
690
 
691
Normally @code{true} is returned, else @code{false}. Possible error
692
returns are:
693
@itemize @bullet
694
 
695
@item
696
@code{bfd_error_no_contents} -
697
The output section does not have the @code{SEC_HAS_CONTENTS}
698
attribute, so nothing can be written to it.
699
@item
700
and some more too
701
@end itemize
702
This routine is front end to the back end function
703
@code{_bfd_set_section_contents}.
704
 
705
@findex bfd_get_section_contents
706
@subsubsection @code{bfd_get_section_contents}
707
@strong{Synopsis}
708
@example
709
boolean bfd_get_section_contents
710
   (bfd *abfd, asection *section, PTR location,
711
    file_ptr offset, bfd_size_type count);
712
@end example
713
@strong{Description}@*
714
Read data from @var{section} in BFD @var{abfd}
715
into memory starting at @var{location}. The data is read at an
716
offset of @var{offset} from the start of the input section,
717
and is read for @var{count} bytes.
718
 
719
If the contents of a constructor with the @code{SEC_CONSTRUCTOR}
720
flag set are requested or if the section does not have the
721
@code{SEC_HAS_CONTENTS} flag set, then the @var{location} is filled
722
with zeroes. If no errors occur, @code{true} is returned, else
723
@code{false}.
724
 
725
@findex bfd_copy_private_section_data
726
@subsubsection @code{bfd_copy_private_section_data}
727
@strong{Synopsis}
728
@example
729
boolean bfd_copy_private_section_data(bfd *ibfd, asection *isec, bfd *obfd, asection *osec);
730
@end example
731
@strong{Description}@*
732
Copy private section information from @var{isec} in the BFD
733
@var{ibfd} to the section @var{osec} in the BFD @var{obfd}.
734
Return @code{true} on success, @code{false} on error.  Possible error
735
returns are:
736
 
737
@itemize @bullet
738
 
739
@item
740
@code{bfd_error_no_memory} -
741
Not enough memory exists to create private data for @var{osec}.
742
@end itemize
743
@example
744
#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
745
     BFD_SEND (obfd, _bfd_copy_private_section_data, \
746
               (ibfd, isection, obfd, osection))
747
@end example
748
 
749
@findex _bfd_strip_section_from_output
750
@subsubsection @code{_bfd_strip_section_from_output}
751
@strong{Synopsis}
752
@example
753
void _bfd_strip_section_from_output
754
   (struct bfd_link_info *info, asection *section);
755
@end example
756
@strong{Description}@*
757
Remove @var{section} from the output.  If the output section
758
becomes empty, remove it from the output bfd.  @var{info} may
759
be NULL; if it is not, it is used to decide whether the output
760
section is empty.
761
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.