* linker.c (default_fill_link_order): Handle four byte fill value.

This commit is contained in:
Alan Modra 2001-08-17 09:50:05 +00:00
parent 5d964dfa3e
commit 0ac450b689
2 changed files with 26 additions and 11 deletions

View File

@ -1,3 +1,7 @@
2001-08-17 Alan Modra <amodra@bigpond.net.au>
* linker.c (default_fill_link_order): Handle four byte fill value.
2001-08-17 Alan Modra <amodra@bigpond.net.au>
* elf64-sparc.c (sparc64_elf_output_arch_syms): Add missing
@ -31,6 +35,8 @@
(elfNN_ia64_relocate_section): Fix warning.
(elfNN_ia64_unwind_entry_compare): Make params const.
2001-08-17 Alan Modra <amodra@bigpond.net.au>
* config.bfd (targ64_selvecs): New.
<powerpc-*-aix* entry>: Use it here instead of ineffectual #ifdef.
@ -43,6 +49,8 @@
* bfd-in2.h: Regenerate.
* configure: Regenerate.
2001-08-17 Alan Modra <amodra@bigpond.net.au>
* bfd.c (enum bfd_error): Add bfd_error_wrong_object_format.
(bfd_errmsgs): Add corresponding message.
* archive.c (bfd_generic_archive_p): Don't release bfd_ardata when

View File

@ -2655,28 +2655,35 @@ default_fill_link_order (abfd, info, sec, link_order)
struct bfd_link_order *link_order;
{
size_t size;
char *space;
unsigned char *space;
size_t i;
int fill;
unsigned int fill;
file_ptr loc;
boolean result;
BFD_ASSERT ((sec->flags & SEC_HAS_CONTENTS) != 0);
size = (size_t) link_order->size;
space = (char *) bfd_malloc (size);
if (space == NULL && size != 0)
if (size == 0)
return true;
space = (unsigned char *) bfd_malloc (size);
if (space == NULL)
return false;
fill = link_order->u.fill.value;
for (i = 0; i < size; i += 2)
for (i = 0; i < size; i += 4)
space[i] = fill >> 24;
for (i = 1; i < size; i += 4)
space[i] = fill >> 16;
for (i = 2; i < size; i += 4)
space[i] = fill >> 8;
for (i = 1; i < size; i += 2)
for (i = 3; i < size; i += 4)
space[i] = fill;
result = bfd_set_section_contents (abfd, sec, space,
(file_ptr)
(link_order->offset *
bfd_octets_per_byte (abfd)),
link_order->size);
loc = (file_ptr) (link_order->offset * bfd_octets_per_byte (abfd));
result = bfd_set_section_contents (abfd, sec, space, loc, link_order->size);
free (space);
return result;
}