CVS commit: src/external/bsd/libelf
Module Name:src Committed By: thorpej Date: Sat Dec 19 05:45:28 UTC 2009 Added Files: src/external/bsd/libelf: prepare-import.sh Log Message: Add a script to prepare libelf for import. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/external/bsd/libelf/prepare-import.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/external/bsd/libelf/prepare-import.sh diff -u /dev/null src/external/bsd/libelf/prepare-import.sh:1.1 --- /dev/null Sat Dec 19 05:45:28 2009 +++ src/external/bsd/libelf/prepare-import.sh Sat Dec 19 05:45:28 2009 @@ -0,0 +1,42 @@ +#!/bin/sh +# $NetBSD: prepare-import.sh,v 1.1 2009/12/19 05:45:28 thorpej Exp $ + +# Copy the FreeBSD src/lib/libelf directory contents to dist. Run +# this script and you're done. +# +# lib/ is built as SUBDIR from external/lib/Makefile. +# +# Use the following template to import +# cvs import src/external/bsd/libelf/dist FreeBSD FreeBSD-X-Y-Z +# +# don't forget to bump the lib/shlib_version if necessary +# + +set -e + +echo "Adding RCS tags .." +for f in $(grep -RL '\$NetBSD.*\$' dist | grep -v CVS); do +case $f in +*.[ch] | *.m4) + cat - > ${f}_tmp <<- EOF + /* \$NetBSD\$ */ + + EOF + sed -e 's,^__FBSDID.*,\/\* & \*\/\ +__RCSID\(\"\$NetBSD\$\"\)\;,g' ${f} >> ${f}_tmp + mv ${f}_tmp ${f} + ;; +*.[0-9]) + cat - ${f} > ${f}_tmp <<- EOF + .\" \$NetBSD\$ + .\" + EOF + mv ${f}_tmp ${f} + ;; +*) + echo "No RCS tag added to ${f}" + ;; +esac +done + +echo "prepare-import done"
CVS commit: src/external/bsd/libelf
Module Name:src Committed By: thorpej Date: Sat Dec 19 05:52:01 UTC 2009 Added Files: src/external/bsd/libelf: Makefile Makefile.inc src/external/bsd/libelf/lib: Makefile shlib_version Log Message: Initial build glue for libelf. Still a work-in-progress. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/external/bsd/libelf/Makefile \ src/external/bsd/libelf/Makefile.inc cvs rdiff -u -r0 -r1.1 src/external/bsd/libelf/lib/Makefile \ src/external/bsd/libelf/lib/shlib_version Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/external/bsd/libelf/Makefile diff -u /dev/null src/external/bsd/libelf/Makefile:1.1 --- /dev/null Sat Dec 19 05:52:01 2009 +++ src/external/bsd/libelf/Makefile Sat Dec 19 05:52:01 2009 @@ -0,0 +1,5 @@ +# $NetBSD: Makefile,v 1.1 2009/12/19 05:52:01 thorpej Exp $ + +SUBDIR= lib + +.include Index: src/external/bsd/libelf/Makefile.inc diff -u /dev/null src/external/bsd/libelf/Makefile.inc:1.1 --- /dev/null Sat Dec 19 05:52:01 2009 +++ src/external/bsd/libelf/Makefile.inc Sat Dec 19 05:52:01 2009 @@ -0,0 +1,11 @@ +# $NetBSD: Makefile.inc,v 1.1 2009/12/19 05:52:01 thorpej Exp $ + +.include + +LIBELF_DIR= ${NETBSDSRCDIR}/external/bsd/libelf/dist + +CPPFLAGS+= -I${LIBELF_DIR} + +WARNS?= 4 + +.PATH: ${LIBELF_DIR} Index: src/external/bsd/libelf/lib/Makefile diff -u /dev/null src/external/bsd/libelf/lib/Makefile:1.1 --- /dev/null Sat Dec 19 05:52:01 2009 +++ src/external/bsd/libelf/lib/Makefile Sat Dec 19 05:52:01 2009 @@ -0,0 +1,144 @@ +# $NetBSD: Makefile,v 1.1 2009/12/19 05:52:01 thorpej Exp $ + +.include + +LIB= elf + +SRCS= elf_begin.c \ + elf_cntl.c \ + elf_end.c elf_errmsg.c elf_errno.c \ + elf_data.c \ + elf_fill.c elf_flag.c \ + elf_getarhdr.c elf_getarsym.c elf_getbase.c \ + elf_getident.c \ + elf_hash.c \ + elf_kind.c \ + elf_memory.c \ + elf_next.c \ + elf_rand.c elf_rawfile.c\ + elf_phnum.c \ + elf_shnum.c elf_shstrndx.c elf_scn.c elf_strptr.c \ + elf_update.c \ + elf_version.c \ + gelf_cap.c \ + gelf_checksum.c \ + gelf_dyn.c \ + gelf_ehdr.c \ + gelf_getclass.c \ + gelf_fsize.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 \ + gelf_xlate.c \ + libelf.c \ + libelf_align.c libelf_allocate.c libelf_ar.c \ + libelf_checksum.c \ + libelf_data.c \ + libelf_ehdr.c libelf_extended.c\ + libelf_phdr.c \ + libelf_shdr.c \ + libelf_xlate.c \ + ${LIBELF_GENSRCS} + +INCS= libelf.h gelf.h +INCSDIR= /usr/include + +LIBELF_GENSRCS= libelf_fsize.c libelf_msize.c libelf_convert.c + +CLEANFILES+= ${LIBELF_GENSRCS} +CPPFLAGS+= -I${.CURDIR} + +MAN= elf.3 \ + elf_begin.3 \ + elf_cntl.3 \ + elf_end.3 elf_errmsg.3 \ + elf_fill.3 elf_flagdata.3\ + elf_getarhdr.3 elf_getarsym.3 elf_getbase.3 \ + elf_getdata.3 elf_getident.3 elf_getscn.3 \ + elf_getphnum.3 elf_getshnum.3 elf_getshstrndx.3 \ + elf_hash.3 \ + elf_kind.3 \ + elf_memory.3 \ + elf_next.3 \ + elf_rawfile.3 elf_rand.3\ + elf_strptr.3 \ + elf_update.3 \ + elf_version.3 \ + gelf.3 \ + gelf_checksum.3 \ + gelf_fsize.3 \ + gelf_getcap.3 gelf_getclass.3 gelf_getdyn.3 \ + gelf_getehdr.3 gelf_getmove.3 gelf_getphdr.3 \ + gelf_getrel.3 gelf_getrela.3 gelf_getshdr.3 \ + gelf_getsym.3 gelf_getsyminfo.3 gelf_getsymshndx.3 \ + gelf_newehdr.3 gelf_hewphdr.3\ + gelf_update_ehdr.3 \ + gelf_xlatetof.3 + +MLINKS+= elf_errmsg.3 elf_errno.3 + +MLINKS+= elf_flagdata.3 elf_flagehdr.3 +MLINKS+= elf_flagdata.3 elf_flagelf.3 +MLINKS+= elf_flagdata.3 elf_flagphdr.3 +MLINKS+= elf_flagdata.3 elf_flagscn.3 +MLINKS+= elf_flagdata.3 elf_flagshdr.3 + +MLINKS+= elf_getdata.3 elf_newdata.3 +MLINKS+= elf_getdata.3 elf_rawdata.3 + +MLINKS+= elf_getscn.3 elf_ndxscn.3 +MLINKS+= elf_getscn.3 elf_newscn.3 +MLINKS+= elf_getscn.3 elf_nextscn.3 + +MLINKS+= elf_getshstrndx.3 elf_setshstrndx.3 + +MLINKS+= gelf_getcap.3 gelf_update_cap.3 + +MLINKS+= gelf_getdyn.3 gelf_update_dyn.3 + +MLINKS+= gelf_getmove.3 gelf_update_move.3 + +MLINKS+= gelf_getrel.3 gelf_update_rel.3 + +MLINKS+= gelf_getrela.3 gelf_update_rela.3 + +MLINKS+= gelf_getsym.3 gelf_update_sym.3 + +MLINKS+= gelf_getsyminfo.3 gelf_update_syminfo.3 + +MLINKS+= gelf_getsymshndx.3 gelf_update_symshndx.3 + +MLINKS+= gelf_update_ehdr.3 gelf_update_phdr.3 + +MLINKS+= gelf_update_ehdr.3 gelf_update_shdr.3 + +MLINKS+= gelf_xlatetof.3 gelf_xlatetom.3 + +.for E in 32 64 +MLINKS+= gelf_checksum.3 elf${E}_checksum.3 +MLINKS+= gelf_fsize.3 elf${E}_fsize.3 +MLINKS+= gelf_getehdr.3 elf${E}_getehdr.3 +MLINKS+= gelf_getphdr.3 elf${E}_getphdr.3 +MLINKS+= gelf_getshdr.3 elf${E}_getshdr.3 +MLINKS+= gelf_newehdr.3 elf$
CVS commit: src/external/bsd/libelf
Module Name:src Committed By: thorpej Date: Tue Dec 29 16:56:26 UTC 2009 Modified Files: src/external/bsd/libelf: prepare-import.sh Log Message: We don't really need __RCSID() tags in these files, so just get rid of them. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/bsd/libelf/prepare-import.sh 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/prepare-import.sh diff -u src/external/bsd/libelf/prepare-import.sh:1.1 src/external/bsd/libelf/prepare-import.sh:1.2 --- src/external/bsd/libelf/prepare-import.sh:1.1 Sat Dec 19 05:45:28 2009 +++ src/external/bsd/libelf/prepare-import.sh Tue Dec 29 16:56:25 2009 @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: prepare-import.sh,v 1.1 2009/12/19 05:45:28 thorpej Exp $ +# $NetBSD: prepare-import.sh,v 1.2 2009/12/29 16:56:25 thorpej Exp $ # Copy the FreeBSD src/lib/libelf directory contents to dist. Run # this script and you're done. @@ -22,8 +22,7 @@ /* \$NetBSD\$ */ EOF - sed -e 's,^__FBSDID.*,\/\* & \*\/\ -__RCSID\(\"\$NetBSD\$\"\)\;,g' ${f} >> ${f}_tmp + sed -e 's,^__FBSDID.*,\/\* & \*\/,g' ${f} >> ${f}_tmp mv ${f}_tmp ${f} ;; *.[0-9])
CVS commit: src/external/bsd/libelf/dist
Module Name:src Committed By: darran Date: Thu Jan 28 21:38:29 UTC 2010 Modified Files: src/external/bsd/libelf/dist: elf_data.c elf_getdata.3 Log Message: Fix a problem with the handling of NOBITS sections (i.e. bss), where the elf_getdata() function would return an invalid section error if the size of the section was bigger than the raw size of the elf binary. This is basically a sync with changeset 10 of the sourceforge repository for this library (elftoolchain). To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/bsd/libelf/dist/elf_data.c cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/libelf/dist/elf_getdata.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_data.c diff -u src/external/bsd/libelf/dist/elf_data.c:1.3 src/external/bsd/libelf/dist/elf_data.c:1.4 --- src/external/bsd/libelf/dist/elf_data.c:1.3 Tue Dec 29 17:05:58 2009 +++ src/external/bsd/libelf/dist/elf_data.c Thu Jan 28 21:38:29 2010 @@ -1,4 +1,4 @@ -/* $NetBSD: elf_data.c,v 1.3 2009/12/29 17:05:58 thorpej Exp $ */ +/* $NetBSD: elf_data.c,v 1.4 2010/01/28 21:38:29 darran Exp $ */ /*- * Copyright (c) 2006 Joseph Koshy @@ -41,7 +41,6 @@ elf_getdata(Elf_Scn *s, Elf_Data *d) { Elf *e; - char *dst; size_t fsz, msz, count; int elfclass, elftype; unsigned int sh_type; @@ -82,8 +81,8 @@ } if ((elftype = _libelf_xlate_shtype(sh_type)) < ELF_T_FIRST || - elftype > ELF_T_LAST || - sh_offset + sh_size > (uint64_t) e->e_rawsize) { + elftype > ELF_T_LAST || (sh_type != SHT_NOBITS && + sh_offset + sh_size > (uint64_t) e->e_rawsize)) { LIBELF_SET_ERROR(SECTION, 0); return (NULL); } @@ -106,22 +105,27 @@ assert(msz > 0); - if ((dst = malloc(msz*count)) == NULL) { - LIBELF_SET_ERROR(RESOURCE, 0); - return (NULL); - } - if ((d = _libelf_allocate_data(s)) == NULL) return (NULL); - d->d_buf = dst; + d->d_buf = NULL; d->d_off = 0; d->d_align = sh_align; d->d_size= msz * count; d->d_type= elftype; d->d_version = e->e_version; + if (sh_type == SHT_NOBITS) + return (d); + d->d_flags |= LIBELF_F_MALLOCED; + + if ((d->d_buf = malloc(msz*count)) == NULL) { + (void) _libelf_release_data(d); + LIBELF_SET_ERROR(RESOURCE, 0); + return (NULL); + } + STAILQ_INSERT_TAIL(&s->s_data, d, d_next); xlate = _libelf_get_translator(elftype, ELF_TOMEMORY, elfclass); @@ -181,6 +185,7 @@ elf_rawdata(Elf_Scn *s, Elf_Data *d) { Elf *e; + uint32_t sh_type; int elf_class; uint64_t sh_align, sh_offset, sh_size; @@ -201,10 +206,12 @@ assert(elf_class == ELFCLASS32 || elf_class == ELFCLASS64); if (elf_class == ELFCLASS32) { + sh_type = s->s_shdr.s_shdr32.sh_type; sh_offset = (uint64_t) s->s_shdr.s_shdr32.sh_offset; sh_size = (uint64_t) s->s_shdr.s_shdr32.sh_size; sh_align = (uint64_t) s->s_shdr.s_shdr32.sh_addralign; } else { + sh_type = s->s_shdr.s_shdr64.sh_type; sh_offset = s->s_shdr.s_shdr64.sh_offset; sh_size = s->s_shdr.s_shdr64.sh_size; sh_align = s->s_shdr.s_shdr64.sh_addralign; @@ -213,7 +220,7 @@ if ((d = _libelf_allocate_data(s)) == NULL) return (NULL); - d->d_buf = e->e_rawfile + sh_offset; + d->d_buf = sh_type == SHT_NOBITS ? NULL : e->e_rawfile + sh_offset; d->d_off = 0; d->d_align = sh_align; d->d_size= sh_size; Index: src/external/bsd/libelf/dist/elf_getdata.3 diff -u src/external/bsd/libelf/dist/elf_getdata.3:1.1.1.1 src/external/bsd/libelf/dist/elf_getdata.3:1.2 --- src/external/bsd/libelf/dist/elf_getdata.3:1.1.1.1 Sat Dec 19 05:43:39 2009 +++ src/external/bsd/libelf/dist/elf_getdata.3 Thu Jan 28 21:38:29 2010 @@ -1,6 +1,6 @@ -.\" $NetBSD: elf_getdata.3,v 1.1.1.1 2009/12/19 05:43:39 thorpej Exp $ +.\" $NetBSD: elf_getdata.3,v 1.2 2010/01/28 21:38:29 darran Exp $ .\" -.\" Copyright (c) 2006 Joseph Koshy. All rights reserved. +.\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -25,7 +25,7 @@ .\" .\" $FreeBSD: src/lib/libelf/elf_getdata.3,v 1.2.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $ .\" -.Dd August 26, 2006 +.Dd April 7, 2008 .Os .Dt ELF_GETDATA 3 .Sh NAME @@ -144,6 +144,32 @@ .Vt Elf_Data structures of type .Dv ELF_T_BYTE . +.Ss Special handling of SHT_NOBITS sections +For sections of type +.Dv SHT_NOBITS , +the functions +.Fn elf_getdata +and +.Fn elf_rawdata +return a pointer to a valid +.Vt Elf_Data +structure that has its +.Va d_buf +member set to NULL and its +.Va d_size +member set to the size of the section. +.Pp +If an application wishes to create a section of type +.Dv SHT_NOBITS , +it should add a data buffer to the section using function +.Fn elf_newdata . +It should then set the +.Va d_buf +and +.Va d_size +members of the returned +.
CVS commit: src/external/bsd/libelf/dist
Module Name:src Committed By: wiz Date: Fri Jan 29 10:49:07 UTC 2010 Modified Files: src/external/bsd/libelf/dist: elf_getdata.3 Log Message: Mark up NULL. Join two sections describing same error. Remove trailing whitespace. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libelf/dist/elf_getdata.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_getdata.3 diff -u src/external/bsd/libelf/dist/elf_getdata.3:1.2 src/external/bsd/libelf/dist/elf_getdata.3:1.3 --- src/external/bsd/libelf/dist/elf_getdata.3:1.2 Thu Jan 28 21:38:29 2010 +++ src/external/bsd/libelf/dist/elf_getdata.3 Fri Jan 29 10:49:07 2010 @@ -1,4 +1,4 @@ -.\" $NetBSD: elf_getdata.3,v 1.2 2010/01/28 21:38:29 darran Exp $ +.\" $NetBSD: elf_getdata.3,v 1.3 2010/01/29 10:49:07 wiz Exp $ .\" .\" Copyright (c) 2006,2008 Joseph Koshy. All rights reserved. .\" @@ -56,18 +56,24 @@ The returned data descriptor will be setup to contain translated data. Argument .Ar data -may be NULL, in which case the function returns the first data descriptor +may be +.Dv NULL , +in which case the function returns the first data descriptor associated with section .Ar scn . If argument .Ar data -is not NULL, it must be a pointer to a data descriptor associated with +is not +.Dv NULL , +it must be a pointer to a data descriptor associated with section descriptor .Ar scn , and function .Fn elf_getdata will return a pointer to the next data descriptor for the section, -or NULL when the end of the section's descriptor list is reached. +or +.Dv NULL +when the end of the section's descriptor list is reached. .Pp Function .Fn elf_newdata @@ -79,7 +85,8 @@ .It Va d_align Set to 1. .It Va d_buf -Initialized to NULL. +Initialized to +.Dv NULL . .It Va d_off Set to (off_t) -1. This field is under application control if the @@ -126,17 +133,21 @@ this function returns untranslated data. If argument .Ar data -is NULL, the first data descriptor associated with section +is +.Dv NULL , +the first data descriptor associated with section .Ar scn is returned. If argument .Ar data -is not NULL, is must be a data descriptor associated with -section +is not +.Dv NULL , +is must be a data descriptor associated with section .Ar scn , and function .Fn elf_rawdata -will return the next data descriptor in the list, or NULL +will return the next data descriptor in the list, or +.Dv NULL if no further descriptors are present. Function .Fn elf_rawdata @@ -155,7 +166,9 @@ .Vt Elf_Data structure that has its .Va d_buf -member set to NULL and its +member set to +.Dv NULL +and its .Va d_size member set to the size of the section. .Pp @@ -169,19 +182,22 @@ .Va d_size members of the returned .Vt Elf_Data -structure to NULL and the desired size of the section respectively. +structure to +.Dv NULL +and the desired size of the section respectively. .Sh RETURN VALUES These functions return a valid pointer to a data descriptor if successful, or -NULL if an error occurs. +.Dv NULL +if an error occurs. .Sh ERRORS These functions may fail with the following errors: -.Bl -tag -width "[ELF_E_RESOURCE]" +.Bl -tag -width "[ELF_E_RESOURCE]" .It Bq Er ELF_E_ARGUMENT Arguments .Ar scn -was NULL. -.It Bq Er ELF_E_ARGUMENT -Data descriptor +was +.Dv NULL , +or data descriptor .Ar data was not associated with section descriptor .Ar scn .
CVS commit: src/external/bsd/libelf/dist
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 #include #include +#include +#include +#include #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
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 this
CVS commit: src/external/bsd/libelf/dist
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 /* __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 #include @@ -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 /* __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 #include @@ -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 /* __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 @@ -91,7 +91,7 @@ #define FREE(P) do {\ if (P) \ free(P); \ - } while (0) + } while (/*CONSTCOND*/0) Elf * Index: sr
CVS commit: src/external/bsd/libelf/dist
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: -> 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 /* __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 -#include #include #include #include #include +#include #include #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 /* __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 +__RCSID("$NetBSD: libelf_allocate.c,v 1.3 2009/12/19 06:22:25 thorpej Exp $"); #include +#include #include #include #include
CVS commit: src/external/bsd/libelf/dist
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: -> 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 /* __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 +__RCSID("$NetBSD: gelf_cap.c,v 1.2 2009/12/19 06:39:29 thorpej Exp $"); #include +#include #include #include 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 /* __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 +__RCSID("$NetBSD: gelf_dyn.c,v 1.2 2009/12/19 06:39:29 thorpej Exp $"); #include +#include #include #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 /* __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 +__RCSID("$NetBSD: gelf_ehdr.c,v 1.2 2009/12/19 06:39:29 thorpej Exp $"); #include +#include #include #include #include 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 /* __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 +__RCSID("$NetBSD: gelf_move.c,v 1.2 2009/12/19 06:39:29 thorpej Exp $"); #include +#include #include #include 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 2009/12/19 05:43:40 thorpej Exp $ */ +/* $NetBSD: gelf_phdr.c,v 1.2 2009/12/19 06:39:29 thorpej Exp $ */ /*- * Copyright (c) 2006 Joseph Koshy @@ -28,11 +28,10 @@ #include /* __FBSDID("$FreeBSD: src/lib/libel
CVS commit: src/external/bsd/libelf/dist
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 #include -#include 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); Elf_Data *gelf_xlatetom(Elf *_elf,
CVS commit: src/external/bsd/libelf/dist
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 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 /* __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 #include @@ -36,7 +36,6 @@ #include #include -#include #include #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 -#include #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 /* __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 #include @@ -36,7 +36,6 @@ #include #include -#include #include #include "_libelf.h"
CVS commit: src/external/bsd/libelf/dist
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: is responsible for including and 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 /* __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 -#include -#include #include #include 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 /* __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 -#include -#include #include #include
CVS commit: src/external/bsd/libelf/dist
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: 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 /* __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 +#if defined(__FreeBSD__) #include +#endif /* __FreeBSD__ */ #include #include
CVS commit: src/external/bsd/libelf/dist
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 /* __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 #include #include #include +#include #include +#include #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
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
Module Name:src Committed By: thorpej Date: Sat Dec 19 07:52:59 UTC 2009 Modified Files: src/external/bsd/libelf/dist: libelf.c Log Message: ELF_ARCH, ELF_TARG_DATA, and ELF_TARG_CLASS are macros defined in a FreeBSD header file. For NetBSD, map to equivalent defines. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 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.2 src/external/bsd/libelf/dist/libelf.c:1.3 --- src/external/bsd/libelf/dist/libelf.c:1.2 Sat Dec 19 07:37:34 2009 +++ src/external/bsd/libelf/dist/libelf.c Sat Dec 19 07:52:59 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: libelf.c,v 1.2 2009/12/19 07:37:34 thorpej Exp $ */ +/* $NetBSD: libelf.c,v 1.3 2009/12/19 07:52:59 thorpej Exp $ */ /*- * Copyright (c) 2006 Joseph Koshy @@ -28,7 +28,7 @@ #include /* __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.2 2009/12/19 07:37:34 thorpej Exp $"); +__RCSID("$NetBSD: libelf.c,v 1.3 2009/12/19 07:52:59 thorpej Exp $"); #include @@ -41,6 +41,18 @@ #include "_libelf.h" +#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_byteorder = ELF_TARG_DATA,
CVS commit: src/external/bsd/libelf/dist
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 /* __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 @@ -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
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 /* __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 @@ -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
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 /* __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 #include @@ -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++;
CVS commit: src/external/bsd/libelf/dist
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 /* __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 @@ -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; \ + uns
CVS commit: src/external/bsd/libelf/dist
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 /* __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 @@ -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
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 /* __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 #include #include +#include #include #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/lib
Module Name:src Committed By: thorpej Date: Sat Dec 19 09:01:32 UTC 2009 Modified Files: src/external/bsd/libelf/lib: Makefile Log Message: Fix a typo. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/external/bsd/libelf/lib/Makefile 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/lib/Makefile diff -u src/external/bsd/libelf/lib/Makefile:1.1 src/external/bsd/libelf/lib/Makefile:1.2 --- src/external/bsd/libelf/lib/Makefile:1.1 Sat Dec 19 05:52:01 2009 +++ src/external/bsd/libelf/lib/Makefile Sat Dec 19 09:01:32 2009 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.1 2009/12/19 05:52:01 thorpej Exp $ +# $NetBSD: Makefile,v 1.2 2009/12/19 09:01:32 thorpej Exp $ .include @@ -72,7 +72,7 @@ gelf_getehdr.3 gelf_getmove.3 gelf_getphdr.3 \ gelf_getrel.3 gelf_getrela.3 gelf_getshdr.3 \ gelf_getsym.3 gelf_getsyminfo.3 gelf_getsymshndx.3 \ - gelf_newehdr.3 gelf_hewphdr.3\ + gelf_newehdr.3 gelf_newphdr.3\ gelf_update_ehdr.3 \ gelf_xlatetof.3
CVS commit: src/external/bsd/libelf/dist
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
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 /* __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 @@ -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
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 /* __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 #include @@ -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 /* __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 #include @@ -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 +++ src/external/bsd/libelf/dist/elf_begin.c
CVS commit: src/external/bsd/libelf/dist
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
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 src/external/bsd/libe
CVS commit: src/external/bsd/libelf/dist
Module Name:src Committed By: thorpej Date: Tue Dec 29 17:05:59 UTC 2009 Modified Files: src/external/bsd/libelf/dist: elf_begin.c elf_data.c elf_hash.c elf_scn.c elf_update.c 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 libelf.c libelf_align.c libelf_allocate.c libelf_ar.c libelf_convert.m4 libelf_data.c libelf_ehdr.c libelf_msize.m4 libelf_phdr.c libelf_xlate.c Log Message: Merge FreeBSD-8-0-RELEASE. All this does is remove the __RCSID() tags due to the modified prepare-import.sh. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/external/bsd/libelf/dist/elf_begin.c \ 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_align.c \ src/external/bsd/libelf/dist/libelf_allocate.c \ src/external/bsd/libelf/dist/libelf_ar.c cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libelf/dist/elf_data.c \ src/external/bsd/libelf/dist/elf_hash.c \ src/external/bsd/libelf/dist/elf_update.c \ src/external/bsd/libelf/dist/gelf_dyn.c \ src/external/bsd/libelf/dist/gelf_ehdr.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_symshndx.c \ src/external/bsd/libelf/dist/libelf_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/elf_scn.c \ src/external/bsd/libelf/dist/libelf_ehdr.c \ src/external/bsd/libelf/dist/libelf_msize.m4 cvs rdiff -u -r1.5 -r1.6 src/external/bsd/libelf/dist/libelf.c cvs rdiff -u -r1.7 -r1.8 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_begin.c diff -u src/external/bsd/libelf/dist/elf_begin.c:1.3 src/external/bsd/libelf/dist/elf_begin.c:1.4 --- src/external/bsd/libelf/dist/elf_begin.c:1.3 Sun Dec 20 23:23:46 2009 +++ src/external/bsd/libelf/dist/elf_begin.c Tue Dec 29 17:05:58 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: elf_begin.c,v 1.3 2009/12/20 23:23:46 thorpej Exp $ */ +/* $NetBSD: elf_begin.c,v 1.4 2009/12/29 17:05:58 thorpej Exp $ */ /*- * Copyright (c) 2006 Joseph Koshy @@ -28,7 +28,6 @@ #include /* __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.3 2009/12/20 23:23:46 thorpej Exp $"); #include #include Index: src/external/bsd/libelf/dist/gelf_cap.c diff -u src/external/bsd/libelf/dist/gelf_cap.c:1.3 src/external/bsd/libelf/dist/gelf_cap.c:1.4 --- src/external/bsd/libelf/dist/gelf_cap.c:1.3 Sat Dec 19 07:31:04 2009 +++ src/external/bsd/libelf/dist/gelf_cap.c Tue Dec 29 17:05:58 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: gelf_cap.c,v 1.3 2009/12/19 07:31:04 thorpej Exp $ */ +/* $NetBSD: gelf_cap.c,v 1.4 2009/12/29 17:05:58 thorpej Exp $ */ /*- * Copyright (c) 2006 Joseph Koshy @@ -28,7 +28,6 @@ #include /* __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.3 2009/12/19 07:31:04 thorpej Exp $"); #include #include Index: src/external/bsd/libelf/dist/gelf_move.c diff -u src/external/bsd/libelf/dist/gelf_move.c:1.3 src/external/bsd/libelf/dist/gelf_move.c:1.4 --- src/external/bsd/libelf/dist/gelf_move.c:1.3 Sat Dec 19 07:31:04 2009 +++ src/external/bsd/libelf/dist/gelf_move.c Tue Dec 29 17:05:58 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: gelf_move.c,v 1.3 2009/12/19 07:31:04 thorpej Exp $ */ +/* $NetBSD: gelf_move.c,v 1.4 2009/12/29 17:05:58 thorpej Exp $ */ /*- * Copyright (c) 2006 Joseph Koshy @@ -28,7 +28,6 @@ #include /* __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.3 2009/12/19 07:31:04 thorpej Exp $"); #include #include Index: src/external/bsd/libelf/dist/gelf_syminfo.c diff -u src/external/bsd/libelf/dist/gelf_syminfo.c:1.3 src/external/bsd/libelf/dist/gelf_syminfo.c:1.4 --- src/external/bsd/libelf/dist/gelf_syminfo.c:1.3 Sat Dec 19 07:31:04 2009 +++ src/external/bsd/libelf/dist/gelf_syminfo.c Tue Dec 29 17:05:58 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: gelf_syminfo.c,v 1.3 2009/12/19 07:31:04 thorpej Exp $ */ +/* $NetBSD: gelf_syminfo.c,v 1.4 2009/12/29 17:05:58 thorpej Exp $ */ /*- * Copyright (c) 2006 Joseph Koshy @@ -28,7 +28,6 @@ #include /* __FBSDID("$FreeBSD: src/lib/libelf/gelf_syminfo.c,v 1.2.10.1.2.1 2009/10/25 01:10:29 kensmith Exp $"); */ -__RCSID("$NetBSD: gelf_
CVS commit: src/external/bsd/libelf/dist
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/lib
Module Name:src Committed By: martin Date: Thu Dec 27 08:06:28 UTC 2012 Modified Files: src/external/bsd/libelf/lib: Makefile Log Message: ia64 compiler bug workaround: reduce -O to 1 for one file To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libelf/lib/Makefile 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/lib/Makefile diff -u src/external/bsd/libelf/lib/Makefile:1.2 src/external/bsd/libelf/lib/Makefile:1.3 --- src/external/bsd/libelf/lib/Makefile:1.2 Sat Dec 19 09:01:32 2009 +++ src/external/bsd/libelf/lib/Makefile Thu Dec 27 08:06:28 2012 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2009/12/19 09:01:32 thorpej Exp $ +# $NetBSD: Makefile,v 1.3 2012/12/27 08:06:28 martin Exp $ .include @@ -49,6 +49,10 @@ LIBELF_GENSRCS= libelf_fsize.c libelf_ms CLEANFILES+= ${LIBELF_GENSRCS} CPPFLAGS+= -I${.CURDIR} +.if ${HAVE_GCC:U} == "45" && ${MACHINE_CPU} == "ia64" +COPTS.libelf_extended.c+= ${${ACTIVE_CC} == "gcc" :? -O1 :} +.endif + MAN= elf.3 \ elf_begin.3 \ elf_cntl.3 \
CVS commit: src/external/bsd/libelf/dist
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 # include 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
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
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; }