CVS commit: src/external/bsd/libelf/dist

2014-01-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Jan  2 19:20:35 UTC 2014

Modified Files:
src/external/bsd/libelf/dist: libelf.h libelf_data.c

Log Message:
add gnu attributes to the known sections


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/libelf/dist/libelf.h
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/libelf/dist/libelf_data.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/libelf.h
diff -u src/external/bsd/libelf/dist/libelf.h:1.7 src/external/bsd/libelf/dist/libelf.h:1.8
--- src/external/bsd/libelf/dist/libelf.h:1.7	Mon Feb 22 05:48:32 2010
+++ src/external/bsd/libelf/dist/libelf.h	Thu Jan  2 14:20:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf.h,v 1.7 2010/02/22 10:48:32 darran Exp $	*/
+/*	$NetBSD: libelf.h,v 1.8 2014/01/02 19:20:35 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -54,6 +54,7 @@
 # define __LIBELF_HAVE_ELF_NOTE		1
 # define __LIBELF_HAVE_ELF_SYMINFO	1
 # define __LIBELF_HAVE_ELF_VERS		1
+# define __LIBELF_HAVE_ELF_ATTRIBUTES	1
 #elif defined(__FreeBSD__)
 # include sys/elf32.h
 # include sys/elf64.h

Index: src/external/bsd/libelf/dist/libelf_data.c
diff -u src/external/bsd/libelf/dist/libelf_data.c:1.5 src/external/bsd/libelf/dist/libelf_data.c:1.6
--- src/external/bsd/libelf/dist/libelf_data.c:1.5	Thu Jun 20 21:36:31 2013
+++ src/external/bsd/libelf/dist/libelf_data.c	Thu Jan  2 14:20:35 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf_data.c,v 1.5 2013/06/21 01:36:31 christos Exp $	*/
+/*	$NetBSD: libelf_data.c,v 1.6 2014/01/02 19:20:35 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -87,6 +87,10 @@ _libelf_xlate_shtype(uint32_t sht)
 	case SHT_SUNW_syminfo:
 		return (ELF_T_SYMINFO);
 #endif /* __LIBELF_HAVE_ELF_SYMINFO */
+#if defined(__LIBELF_HAVE_ELF_ATTRIBUTES)
+	case SHT_GNU_ATTRIBUTES:
+		return (ELF_T_BYTE);	/* XXX */
+#endif /* __LIBELF_HAVE_ELF_ATTRIBUTES */
 	default:
 		if (sht = SHT_LOPROC  sht = SHT_HIPROC)
 			return (ELF_T_BYTE);



CVS commit: src/external/bsd/libelf/dist

2013-10-18 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Oct 18 08:04:47 UTC 2013

Modified Files:
src/external/bsd/libelf/dist: elf_update.c libelf_phdr.c

Log Message:
remove some set-but unused variables.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/libelf/dist/elf_update.c \
src/external/bsd/libelf/dist/libelf_phdr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/elf_update.c
diff -u src/external/bsd/libelf/dist/elf_update.c:1.4 src/external/bsd/libelf/dist/elf_update.c:1.5
--- src/external/bsd/libelf/dist/elf_update.c:1.4	Mon Feb 22 10:48:32 2010
+++ src/external/bsd/libelf/dist/elf_update.c	Fri Oct 18 08:04:47 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf_update.c,v 1.4 2010/02/22 10:48:32 darran Exp $	*/
+/*	$NetBSD: elf_update.c,v 1.5 2013/10/18 08:04:47 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2006-2008 Joseph Koshy
@@ -357,7 +357,7 @@ _libelf_resync_sections(Elf *e, off_t rc
 static off_t
 _libelf_resync_elf(Elf *e)
 {
-	int ec, eh_class, eh_type;
+	int ec, eh_class;
 	unsigned int eh_byteorder, eh_version;
 	size_t align, fsz;
 	size_t phnum, shnum;
@@ -386,14 +386,12 @@ _libelf_resync_elf(Elf *e)
 		eh_class = eh32-e_ident[EI_CLASS];
 		phoff= (uint64_t) eh32-e_phoff;
 		shoff= (uint64_t) eh32-e_shoff;
-		eh_type  = eh32-e_type;
 		eh_version   = eh32-e_version;
 	} else {
 		eh_byteorder = eh64-e_ident[EI_DATA];
 		eh_class = eh64-e_ident[EI_CLASS];
 		phoff= eh64-e_phoff;
 		shoff= eh64-e_shoff;
-		eh_type  = eh64-e_type;
 		eh_version   = eh64-e_version;
 	}
 
Index: src/external/bsd/libelf/dist/libelf_phdr.c
diff -u src/external/bsd/libelf/dist/libelf_phdr.c:1.4 src/external/bsd/libelf/dist/libelf_phdr.c:1.5
--- src/external/bsd/libelf/dist/libelf_phdr.c:1.4	Mon Feb 22 10:48:33 2010
+++ src/external/bsd/libelf/dist/libelf_phdr.c	Fri Oct 18 08:04:47 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf_phdr.c,v 1.4 2010/02/22 10:48:33 darran Exp $	*/
+/*	$NetBSD: libelf_phdr.c,v 1.5 2013/10/18 08:04:47 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -45,7 +45,7 @@
 void *
 _libelf_getphdr(Elf *e, int ec)
 {
-	size_t phnum, phentsize;
+	size_t phnum;
 	size_t fsz, msz;
 	uint64_t phoff;
 	Elf32_Ehdr *eh32;
@@ -76,11 +76,9 @@ _libelf_getphdr(Elf *e, int ec)
 
 	if (ec == ELFCLASS32) {
 		eh32  = (Elf32_Ehdr *) ehdr;
-		phentsize = eh32-e_phentsize;
 		phoff = (uint64_t) eh32-e_phoff;
 	} else {
 		eh64  = (Elf64_Ehdr *) ehdr;
-		phentsize = eh64-e_phentsize;
 		phoff = (uint64_t) eh64-e_phoff;
 	}
 



CVS commit: src/external/bsd/libelf/dist

2013-06-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Jun 21 01:36:31 UTC 2013

Modified Files:
src/external/bsd/libelf/dist: libelf_data.c

Log Message:
Instead of hard-coding each processor-specific section type, handle all
processor-specific section types the same way.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/libelf/dist/libelf_data.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/libelf_data.c
diff -u src/external/bsd/libelf/dist/libelf_data.c:1.4 src/external/bsd/libelf/dist/libelf_data.c:1.5
--- src/external/bsd/libelf/dist/libelf_data.c:1.4	Mon Feb 22 05:48:33 2010
+++ src/external/bsd/libelf/dist/libelf_data.c	Thu Jun 20 21:36:31 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf_data.c,v 1.4 2010/02/22 10:48:33 darran Exp $	*/
+/*	$NetBSD: libelf_data.c,v 1.5 2013/06/21 01:36:31 christos Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -87,9 +87,9 @@ _libelf_xlate_shtype(uint32_t sht)
 	case SHT_SUNW_syminfo:
 		return (ELF_T_SYMINFO);
 #endif /* __LIBELF_HAVE_ELF_SYMINFO */
-	case SHT_AMD64_UNWIND:	/* == SHT_IA_64_UNWIND */
-		return (ELF_T_BYTE);
 	default:
+		if (sht = SHT_LOPROC  sht = SHT_HIPROC)
+			return (ELF_T_BYTE);
 		return (-1);
 	}
 }



CVS commit: src/external/bsd/libelf/dist

2010-10-30 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Sun Oct 31 05:03:12 UTC 2010

Modified Files:
src/external/bsd/libelf/dist: _libelf.h elf_begin.c elf_end.c

Log Message:
fall back to malloc+pread when stat+malloc doesn't seem to work.
it allows libelf work on /dev/ksyms.

XXX the name of the flag is a bit confusing and i think it's better to rename
MALLOCED to DATA_MALLOCED or such.  but i don't think it's worth increasing
the diff against the upstream for it.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/libelf/dist/_libelf.h
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/libelf/dist/elf_begin.c
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libelf/dist/elf_end.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/_libelf.h
diff -u src/external/bsd/libelf/dist/_libelf.h:1.5 src/external/bsd/libelf/dist/_libelf.h:1.6
--- src/external/bsd/libelf/dist/_libelf.h:1.5	Tue Mar  2 21:08:36 2010
+++ src/external/bsd/libelf/dist/_libelf.h	Sun Oct 31 05:03:12 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: _libelf.h,v 1.5 2010/03/02 21:08:36 darran Exp $	*/
+/*	$NetBSD: _libelf.h,v 1.6 2010/10/31 05:03:12 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -75,6 +75,7 @@
 #define	LIBELF_F_MALLOCED	0x01 /* whether data was malloc'ed */
 #define	LIBELF_F_MMAP		0x02 /* whether e_rawfile was mmap'ed */
 #define	LIBELF_F_SHDRS_LOADED	0x04 /* whether all shdrs were read in */
+#define	LIBELF_F_MALLOC		0x08 /* whether e_rawfile was mmap'ed */
 
 struct _Elf {
 	int		e_activations;	/* activation count */

Index: src/external/bsd/libelf/dist/elf_begin.c
diff -u src/external/bsd/libelf/dist/elf_begin.c:1.6 src/external/bsd/libelf/dist/elf_begin.c:1.7
--- src/external/bsd/libelf/dist/elf_begin.c:1.6	Mon Feb 22 10:59:08 2010
+++ src/external/bsd/libelf/dist/elf_begin.c	Sun Oct 31 05:03:12 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf_begin.c,v 1.6 2010/02/22 10:59:08 darran Exp $	*/
+/*	$NetBSD: elf_begin.c,v 1.7 2010/10/31 05:03:12 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -41,6 +41,9 @@
 #include err.h
 #include errno.h
 #include libelf.h
+#include stdbool.h
+#include stdlib.h
+#include unistd.h
 
 #include _libelf.h
 
@@ -49,7 +52,9 @@
 {
 	Elf *e;
 	void *m;
+	void *p; /* malloc'ed pointer */
 	struct stat sb;
+	size_t objsize;
 
 	/*
 	 * 'Raw' files are always mapped with 'PROT_READ'.  At
@@ -63,18 +68,76 @@
 	}
 
 	m = NULL;
-	if ((m = mmap(NULL, (size_t) sb.st_size, PROT_READ, MAP_PRIVATE, fd,
+	p = NULL;
+	if (sb.st_size == 0) {
+		/*
+		 * Might be a special device like /dev/ksyms.  Try read(2)ing.
+		 */
+		goto doread;
+	}
+	objsize = (size_t) sb.st_size;
+	if ((m = mmap(NULL, objsize, PROT_READ, MAP_PRIVATE, fd,
 	(off_t) 0)) == MAP_FAILED) {
-		LIBELF_SET_ERROR(IO, errno);
-		return (NULL);
+		size_t bufsize;
+
+		if (errno != EINVAL) {
+			LIBELF_SET_ERROR(IO, errno);
+			return (NULL);
+		}
+doread:
+		/*
+		 * Fall back to malloc+read.
+		 */
+		bufsize = 1024 * 1024;
+		while (/*CONSTCOND*/true) {
+			void *newp = realloc(p, bufsize);
+			ssize_t rsz;
+
+			if (newp == NULL) {
+free(p);
+LIBELF_SET_ERROR(RESOURCE, 0);
+return (NULL);
+			}
+			p = newp;
+			rsz = pread(fd, p, bufsize, 0);
+			if (rsz == -1) {
+free(p);
+LIBELF_SET_ERROR(IO, errno);
+return (NULL);
+			} else if ((size_t) rsz  bufsize) {
+free(p);
+LIBELF_SET_ERROR(IO, EIO); /* XXX */
+return (NULL);
+			} else if ((size_t) rsz  bufsize) {
+/*
+ * try to shrink the buffer.
+ */
+newp = realloc(p, (size_t) rsz);
+if (newp != NULL) {
+	p = newp;
+}
+break;
+			}
+			bufsize *= 2;
+		}
+		m = p;
+		objsize = bufsize;
 	}
 
