8 Tie together all the interseting blocks
14 #include "../bfd/seclet.h"
15 #include "coff/internal.h"
26 DEFUN(build_it
,(statement
),
27 lang_statement_union_type
*statement
)
29 switch (statement
->header
.type
) {
32 bfd_byte play_area
[SHORT_SIZE
];
34 bfd_putshort(output_bfd
, statement
->fill_statement
.fill
, play_area
);
35 /* Write out all entire shorts */
37 i
< statement
->fill_statement
.size
- SHORT_SIZE
+ 1;
40 bfd_set_section_contents(output_bfd
,
41 statement
->fill_statement
.output_section
,
43 statement
->data_statement
.output_offset
+i
,
48 /* Now write any remaining byte */
49 if (i
< statement
->fill_statement
.size
)
51 bfd_set_section_contents(output_bfd
,
52 statement
->fill_statement
.output_section
,
54 statement
->data_statement
.output_offset
+i
,
62 case lang_data_statement_enum
:
66 bfd_vma value
= statement
->data_statement
.value
;
67 bfd_byte play_area
[LONG_SIZE
];
68 unsigned int size
= 0;
69 switch (statement
->data_statement
.type
) {
71 bfd_put_32(output_bfd
, value
, play_area
);
75 bfd_put_16(output_bfd
, value
, play_area
);
79 bfd_put_8(output_bfd
, value
, play_area
);
84 bfd_set_section_contents(output_bfd
,
85 statement
->data_statement
.output_section
,
87 statement
->data_statement
.output_vma
,
95 case lang_input_section_enum
:
97 /* Create a new seclet in the output section with this
99 if (statement
->input_section
.ifile
->just_syms_flag
== false)
101 asection
*i
= statement
->input_section
.section
;
103 asection
*output_section
= i
->output_section
;
105 bfd_seclet_type
*seclet
= bfd_new_seclet(output_section
->owner
,output_section
);
107 seclet
->type
= bfd_indirect_seclet
;
108 seclet
->u
.indirect
.section
= i
;
109 seclet
->u
.indirect
.symbols
= statement
->input_section
.ifile
->asymbols
;
110 seclet
->size
= bfd_get_section_size_before_reloc(i
);
111 seclet
->offset
= i
->output_offset
;
117 case lang_padding_statement_enum
:
118 /* Make a new seclet with the right filler */
120 /* Create a new seclet in the output section with this
123 bfd_seclet_type
*seclet
=
124 bfd_new_seclet(statement
->padding_statement
.output_section
->owner
,
125 statement
->padding_statement
.output_section
);
127 seclet
->type
= bfd_fill_seclet
;
128 seclet
->size
= statement
->padding_statement
.size
;
129 seclet
->offset
= statement
->padding_statement
.output_offset
;
130 seclet
->u
.fill
.value
= statement
->padding_statement
.fill
;
139 /* All the other ones fall through */
150 DEFUN(write_relaxnorel
,(output_bfd
),
153 /* Tie up all the statements to generate an output bfd structure which
157 lang_for_each_statement(build_it
);
159 seclet_dump(output_bfd
);
167 /* See if we can change the size of this section by shrinking the
168 relocations in it. If this happens, then we'll have to renumber the
169 symbols in it, and shift around the data too.
172 DEFUN(relax_section
,(this_ptr
),
173 lang_statement_union_type
**this_ptr
)
176 lang_input_section_type
*is
= &((*this_ptr
)->input_section
);
177 asection
*i
= is
->section
;
179 return bfd_relax_section(i
->owner
, i
, is
->ifile
->asymbols
);