View | Details | Return to bug 69880 | Differences between
and this patch

Collapse All | Expand All

(-)a/bfd/peXXigen.c (-15 / +20 lines)
Lines 4122-4127 rsrc_process_section (bfd * abfd, Link Here
4122
  unsigned int      num_input_rsrc = 0;
4122
  unsigned int      num_input_rsrc = 0;
4123
  unsigned int      max_num_input_rsrc = 4;
4123
  unsigned int      max_num_input_rsrc = 4;
4124
  ptrdiff_t *       rsrc_sizes = NULL;
4124
  ptrdiff_t *       rsrc_sizes = NULL;
4125
  unsigned long     page_size;
4126
4125
4127
4126
  new_table.names.num_entries = 0;
4128
  new_table.names.num_entries = 0;
4127
  new_table.ids.num_entries = 0;
4129
  new_table.ids.num_entries = 0;
Lines 4300-4321 rsrc_process_section (bfd * abfd, Link Here
4300
     We recompute the size as we may have lost entries due to mergeing.  */
4302
     We recompute the size as we may have lost entries due to mergeing.  */
4301
  size = ((write_data.next_data - new_data) + 3) & ~ 3;
4303
  size = ((write_data.next_data - new_data) + 3) & ~ 3;
4302
4304
4303
  {
4305
  if (coff_data (abfd)->link_info)
4304
    int page_size;
4306
    {
4305
4307
      page_size = pe_data (abfd)->pe_opthdr.FileAlignment;
4306
    if (coff_data (abfd)->link_info)
4307
      {
4308
	page_size = pe_data (abfd)->pe_opthdr.FileAlignment;
4309
4308
4310
	/* If no file alignment has been set, default to one.
4309
      /* If no file alignment has been set, default to one.
4311
	   This repairs 'ld -r' for arm-wince-pe target.  */
4310
	 This repairs 'ld -r' for arm-wince-pe target.  */
4312
	if (page_size == 0)
4311
      if (page_size == 0)
4313
	  page_size = 1;
4312
	page_size = 1;
4314
      }
4313
    }
4315
    else
4314
  else
4316
      page_size = PE_DEF_FILE_ALIGNMENT;
4315
    page_size = PE_DEF_FILE_ALIGNMENT;
4317
    size = (size + page_size - 1) & - page_size;
4316
4318
  }
4317
  size = (size + page_size - 1) & - page_size;
4318
  /* PR gcc/69880: We must ensure that there are no gaps between the end
4319
     of the .rsrc section and whichever section comes next in the file.
4320
     This does mean that we can end up with a lot of unused space at
4321
     the end of the .rsrc section, but at least this way works.  */
4322
  if (sec->next && sec->next->filepos > (file_ptr)(sec->filepos + size))
4323
    size = sec->next->filepos - sec->filepos;
4319
4324
4320
  bfd_set_section_contents (pfinfo->output_bfd, sec, new_data, 0, size);
4325
  bfd_set_section_contents (pfinfo->output_bfd, sec, new_data, 0, size);
4321
  sec->size = sec->rawsize = size;
4326
  sec->size = sec->rawsize = size;

Return to bug 69880