-	if ((e = elf_memory(m, (size_t) sb.st_size)) == NULL) {
-		(void) munmap(m, (size_t) sb.st_size);
+	if ((e = elf_memory(m, objsize)) == NULL) {
+		if (p != NULL) {
+			free(p);
+		} else {
+			(void) munmap(m, objsize);
+		}
 		return (NULL);
 	}
 
-	e-e_flags |= LIBELF_F_MMAP;
+	if (p != NULL) {
+		e-e_flags |= LIBELF_F_MALLOC;
+	} else {
+		e-e_flags |= LIBELF_F_MMAP;
+	}
 	e-e_fd = fd;
 	e-e_cmd = c;
 

Index: src/external/bsd/libelf/dist/elf_end.c
diff -u src/external/bsd/libelf/dist/elf_end.c:1.2 src/external/bsd/libelf/dist/elf_end.c:1.3
--- src/external/bsd/libelf/dist/elf_end.c:1.2	Mon Feb 22 10:48:32 2010
+++ src/external/bsd/libelf/dist/elf_end.c	Sun Oct 31 05:03:12 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf_end.c,v 1.2 2010/02/22 10:48:32 darran Exp $	*/
+/*	$NetBSD: elf_end.c,v 1.3 2010/10/31 05:03:12 yamt Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -82,6 +82,8 @@
 
 		if (e-e_flags  LIBELF_F_MMAP)
 			(void) munmap(e-e_rawfile, e-e_rawsize);
+		if (e-e_flags  LIBELF_F_MALLOC)
+			(void) free(e-e_rawfile);
 
 		sv = e;
 		if ((e = e-e_parent) != NULL)



CVS commit: src/external/bsd/libelf/dist

2009-12-29 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Tue Dec 29 16:58:10 UTC 2009

Update of /cvsroot/src/external/bsd/libelf/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv13969

Log Message:
Import libelf from FreeBSD 8.0-RELEASE.  The main purpose of this is to
get a new import after prepare-import.sh was changed to not insert NetBSD
__RCSID() macros (which are problematic for host tool builds).

Status:

Vendor Tag: FreeBSD
Release Tags:   FreeBSD-8-0-RELEASE

U src/external/bsd/libelf/dist/_libelf.h
U src/external/bsd/libelf/dist/elf.3
U src/external/bsd/libelf/dist/elf_begin.3
C src/external/bsd/libelf/dist/elf_begin.c
U src/external/bsd/libelf/dist/elf_cntl.3
U src/external/bsd/libelf/dist/elf_cntl.c
C src/external/bsd/libelf/dist/elf_data.c
U src/external/bsd/libelf/dist/elf_end.3
U src/external/bsd/libelf/dist/elf_end.c
U src/external/bsd/libelf/dist/elf_errmsg.3
U src/external/bsd/libelf/dist/elf_errmsg.c
U src/external/bsd/libelf/dist/elf_errno.c
U src/external/bsd/libelf/dist/elf_fill.3
U src/external/bsd/libelf/dist/elf_fill.c
U src/external/bsd/libelf/dist/elf_flag.c
U src/external/bsd/libelf/dist/elf_flagdata.3
U src/external/bsd/libelf/dist/elf_getarhdr.3
U src/external/bsd/libelf/dist/elf_getarhdr.c
U src/external/bsd/libelf/dist/elf_getarsym.3
U src/external/bsd/libelf/dist/elf_getarsym.c
U src/external/bsd/libelf/dist/elf_getbase.3
U src/external/bsd/libelf/dist/elf_getbase.c
U src/external/bsd/libelf/dist/elf_getdata.3
U src/external/bsd/libelf/dist/elf_getident.3
U src/external/bsd/libelf/dist/elf_getident.c
U src/external/bsd/libelf/dist/elf_getphnum.3
U src/external/bsd/libelf/dist/elf_getscn.3
U src/external/bsd/libelf/dist/elf_getshnum.3
U src/external/bsd/libelf/dist/elf_getshstrndx.3
U src/external/bsd/libelf/dist/elf_hash.3
C src/external/bsd/libelf/dist/elf_hash.c
U src/external/bsd/libelf/dist/elf_kind.3
U src/external/bsd/libelf/dist/elf_kind.c
U src/external/bsd/libelf/dist/elf_memory.3
U src/external/bsd/libelf/dist/elf_memory.c
U src/external/bsd/libelf/dist/elf_next.3
U src/external/bsd/libelf/dist/elf_next.c
U src/external/bsd/libelf/dist/elf_phnum.c
U src/external/bsd/libelf/dist/elf_rand.3
U src/external/bsd/libelf/dist/elf_rand.c
U src/external/bsd/libelf/dist/elf_rawfile.3
U src/external/bsd/libelf/dist/elf_rawfile.c
C src/external/bsd/libelf/dist/elf_scn.c
U src/external/bsd/libelf/dist/elf_shnum.c
U src/external/bsd/libelf/dist/elf_shstrndx.c
U src/external/bsd/libelf/dist/elf_strptr.3
U src/external/bsd/libelf/dist/elf_strptr.c
U src/external/bsd/libelf/dist/elf_types.m4
U src/external/bsd/libelf/dist/elf_update.3
C src/external/bsd/libelf/dist/elf_update.c
U src/external/bsd/libelf/dist/elf_version.3
U src/external/bsd/libelf/dist/elf_version.c
U src/external/bsd/libelf/dist/gelf.3
U src/external/bsd/libelf/dist/gelf.h
C src/external/bsd/libelf/dist/gelf_cap.c
U src/external/bsd/libelf/dist/gelf_checksum.3
U src/external/bsd/libelf/dist/gelf_checksum.c
C src/external/bsd/libelf/dist/gelf_dyn.c
C src/external/bsd/libelf/dist/gelf_ehdr.c
U src/external/bsd/libelf/dist/gelf_fsize.3
U src/external/bsd/libelf/dist/gelf_fsize.c
U src/external/bsd/libelf/dist/gelf_getcap.3
U src/external/bsd/libelf/dist/gelf_getclass.3
U src/external/bsd/libelf/dist/gelf_getclass.c
U src/external/bsd/libelf/dist/gelf_getdyn.3
U src/external/bsd/libelf/dist/gelf_getehdr.3
U src/external/bsd/libelf/dist/gelf_getmove.3
U src/external/bsd/libelf/dist/gelf_getphdr.3
U src/external/bsd/libelf/dist/gelf_getrel.3
U src/external/bsd/libelf/dist/gelf_getrela.3
U src/external/bsd/libelf/dist/gelf_getshdr.3
U src/external/bsd/libelf/dist/gelf_getsym.3
U src/external/bsd/libelf/dist/gelf_getsyminfo.3
U src/external/bsd/libelf/dist/gelf_getsymshndx.3
C src/external/bsd/libelf/dist/gelf_move.c
U src/external/bsd/libelf/dist/gelf_newehdr.3
U src/external/bsd/libelf/dist/gelf_newphdr.3
C src/external/bsd/libelf/dist/gelf_phdr.c
C src/external/bsd/libelf/dist/gelf_rel.c
C src/external/bsd/libelf/dist/gelf_rela.c
C src/external/bsd/libelf/dist/gelf_shdr.c
C src/external/bsd/libelf/dist/gelf_sym.c
C src/external/bsd/libelf/dist/gelf_syminfo.c
C src/external/bsd/libelf/dist/gelf_symshndx.c
U src/external/bsd/libelf/dist/gelf_update_ehdr.3
U src/external/bsd/libelf/dist/gelf_xlate.c
U src/external/bsd/libelf/dist/gelf_xlatetof.3
C src/external/bsd/libelf/dist/libelf.c
U src/external/bsd/libelf/dist/libelf.h
C src/external/bsd/libelf/dist/libelf_align.c
C src/external/bsd/libelf/dist/libelf_allocate.c
C src/external/bsd/libelf/dist/libelf_ar.c
U src/external/bsd/libelf/dist/libelf_checksum.c
C src/external/bsd/libelf/dist/libelf_convert.m4
C src/external/bsd/libelf/dist/libelf_data.c
C src/external/bsd/libelf/dist/libelf_ehdr.c
U src/external/bsd/libelf/dist/libelf_extended.c
U src/external/bsd/libelf/dist/libelf_fsize.m4
C src/external/bsd/libelf/dist/libelf_msize.m4
C src/external/bsd/libelf/dist/libelf_phdr.c
U src/external/bsd/libelf/dist/libelf_shdr.c
C 

CVS commit: src/external/bsd/libelf/dist

2009-12-29 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Dec 29 18:07:28 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: elf.3

Log Message:
Do not use .Xo/.Xc to work around ancient roff limits.
Remove .TE without matching .TS.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libelf/dist/elf.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/elf.3
diff -u src/external/bsd/libelf/dist/elf.3:1.2 src/external/bsd/libelf/dist/elf.3:1.3
--- src/external/bsd/libelf/dist/elf.3:1.2	Mon Dec 21 18:27:48 2009
+++ src/external/bsd/libelf/dist/elf.3	Tue Dec 29 18:07:28 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: elf.3,v 1.2 2009/12/21 18:27:48 thorpej Exp $
+.\	$NetBSD: elf.3,v 1.3 2009/12/29 18:07:28 joerg Exp $
 .\
 .\ Copyright (c) 2006,2007 Joseph Koshy.  All rights reserved.
 .\
@@ -353,20 +353,13 @@
 and the types supported by the library.
 .Bl -column .Dv SHT_PREINIT_ARRAY .Dv ELF_T_SYMINFO
 .It Em Section Type Ta Em Library Type Ta Em Description
-.It Dv SHT_DYNAMIC Ta Dv ELF_T_DYN Ta Xo
-.Sq .dynamic
-section entries.
-.Xc
+.It Dv SHT_DYNAMIC Ta Dv ELF_T_DYN Ta So .dynamic Sc section entries.
 .It Dv SHT_DYNSYM Ta Dv ELF_T_SYM Ta Symbols for dynamic linking.
 .It Dv SHT_FINI_ARRAY Ta Dv ELF_T_ADDR Ta Termination function pointers.
 .It Dv SHT_GROUP Ta Dv ELF_T_WORD Ta Section group marker.
 .It Dv SHT_HASH Ta Dv ELF_T_HASH Ta Symbol hashes.
 .It Dv SHT_INIT_ARRAY Ta Dv ELF_T_ADDR Ta Initialization function pointers.
-.It Dv SHT_NOBITS Ta Dv ELF_T_BYTE Ta Xo
-Empty sections.
-See
-.Xr elf 5 .
-.Xc
+.It Dv SHT_NOBITS Ta Dv ELF_T_BYTE Ta Empty sections.  See Xr elf 5 .
 .It Dv SHT_NOTE Ta Dv ELF_T_NOTE Ta ELF note records.
 .It Dv SHT_PREINIT_ARRAY Ta Dv ELF_T_ADDR Ta Pre-initialization function pointers.
 .It Dv SHT_PROGBITS Ta Dv ELF_T_BYTE Ta Machine code.
@@ -381,7 +374,6 @@
 .It Dv SHT_SUNW_move Ta Dv ELF_T_MOVE Ta ELF move records.
 .It Dv SHT_SUNW_syminfo Ta Dv ELF_T_SYMINFO Ta Additional symbol flags.
 .El
-.TE
 .Ss Functional Grouping
 This section contains a brief overview of the available functionality
 in the ELF library.



CVS commit: src/external/bsd/libelf/dist

2009-12-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Mon Dec 21 18:27:48 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: elf.3

Log Message:
Note when this appeared in NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/libelf/dist/elf.3

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/elf.3
diff -u src/external/bsd/libelf/dist/elf.3:1.1.1.1 src/external/bsd/libelf/dist/elf.3:1.2
--- src/external/bsd/libelf/dist/elf.3:1.1.1.1	Sat Dec 19 05:43:39 2009
+++ src/external/bsd/libelf/dist/elf.3	Mon Dec 21 18:27:48 2009
@@ -1,4 +1,4 @@
-.\	$NetBSD: elf.3,v 1.1.1.1 2009/12/19 05:43:39 thorpej Exp $
+.\	$NetBSD: elf.3,v 1.2 2009/12/21 18:27:48 thorpej Exp $
 .\
 .\ Copyright (c) 2006,2007 Joseph Koshy.  All rights reserved.
 .\
@@ -573,8 +573,10 @@
 .Xr elf 5
 .Sh HISTORY
 The original ELF(3) API was developed for Unix System V.
-The current implementation of the ELF(3) API appeared in
-.Fx 7.0 .
+This implementation first appeared in
+.Fx 7.0
+and
+.Nx 6.0 .
 .Sh AUTHORS
 The ELF library was written by
 .An Joseph Koshy



CVS commit: src/external/bsd/libelf/dist

2009-12-20 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Dec 20 19:38:13 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: libelf.c

Log Message:
PRIVATE_VERSION(arch) isn't ever used, so don't try to setup this member
of _libelf{}.  ELF??_MACHDEP_ID may not be defined if ELFSIZE wasn't
defined before including this file.

this fixes a build error on mips platforms.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/libelf/dist/libelf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/libelf.c
diff -u src/external/bsd/libelf/dist/libelf.c:1.3 src/external/bsd/libelf/dist/libelf.c:1.4
--- src/external/bsd/libelf/dist/libelf.c:1.3	Sat Dec 19 07:52:59 2009
+++ src/external/bsd/libelf/dist/libelf.c	Sun Dec 20 19:38:13 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf.c,v 1.3 2009/12/19 07:52:59 thorpej Exp $	*/
+/*	$NetBSD: libelf.c,v 1.4 2009/12/20 19:38:13 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/libelf.c,v 1.1.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: libelf.c,v 1.3 2009/12/19 07:52:59 thorpej Exp $);
+__RCSID($NetBSD: libelf.c,v 1.4 2009/12/20 19:38:13 mrg Exp $);
 
 #include sys/param.h
 
@@ -43,18 +43,16 @@
 
 #if defined(__NetBSD__)
 # if ARCH_ELFSIZE == 64
-#  define ELF_ARCH		ELF64_MACHDEP_ID
 #  define ELF_TARG_DATA		ELF64_MACHDEP_ENDIANNESS
 #  define ELF_TARG_CLASS	ELFCLASS64
 # else
-#  define ELF_ARCH		ELF32_MACHDEP_ID
 #  define ELF_TARG_DATA		ELF32_MACHDEP_ENDIANNESS
 #  define ELF_TARG_CLASS	ELFCLASS32
 # endif /* ARCH_ELFSIZE */
 #endif /* __NetBSD__ */
 
 struct _libelf_globals _libelf = {
-	.libelf_arch		= ELF_ARCH,
+	.libelf_arch		= 0 /* unused - ELF_ARCH */,
 	.libelf_byteorder	= ELF_TARG_DATA,
 	.libelf_class		= ELF_TARG_CLASS,
 	.libelf_error		= 0,



CVS commit: src/external/bsd/libelf/dist

2009-12-20 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Dec 20 23:23:46 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: _libelf.h elf_begin.c elf_data.c
elf_scn.c libelf.c libelf_ehdr.c libelf_phdr.c libelf_xlate.c

Log Message:
- _libelf_globals::libelf_arch and _libelf_globals::libelf_class are
  completely unused.  Remove them.
- _libelf_globals::libelf_byteorder is really all about the byte order of
  the host running libelf, so replace it with a _libelf_host_byteorder()
  internal function that computes the host byte order in a very portable
  way (doesn't rely on BSD-specific header files).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/libelf/dist/_libelf.h \
src/external/bsd/libelf/dist/elf_scn.c \
src/external/bsd/libelf/dist/libelf_ehdr.c
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libelf/dist/elf_begin.c
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/libelf/dist/elf_data.c \
src/external/bsd/libelf/dist/libelf_phdr.c \
src/external/bsd/libelf/dist/libelf_xlate.c
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/libelf/dist/libelf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/_libelf.h
diff -u src/external/bsd/libelf/dist/_libelf.h:1.3 src/external/bsd/libelf/dist/_libelf.h:1.4
--- src/external/bsd/libelf/dist/_libelf.h:1.3	Sat Dec 19 07:47:22 2009
+++ src/external/bsd/libelf/dist/_libelf.h	Sun Dec 20 23:23:46 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: _libelf.h,v 1.3 2009/12/19 07:47:22 thorpej Exp $	*/
+/*	$NetBSD: _libelf.h,v 1.4 2009/12/20 23:23:46 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -44,9 +44,6 @@
 #define LIBELF_MSG_SIZE	256
 
 struct _libelf_globals {
-	int		libelf_arch;
-	unsigned int	libelf_byteorder;
-	int		libelf_class;
 	int		libelf_error;
 	int		libelf_fillchar;
 	unsigned int	libelf_version;
@@ -161,6 +158,8 @@
  * Prototypes
  */
 
+unsigned int _libelf_host_byteorder(void);
+
 Elf_Data *_libelf_allocate_data(Elf_Scn *_s);
 Elf	*_libelf_allocate_elf(void);
 Elf_Scn	*_libelf_allocate_scn(Elf *_e, size_t _ndx);
Index: src/external/bsd/libelf/dist/elf_scn.c
diff -u src/external/bsd/libelf/dist/elf_scn.c:1.3 src/external/bsd/libelf/dist/elf_scn.c:1.4
--- src/external/bsd/libelf/dist/elf_scn.c:1.3	Sat Dec 19 07:44:27 2009
+++ src/external/bsd/libelf/dist/elf_scn.c	Sun Dec 20 23:23:46 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf_scn.c,v 1.3 2009/12/19 07:44:27 thorpej Exp $	*/
+/*	$NetBSD: elf_scn.c,v 1.4 2009/12/20 23:23:46 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/elf_scn.c,v 1.2.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: elf_scn.c,v 1.3 2009/12/19 07:44:27 thorpej Exp $);
+__RCSID($NetBSD: elf_scn.c,v 1.4 2009/12/20 23:23:46 thorpej Exp $);
 
 #include assert.h
 #include errno.h
@@ -85,7 +85,7 @@
 
 	xlator = _libelf_get_translator(ELF_T_SHDR, ELF_TOMEMORY, ec);
 
-	swapbytes = e-e_byteorder != LIBELF_PRIVATE(byteorder);
+	swapbytes = e-e_byteorder != _libelf_host_byteorder();
 	if (shoff  SSIZE_MAX) {
 		LIBELF_SET_ERROR(HEADER, 0);
 		return (0);
Index: src/external/bsd/libelf/dist/libelf_ehdr.c
diff -u src/external/bsd/libelf/dist/libelf_ehdr.c:1.3 src/external/bsd/libelf/dist/libelf_ehdr.c:1.4
--- src/external/bsd/libelf/dist/libelf_ehdr.c:1.3	Sat Dec 19 09:00:56 2009
+++ src/external/bsd/libelf/dist/libelf_ehdr.c	Sun Dec 20 23:23:46 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf_ehdr.c,v 1.3 2009/12/19 09:00:56 thorpej Exp $	*/
+/*	$NetBSD: libelf_ehdr.c,v 1.4 2009/12/20 23:23:46 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -30,7 +30,7 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/libelf_ehdr.c,v 1.2.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: libelf_ehdr.c,v 1.3 2009/12/19 09:00:56 thorpej Exp $);
+__RCSID($NetBSD: libelf_ehdr.c,v 1.4 2009/12/20 23:23:46 thorpej Exp $);
 
 #include assert.h
 #include gelf.h
@@ -73,7 +73,7 @@
 
 	xlator = _libelf_get_translator(ELF_T_SHDR, ELF_TOMEMORY, ec);
 	(*xlator)((void *) scn-s_shdr, e-e_rawfile + (ssize_t)shoff,
-	(size_t) 1, e-e_byteorder != LIBELF_PRIVATE(byteorder));
+	(size_t) 1, e-e_byteorder != _libelf_host_byteorder());
 
 #define	GET_SHDR_MEMBER(M) ((ec == ELFCLASS32) ? scn-s_shdr.s_shdr32.M : \
 		scn-s_shdr.s_shdr64.M)
@@ -182,7 +182,7 @@
 
 	xlator = _libelf_get_translator(ELF_T_EHDR, ELF_TOMEMORY, ec);
 	(*xlator)(ehdr, e-e_rawfile, (size_t) 1,
-	e-e_byteorder != LIBELF_PRIVATE(byteorder));
+	e-e_byteorder != _libelf_host_byteorder());
 
 	/*
 	 * If extended numbering is being used, read the correct

Index: src/external/bsd/libelf/dist/elf_begin.c
diff -u src/external/bsd/libelf/dist/elf_begin.c:1.2 src/external/bsd/libelf/dist/elf_begin.c:1.3
--- src/external/bsd/libelf/dist/elf_begin.c:1.2	Sat Dec 19 06:22:25 2009
+++ 

CVS commit: src/external/bsd/libelf/dist

2009-12-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Dec 20 05:52:15 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: libelf.h

Log Message:
Enable __LIBELF_HAVE_ELF_SYMINFO.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/libelf/dist/libelf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/libelf.h
diff -u src/external/bsd/libelf/dist/libelf.h:1.3 src/external/bsd/libelf/dist/libelf.h:1.4
--- src/external/bsd/libelf/dist/libelf.h:1.3	Sat Dec 19 07:58:24 2009
+++ src/external/bsd/libelf/dist/libelf.h	Sun Dec 20 05:52:15 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf.h,v 1.3 2009/12/19 07:58:24 thorpej Exp $	*/
+/*	$NetBSD: libelf.h,v 1.4 2009/12/20 05:52:15 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -39,7 +39,7 @@
 # define __LIBELF_HAVE_ELF_CAP		1
 # define __LIBELF_HAVE_ELF_MOVE		1
 # define __LIBELF_HAVE_ELF_NOTE		1
-/* # define __LIBELF_HAVE_ELF_SYMINFO	1 */
+# define __LIBELF_HAVE_ELF_SYMINFO	1
 # define __LIBELF_HAVE_ELF_VERS		1
 #endif /* __NetBSD__ */
 



CVS commit: src/external/bsd/libelf/dist

2009-12-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 08:40:58 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: libelf_convert.m4

Log Message:
Fix all sorts of problems with lint and compiler warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/libelf/dist/libelf_convert.m4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/libelf_convert.m4
diff -u src/external/bsd/libelf/dist/libelf_convert.m4:1.5 src/external/bsd/libelf/dist/libelf_convert.m4:1.6
--- src/external/bsd/libelf/dist/libelf_convert.m4:1.5	Sat Dec 19 07:33:06 2009
+++ src/external/bsd/libelf/dist/libelf_convert.m4	Sat Dec 19 08:40:57 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf_convert.m4,v 1.5 2009/12/19 07:33:06 thorpej Exp $	*/
+/*	$NetBSD: libelf_convert.m4,v 1.6 2009/12/19 08:40:57 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006,2007 Joseph Koshy
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/libelf_convert.m4,v 1.4.2.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: libelf_convert.m4,v 1.5 2009/12/19 07:33:06 thorpej Exp $);
+__RCSID($NetBSD: libelf_convert.m4,v 1.6 2009/12/19 08:40:57 thorpej Exp $);
 
 #include sys/types.h
 
@@ -46,9 +46,9 @@
 
 #define	SWAP_HALF(X) 	do {		\
 		uint16_t _x = (uint16_t) (X);\
-		uint16_t _t = _x  0xFF;\
+		uint32_t _t = _x  0xFF;\
 		_t = 8; _x = 8; _t |= _x  0xFF;			\
-		(X) = _t;		\
+		(X) = (uint16_t)(_t  0x);\
 	} while (/*CONSTCOND*/0)
 #define	SWAP_WORD(X) 	do {		\
 		uint32_t _x = (uint32_t) (X);\
@@ -85,44 +85,53 @@
  * destination pointer is incremented after the write.
  */
 #define	WRITE_BYTE(P,X) do {		\
-		unsigned char *const _p = (unsigned char *) (P);	\
+		unsigned char *const _p = (void *) (P);			\
 		_p[0]		= (unsigned char) (X);			\
-		(P)		= _p + 1;\
+		(P)		= (void *)(_p + 1);			\
 	} while (/*CONSTCOND*/0)
 #define	WRITE_HALF(P,X)	do {		\
-		uint16_t _t	= (X);	\
-		unsigned char *const _p	= (unsigned char *) (P);	\
-		unsigned const char *const _q = (unsigned char *) _t;	\
-		_p[0]		= _q[0];\
-		_p[1]		= _q[1];\
-		(P) 		= _p + 2;\
+		union {			\
+			uint16_t val;	\
+			uint8_t bytes[2];\
+		} _t;			\
+		unsigned char *const _p	= (void *) (P);			\
+		_t.val = (X);		\
+		_p[0]		= _t.bytes[0];\
+		_p[1]		= _t.bytes[1];\
+		(P) 		= (void *)(_p + 2);			\
 	} while (/*CONSTCOND*/0)
 #define	WRITE_WORD(P,X)	do {		\
