Subject: port-alpha/2413: Bogons left from ecoff header changes
To: None <gnats-bugs@NetBSD.ORG>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: netbsd-bugs
Date: 05/14/1996 14:34:17
>Number:         2413
>Category:       port-alpha
>Synopsis:       Bogons left from ecoff header changes
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 14 17:50:04 1996
>Last-Modified:
>Originator:     Jason Thorpe
>Organization:
Numerical Aerodynamic Simulation Project - NASA Ames
>Release:        NetBSD 1.1B, May 13th, 1996
>Environment:
	
System: NetBSD nostromo 1.1B NetBSD 1.1B (NOSY) #9: Tue May 7 19:08:07 PDT 1996 thorpej@nostromo:/work/netbsd/src/sys/arch/alpha/compile/NOSY alpha


>Description:

	There appear to be a couple of mistakes in the recent ecoff
	header changes, and it appears that the C library nlist functions
	were not updated.

>How-To-Repeat:

	Try to compile a NetBSD/alpha C library.

>Fix:

	The diffs below fix a broken macro in alpha/include/ecoff.h
	and update the C library nlist functions to the new ecoff
	structure member names.

Index: lib/libc/gen/nlist.c
===================================================================
RCS file: /mastersrc/netbsd/src/lib/libc/gen/nlist.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 nlist.c
*** nlist.c	1995/12/27 23:45:40	1.1.1.1
--- nlist.c	1996/05/14 21:28:27
***************
*** 211,229 ****
  	if (ECOFF_BADMAG(filehdrp))
  		BADUNMAP;
  
! 	symhdroff = filehdrp->ef_symptr;
! 	symhdrsize = filehdrp->ef_syms;
  
  	if (check(symhdroff, sizeof *symhdrp) ||
  	    sizeof *symhdrp != symhdrsize)
  		BADUNMAP;
  	symhdrp = (struct ecoff_symhdr *)&mappedfile[symhdroff];
  
! 	nesyms = symhdrp->sh_esymmax;
! 	if (check(symhdrp->sh_esymoff, nesyms * sizeof *esyms))
  		BADUNMAP;
! 	esyms = (struct ecoff_extsym *)&mappedfile[symhdrp->sh_esymoff];
! 	extstroff = symhdrp->sh_estroff;
  
  	/*
  	 * clean out any left-over information for all valid entries.
--- 211,229 ----
  	if (ECOFF_BADMAG(filehdrp))
  		BADUNMAP;
  
! 	symhdroff = filehdrp->f_symptr;
! 	symhdrsize = filehdrp->f_nsyms;
  
  	if (check(symhdroff, sizeof *symhdrp) ||
  	    sizeof *symhdrp != symhdrsize)
  		BADUNMAP;
  	symhdrp = (struct ecoff_symhdr *)&mappedfile[symhdroff];
  
! 	nesyms = symhdrp->esymMax;
! 	if (check(symhdrp->cbExtOffset, nesyms * sizeof *esyms))
  		BADUNMAP;
! 	esyms = (struct ecoff_extsym *)&mappedfile[symhdrp->cbExtOffset];
! 	extstroff = symhdrp->cbSsExtOffset;
  
  	/*
  	 * clean out any left-over information for all valid entries.
Index: sys/arch/alpha/include/ecoff.h
===================================================================
RCS file: /mastersrc/netbsd/src/sys/arch/alpha/include/ecoff.h,v
retrieving revision 1.1.1.2
diff -c -r1.1.1.2 ecoff.h
*** ecoff.h	1996/05/13 03:57:01	1.1.1.2
--- ecoff.h	1996/05/14 21:18:48
***************
*** 44,55 ****
  #define ECOFF_MAGIC_ALPHA		0603
  #define ECOFF_MAGIC_NETBSD_ALPHA	0605
  #define ECOFF_BADMAG(ep)						\
! 	((ep)->f.f_magic != ECOFF_MAGIC_ALPHA &&			\
! 	    (ep)->f.f_magic != ECOFF_MAGIC_NETBSD_ALPHA)
  
  #define ECOFF_FLAG_EXEC			0002
  #define ECOFF_SEGMENT_ALIGNMENT(ep) \
!     (((ep)->f.f_flags & ECOFF_FLAG_EXEC) == 0 ? 8 : 16)
  
  struct ecoff_symhdr {
  	int16_t		magic;
--- 44,55 ----
  #define ECOFF_MAGIC_ALPHA		0603
  #define ECOFF_MAGIC_NETBSD_ALPHA	0605
  #define ECOFF_BADMAG(ep)						\
! 	((ep)->f_magic != ECOFF_MAGIC_ALPHA &&				\
! 	    (ep)->f_magic != ECOFF_MAGIC_NETBSD_ALPHA)
  
  #define ECOFF_FLAG_EXEC			0002
  #define ECOFF_SEGMENT_ALIGNMENT(ep) \
!     (((ep)->f_flags & ECOFF_FLAG_EXEC) == 0 ? 8 : 16)
  
  struct ecoff_symhdr {
  	int16_t		magic;
>Audit-Trail:
>Unformatted: