Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/gnu/usr.bin/ld/ld Pull up revision 1.68 (requested by m...
details: https://anonhg.NetBSD.org/src/rev/19acaa01614d
branches: netbsd-1-4
changeset: 470037:19acaa01614d
user: he <he%NetBSD.org@localhost>
date: Sat Jan 15 17:15:37 2000 +0000
description:
Pull up revision 1.68 (requested by mycroft):
More alloca() -> malloc() changes, so that large shared libraries
built with `-g' can be linked.
diffstat:
gnu/usr.bin/ld/ld/ld.c | 28 ++++++++++++++++++----------
1 files changed, 18 insertions(+), 10 deletions(-)
diffs (123 lines):
diff -r 3c4d409eac30 -r 19acaa01614d gnu/usr.bin/ld/ld/ld.c
--- a/gnu/usr.bin/ld/ld/ld.c Sat Jan 15 17:04:53 2000 +0000
+++ b/gnu/usr.bin/ld/ld/ld.c Sat Jan 15 17:15:37 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ld.c,v 1.64 1999/02/27 03:31:12 tv Exp $ */
+/* $NetBSD: ld.c,v 1.64.2.1 2000/01/15 17:15:37 he Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
@@ -88,7 +88,7 @@
#ifndef lint
/* from: "@(#)ld.c 6.10 (Berkeley) 5/22/91"; */
-__RCSID("$NetBSD: ld.c,v 1.64 1999/02/27 03:31:12 tv Exp $");
+__RCSID("$NetBSD: ld.c,v 1.64.2.1 2000/01/15 17:15:37 he Exp $");
#endif /* not lint */
#define GNU_BINUTIL_COMPAT /* forwards compatiblity with binutils 2.x */
@@ -1334,7 +1334,7 @@
if (!(entry->flags & E_HEADER_VALID))
read_header(fd, entry);
- np = (struct nlist *)alloca(entry->header.a_syms);
+ np = (struct nlist *)malloc(entry->header.a_syms);
entry->nsymbols = entry->header.a_syms / sizeof(struct nlist);
if (entry->nsymbols == 0)
return;
@@ -1353,7 +1353,7 @@
md_swapin_symbols(np, entry->header.a_syms / sizeof(struct nlist));
for (i = 0; i < entry->nsymbols; i++) {
- entry->symbols[i].nzlist.nlist = *np++;
+ entry->symbols[i].nzlist.nlist = np[i];
entry->symbols[i].nzlist.nz_size = 0;
entry->symbols[i].symbol = NULL;
entry->symbols[i].next = NULL;
@@ -1361,6 +1361,7 @@
entry->symbols[i].gotslot_offset = -1;
entry->symbols[i].flags = 0;
}
+ free(np);
entry->strings_offset = N_STROFF(entry->header) +
entry->starting_offset;
@@ -1525,10 +1526,11 @@
if (N_GETFLAG(hdr) & EX_PIC)
pic_code_seen = 1;
read_entry_symbols(fd, entry);
- entry->strings = (char *)alloca(entry->string_size);
+ entry->strings = (char *)malloc(entry->string_size);
read_entry_strings(fd, entry);
read_entry_relocation(fd, entry);
enter_file_symbols(entry);
+ free(entry->strings);
entry->strings = 0;
}
} else {
@@ -2995,7 +2997,7 @@
fd = file_open(entry);
/* Allocate space for the file's text section */
- bytes = (char *)alloca(entry->header.a_text);
+ bytes = (char *)malloc(entry->header.a_text);
/* Deal with relocation information however is appropriate */
if (entry->textrel == NULL)
@@ -3013,6 +3015,8 @@
/* Write the relocated text to the output file. */
mywrite(bytes, entry->header.a_text, 1, outstream);
+
+ free(bytes);
}
/*
@@ -3069,7 +3073,7 @@
fd = file_open(entry);
- bytes = (char *)alloca(entry->header.a_data);
+ bytes = (char *)malloc(entry->header.a_data);
if (entry->datarel == NULL)
errx(1, "%s: no data relocation", get_file_name(entry));
@@ -3084,6 +3088,8 @@
entry->datarel, entry->ndatarel, entry, 1);
mywrite(bytes, entry->header.a_data, 1, outstream);
+
+ free(bytes);
}
/*
@@ -3966,7 +3972,7 @@
}
/* Read the file's string table. */
- entry->strings = (char *)alloca(entry->string_size);
+ entry->strings = (char *)malloc(entry->string_size);
read_entry_strings(file_open(entry), entry);
lspend = entry->symbols + entry->nsymbols;
@@ -4016,8 +4022,9 @@
* Write the string-table data for the symbols just written, using
* the data in vectors `strtab_vector' and `strtab_lens'.
*/
-
write_string_table();
+
+ free(entry->strings);
entry->strings = 0; /* Since it will disappear anyway. */
}
@@ -4080,7 +4087,8 @@
if (padding <= 0)
return;
- buf = (char *)alloca(padding);
+ buf = (char *)malloc(padding);
bzero(buf, padding);
mywrite(buf, padding, 1, fd);
+ free(buf);
}
Home |
Main Index |
Thread Index |
Old Index