-		uint32_t _t	= (X);	\
-		unsigned char *const _p	= (unsigned char *) (P);	\
-		unsigned const char *const _q = (unsigned char *) _t;	\
-		_p[0]		= _q[0];\
-		_p[1]		= _q[1];\
-		_p[2]		= _q[2];\
-		_p[3]		= _q[3];\
-		(P)		= _p + 4;\
+		union {			\
+			uint32_t val;	\
+			uint8_t bytes[4];\
+		} _t;			\
+		unsigned char *const _p	= (void *) (P);			\
+		_t.val = (X);		\
+		_p[0]		= _t.bytes[0];\
+		_p[1]		= _t.bytes[1];\
+		_p[2]		= _t.bytes[2];\
+		_p[3]		= _t.bytes[3];\
+		(P)		= (void *)(_p + 4);			\
 	} while (/*CONSTCOND*/0)
 #define	WRITE_ADDR32(P,X)	WRITE_WORD(P,X)
 #define	WRITE_OFF32(P,X)	WRITE_WORD(P,X)
 #define	WRITE_SWORD(P,X)	WRITE_WORD(P,X)
 #define	WRITE_WORD64(P,X)	do {	\
-		uint64_t _t	= (X);	\
-		unsigned char *const _p	= (unsigned char *) (P);	\
-		unsigned const char *const _q = (unsigned char *) _t;	\
-		_p[0]		= _q[0];\
-		_p[1]		= _q[1];\
-		_p[2]		= _q[2];\
-		_p[3]		= _q[3];\
-		_p[4]		= _q[4];\
-		_p[5]		= _q[5];\
-		_p[6]		= _q[6];\
-		_p[7]		= _q[7];\
-		(P)		= _p + 8;\
+		union {			\
+			uint64_t val;	\
+			uint8_t bytes[8];\
+		} _t;			\
+		unsigned char *const _p	= (void *) (P);			\
+		_t.val = (X);		\
+		_p[0]		= _t.bytes[0];\
+		_p[1]		= _t.bytes[1];\
+		_p[2]		= _t.bytes[2];\
+		_p[3]		= _t.bytes[3];\
+		_p[4]		= _t.bytes[4];\
+		_p[5]		= _t.bytes[5];\
+		_p[6]		= _t.bytes[6];\
+		_p[7]		= _t.bytes[7];\
+		(P)		= (void *)(_p + 8);			\
 	} while (/*CONSTCOND*/0)
 #define	WRITE_ADDR64(P,X)	WRITE_WORD64(P,X)
 #define	WRITE_LWORD(P,X)	WRITE_WORD64(P,X)
