From 88ac367bd71d8171a1b283272f89537888746a11 Mon Sep 17 00:00:00 2001 From: "Jordan K. Hubbard" Date: Thu, 2 Dec 1993 00:56:40 +0000 Subject: Second attempt to integrate Paul K's changes. --- gnu/usr.bin/ld/Makefile | 10 +++------- gnu/usr.bin/ld/ld.c | 4 ++-- gnu/usr.bin/ld/lib.c | 38 ++++++++++++++++++++++++++++++-------- gnu/usr.bin/ld/rrs.c | 4 +--- 4 files changed, 36 insertions(+), 20 deletions(-) (limited to 'gnu') diff --git a/gnu/usr.bin/ld/Makefile b/gnu/usr.bin/ld/Makefile index 09b9b11622a5..0e55c98d46db 100644 --- a/gnu/usr.bin/ld/Makefile +++ b/gnu/usr.bin/ld/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.9 1993/12/01 14:45:35 ache Exp $ +# $Id: Makefile,v 1.8 1993/11/03 13:01:36 cgd Exp $ # PROG= ld @@ -7,13 +7,9 @@ CFLAGS += -static -I$(.CURDIR) -I$(.CURDIR)/$(MACHINE) LDADD+= -lgnumalloc DPADD+= /usr/lib/libgnumalloc.a -LDFLAGS+= -Xlinker -Bstatic -SUBDIR= ldconfig ldd -.if !defined(NOPIC) -SUBDIR+= rtld -.endif - +SUBDIR= ldconfig ldd rtld + .PATH: $(.CURDIR)/$(MACHINE) .include diff --git a/gnu/usr.bin/ld/ld.c b/gnu/usr.bin/ld/ld.c index 7285e5d23a43..5b93e9e529af 100644 --- a/gnu/usr.bin/ld/ld.c +++ b/gnu/usr.bin/ld/ld.c @@ -32,7 +32,7 @@ static char sccsid[] = "@(#)ld.c 6.10 (Berkeley) 5/22/91"; Set, indirect, and warning symbol features added by Randy Smith. */ /* - * $Id: ld.c,v 1.11 1993/11/30 20:47:25 jkh Exp $ + * $Id: ld.c,v 1.10 1993/11/22 19:04:40 jkh Exp $ */ /* Define how to initialize system-dependent header fields. */ @@ -2111,13 +2111,13 @@ write_header () if (relocatable_output) nsyms += set_symbol_count; -#ifdef DEBUG printf("global symbols %d (defined %d, undefined %d), locals: %d, \ debug symbols: %d, set_symbols %d, aliases %d --> nsyms %d\n", global_sym_count, defined_global_sym_count, undefined_global_sym_count, local_sym_count, debugger_sym_count, set_symbol_count, global_alias_count, nsyms); +#ifdef DEBUG #endif outheader.a_syms = nsyms * sizeof (struct nlist); diff --git a/gnu/usr.bin/ld/lib.c b/gnu/usr.bin/ld/lib.c index 674f13103286..c75209e51be4 100644 --- a/gnu/usr.bin/ld/lib.c +++ b/gnu/usr.bin/ld/lib.c @@ -78,11 +78,11 @@ decode_library_subfile(desc, library_entry, subfile_offset, length_loc) { int bytes_read; register int namelen; - int member_length; + int member_length, content_length; register char *name; struct ar_hdr hdr1; register struct file_entry *subentry; - + int starting_offset; lseek(desc, subfile_offset, 0); bytes_read = read(desc, &hdr1, sizeof hdr1); @@ -104,22 +104,44 @@ decode_library_subfile(desc, library_entry, subfile_offset, length_loc) && hdr1.ar_name[namelen] != '/'; namelen++); - name = (char *) xmalloc(namelen + 1); - strncpy(name, hdr1.ar_name, namelen); - name[namelen] = 0; - + starting_offset = subfile_offset + sizeof hdr1; + content_length = member_length; +#ifdef AR_EFMT1 + /* + * BSD 4.4 extended AR format: #1/, with name as the + * first bytes of the file + */ + if ((hdr1.ar_name[0]=='#') && + (hdr1.ar_name[1]=='1') && + (hdr1.ar_name[2]=='/') && + (isdigit(hdr1.ar_name[3]))) + { + namelen = atoi (&hdr1.ar_name[3]); + name = (char *) xmalloc(namelen + 1); + read (desc, name, namelen); + name[namelen] = 0; + content_length -= namelen; + starting_offset += namelen; + } else +#endif + { + name = (char *) xmalloc(namelen + 1); + strncpy(name, hdr1.ar_name, namelen); + name[namelen] = 0; + } + subentry->filename = name; subentry->local_sym_name = name; subentry->symbols = 0; subentry->strings = 0; subentry->subfiles = 0; - subentry->starting_offset = subfile_offset + sizeof hdr1; + subentry->starting_offset = starting_offset; subentry->superfile = library_entry; subentry->library_flag = 0; subentry->header_read_flag = 0; subentry->just_syms_flag = 0; subentry->chain = 0; - subentry->total_size = member_length; + subentry->total_size = content_length; (*length_loc) = member_length; diff --git a/gnu/usr.bin/ld/rrs.c b/gnu/usr.bin/ld/rrs.c index 8ab992d67a82..6a3bf0810a82 100644 --- a/gnu/usr.bin/ld/rrs.c +++ b/gnu/usr.bin/ld/rrs.c @@ -27,7 +27,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: rrs.c,v 1.5 1993/11/30 20:47:29 jkh Exp $ + * $Id: rrs.c,v 1.4 1993/11/22 19:04:44 jkh Exp $ */ #include @@ -319,10 +319,8 @@ long *relocation; struct relocation_info *r = rrs_next_reloc(); if (rp->r_address < text_start + text_size) -#ifdef DEBUG error("%s: RRS text relocation at %#x for \"%s\"", get_file_name(entry), rp->r_address, sp->name); -#endif #ifdef DEBUG printf("claim_rrs_reloc: %s in %s\n", sp->name, get_file_name(entry)); -- cgit v1.2.3