From: Steve Chamberlain Date: Tue, 29 Aug 1995 23:26:43 +0000 (+0000) Subject: * coffswap.h (coff_swap_scnhdr_in): Don't always add IMAGE_BASE. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c7f6ebe2c31b81c1dae00a784a6e6eb61bd8231f;p=binutils-gdb.git * coffswap.h (coff_swap_scnhdr_in): Don't always add IMAGE_BASE. Swap in PE header. * coffcode.h (coff_write_object_contents): Remove #if0ed code Only remove empty sections in PE inmage files. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index bb4ed7f6523..c4560fcb494 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -10,10 +10,12 @@ Tue Aug 29 13:50:21 1995 steve chamberlain (coff-i386_rtype_to_howto): Understand R_IMAGEBASE type. * coffcode.h (sec_to_styp_flags): .edata is data. (coff_compute_section_file_positions): Get page size right for PE. + Pagesize info is only valid in PE image files. (fill_pe_header_info): Fix fields. (coff_write_object_contents): Remove end_of_image calc. (_bfd_coff_generate_reloc_section): Remove orphaned comment. * coffswap.h (coff_swap_scnhdr_in): Don't always add IMAGE_BASE. + Swap in PE header. (coff_swap_scnhdr_out): Setup PE flags correctly. * reloc.c (BFD_RELOC_RVA): New field. diff --git a/bfd/coffcode.h b/bfd/coffcode.h index 771693660f0..76d8fd4c0ea 100644 --- a/bfd/coffcode.h +++ b/bfd/coffcode.h @@ -1513,17 +1513,22 @@ coff_compute_section_file_positions (abfd) #endif unsigned int count; + #ifdef COFF_IMAGE_WITH_PE - page_size = pe_value (&(coff_data (abfd)->link_info->pe_info->file_alignment), - PE_DEF_FILE_ALIGNMENT); + if (coff_data (abfd)->link_info) + { + page_size = pe_value (&(coff_data (abfd)->link_info->pe_info->file_alignment), + PE_DEF_FILE_ALIGNMENT); + } + else + page_size = PE_DEF_FILE_ALIGNMENT; #else page_size = COFF_PAGE_SIZE; #endif - if (bfd_get_start_address (abfd)) { /* A start address may have been added to the original file. In this - case it will need an optional header to record it. */ + case it will need an optional header to record it. */ abfd->flags |= EXEC_P; } @@ -1547,7 +1552,7 @@ coff_compute_section_file_positions (abfd) stores codeview debug data. */ if (strcmp (current->name, ".junk") == 0) { - continue; + continue; } #endif @@ -1558,7 +1563,7 @@ coff_compute_section_file_positions (abfd) #ifndef I960 { /* make sure this section is aligned on the right boundary - by - padding the previous section up if necessary */ + padding the previous section up if necessary */ old_sofar = sofar; sofar = BFD_ALIGN (sofar, 1 << current->alignment_power);