@@ -142,15 +151,15 @@
 
 #define	READ_BYTE(P,X)	do {		\
 		const unsigned char *const _p =\
-			(const unsigned char *) (P);			\
+			(const void *) (P);\
 		(X)		= _p[0];\
 		(P)		= (P) + 1;\
 	} while (/*CONSTCOND*/0)
 #define	READ_HALF(P,X)	do {		\
 		uint16_t _t;		\
-		unsigned char *const _q = (unsigned char *) _t;	\
+		unsigned char *const _q = (void *) _t;			\
 		const unsigned char *const _p =\
-			(const unsigned char *) (P);			\
+			(const void *) (P);\
 		_q[0]		= _p[0];\
 		_q[1]		= _p[1];\
 		(P)		= (P) + 2;\
@@ -158,9 +167,9 @@
 	} while (/*CONSTCOND*/0)
 #define	READ_WORD(P,X)	do {		\
 		uint32_t _t;		\
-		unsigned char *const _q = (unsigned char *) _t;	\
+		

CVS commit: src/external/bsd/libelf/dist

2009-12-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 08:47:46 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: libelf_convert.m4

Log Message:
We don't have an Elf_Note typedef, but Elf32_Nhdr and Elf64_Nhdr are
equivalent; use Elf32_Nhdr instead.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/libelf/dist/libelf_convert.m4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/libelf_convert.m4
diff -u src/external/bsd/libelf/dist/libelf_convert.m4:1.6 src/external/bsd/libelf/dist/libelf_convert.m4:1.7
--- src/external/bsd/libelf/dist/libelf_convert.m4:1.6	Sat Dec 19 08:40:57 2009
+++ src/external/bsd/libelf/dist/libelf_convert.m4	Sat Dec 19 08:47:46 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf_convert.m4,v 1.6 2009/12/19 08:40:57 thorpej Exp $	*/
+/*	$NetBSD: libelf_convert.m4,v 1.7 2009/12/19 08:47:46 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006,2007 Joseph Koshy
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/libelf_convert.m4,v 1.4.2.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: libelf_convert.m4,v 1.6 2009/12/19 08:40:57 thorpej Exp $);
+__RCSID($NetBSD: libelf_convert.m4,v 1.7 2009/12/19 08:47:46 thorpej Exp $);
 
 #include sys/types.h
 
@@ -493,7 +493,7 @@
 }
 
 /*
- * Elf_Note structures comprise a fixed size header followed by variable
+ * Elf note structures comprise a fixed size header followed by variable
  * length strings.  The fixed size header needs to be byte swapped, but
  * not the strings.
  *
@@ -503,7 +503,7 @@
 libelf_cvt_NOTE_tom(char *dst, char *src, size_t count, int byteswap)
 {
 	uint32_t namesz, descsz, type;
-	Elf_Note *en;
+	Elf32_Nhdr *en;		/* Elf32_Nhdr and Elf64_Nhdr are equiv. */
 	size_t sz;
 
 	if (dst == src  !byteswap)
@@ -514,7 +514,7 @@
 		return;
 	}
 
