}
+static unsigned long align_section_if_needed (unsigned long value) {
+
+ if (state->format == LD_FORMAT_I386_PE) {
+ return pe_align_to_file_alignment (value);
+ }
+
+ return value;
+
+}
+
void link (void) {
struct section *section;
if ((symbol = symbol_find ("__edata")) && symbol_is_undefined (symbol)) {
if ((section = section_find (".text"))) {
-
- if (state->format == LD_FORMAT_I386_PE) {
- value += pe_align_to_file_alignment (section->total_size);
- } else {
- value += section->total_size;
- }
-
+ value += align_section_if_needed (section->total_size);
}
of = object_file_make (FAKE_LD_FILENAME, 1);
if ((symbol = symbol_find ("__end")) && symbol_is_undefined (symbol)) {
if ((section = section_find (".data"))) {
-
- if (state->format == LD_FORMAT_I386_PE) {
- value += pe_align_to_file_alignment (section->total_size);
- } else {
- value += section->total_size;
- }
-
+ value += align_section_if_needed (section->total_size);
}
if ((section = section_find (".bss"))) {
-
- if (state->format == LD_FORMAT_I386_PE) {
- value += pe_align_to_file_alignment (section->total_size);
- } else {
- value += section->total_size;
- }
-
+ value += align_section_if_needed (section->total_size);
}
of = object_file_make (FAKE_LD_FILENAME, 1);
int pe_check_option (const char *cmd_arg, int argc, char **argv, int *optind, const char **optarg);
+unsigned long pe_align_to_file_alignment (unsigned long value);
+unsigned long pe_get_first_section_rva (void);
+
void pe_after_link (void);
void pe_before_link (void);
void pe_print_help (void);
-unsigned long pe_align_to_file_alignment (unsigned long value);
-unsigned long pe_get_first_section_rva (void);
-
void pe_write (const char *filename);
void pe_use_option (const char *cmd_arg, int idx, const char *optarg);