Handle out of memory situations.
This commit is contained in:
parent
6091b433d7
commit
b3ea35849f
@ -1,3 +1,8 @@
|
|||||||
|
2000-09-20 Alan Modra <alan@linuxcare.com.au>
|
||||||
|
|
||||||
|
* section.c (bfd_get_unique_section_name): Return NULL if
|
||||||
|
bfd_malloc fails.
|
||||||
|
|
||||||
2000-09-19 Michael Sokolov <msokolov@ivan.Harhan.ORG>
|
2000-09-19 Michael Sokolov <msokolov@ivan.Harhan.ORG>
|
||||||
|
|
||||||
* elf32-m68k.c (elf_cpu32_plt0_entry): Change the PLT entry 0
|
* elf32-m68k.c (elf_cpu32_plt0_entry): Change the PLT entry 0
|
||||||
|
@ -672,6 +672,8 @@ bfd_get_unique_section_name (abfd, templat, count)
|
|||||||
|
|
||||||
len = strlen (templat);
|
len = strlen (templat);
|
||||||
sname = bfd_malloc (len + 8);
|
sname = bfd_malloc (len + 8);
|
||||||
|
if (sname == NULL)
|
||||||
|
return NULL;
|
||||||
strcpy (sname, templat);
|
strcpy (sname, templat);
|
||||||
num = 1;
|
num = 1;
|
||||||
if (count != NULL)
|
if (count != NULL)
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
2000-09-20 Alan Modra <alan@linuxcare.com.au>
|
||||||
|
|
||||||
|
* emultempl/elf32.em (gld${EMULATION_NAME}_place_orphan): Handle
|
||||||
|
out of memory failure.
|
||||||
|
|
||||||
|
* ldwrite.c (ldwrite): Remove unnecessary einfo arg.
|
||||||
|
(clone_section): Handle out of memory failures. Rename var to
|
||||||
|
avoid c++ reserved word.
|
||||||
|
|
||||||
2000-09-18 Alan Modra <alan@linuxcare.com.au>
|
2000-09-18 Alan Modra <alan@linuxcare.com.au>
|
||||||
|
|
||||||
* emultempl/hppaelf.em (hppaelf_add_stub_section): Rename
|
* emultempl/hppaelf.em (hppaelf_add_stub_section): Rename
|
||||||
|
@ -1092,9 +1092,13 @@ gld${EMULATION_NAME}_place_orphan (file, s)
|
|||||||
loadable or allocateable characteristics. */
|
loadable or allocateable characteristics. */
|
||||||
outsecname = secname;
|
outsecname = secname;
|
||||||
if (bfd_get_section_by_name (output_bfd, outsecname) != NULL)
|
if (bfd_get_section_by_name (output_bfd, outsecname) != NULL)
|
||||||
outsecname = bfd_get_unique_section_name (output_bfd,
|
{
|
||||||
outsecname,
|
outsecname = bfd_get_unique_section_name (output_bfd,
|
||||||
&count);
|
outsecname,
|
||||||
|
&count);
|
||||||
|
if (outsecname == NULL)
|
||||||
|
einfo ("%F%P: place_orphan failed: %E\n");
|
||||||
|
}
|
||||||
|
|
||||||
/* Start building a list of statements for this section.
|
/* Start building a list of statements for this section.
|
||||||
First save the current statement pointer. */
|
First save the current statement pointer. */
|
||||||
|
21
ld/ldwrite.c
21
ld/ldwrite.c
@ -306,23 +306,22 @@ clone_section (abfd, s, name, count)
|
|||||||
const char *name;
|
const char *name;
|
||||||
int *count;
|
int *count;
|
||||||
{
|
{
|
||||||
char template[6];
|
char templ[6];
|
||||||
char *sname;
|
char *sname;
|
||||||
asection *n;
|
asection *n;
|
||||||
struct bfd_link_hash_entry *h;
|
struct bfd_link_hash_entry *h;
|
||||||
|
|
||||||
/* Invent a section name from the first five chars of the base
|
/* Invent a section name from the first five chars of the base
|
||||||
section name and a digit suffix. */
|
section name and a digit suffix. */
|
||||||
strncpy (template, name, sizeof (template) - 1);
|
strncpy (templ, name, sizeof (templ) - 1);
|
||||||
template[sizeof (template) - 1] = '\0';
|
templ[sizeof (templ) - 1] = '\0';
|
||||||
sname = bfd_get_unique_section_name (abfd, template, count);
|
if ((sname = bfd_get_unique_section_name (abfd, templ, count)) == NULL
|
||||||
|
|| (n = bfd_make_section_anyway (abfd, sname)) == NULL
|
||||||
|
|| (h = bfd_link_hash_lookup (link_info.hash,
|
||||||
|
sname, true, true, false)) == NULL)
|
||||||
|
einfo (_("%F%P: clone section failed: %E\n"));
|
||||||
|
|
||||||
n = bfd_make_section_anyway (abfd, sname);
|
/* Set up section symbol. */
|
||||||
|
|
||||||
/* Create a symbol of the same name. */
|
|
||||||
|
|
||||||
h = bfd_link_hash_lookup (link_info.hash,
|
|
||||||
sname, true, true, false);
|
|
||||||
h->type = bfd_link_hash_defined;
|
h->type = bfd_link_hash_defined;
|
||||||
h->u.def.value = 0;
|
h->u.def.value = 0;
|
||||||
h->u.def.section = n;
|
h->u.def.section = n;
|
||||||
@ -536,7 +535,7 @@ ldwrite ()
|
|||||||
out. */
|
out. */
|
||||||
|
|
||||||
if (bfd_get_error () != bfd_error_no_error)
|
if (bfd_get_error () != bfd_error_no_error)
|
||||||
einfo (_("%F%P: final link failed: %E\n"), output_bfd);
|
einfo (_("%F%P: final link failed: %E\n"));
|
||||||
else
|
else
|
||||||
xexit(1);
|
xexit(1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user