-	while (count  sizeof(Elf_Note)) {
+	while (count  sizeof(Elf32_Nhdr)) {
 
 		READ_WORD(src, namesz);
 		READ_WORD(src, descsz);
@@ -526,12 +526,12 @@
 			SWAP_WORD(type);
 		}
 
-		en = (Elf_Note *) (uintptr_t) dst;
+		en = (Elf32_Nhdr *) (uintptr_t) dst;
 		en-n_namesz = namesz;
 		en-n_descsz = descsz;
 		en-n_type = type;
 
-		dst += sizeof(Elf_Note);
+		dst += sizeof(Elf32_Nhdr);
 
 		ROUNDUP2(namesz, 4);
 		ROUNDUP2(descsz, 4);
@@ -553,7 +553,7 @@
 libelf_cvt_NOTE_tof(char *dst, char *src, size_t count, int byteswap)
 {
 	uint32_t namesz, descsz, type;
-	Elf_Note *en;
+	Elf32_Nhdr *en;		/* Elf32_Nhdr and Elf64_Nhdr are equiv. */
 	size_t sz;
 
 	if (dst == src  !byteswap)
@@ -564,9 +564,9 @@
 		return;
 	}
 
-	while (count  sizeof(Elf_Note)) {
+	while (count  sizeof(Elf32_Nhdr)) {
 
-		en = (Elf_Note *) (uintptr_t) src;
+		en = (Elf32_Nhdr *) (uintptr_t) src;
 		namesz = en-n_namesz;
 		descsz = en-n_descsz;
 		type = en-n_type;
@@ -582,7 +582,7 @@
 		WRITE_WORD(dst, descsz);
 		WRITE_WORD(dst, type);
 
-		src += sizeof(Elf_Note);
+		src += sizeof(Elf32_Nhdr);
 
 		ROUNDUP2(namesz, 4);
 		ROUNDUP2(descsz, 4);



CVS commit: src/external/bsd/libelf/dist

2009-12-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 09:00:56 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: libelf_ehdr.c

Log Message:
Add some range checks to quiet warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libelf/dist/libelf_ehdr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/libelf_ehdr.c
diff -u src/external/bsd/libelf/dist/libelf_ehdr.c:1.2 src/external/bsd/libelf/dist/libelf_ehdr.c:1.3
--- src/external/bsd/libelf/dist/libelf_ehdr.c:1.2	Sat Dec 19 05:55:37 2009
+++ src/external/bsd/libelf/dist/libelf_ehdr.c	Sat Dec 19 09:00:56 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf_ehdr.c,v 1.2 2009/12/19 05:55:37 thorpej Exp $	*/
+/*	$NetBSD: libelf_ehdr.c,v 1.3 2009/12/19 09:00:56 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -30,11 +30,12 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/libelf_ehdr.c,v 1.2.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: libelf_ehdr.c,v 1.2 2009/12/19 05:55:37 thorpej Exp $);
+__RCSID($NetBSD: libelf_ehdr.c,v 1.3 2009/12/19 09:00:56 thorpej Exp $);
 
 #include assert.h
 #include gelf.h
 #include libelf.h
+#include limits.h
 #include stdlib.h
 
 #include _libelf.h
@@ -65,9 +66,14 @@
 	if ((scn = _libelf_allocate_scn(e, (size_t) 0)) == NULL)
 		return (0);
 
+	if (shoff  SSIZE_MAX) {
+		LIBELF_SET_ERROR(HEADER, 0);
+		return (0);
+	}
+
 	xlator = _libelf_get_translator(ELF_T_SHDR, ELF_TOMEMORY, ec);
-	(*xlator)((char *) scn-s_shdr, e-e_rawfile + shoff, (size_t) 1,
-	e-e_byteorder != LIBELF_PRIVATE(byteorder));
+	(*xlator)((void *) scn-s_shdr, e-e_rawfile + (ssize_t)shoff,
+	(size_t) 1, e-e_byteorder != LIBELF_PRIVATE(byteorder));
 
 #define	GET_SHDR_MEMBER(M) ((ec == ELFCLASS32) ? scn-s_shdr.s_shdr32.M : \
 		scn-s_shdr.s_shdr64.M)
@@ -77,7 +83,12 @@
 		return (0);
 	}
 
-	e-e_u.e_elf.e_nscn = GET_SHDR_MEMBER(sh_size);
+	if (GET_SHDR_MEMBER(sh_size)  UINT_MAX) {
+		LIBELF_SET_ERROR(HEADER, 0);
+		return (0);
+	}
+
+	e-e_u.e_elf.e_nscn = (unsigned int)GET_SHDR_MEMBER(sh_size);
 	e-e_u.e_elf.e_nphdr = (phnum != PN_XNUM) ? phnum :
 	GET_SHDR_MEMBER(sh_info);
 	e-e_u.e_elf.e_strndx = (strndx != SHN_XINDEX) ? strndx :



CVS commit: src/external/bsd/libelf/dist

2009-12-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 05:43:41 UTC 2009

Update of /cvsroot/src/external/bsd/libelf/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv25031

Log Message:
Import the libelf from FreeBSD 8.0-RC3.

Status:

Vendor Tag: FreeBSD
Release Tags:   FreeBSD-8-0-RC3

N src/external/bsd/libelf/dist/_libelf.h
N src/external/bsd/libelf/dist/elf.3
N src/external/bsd/libelf/dist/elf_begin.3
N src/external/bsd/libelf/dist/elf_begin.c
N src/external/bsd/libelf/dist/elf_cntl.3
N src/external/bsd/libelf/dist/elf_cntl.c
N src/external/bsd/libelf/dist/elf_data.c
N src/external/bsd/libelf/dist/elf_end.3
N src/external/bsd/libelf/dist/elf_end.c
N src/external/bsd/libelf/dist/elf_errmsg.3
N src/external/bsd/libelf/dist/elf_errmsg.c
N src/external/bsd/libelf/dist/elf_errno.c
N src/external/bsd/libelf/dist/elf_fill.3
N src/external/bsd/libelf/dist/elf_fill.c
N src/external/bsd/libelf/dist/elf_flag.c
N src/external/bsd/libelf/dist/elf_flagdata.3
N src/external/bsd/libelf/dist/elf_getarhdr.3
N src/external/bsd/libelf/dist/elf_getarhdr.c
N src/external/bsd/libelf/dist/elf_getarsym.3
N src/external/bsd/libelf/dist/elf_getarsym.c
N src/external/bsd/libelf/dist/elf_getbase.3
N src/external/bsd/libelf/dist/elf_getbase.c
N src/external/bsd/libelf/dist/elf_getdata.3
N src/external/bsd/libelf/dist/elf_getident.3
N src/external/bsd/libelf/dist/elf_getident.c
N src/external/bsd/libelf/dist/elf_getphnum.3
N src/external/bsd/libelf/dist/elf_getscn.3
N src/external/bsd/libelf/dist/elf_getshnum.3
N src/external/bsd/libelf/dist/elf_getshstrndx.3
N src/external/bsd/libelf/dist/elf_hash.3
N src/external/bsd/libelf/dist/elf_hash.c
N src/external/bsd/libelf/dist/elf_kind.3
N src/external/bsd/libelf/dist/elf_kind.c
N src/external/bsd/libelf/dist/elf_memory.3
N src/external/bsd/libelf/dist/elf_memory.c
N src/external/bsd/libelf/dist/elf_next.3
N src/external/bsd/libelf/dist/elf_next.c
N src/external/bsd/libelf/dist/elf_phnum.c
N src/external/bsd/libelf/dist/elf_rand.3
N src/external/bsd/libelf/dist/elf_rand.c
N src/external/bsd/libelf/dist/elf_rawfile.3
N src/external/bsd/libelf/dist/elf_rawfile.c
N src/external/bsd/libelf/dist/elf_scn.c
N src/external/bsd/libelf/dist/elf_shnum.c
N src/external/bsd/libelf/dist/elf_shstrndx.c
N src/external/bsd/libelf/dist/elf_strptr.3
N src/external/bsd/libelf/dist/elf_strptr.c
N src/external/bsd/libelf/dist/elf_types.m4
N src/external/bsd/libelf/dist/elf_update.3
N src/external/bsd/libelf/dist/elf_update.c
N src/external/bsd/libelf/dist/elf_version.3
N src/external/bsd/libelf/dist/elf_version.c
N src/external/bsd/libelf/dist/gelf.3
N src/external/bsd/libelf/dist/gelf.h
N src/external/bsd/libelf/dist/gelf_cap.c
N src/external/bsd/libelf/dist/gelf_checksum.3
N src/external/bsd/libelf/dist/gelf_checksum.c
N src/external/bsd/libelf/dist/gelf_dyn.c
N src/external/bsd/libelf/dist/gelf_ehdr.c
N src/external/bsd/libelf/dist/gelf_fsize.3
N src/external/bsd/libelf/dist/gelf_fsize.c
N src/external/bsd/libelf/dist/gelf_getcap.3
N src/external/bsd/libelf/dist/gelf_getclass.3
N src/external/bsd/libelf/dist/gelf_getclass.c
N src/external/bsd/libelf/dist/gelf_getdyn.3
N src/external/bsd/libelf/dist/gelf_getehdr.3
N src/external/bsd/libelf/dist/gelf_getmove.3
N src/external/bsd/libelf/dist/gelf_getphdr.3
N src/external/bsd/libelf/dist/gelf_getrel.3
N src/external/bsd/libelf/dist/gelf_getrela.3
N src/external/bsd/libelf/dist/gelf_getshdr.3
N src/external/bsd/libelf/dist/gelf_getsym.3
N src/external/bsd/libelf/dist/gelf_getsyminfo.3
N src/external/bsd/libelf/dist/gelf_getsymshndx.3
N src/external/bsd/libelf/dist/gelf_move.c
N src/external/bsd/libelf/dist/gelf_newehdr.3
N src/external/bsd/libelf/dist/gelf_newphdr.3
N src/external/bsd/libelf/dist/gelf_phdr.c
N src/external/bsd/libelf/dist/gelf_rel.c
N src/external/bsd/libelf/dist/gelf_rela.c
N src/external/bsd/libelf/dist/gelf_shdr.c
N src/external/bsd/libelf/dist/gelf_sym.c
N src/external/bsd/libelf/dist/gelf_syminfo.c
N src/external/bsd/libelf/dist/gelf_symshndx.c
N src/external/bsd/libelf/dist/gelf_update_ehdr.3
N src/external/bsd/libelf/dist/gelf_xlate.c
N src/external/bsd/libelf/dist/gelf_xlatetof.3
N src/external/bsd/libelf/dist/libelf.c
N src/external/bsd/libelf/dist/libelf.h
N src/external/bsd/libelf/dist/libelf_align.c
N src/external/bsd/libelf/dist/libelf_allocate.c
N src/external/bsd/libelf/dist/libelf_ar.c
N src/external/bsd/libelf/dist/libelf_checksum.c
N src/external/bsd/libelf/dist/libelf_convert.m4
N src/external/bsd/libelf/dist/libelf_data.c
N src/external/bsd/libelf/dist/libelf_ehdr.c
N src/external/bsd/libelf/dist/libelf_extended.c
N src/external/bsd/libelf/dist/libelf_fsize.m4
N src/external/bsd/libelf/dist/libelf_msize.m4
N src/external/bsd/libelf/dist/libelf_phdr.c
N src/external/bsd/libelf/dist/libelf_shdr.c
N src/external/bsd/libelf/dist/libelf_xlate.c
N src/external/bsd/libelf/dist/Makefile
N src/external/bsd/libelf/dist/README
N src/external/bsd/libelf/dist/Version.map

No conflicts created by 

CVS commit: src/external/bsd/libelf/dist

2009-12-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 05:55:37 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: _libelf.h elf_scn.c elf_update.c
libelf_allocate.c libelf_ar.c libelf_convert.m4 libelf_ehdr.c

Log Message:
while (0) - while (/*CONSTCOND*/0)


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/libelf/dist/_libelf.h \
src/external/bsd/libelf/dist/elf_scn.c \
src/external/bsd/libelf/dist/elf_update.c \
src/external/bsd/libelf/dist/libelf_allocate.c \
src/external/bsd/libelf/dist/libelf_ar.c \
src/external/bsd/libelf/dist/libelf_convert.m4 \
src/external/bsd/libelf/dist/libelf_ehdr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/_libelf.h
diff -u src/external/bsd/libelf/dist/_libelf.h:1.1.1.1 src/external/bsd/libelf/dist/_libelf.h:1.2
--- src/external/bsd/libelf/dist/_libelf.h:1.1.1.1	Sat Dec 19 05:43:39 2009
+++ src/external/bsd/libelf/dist/_libelf.h	Sat Dec 19 05:55:37 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: _libelf.h,v 1.1.1.1 2009/12/19 05:43:39 thorpej Exp $	*/
+/*	$NetBSD: _libelf.h,v 1.2 2009/12/19 05:55:37 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -63,7 +63,7 @@
 #define	LIBELF_SET_ERROR(E, O) do {	\
 	LIBELF_PRIVATE(error) = ((ELF_E_##E  LIBELF_ELF_ERROR_MASK)|	\
 	((O)  LIBELF_OS_ERROR_SHIFT));\
-	} while (0)
+	} while (/*CONSTCOND*/0)
 
 #define	LIBELF_ADJUST_AR_SIZE(S)	(((S) + 1U)  ~1U)
 
@@ -145,7 +145,7 @@
 			return (0);			\
 		}	\
 		(DST)-NAME = (SRC)-NAME;		\
-	} while (0)
+	} while (/*CONSTCOND*/0)
 
 #define	LIBELF_COPY_S32(DST,SRC,NAME)	do {		\
 		if ((SRC)-NAME  INT_MAX ||		\
@@ -154,7 +154,7 @@
 			return (0);			\
 		}	\
 		(DST)-NAME = (SRC)-NAME;		\
-	} while (0)
+	} while (/*CONSTCOND*/0)
 
 
 /*
Index: src/external/bsd/libelf/dist/elf_scn.c
diff -u src/external/bsd/libelf/dist/elf_scn.c:1.1.1.1 src/external/bsd/libelf/dist/elf_scn.c:1.2
--- src/external/bsd/libelf/dist/elf_scn.c:1.1.1.1	Sat Dec 19 05:43:39 2009
+++ src/external/bsd/libelf/dist/elf_scn.c	Sat Dec 19 05:55:37 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf_scn.c,v 1.1.1.1 2009/12/19 05:43:39 thorpej Exp $	*/
+/*	$NetBSD: elf_scn.c,v 1.2 2009/12/19 05:55:37 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/elf_scn.c,v 1.2.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: elf_scn.c,v 1.1.1.1 2009/12/19 05:43:39 thorpej Exp $);
+__RCSID($NetBSD: elf_scn.c,v 1.2 2009/12/19 05:55:37 thorpej Exp $);
 
 #include assert.h
 #include errno.h
@@ -63,7 +63,7 @@
 			LIBELF_SET_ERROR(HEADER, 0);		\
 			return (0);\
 		}		\
-	} while (0)
+	} while (/*CONSTCOND*/0)
 
 	ec = e-e_class;
 	fsz = _libelf_fsize(ELF_T_SHDR, ec, e-e_version, (size_t) 1);
