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
) {
33 bfd_byte play_area
[SHORT_SIZE
];
35 bfd_putshort(output_bfd
, statement
->fill_statement
.fill
, play_area
);
36 /* Write out all entire shorts */
38 i
< statement
->fill_statement
.size
- SHORT_SIZE
+ 1;
41 bfd_set_section_contents(output_bfd
,
42 statement
->fill_statement
.output_section
,
44 statement
->data_statement
.output_offset
+i
,
49 /* Now write any remaining byte */
50 if (i
< statement
->fill_statement
.size
)
52 bfd_set_section_contents(output_bfd
,
53 statement
->fill_statement
.output_section
,
55 statement
->data_statement
.output_offset
+i
,
64 case lang_data_statement_enum
:
68 bfd_vma value
= statement
->data_statement
.value
;
69 bfd_byte play_area
[LONG_SIZE
];
70 unsigned int size
= 0;
71 asection
* output_section
= statement
->data_statement
.output_section
;
72 switch (statement
->data_statement
.type
) {
74 bfd_put_32(output_section
->owner
, value
, play_area
);
78 bfd_put_16(output_section
->owner
, value
, play_area
);
82 bfd_put_8(output_section
->owner
, value
, play_area
);
87 bfd_set_section_contents(output_section
->owner
,
88 statement
->data_statement
.output_section
,
90 statement
->data_statement
.output_vma
,
98 case lang_input_section_enum
:
100 /* Create a new seclet in the output section with this
102 if (statement
->input_section
.ifile
->just_syms_flag
== false)
104 asection
*i
= statement
->input_section
.section
;
106 asection
*output_section
= i
->output_section
;
108 bfd_seclet_type
*seclet
= bfd_new_seclet(output_section
->owner
,output_section
);
110 seclet
->type
= bfd_indirect_seclet
;
111 seclet
->u
.indirect
.section
= i
;
112 seclet
->u
.indirect
.symbols
= statement
->input_section
.ifile
->asymbols
;
113 seclet
->size
= i
->_cooked_size
;
114 seclet
->offset
= i
->output_offset
;
120 case lang_padding_statement_enum
:
121 /* Make a new seclet with the right filler */
123 /* Create a new seclet in the output section with this
126 bfd_seclet_type
*seclet
=
127 bfd_new_seclet(statement
->padding_statement
.output_section
->owner
,
128 statement
->padding_statement
.output_section
);
130 seclet
->type
= bfd_fill_seclet
;
131 seclet
->size
= statement
->padding_statement
.size
;
132 seclet
->offset
= statement
->padding_statement
.output_offset
;
133 seclet
->u
.fill
.value
= statement
->padding_statement
.fill
;
142 /* All the other ones fall through */
153 DEFUN(write_relaxnorel
,(output_bfd
, data
),
157 /* Tie up all the statements to generate an output bfd structure which
161 lang_for_each_statement(build_it
);
163 seclet_dump(output_bfd
, data
);
171 /* See if we can change the size of this section by shrinking the
172 relocations in it. If this happens, then we'll have to renumber the
173 symbols in it, and shift around the data too.
176 DEFUN(relax_section
,(this_ptr
),
177 lang_statement_union_type
**this_ptr
)
180 lang_input_section_type
*is
= &((*this_ptr
)->input_section
);
181 asection
*i
= is
->section
;
182 if (!(i
->owner
->flags
& BFD_IS_RELAXABLE
))
184 einfo("%B: not assembled with -linkrelax\n", i
->owner
);
187 return bfd_relax_section(i
->owner
, i
, is
->ifile
->asymbols
);