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
100 asection
*i
= statement
->input_section
.section
;
102 asection
*output_section
= i
->output_section
;
104 bfd_seclet_type
*seclet
= bfd_new_seclet(output_section
->owner
,output_section
);
106 seclet
->type
= bfd_indirect_seclet
;
107 seclet
->u
.indirect
.section
= i
;
108 seclet
->u
.indirect
.symbols
= statement
->input_section
.ifile
->asymbols
;
109 seclet
->size
= bfd_get_section_size_before_reloc(i
);
110 seclet
->offset
= i
->output_offset
;
115 case lang_padding_statement_enum
:
116 /* Make a new seclet with the right filler */
118 /* Create a new seclet in the output section with this
121 bfd_seclet_type
*seclet
=
122 bfd_new_seclet(statement
->padding_statement
.output_section
->owner
,
123 statement
->padding_statement
.output_section
);
125 seclet
->type
= bfd_fill_seclet
;
126 seclet
->size
= statement
->padding_statement
.size
;
127 seclet
->offset
= statement
->padding_statement
.output_offset
;
128 seclet
->u
.fill
.value
= statement
->padding_statement
.fill
;
137 /* All the other ones fall through */
148 DEFUN(write_relaxnorel
,(output_bfd
),
151 /* Tie up all the statements to generate an output bfd structure which
155 lang_for_each_statement(build_it
);
157 seclet_dump(output_bfd
);
165 /* See if we can change the size of this section by shrinking the
166 relocations in it. If this happens, then we'll have to renumber the
167 symbols in it, and shift around the data too.
170 DEFUN(relax_section
,(this_ptr
),
171 lang_statement_union_type
**this_ptr
)
174 lang_input_section_type
*is
= &((*this_ptr
)->input_section
);
175 asection
*i
= is
->section
;
177 return bfd_relax_section(i
->owner
, i
, is
->ifile
->asymbols
);