Index: src/external/bsd/libelf/dist/elf_update.c
diff -u src/external/bsd/libelf/dist/elf_update.c:1.1.1.1 src/external/bsd/libelf/dist/elf_update.c:1.2
--- src/external/bsd/libelf/dist/elf_update.c:1.1.1.1	Sat Dec 19 05:43:40 2009
+++ src/external/bsd/libelf/dist/elf_update.c	Sat Dec 19 05:55:37 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf_update.c,v 1.1.1.1 2009/12/19 05:43:40 thorpej Exp $	*/
+/*	$NetBSD: elf_update.c,v 1.2 2009/12/19 05:55:37 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006-2008 Joseph Koshy
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/elf_update.c,v 1.5.2.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: elf_update.c,v 1.1.1.1 2009/12/19 05:43:40 thorpej Exp $);
+__RCSID($NetBSD: elf_update.c,v 1.2 2009/12/19 05:55:37 thorpej Exp $);
 
 #include sys/mman.h
 #include sys/param.h
@@ -430,7 +430,7 @@
 		(size_t) 1);	\
 		(E)-e_shentsize = _libelf_fsize(ELF_T_SHDR, (EC), (V),	\
 		(size_t) 1);	\
-	} while (0)
+	} while (/*CONSTCOND*/0)
 
 	if (ec == ELFCLASS32)
 		INITIALIZE_EHDR(eh32, ec, eh_version);
Index: src/external/bsd/libelf/dist/libelf_allocate.c
diff -u src/external/bsd/libelf/dist/libelf_allocate.c:1.1.1.1 src/external/bsd/libelf/dist/libelf_allocate.c:1.2
--- src/external/bsd/libelf/dist/libelf_allocate.c:1.1.1.1	Sat Dec 19 05:43:41 2009
+++ src/external/bsd/libelf/dist/libelf_allocate.c	Sat Dec 19 05:55:37 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf_allocate.c,v 1.1.1.1 2009/12/19 05:43:41 thorpej Exp $	*/
+/*	$NetBSD: libelf_allocate.c,v 1.2 2009/12/19 05:55:37 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -32,7 +32,7 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/libelf_allocate.c,v 1.2.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: libelf_allocate.c,v 1.1.1.1 2009/12/19 05:43:41 thorpej Exp $);
+__RCSID($NetBSD: libelf_allocate.c,v 1.2 2009/12/19 05:55:37 thorpej Exp $);
 
 #include sys/errno.h
 
@@ -91,7 +91,7 @@
 #define	FREE(P)		do {\
 		if (P)	\
 			free(P);			\
-	} while 

CVS commit: src/external/bsd/libelf/dist

2009-12-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 06:22:25 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: elf_begin.c libelf_allocate.c

Log Message:
sys/errno.h - errno.h


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/libelf/dist/elf_begin.c
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libelf/dist/libelf_allocate.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/elf_begin.c
diff -u src/external/bsd/libelf/dist/elf_begin.c:1.1.1.1 src/external/bsd/libelf/dist/elf_begin.c:1.2
--- src/external/bsd/libelf/dist/elf_begin.c:1.1.1.1	Sat Dec 19 05:43:39 2009
+++ src/external/bsd/libelf/dist/elf_begin.c	Sat Dec 19 06:22:25 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf_begin.c,v 1.1.1.1 2009/12/19 05:43:39 thorpej Exp $	*/
+/*	$NetBSD: elf_begin.c,v 1.2 2009/12/19 06:22:25 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -28,15 +28,15 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/elf_begin.c,v 1.1.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: elf_begin.c,v 1.1.1.1 2009/12/19 05:43:39 thorpej Exp $);
+__RCSID($NetBSD: elf_begin.c,v 1.2 2009/12/19 06:22:25 thorpej Exp $);
 
 #include sys/types.h
-#include sys/errno.h
 #include sys/mman.h
 #include sys/stat.h
 
 #include ar.h
 #include ctype.h
+#include errno.h
 #include libelf.h
 
 #include _libelf.h

Index: src/external/bsd/libelf/dist/libelf_allocate.c
diff -u src/external/bsd/libelf/dist/libelf_allocate.c:1.2 src/external/bsd/libelf/dist/libelf_allocate.c:1.3
--- src/external/bsd/libelf/dist/libelf_allocate.c:1.2	Sat Dec 19 05:55:37 2009
+++ src/external/bsd/libelf/dist/libelf_allocate.c	Sat Dec 19 06:22:25 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf_allocate.c,v 1.2 2009/12/19 05:55:37 thorpej Exp $	*/
+/*	$NetBSD: libelf_allocate.c,v 1.3 2009/12/19 06:22:25 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -32,11 +32,10 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/libelf_allocate.c,v 1.2.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: libelf_allocate.c,v 1.2 2009/12/19 05:55:37 thorpej Exp $);
-
-#include sys/errno.h
+__RCSID($NetBSD: libelf_allocate.c,v 1.3 2009/12/19 06:22:25 thorpej Exp $);
 
 #include assert.h
+#include errno.h
 #include libelf.h
 #include stdlib.h
 #include string.h



CVS commit: src/external/bsd/libelf/dist

2009-12-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 06:39:29 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: gelf_cap.c gelf_dyn.c gelf_ehdr.c
gelf_move.c gelf_phdr.c gelf_rel.c gelf_rela.c gelf_shdr.c
gelf_sym.c gelf_syminfo.c gelf_symshndx.c

Log Message:
sys/limits.h - limits.h


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/libelf/dist/gelf_cap.c \
src/external/bsd/libelf/dist/gelf_dyn.c \
src/external/bsd/libelf/dist/gelf_ehdr.c \
src/external/bsd/libelf/dist/gelf_move.c \
src/external/bsd/libelf/dist/gelf_phdr.c \
src/external/bsd/libelf/dist/gelf_rel.c \
src/external/bsd/libelf/dist/gelf_rela.c \
src/external/bsd/libelf/dist/gelf_shdr.c \
src/external/bsd/libelf/dist/gelf_sym.c \
src/external/bsd/libelf/dist/gelf_syminfo.c \
src/external/bsd/libelf/dist/gelf_symshndx.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/gelf_cap.c
diff -u src/external/bsd/libelf/dist/gelf_cap.c:1.1.1.1 src/external/bsd/libelf/dist/gelf_cap.c:1.2
--- src/external/bsd/libelf/dist/gelf_cap.c:1.1.1.1	Sat Dec 19 05:43:40 2009
+++ src/external/bsd/libelf/dist/gelf_cap.c	Sat Dec 19 06:39:29 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: gelf_cap.c,v 1.1.1.1 2009/12/19 05:43:40 thorpej Exp $	*/
+/*	$NetBSD: gelf_cap.c,v 1.2 2009/12/19 06:39:29 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -28,11 +28,10 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/gelf_cap.c,v 1.2.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: gelf_cap.c,v 1.1.1.1 2009/12/19 05:43:40 thorpej Exp $);
-
-#include sys/limits.h
+__RCSID($NetBSD: gelf_cap.c,v 1.2 2009/12/19 06:39:29 thorpej Exp $);
 
 #include assert.h
+#include limits.h
 #include gelf.h
 #include osreldate.h
 
Index: src/external/bsd/libelf/dist/gelf_dyn.c
diff -u src/external/bsd/libelf/dist/gelf_dyn.c:1.1.1.1 src/external/bsd/libelf/dist/gelf_dyn.c:1.2
--- src/external/bsd/libelf/dist/gelf_dyn.c:1.1.1.1	Sat Dec 19 05:43:40 2009
+++ src/external/bsd/libelf/dist/gelf_dyn.c	Sat Dec 19 06:39:29 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: gelf_dyn.c,v 1.1.1.1 2009/12/19 05:43:40 thorpej Exp $	*/
+/*	$NetBSD: gelf_dyn.c,v 1.2 2009/12/19 06:39:29 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -28,11 +28,10 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/gelf_dyn.c,v 1.1.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: gelf_dyn.c,v 1.1.1.1 2009/12/19 05:43:40 thorpej Exp $);
-
-#include sys/limits.h
+__RCSID($NetBSD: gelf_dyn.c,v 1.2 2009/12/19 06:39:29 thorpej Exp $);
 
 #include assert.h
+#include limits.h
 #include gelf.h
 
 #include _libelf.h
Index: src/external/bsd/libelf/dist/gelf_ehdr.c
diff -u src/external/bsd/libelf/dist/gelf_ehdr.c:1.1.1.1 src/external/bsd/libelf/dist/gelf_ehdr.c:1.2
--- src/external/bsd/libelf/dist/gelf_ehdr.c:1.1.1.1	Sat Dec 19 05:43:40 2009
+++ src/external/bsd/libelf/dist/gelf_ehdr.c	Sat Dec 19 06:39:29 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: gelf_ehdr.c,v 1.1.1.1 2009/12/19 05:43:40 thorpej Exp $	*/
+/*	$NetBSD: gelf_ehdr.c,v 1.2 2009/12/19 06:39:29 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -28,11 +28,10 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/gelf_ehdr.c,v 1.1.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: gelf_ehdr.c,v 1.1.1.1 2009/12/19 05:43:40 thorpej Exp $);
-
-#include sys/limits.h
+__RCSID($NetBSD: gelf_ehdr.c,v 1.2 2009/12/19 06:39:29 thorpej Exp $);
 
 #include assert.h
+#include limits.h
 #include gelf.h
 #include libelf.h
 #include string.h
Index: src/external/bsd/libelf/dist/gelf_move.c
diff -u src/external/bsd/libelf/dist/gelf_move.c:1.1.1.1 src/external/bsd/libelf/dist/gelf_move.c:1.2
--- src/external/bsd/libelf/dist/gelf_move.c:1.1.1.1	Sat Dec 19 05:43:40 2009
+++ src/external/bsd/libelf/dist/gelf_move.c	Sat Dec 19 06:39:29 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: gelf_move.c,v 1.1.1.1 2009/12/19 05:43:40 thorpej Exp $	*/
+/*	$NetBSD: gelf_move.c,v 1.2 2009/12/19 06:39:29 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -28,11 +28,10 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/gelf_move.c,v 1.2.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: gelf_move.c,v 1.1.1.1 2009/12/19 05:43:40 thorpej Exp $);
-
-#include sys/limits.h
+__RCSID($NetBSD: gelf_move.c,v 1.2 2009/12/19 06:39:29 thorpej Exp $);
 
 #include assert.h
+#include limits.h
 #include gelf.h
 #include osreldate.h
 
Index: src/external/bsd/libelf/dist/gelf_phdr.c
diff -u src/external/bsd/libelf/dist/gelf_phdr.c:1.1.1.1 src/external/bsd/libelf/dist/gelf_phdr.c:1.2
--- src/external/bsd/libelf/dist/gelf_phdr.c:1.1.1.1	Sat Dec 19 05:43:40 2009
+++ src/external/bsd/libelf/dist/gelf_phdr.c	Sat Dec 19 06:39:29 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: gelf_phdr.c,v 1.1.1.1 

CVS commit: src/external/bsd/libelf/dist

2009-12-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 07:31:04 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: elf_types.m4 gelf.h gelf_cap.c
gelf_move.c gelf_syminfo.c libelf.h libelf_align.c
libelf_convert.m4 libelf_data.c libelf_fsize.m4 libelf_msize.m4

Log Message:
Centralize dependency on __FreeBSD_version into libelf.h, and generalize
the conditional inclusion of API/ELF features so that it works with NetBSD
as well.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/libelf/dist/elf_types.m4 \
src/external/bsd/libelf/dist/gelf.h src/external/bsd/libelf/dist/libelf.h \
src/external/bsd/libelf/dist/libelf_align.c \
src/external/bsd/libelf/dist/libelf_data.c \
src/external/bsd/libelf/dist/libelf_fsize.m4 \
src/external/bsd/libelf/dist/libelf_msize.m4
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libelf/dist/gelf_cap.c \
src/external/bsd/libelf/dist/gelf_move.c \
src/external/bsd/libelf/dist/gelf_syminfo.c \
src/external/bsd/libelf/dist/libelf_convert.m4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/elf_types.m4
diff -u src/external/bsd/libelf/dist/elf_types.m4:1.1.1.1 src/external/bsd/libelf/dist/elf_types.m4:1.2
--- src/external/bsd/libelf/dist/elf_types.m4:1.1.1.1	Sat Dec 19 05:43:40 2009
+++ src/external/bsd/libelf/dist/elf_types.m4	Sat Dec 19 07:31:04 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf_types.m4,v 1.1.1.1 2009/12/19 05:43:40 thorpej Exp $	*/
+/*	$NetBSD: elf_types.m4,v 1.2 2009/12/19 07:31:04 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -31,41 +31,36 @@
 /*
  * ELF types, defined in the enum Elf_Type API.
  *
- * The members of the list form a 3-tuple: (name, C-type-suffix, OSversion).
+ * The members of the list form a 3-tuple: (name, C-type-suffix, condition).
  * + `name' is an Elf_Type symbol without the `ELF_T_' prefix.
  * + `C-type-suffix' is the suffix for Elf32_ and Elf64_ type names.
- * + `version' is the OS version the symbol first appeared in.
- *
- * OS revisions of note are:
- * 600102 - The earliest (6.0-STABLE) version supported by this code.
- * 79 - Symbol versioning and ELF64 type changes.
- * 700025 - More ELF types and the introduction of libelf.
+ * + `condition' is the conditional check for this type.
  */
 
 define(`ELF_TYPE_LIST',
-	``ADDR,		Addr,	600102',
-	`BYTE,		Byte,	600102',
-	`CAP,		Cap,	700025',
-	`DYN,		Dyn,	600102',
-	`EHDR,		Ehdr,	600102',
-	`HALF,		Half,	600102',
-	`LWORD,		Lword,	700025',
-	`MOVE,		Move,	700025',
-	`MOVEP,		MoveP,	700025',
-	`NOTE,		Note,	600102',
-	`OFF,		Off,	600102',
-	`PHDR,		Phdr,	600102',
-	`REL,		Rel,	600102',
-	`RELA,		Rela,	600102',
-	`SHDR,		Shdr,	600102',
-	`SWORD,		Sword,	600102',
-	`SXWORD,	Sxword,	79',
-	`SYMINFO,	Syminfo, 700025',
-	`SYM,		Sym,	600102',
-	`VDEF,		Verdef,	79',
-	`VNEED,		Verneed, 79',
-	`WORD,		Word,	600102',
-	`XWORD,		Xword,	79',
+	``ADDR,		Addr,	1',
+	`BYTE,		Byte,	1',
+	`CAP,		Cap,	__LIBELF_HAVE_ELF_CAP',
+	`DYN,		Dyn,	1',
+	`EHDR,		Ehdr,	1',
+	`HALF,		Half,	1',
+	`LWORD,		Lword,	__LIBELF_HAVE_ELF_MOVE',
+	`MOVE,		Move,	__LIBELF_HAVE_ELF_MOVE',
+	`MOVEP,		MoveP,	__LIBELF_HAVE_ELF_MOVE',
+	`NOTE,		Note,	1',
+	`OFF,		Off,	1',
+	`PHDR,		Phdr,	1',
+	`REL,		Rel,	1',
+	`RELA,		Rela,	1',
+	`SHDR,		Shdr,	1',
+	`SWORD,		Sword,	1',
+	`SXWORD,	Sxword,	__LIBELF_HAVE_ELF_VERS',
+	`SYMINFO,	Syminfo, __LIBELF_HAVE_ELF_SYMINFO',
+	`SYM,		Sym,	1',
+	`VDEF,		Verdef,	__LIBELF_HAVE_ELF_VERS',
+	`VNEED,		Verneed, __LIBELF_HAVE_ELF_VERS',
+	`WORD,		Word,	1',
+	`XWORD,		Xword,	__LIBELF_HAVE_ELF_VERS',
 	`NUM,		_,	_'')
 
 /*
Index: src/external/bsd/libelf/dist/gelf.h
diff -u src/external/bsd/libelf/dist/gelf.h:1.1.1.1 src/external/bsd/libelf/dist/gelf.h:1.2
--- src/external/bsd/libelf/dist/gelf.h:1.1.1.1	Sat Dec 19 05:43:40 2009
+++ src/external/bsd/libelf/dist/gelf.h	Sat Dec 19 07:31:04 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: gelf.h,v 1.1.1.1 2009/12/19 05:43:40 thorpej Exp $	*/
+/*	$NetBSD: gelf.h,v 1.2 2009/12/19 07:31:04 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -34,7 +34,6 @@
 #include sys/cdefs.h
 
 #include libelf.h
-#include osreldate.h
 
 typedef Elf64_Addr	GElf_Addr;	/* Addresses */
 typedef Elf64_Half	GElf_Half;	/* Half words (16 bit) */
