mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-22 02:50:08 +08:00
* ldmisc.c (ldmalloc, xmalloc, ldrealloc, xrealloc): Functions
deleted; will use libiberty versions instead. * ldctor.c ldfile.c ldlang.c ldmain.c ldmisc.c ldmisc.h lexsup.c mri.c Makefile.in: Change callers. * ldmisc.c (vfinfo): Remove cleanup code. * ldmain.c (remove_output): Put it here (new function). (preserve_output): New function. (main): Register remove_output and preserve_output with atexit. * ldmain.c ldgram.y: Call xexit instead of exit. * ldmisc.h: Declare xexit.
This commit is contained in:
14
ld/ChangeLog
14
ld/ChangeLog
@ -1,3 +1,17 @@
|
|||||||
|
Fri Feb 4 16:26:08 1994 David J. Mackenzie (djm@thepub.cygnus.com)
|
||||||
|
|
||||||
|
* ldmisc.c (ldmalloc, xmalloc, ldrealloc, xrealloc): Functions
|
||||||
|
deleted; will use libiberty versions instead.
|
||||||
|
* ldctor.c ldfile.c ldlang.c ldmain.c ldmisc.c ldmisc.h lexsup.c
|
||||||
|
mri.c Makefile.in: Change callers.
|
||||||
|
|
||||||
|
* ldmisc.c (vfinfo): Remove cleanup code.
|
||||||
|
* ldmain.c (remove_output): Put it here (new function).
|
||||||
|
(preserve_output): New function.
|
||||||
|
(main): Register remove_output and preserve_output with atexit.
|
||||||
|
* ldmain.c ldgram.y: Call xexit instead of exit.
|
||||||
|
* ldmisc.h: Declare xexit.
|
||||||
|
|
||||||
Fri Feb 4 15:19:01 1994 Steve Chamberlain (sac@cygnus.com)
|
Fri Feb 4 15:19:01 1994 Steve Chamberlain (sac@cygnus.com)
|
||||||
|
|
||||||
* Makefile.in: Lots of new H8/500 memory models.
|
* Makefile.in: Lots of new H8/500 memory models.
|
||||||
|
@ -235,7 +235,7 @@ ldlex.c: ldlex.l
|
|||||||
$(LEX) -I -Cem $(srcdir)/ldlex.l
|
$(LEX) -I -Cem $(srcdir)/ldlex.l
|
||||||
-sed -e '/^int.*free();/d' \
|
-sed -e '/^int.*free();/d' \
|
||||||
-e '/^char.*malloc();/d' \
|
-e '/^char.*malloc();/d' \
|
||||||
-e 's/malloc/ldmalloc/g' \
|
-e 's/malloc/xmalloc/g' \
|
||||||
< lex.yy.c > ldlex.c.new
|
< lex.yy.c > ldlex.c.new
|
||||||
-rm lex.yy.c
|
-rm lex.yy.c
|
||||||
mv ldlex.c.new ./ldlex.c
|
mv ldlex.c.new ./ldlex.c
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Linker command language support.
|
/* Linker command language support.
|
||||||
Copyright 1991, 1992, 1993 Free Software Foundation, Inc.
|
Copyright (C) 1991, 92, 93, 94 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GLD, the Gnu Linker.
|
This file is part of GLD, the Gnu Linker.
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ static lang_statement_union_type *new_statement PARAMS ((enum statement_enum,
|
|||||||
/* LOCALS */
|
/* LOCALS */
|
||||||
static struct obstack stat_obstack;
|
static struct obstack stat_obstack;
|
||||||
|
|
||||||
#define obstack_chunk_alloc ldmalloc
|
#define obstack_chunk_alloc xmalloc
|
||||||
#define obstack_chunk_free free
|
#define obstack_chunk_free free
|
||||||
static CONST char *startup_file;
|
static CONST char *startup_file;
|
||||||
static lang_statement_list_type input_file_chain;
|
static lang_statement_list_type input_file_chain;
|
||||||
@ -1777,7 +1777,7 @@ lang_size_sections (s, output_section_statement, prev, fill, dot, relax)
|
|||||||
unsigned int symsize;
|
unsigned int symsize;
|
||||||
|
|
||||||
symsize = get_symtab_upper_bound (i->owner);
|
symsize = get_symtab_upper_bound (i->owner);
|
||||||
is->ifile->asymbols = (asymbol **) ldmalloc (symsize);
|
is->ifile->asymbols = (asymbol **) xmalloc (symsize);
|
||||||
is->ifile->symbol_count =
|
is->ifile->symbol_count =
|
||||||
bfd_canonicalize_symtab (i->owner, is->ifile->asymbols);
|
bfd_canonicalize_symtab (i->owner, is->ifile->asymbols);
|
||||||
|
|
||||||
|
50
ld/ldmain.c
50
ld/ldmain.c
@ -1,5 +1,5 @@
|
|||||||
/* Main program of GNU linker.
|
/* Main program of GNU linker.
|
||||||
Copyright (C) 1991, 1993, 1994 Free Software Foundation, Inc.
|
Copyright (C) 1991, 92, 93, 94 Free Software Foundation, Inc.
|
||||||
Written by Steve Chamberlain steve@cygnus.com
|
Written by Steve Chamberlain steve@cygnus.com
|
||||||
|
|
||||||
This file is part of GLD, the Gnu Linker.
|
This file is part of GLD, the Gnu Linker.
|
||||||
@ -132,7 +132,26 @@ static struct bfd_link_callbacks link_callbacks =
|
|||||||
|
|
||||||
struct bfd_link_info link_info;
|
struct bfd_link_info link_info;
|
||||||
|
|
||||||
extern int main PARAMS ((int, char **));
|
static void
|
||||||
|
remove_output ()
|
||||||
|
{
|
||||||
|
if (output_filename)
|
||||||
|
{
|
||||||
|
if (output_bfd && output_bfd->iostream)
|
||||||
|
fclose((FILE *)(output_bfd->iostream));
|
||||||
|
if (delete_output_file_on_failure)
|
||||||
|
unlink (output_filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Prevent remove_output from doing anything.
|
||||||
|
Called after a successful link. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
preserve_output ()
|
||||||
|
{
|
||||||
|
output_filename = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (argc, argv)
|
main (argc, argv)
|
||||||
@ -146,6 +165,8 @@ main (argc, argv)
|
|||||||
|
|
||||||
bfd_init ();
|
bfd_init ();
|
||||||
|
|
||||||
|
atexit (remove_output);
|
||||||
|
|
||||||
/* Initialize the data about options. */
|
/* Initialize the data about options. */
|
||||||
trace_files = trace_file_tries = version_printed = false;
|
trace_files = trace_file_tries = version_printed = false;
|
||||||
write_map = false;
|
write_map = false;
|
||||||
@ -195,7 +216,7 @@ main (argc, argv)
|
|||||||
{
|
{
|
||||||
/* sizeof counts the terminating NUL. */
|
/* sizeof counts the terminating NUL. */
|
||||||
size_t size = strlen (s) + sizeof ("-T ");
|
size_t size = strlen (s) + sizeof ("-T ");
|
||||||
char *buf = (char *) ldmalloc(size);
|
char *buf = (char *) xmalloc(size);
|
||||||
sprintf (buf, "-T %s", s);
|
sprintf (buf, "-T %s", s);
|
||||||
parse_line (buf, 0);
|
parse_line (buf, 0);
|
||||||
free (buf);
|
free (buf);
|
||||||
@ -213,7 +234,7 @@ main (argc, argv)
|
|||||||
if (lang_has_input_file == false)
|
if (lang_has_input_file == false)
|
||||||
{
|
{
|
||||||
if (version_printed)
|
if (version_printed)
|
||||||
exit (0);
|
xexit (0);
|
||||||
einfo ("%P%F: no input files\n");
|
einfo ("%P%F: no input files\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +304,7 @@ main (argc, argv)
|
|||||||
fclose ((FILE *) (output_bfd->iostream));
|
fclose ((FILE *) (output_bfd->iostream));
|
||||||
|
|
||||||
unlink (output_filename);
|
unlink (output_filename);
|
||||||
exit (1);
|
xexit (1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -302,7 +323,8 @@ main (argc, argv)
|
|||||||
(long) (lim - (char *) &environ));
|
(long) (lim - (char *) &environ));
|
||||||
}
|
}
|
||||||
|
|
||||||
exit (0);
|
atexit (preserve_output);
|
||||||
|
xexit (0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,7 +398,7 @@ check_for_scripts_dir (dir)
|
|||||||
|
|
||||||
dirlen = strlen (dir);
|
dirlen = strlen (dir);
|
||||||
/* sizeof counts the terminating NUL. */
|
/* sizeof counts the terminating NUL. */
|
||||||
buf = (char *) ldmalloc (dirlen + sizeof("/ldscripts"));
|
buf = (char *) xmalloc (dirlen + sizeof("/ldscripts"));
|
||||||
sprintf (buf, "%s/ldscripts", dir);
|
sprintf (buf, "%s/ldscripts", dir);
|
||||||
|
|
||||||
res = stat (buf, &s) == 0 && S_ISDIR (s.st_mode);
|
res = stat (buf, &s) == 0 && S_ISDIR (s.st_mode);
|
||||||
@ -410,14 +432,14 @@ set_scripts_dir ()
|
|||||||
dirlen = end - program_name;
|
dirlen = end - program_name;
|
||||||
/* Make a copy of program_name in dir.
|
/* Make a copy of program_name in dir.
|
||||||
Leave room for later "/../lib". */
|
Leave room for later "/../lib". */
|
||||||
dir = (char *) ldmalloc (dirlen + 8);
|
dir = (char *) xmalloc (dirlen + 8);
|
||||||
strncpy (dir, program_name, dirlen);
|
strncpy (dir, program_name, dirlen);
|
||||||
dir[dirlen] = '\0';
|
dir[dirlen] = '\0';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dirlen = 1;
|
dirlen = 1;
|
||||||
dir = (char *) ldmalloc (dirlen + 8);
|
dir = (char *) xmalloc (dirlen + 8);
|
||||||
strcpy (dir, ".");
|
strcpy (dir, ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -439,7 +461,7 @@ add_ysym (name)
|
|||||||
if (link_info.notice_hash == (struct bfd_hash_table *) NULL)
|
if (link_info.notice_hash == (struct bfd_hash_table *) NULL)
|
||||||
{
|
{
|
||||||
link_info.notice_hash = ((struct bfd_hash_table *)
|
link_info.notice_hash = ((struct bfd_hash_table *)
|
||||||
ldmalloc (sizeof (struct bfd_hash_table)));
|
xmalloc (sizeof (struct bfd_hash_table)));
|
||||||
if (! bfd_hash_table_init_n (link_info.notice_hash,
|
if (! bfd_hash_table_init_n (link_info.notice_hash,
|
||||||
bfd_hash_newfunc,
|
bfd_hash_newfunc,
|
||||||
61))
|
61))
|
||||||
@ -474,12 +496,12 @@ add_keepsyms_file (filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
link_info.keep_hash = ((struct bfd_hash_table *)
|
link_info.keep_hash = ((struct bfd_hash_table *)
|
||||||
ldmalloc (sizeof (struct bfd_hash_table)));
|
xmalloc (sizeof (struct bfd_hash_table)));
|
||||||
if (! bfd_hash_table_init (link_info.keep_hash, bfd_hash_newfunc))
|
if (! bfd_hash_table_init (link_info.keep_hash, bfd_hash_newfunc))
|
||||||
einfo ("%P%F: bfd_hash_table_init failed: %E\n");
|
einfo ("%P%F: bfd_hash_table_init failed: %E\n");
|
||||||
|
|
||||||
bufsize = 100;
|
bufsize = 100;
|
||||||
buf = (char *) ldmalloc (bufsize);
|
buf = (char *) xmalloc (bufsize);
|
||||||
|
|
||||||
c = getc (file);
|
c = getc (file);
|
||||||
while (c != EOF)
|
while (c != EOF)
|
||||||
@ -498,7 +520,7 @@ add_keepsyms_file (filename)
|
|||||||
if (len >= bufsize)
|
if (len >= bufsize)
|
||||||
{
|
{
|
||||||
bufsize *= 2;
|
bufsize *= 2;
|
||||||
buf = ldrealloc (buf, bufsize);
|
buf = xrealloc (buf, bufsize);
|
||||||
}
|
}
|
||||||
c = getc (file);
|
c = getc (file);
|
||||||
}
|
}
|
||||||
@ -532,7 +554,7 @@ add_archive_element (info, abfd, name)
|
|||||||
lang_input_statement_type *input;
|
lang_input_statement_type *input;
|
||||||
|
|
||||||
input = ((lang_input_statement_type *)
|
input = ((lang_input_statement_type *)
|
||||||
ldmalloc ((bfd_size_type) sizeof (lang_input_statement_type)));
|
xmalloc ((bfd_size_type) sizeof (lang_input_statement_type)));
|
||||||
input->filename = abfd->filename;
|
input->filename = abfd->filename;
|
||||||
input->local_sym_name = abfd->filename;
|
input->local_sym_name = abfd->filename;
|
||||||
input->the_bfd = abfd;
|
input->the_bfd = abfd;
|
||||||
|
Reference in New Issue
Block a user