mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-20 06:15:09 +08:00
PR 11168
* coffcode.h (coff_compute_section_file_positions): Move Rs6000COFF_C block past vars in COFF_IMAGE_WITH_PE block. Report error on more than 32k sections.
This commit is contained in:
@ -1,3 +1,10 @@
|
|||||||
|
2010-01-18 Alan Modra <amodra@gmail.com>
|
||||||
|
|
||||||
|
PR 11168
|
||||||
|
* coffcode.h (coff_compute_section_file_positions): Move Rs6000COFF_C
|
||||||
|
block past vars in COFF_IMAGE_WITH_PE block. Report error on more
|
||||||
|
than 32k sections.
|
||||||
|
|
||||||
2010-01-15 Jan Kratochvil <jan.kratochvil@redhat.com>
|
2010-01-15 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
Fix compilation warning on gcc-3.4.
|
Fix compilation warning on gcc-3.4.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* Support for the generic parts of most COFF variants, for BFD.
|
/* Support for the generic parts of most COFF variants, for BFD.
|
||||||
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||||
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
Written by Cygnus Support.
|
Written by Cygnus Support.
|
||||||
|
|
||||||
@ -3093,10 +3093,31 @@ coff_compute_section_file_positions (bfd * abfd)
|
|||||||
asection *previous = NULL;
|
asection *previous = NULL;
|
||||||
file_ptr sofar = bfd_coff_filhsz (abfd);
|
file_ptr sofar = bfd_coff_filhsz (abfd);
|
||||||
bfd_boolean align_adjust;
|
bfd_boolean align_adjust;
|
||||||
|
int target_index;
|
||||||
#ifdef ALIGN_SECTIONS_IN_FILE
|
#ifdef ALIGN_SECTIONS_IN_FILE
|
||||||
file_ptr old_sofar;
|
file_ptr old_sofar;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef COFF_IMAGE_WITH_PE
|
||||||
|
int page_size;
|
||||||
|
|
||||||
|
if (coff_data (abfd)->link_info)
|
||||||
|
{
|
||||||
|
page_size = pe_data (abfd)->pe_opthdr.FileAlignment;
|
||||||
|
|
||||||
|
/* If no file alignment has been set, default to one.
|
||||||
|
This repairs 'ld -r' for arm-wince-pe target. */
|
||||||
|
if (page_size == 0)
|
||||||
|
page_size = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
page_size = PE_DEF_FILE_ALIGNMENT;
|
||||||
|
#else
|
||||||
|
#ifdef COFF_PAGE_SIZE
|
||||||
|
int page_size = COFF_PAGE_SIZE;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef RS6000COFF_C
|
#ifdef RS6000COFF_C
|
||||||
/* On XCOFF, if we have symbols, set up the .debug section. */
|
/* On XCOFF, if we have symbols, set up the .debug section. */
|
||||||
if (bfd_get_symcount (abfd) > 0)
|
if (bfd_get_symcount (abfd) > 0)
|
||||||
@ -3136,26 +3157,6 @@ coff_compute_section_file_positions (bfd * abfd)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef COFF_IMAGE_WITH_PE
|
|
||||||
int page_size;
|
|
||||||
|
|
||||||
if (coff_data (abfd)->link_info)
|
|
||||||
{
|
|
||||||
page_size = pe_data (abfd)->pe_opthdr.FileAlignment;
|
|
||||||
|
|
||||||
/* If no file alignment has been set, default to one.
|
|
||||||
This repairs 'ld -r' for arm-wince-pe target. */
|
|
||||||
if (page_size == 0)
|
|
||||||
page_size = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
page_size = PE_DEF_FILE_ALIGNMENT;
|
|
||||||
#else
|
|
||||||
#ifdef COFF_PAGE_SIZE
|
|
||||||
int page_size = COFF_PAGE_SIZE;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (bfd_get_start_address (abfd))
|
if (bfd_get_start_address (abfd))
|
||||||
/* A start address may have been added to the original file. In this
|
/* 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. */
|
||||||
@ -3191,7 +3192,6 @@ coff_compute_section_file_positions (bfd * abfd)
|
|||||||
unsigned int count;
|
unsigned int count;
|
||||||
asection **section_list;
|
asection **section_list;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int target_index;
|
|
||||||
bfd_size_type amt;
|
bfd_size_type amt;
|
||||||
|
|
||||||
#ifdef COFF_PAGE_SIZE
|
#ifdef COFF_PAGE_SIZE
|
||||||
@ -3254,14 +3254,20 @@ coff_compute_section_file_positions (bfd * abfd)
|
|||||||
#else /* ! COFF_IMAGE_WITH_PE */
|
#else /* ! COFF_IMAGE_WITH_PE */
|
||||||
{
|
{
|
||||||
/* Set the target_index field. */
|
/* Set the target_index field. */
|
||||||
int target_index;
|
|
||||||
|
|
||||||
target_index = 1;
|
target_index = 1;
|
||||||
for (current = abfd->sections; current != NULL; current = current->next)
|
for (current = abfd->sections; current != NULL; current = current->next)
|
||||||
current->target_index = target_index++;
|
current->target_index = target_index++;
|
||||||
}
|
}
|
||||||
#endif /* ! COFF_IMAGE_WITH_PE */
|
#endif /* ! COFF_IMAGE_WITH_PE */
|
||||||
|
|
||||||
|
if (target_index >= 32768)
|
||||||
|
{
|
||||||
|
bfd_set_error (bfd_error_file_too_big);
|
||||||
|
(*_bfd_error_handler)
|
||||||
|
(_("%B: too many sections (%d)"), abfd, target_index);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
align_adjust = FALSE;
|
align_adjust = FALSE;
|
||||||
for (current = abfd->sections;
|
for (current = abfd->sections;
|
||||||
current != NULL;
|
current != NULL;
|
||||||
|
Reference in New Issue
Block a user