@@ -52,9 +51,13 @@
 typedef Elf64_Rel	GElf_Rel;	/* Relocation entries */
 typedef Elf64_Rela	GElf_Rela;	/* Relocation entries with addend */
 
-#if	__FreeBSD_version = 700025
+#if defined(__LIBELF_HAVE_ELF_CAP)
 typedef	Elf64_Cap	GElf_Cap;	/* SW/HW capabilities */
+#endif
+#if defined(__LIBELF_HAVE_ELF_MOVE)
 typedef Elf64_Move	GElf_Move;	/* Move entries */
+#endif
+#if defined(__LIBELF_HAVE_ELF_SYMINFO)
 typedef Elf64_Syminfo	GElf_Syminfo;	/* Symbol information */
 #endif
 
@@ -102,14 +105,21 @@
 Elf_Data 	*gelf_xlatetof(Elf *_elf, Elf_Data *_dst, const Elf_Data *_src, unsigned int _encode);
 

CVS commit: src/external/bsd/libelf/dist

2009-12-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 07:31:44 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: libelf_convert.m4 libelf_fsize.m4
libelf_msize.m4

Log Message:
Don't need to include osreldate.h here.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/libelf/dist/libelf_convert.m4
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libelf/dist/libelf_fsize.m4 \
src/external/bsd/libelf/dist/libelf_msize.m4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/libelf_convert.m4
diff -u src/external/bsd/libelf/dist/libelf_convert.m4:1.3 src/external/bsd/libelf/dist/libelf_convert.m4:1.4
--- src/external/bsd/libelf/dist/libelf_convert.m4:1.3	Sat Dec 19 07:31:04 2009
+++ src/external/bsd/libelf/dist/libelf_convert.m4	Sat Dec 19 07:31:44 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf_convert.m4,v 1.3 2009/12/19 07:31:04 thorpej Exp $	*/
+/*	$NetBSD: libelf_convert.m4,v 1.4 2009/12/19 07:31:44 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006,2007 Joseph Koshy
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/libelf_convert.m4,v 1.4.2.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: libelf_convert.m4,v 1.3 2009/12/19 07:31:04 thorpej Exp $);
+__RCSID($NetBSD: libelf_convert.m4,v 1.4 2009/12/19 07:31:44 thorpej Exp $);
 
 #include sys/types.h
 #include sys/elf32.h
@@ -36,7 +36,6 @@
 
 #include assert.h
 #include libelf.h
-#include osreldate.h
 #include string.h
 
 #include _libelf.h

Index: src/external/bsd/libelf/dist/libelf_fsize.m4
diff -u src/external/bsd/libelf/dist/libelf_fsize.m4:1.2 src/external/bsd/libelf/dist/libelf_fsize.m4:1.3
--- src/external/bsd/libelf/dist/libelf_fsize.m4:1.2	Sat Dec 19 07:31:04 2009
+++ src/external/bsd/libelf/dist/libelf_fsize.m4	Sat Dec 19 07:31:44 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf_fsize.m4,v 1.2 2009/12/19 07:31:04 thorpej Exp $	*/
+/*	$NetBSD: libelf_fsize.m4,v 1.3 2009/12/19 07:31:44 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -29,7 +29,6 @@
  */
 
 #include libelf.h
-#include osreldate.h
 
 #include _libelf.h
 
Index: src/external/bsd/libelf/dist/libelf_msize.m4
diff -u src/external/bsd/libelf/dist/libelf_msize.m4:1.2 src/external/bsd/libelf/dist/libelf_msize.m4:1.3
--- src/external/bsd/libelf/dist/libelf_msize.m4:1.2	Sat Dec 19 07:31:04 2009
+++ src/external/bsd/libelf/dist/libelf_msize.m4	Sat Dec 19 07:31:44 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf_msize.m4,v 1.2 2009/12/19 07:31:04 thorpej Exp $	*/
+/*	$NetBSD: libelf_msize.m4,v 1.3 2009/12/19 07:31:44 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/libelf_msize.m4,v 1.2.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: libelf_msize.m4,v 1.2 2009/12/19 07:31:04 thorpej Exp $);
+__RCSID($NetBSD: libelf_msize.m4,v 1.3 2009/12/19 07:31:44 thorpej Exp $);
 
 #include sys/types.h
 #include sys/elf32.h
@@ -36,7 +36,6 @@
 
 #include assert.h
 #include libelf.h
-#include osreldate.h
 #include string.h
 
 #include _libelf.h



CVS commit: src/external/bsd/libelf/dist

2009-12-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 07:33:06 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: libelf_convert.m4 libelf_msize.m4

Log Message:
libelf.h is responsible for including sys/elf32.h and sys/elf64.h on
FreeBSD; no need to do it here.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/libelf/dist/libelf_convert.m4
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/libelf/dist/libelf_msize.m4

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/libelf_convert.m4
diff -u src/external/bsd/libelf/dist/libelf_convert.m4:1.4 src/external/bsd/libelf/dist/libelf_convert.m4:1.5
--- src/external/bsd/libelf/dist/libelf_convert.m4:1.4	Sat Dec 19 07:31:44 2009
+++ src/external/bsd/libelf/dist/libelf_convert.m4	Sat Dec 19 07:33:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf_convert.m4,v 1.4 2009/12/19 07:31:44 thorpej Exp $	*/
+/*	$NetBSD: libelf_convert.m4,v 1.5 2009/12/19 07:33:06 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006,2007 Joseph Koshy
@@ -28,11 +28,9 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/libelf_convert.m4,v 1.4.2.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: libelf_convert.m4,v 1.4 2009/12/19 07:31:44 thorpej Exp $);
+__RCSID($NetBSD: libelf_convert.m4,v 1.5 2009/12/19 07:33:06 thorpej Exp $);
 
 #include sys/types.h
-#include sys/elf32.h
-#include sys/elf64.h
 
 #include assert.h
 #include libelf.h

Index: src/external/bsd/libelf/dist/libelf_msize.m4
diff -u src/external/bsd/libelf/dist/libelf_msize.m4:1.3 src/external/bsd/libelf/dist/libelf_msize.m4:1.4
--- src/external/bsd/libelf/dist/libelf_msize.m4:1.3	Sat Dec 19 07:31:44 2009
+++ src/external/bsd/libelf/dist/libelf_msize.m4	Sat Dec 19 07:33:06 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf_msize.m4,v 1.3 2009/12/19 07:31:44 thorpej Exp $	*/
+/*	$NetBSD: libelf_msize.m4,v 1.4 2009/12/19 07:33:06 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -28,11 +28,9 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/libelf_msize.m4,v 1.2.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: libelf_msize.m4,v 1.3 2009/12/19 07:31:44 thorpej Exp $);
+__RCSID($NetBSD: libelf_msize.m4,v 1.4 2009/12/19 07:33:06 thorpej Exp $);
 
 #include sys/types.h
-#include sys/elf32.h
-#include sys/elf64.h
 
 #include assert.h
 #include libelf.h



CVS commit: src/external/bsd/libelf/dist

2009-12-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 07:37:35 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: libelf.c

Log Message:
machine/elf.h is a FreeBSD-specific header.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/libelf/dist/libelf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/libelf.c
diff -u src/external/bsd/libelf/dist/libelf.c:1.1.1.1 src/external/bsd/libelf/dist/libelf.c:1.2
--- src/external/bsd/libelf/dist/libelf.c:1.1.1.1	Sat Dec 19 05:43:40 2009
+++ src/external/bsd/libelf/dist/libelf.c	Sat Dec 19 07:37:34 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf.c,v 1.1.1.1 2009/12/19 05:43:40 thorpej Exp $	*/
+/*	$NetBSD: libelf.c,v 1.2 2009/12/19 07:37:34 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -28,11 +28,13 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/libelf.c,v 1.1.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: libelf.c,v 1.1.1.1 2009/12/19 05:43:40 thorpej Exp $);
+__RCSID($NetBSD: libelf.c,v 1.2 2009/12/19 07:37:34 thorpej Exp $);
 
 #include sys/param.h
 
+#if defined(__FreeBSD__)
 #include machine/elf.h
+#endif /* __FreeBSD__ */
 #include machine/endian.h
 
 #include libelf.h



CVS commit: src/external/bsd/libelf/dist

2009-12-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 07:44:27 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: elf_scn.c

Log Message:
- _libelf_load_scn(): If shoff is larger than SSIZE_MAX, bail out with
  a HEADER error.  Pass lint.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libelf/dist/elf_scn.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/elf_scn.c
diff -u src/external/bsd/libelf/dist/elf_scn.c:1.2 src/external/bsd/libelf/dist/elf_scn.c:1.3
--- src/external/bsd/libelf/dist/elf_scn.c:1.2	Sat Dec 19 05:55:37 2009
+++ src/external/bsd/libelf/dist/elf_scn.c	Sat Dec 19 07:44:27 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf_scn.c,v 1.2 2009/12/19 05:55:37 thorpej Exp $	*/
+/*	$NetBSD: elf_scn.c,v 1.3 2009/12/19 07:44:27 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -28,13 +28,15 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/elf_scn.c,v 1.2.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: elf_scn.c,v 1.2 2009/12/19 05:55:37 thorpej Exp $);
+__RCSID($NetBSD: elf_scn.c,v 1.3 2009/12/19 07:44:27 thorpej Exp $);
 
 #include assert.h
 #include errno.h
 #include gelf.h
 #include libelf.h
+#include stddef.h
 #include stdlib.h
+#include limits.h
 
 #include _libelf.h
 
@@ -84,7 +86,11 @@
 	xlator = _libelf_get_translator(ELF_T_SHDR, ELF_TOMEMORY, ec);
 
 	swapbytes = e-e_byteorder != LIBELF_PRIVATE(byteorder);
-	src = e-e_rawfile + shoff;
+	if (shoff  SSIZE_MAX) {
+		LIBELF_SET_ERROR(HEADER, 0);
+		return (0);
+	}
+	src = e-e_rawfile + (ssize_t)shoff;
 
 	/*
 	 * If the file is using extended numbering then section #0
@@ -104,7 +110,7 @@
 		if ((scn = _libelf_allocate_scn(e, i)) == NULL)
 			return (0);
 
-		(*xlator)((char *) scn-s_shdr, src, (size_t) 1, swapbytes);
+		(*xlator)((void *) scn-s_shdr, src, (size_t) 1, swapbytes);
 
 		if (ec == ELFCLASS32) {
 			scn-s_offset = scn-s_rawoff =



CVS commit: src/external/bsd/libelf/dist

2009-12-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 07:47:23 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: _libelf.h

Log Message:
LIBELF_COPY_U32(), LIBELF_COPY_S32(): Make sure that the SRC values are
being compared as the maximum width and appropriate signed-ness.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libelf/dist/_libelf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/_libelf.h
diff -u src/external/bsd/libelf/dist/_libelf.h:1.2 src/external/bsd/libelf/dist/_libelf.h:1.3
--- src/external/bsd/libelf/dist/_libelf.h:1.2	Sat Dec 19 05:55:37 2009
+++ src/external/bsd/libelf/dist/_libelf.h	Sat Dec 19 07:47:22 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: _libelf.h,v 1.2 2009/12/19 05:55:37 thorpej Exp $	*/
+/*	$NetBSD: _libelf.h,v 1.3 2009/12/19 07:47:22 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -140,7 +140,7 @@
 };
 
 #define	LIBELF_COPY_U32(DST,SRC,NAME)	do {		\
-		if ((SRC)-NAME  UINT_MAX) {		\
+		if ((uint64_t)(SRC)-NAME  UINT_MAX) {	\
 			LIBELF_SET_ERROR(RANGE, 0);	\
 			return (0);			\
 		}	\
@@ -148,8 +148,8 @@
 	} while (/*CONSTCOND*/0)
 
 #define	LIBELF_COPY_S32(DST,SRC,NAME)	do {		\
-		if ((SRC)-NAME  INT_MAX ||		\
-		(SRC)-NAME  INT_MIN) {		\
+		if ((int64_t)(SRC)-NAME  INT_MAX ||	\
+		(int64_t)(SRC)-NAME  INT_MIN) {	\
 			LIBELF_SET_ERROR(RANGE, 0);	\
 			return (0);			\
 		}	\



CVS commit: src/external/bsd/libelf/dist

2009-12-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 07:54:32 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: libelf_align.c

Log Message:
Provide definitions of MALIGN() and MALIGN64() for the __lint__ case.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libelf/dist/libelf_align.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/libelf_align.c
diff -u src/external/bsd/libelf/dist/libelf_align.c:1.2 src/external/bsd/libelf/dist/libelf_align.c:1.3
--- src/external/bsd/libelf/dist/libelf_align.c:1.2	Sat Dec 19 07:31:04 2009
+++ src/external/bsd/libelf/dist/libelf_align.c	Sat Dec 19 07:54:32 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf_align.c,v 1.2 2009/12/19 07:31:04 thorpej Exp $	*/
+/*	$NetBSD: libelf_align.c,v 1.3 2009/12/19 07:54:32 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/libelf_align.c,v 1.3.2.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: libelf_align.c,v 1.2 2009/12/19 07:31:04 thorpej Exp $);
+__RCSID($NetBSD: libelf_align.c,v 1.3 2009/12/19 07:54:32 thorpej Exp $);
 
 #include sys/types.h
 
@@ -43,7 +43,16 @@
 	int a64;
 };
 
-#ifdef	__GNUC__
+#if defined(__lint__)
+#define	MALIGN(N)	{	\
+		.a32 = sizeof(Elf32_##N),			\
+		.a64 = sizeof(Elf64_##N)			\
+	}
+#define	MALIGN64(V)	  {	\
+		.a32 = 0,	\
+		.a64 = sizeof(Elf64_##V)			\
+	}
+#elif defined(__GNUC__)
 #define	MALIGN(N)	{	\
 		.a32 = __alignof__(Elf32_##N),			\
 		.a64 = __alignof__(Elf64_##N)			\



CVS commit: src/external/bsd/libelf/dist

2009-12-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 07:58:24 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: elf_hash.c libelf.h

Log Message:
Change elf_hash() to take a const void *, rather than a const char *.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/libelf/dist/elf_hash.c
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libelf/dist/libelf.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/elf_hash.c
diff -u src/external/bsd/libelf/dist/elf_hash.c:1.1.1.1 src/external/bsd/libelf/dist/elf_hash.c:1.2
--- src/external/bsd/libelf/dist/elf_hash.c:1.1.1.1	Sat Dec 19 05:43:39 2009
+++ src/external/bsd/libelf/dist/elf_hash.c	Sat Dec 19 07:58:24 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf_hash.c,v 1.1.1.1 2009/12/19 05:43:39 thorpej Exp $	*/
+/*	$NetBSD: elf_hash.c,v 1.2 2009/12/19 07:58:24 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/elf_hash.c,v 1.1.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: elf_hash.c,v 1.1.1.1 2009/12/19 05:43:39 thorpej Exp $);
+__RCSID($NetBSD: elf_hash.c,v 1.2 2009/12/19 07:58:24 thorpej Exp $);
 
 #include libelf.h
 
@@ -38,7 +38,7 @@
  */
 
 unsigned long
-elf_hash(const char *name)
+elf_hash(const void *name)
 {
 	unsigned long h, t;
 	const unsigned char *s;

Index: src/external/bsd/libelf/dist/libelf.h
diff -u src/external/bsd/libelf/dist/libelf.h:1.2 src/external/bsd/libelf/dist/libelf.h:1.3
--- src/external/bsd/libelf/dist/libelf.h:1.2	Sat Dec 19 07:31:04 2009
+++ src/external/bsd/libelf/dist/libelf.h	Sat Dec 19 07:58:24 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf.h,v 1.2 2009/12/19 07:31:04 thorpej Exp $	*/
+/*	$NetBSD: libelf.h,v 1.3 2009/12/19 07:58:24 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -220,7 +220,7 @@
 Elf_Scn		*elf_getscn(Elf *_elf, size_t _index);
 int		elf_getshnum(Elf *_elf, size_t *_dst);
 int		elf_getshstrndx(Elf *_elf, size_t *_dst);
-unsigned long	elf_hash(const char *_name);
+unsigned long	elf_hash(const void *_name);
 Elf_Kind	elf_kind(Elf *_elf);
 Elf		*elf_memory(char *_image, size_t _size);
 size_t		elf_ndxscn(Elf_Scn *_scn);



CVS commit: src/external/bsd/libelf/dist

2009-12-18 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Dec 19 07:59:24 UTC 2009

Modified Files:
src/external/bsd/libelf/dist: libelf_ar.c

Log Message:
Squash a signed-vs-unsigned char * warning.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libelf/dist/libelf_ar.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/libelf/dist/libelf_ar.c
diff -u src/external/bsd/libelf/dist/libelf_ar.c:1.2 src/external/bsd/libelf/dist/libelf_ar.c:1.3
--- src/external/bsd/libelf/dist/libelf_ar.c:1.2	Sat Dec 19 05:55:37 2009
+++ src/external/bsd/libelf/dist/libelf_ar.c	Sat Dec 19 07:59:24 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: libelf_ar.c,v 1.2 2009/12/19 05:55:37 thorpej Exp $	*/
+/*	$NetBSD: libelf_ar.c,v 1.3 2009/12/19 07:59:24 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2006 Joseph Koshy
@@ -28,7 +28,7 @@
 
 #include sys/cdefs.h
 /* __FBSDID($FreeBSD: src/lib/libelf/libelf_ar.c,v 1.3.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $); */
-__RCSID($NetBSD: libelf_ar.c,v 1.2 2009/12/19 05:55:37 thorpej Exp $);
+__RCSID($NetBSD: libelf_ar.c,v 1.3 2009/12/19 07:59:24 thorpej Exp $);
 
 #include ar.h
 #include assert.h
@@ -461,7 +461,7 @@
 
 		sym-as_off = off;
 		sym-as_hash = elf_hash(s);
-		sym-as_name = s;
+		sym-as_name = (char *)s;
 
 		p += INTSZ;
 		sym++;