From 6f48c914b2e7af02d4a861658b8c1eb01c0056b8 Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Mon, 30 Apr 2018 13:39:09 +1000 Subject: Revert "rtemstoolkit: Update elftoolchain to the latest code." This reverts commit 0c5db2dd13b8270bb80c497d5f53ae2471f8a819. --- rtemstoolkit/elftoolchain/common/Makefile | 8 +- rtemstoolkit/elftoolchain/common/_elftc.h | 6 +- rtemstoolkit/elftoolchain/common/elfdefinitions.h | 17 +- rtemstoolkit/elftoolchain/common/native-elf-format | 5 +- rtemstoolkit/elftoolchain/common/os.Linux.mk | 2 +- rtemstoolkit/elftoolchain/common/uthash.h | 2 + rtemstoolkit/elftoolchain/libelf/Makefile | 2 +- rtemstoolkit/elftoolchain/libelf/README | 12 -- rtemstoolkit/elftoolchain/libelf/README.build | 66 ------- rtemstoolkit/elftoolchain/libelf/Version.map | 13 +- rtemstoolkit/elftoolchain/libelf/_libelf.h | 24 +-- rtemstoolkit/elftoolchain/libelf/_libelf_ar.h | 2 + rtemstoolkit/elftoolchain/libelf/_libelf_config.h | 50 +++++- rtemstoolkit/elftoolchain/libelf/elf.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf.c | 2 +- rtemstoolkit/elftoolchain/libelf/elf_begin.3 | 35 ++-- rtemstoolkit/elftoolchain/libelf/elf_begin.c | 193 ++++++++++++++++----- rtemstoolkit/elftoolchain/libelf/elf_cntl.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_cntl.c | 2 +- rtemstoolkit/elftoolchain/libelf/elf_data.c | 2 +- rtemstoolkit/elftoolchain/libelf/elf_end.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_end.c | 12 +- rtemstoolkit/elftoolchain/libelf/elf_errmsg.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_errmsg.c | 2 +- rtemstoolkit/elftoolchain/libelf/elf_errno.c | 2 +- rtemstoolkit/elftoolchain/libelf/elf_fill.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_fill.c | 2 +- rtemstoolkit/elftoolchain/libelf/elf_flag.c | 12 +- rtemstoolkit/elftoolchain/libelf/elf_flagdata.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_getarhdr.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_getarhdr.c | 2 +- rtemstoolkit/elftoolchain/libelf/elf_getarsym.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_getarsym.c | 2 +- rtemstoolkit/elftoolchain/libelf/elf_getbase.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_getbase.c | 2 +- rtemstoolkit/elftoolchain/libelf/elf_getdata.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_getident.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_getident.c | 2 +- rtemstoolkit/elftoolchain/libelf/elf_getphdrnum.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_getphnum.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_getscn.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_getshdrnum.3 | 2 +- .../elftoolchain/libelf/elf_getshdrstrndx.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_getshnum.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_getshstrndx.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_hash.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_hash.c | 2 +- rtemstoolkit/elftoolchain/libelf/elf_kind.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_kind.c | 2 +- rtemstoolkit/elftoolchain/libelf/elf_memory.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_memory.c | 2 +- rtemstoolkit/elftoolchain/libelf/elf_next.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_next.c | 2 +- rtemstoolkit/elftoolchain/libelf/elf_phnum.c | 2 +- rtemstoolkit/elftoolchain/libelf/elf_rand.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_rand.c | 2 +- rtemstoolkit/elftoolchain/libelf/elf_rawfile.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_rawfile.c | 2 +- rtemstoolkit/elftoolchain/libelf/elf_scn.c | 4 +- rtemstoolkit/elftoolchain/libelf/elf_shnum.c | 2 +- rtemstoolkit/elftoolchain/libelf/elf_shstrndx.c | 2 +- rtemstoolkit/elftoolchain/libelf/elf_strptr.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_strptr.c | 2 +- rtemstoolkit/elftoolchain/libelf/elf_types.m4 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_update.3 | 2 +- rtemstoolkit/elftoolchain/libelf/elf_update.c | 69 +++++--- rtemstoolkit/elftoolchain/libelf/elf_version.3 | 6 +- rtemstoolkit/elftoolchain/libelf/elf_version.c | 2 +- rtemstoolkit/elftoolchain/libelf/gelf.3 | 2 +- rtemstoolkit/elftoolchain/libelf/gelf.h | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_cap.c | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_checksum.3 | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_checksum.c | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_dyn.c | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_ehdr.c | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_fsize.3 | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_fsize.c | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_getcap.3 | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_getclass.3 | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_getclass.c | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_getdyn.3 | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_getehdr.3 | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_getmove.3 | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_getphdr.3 | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_getrel.3 | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_getrela.3 | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_getshdr.3 | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_getsym.3 | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_getsyminfo.3 | 2 +- .../elftoolchain/libelf/gelf_getsymshndx.3 | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_move.c | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_newehdr.3 | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_newphdr.3 | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_phdr.c | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_rel.c | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_rela.c | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_shdr.c | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_sym.c | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_syminfo.c | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_symshndx.c | 2 +- .../elftoolchain/libelf/gelf_update_ehdr.3 | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_xlate.c | 2 +- rtemstoolkit/elftoolchain/libelf/gelf_xlatetof.3 | 2 +- rtemstoolkit/elftoolchain/libelf/libelf.h | 2 +- rtemstoolkit/elftoolchain/libelf/libelf_align.c | 2 +- rtemstoolkit/elftoolchain/libelf/libelf_allocate.c | 2 +- rtemstoolkit/elftoolchain/libelf/libelf_ar.c | 2 +- rtemstoolkit/elftoolchain/libelf/libelf_ar_util.c | 2 +- rtemstoolkit/elftoolchain/libelf/libelf_checksum.c | 2 +- rtemstoolkit/elftoolchain/libelf/libelf_convert.m4 | 2 +- rtemstoolkit/elftoolchain/libelf/libelf_data.c | 2 +- rtemstoolkit/elftoolchain/libelf/libelf_ehdr.c | 2 +- rtemstoolkit/elftoolchain/libelf/libelf_extended.c | 2 +- rtemstoolkit/elftoolchain/libelf/libelf_fsize.m4 | 2 +- rtemstoolkit/elftoolchain/libelf/libelf_msize.m4 | 2 +- rtemstoolkit/elftoolchain/libelf/libelf_phdr.c | 2 +- rtemstoolkit/elftoolchain/libelf/libelf_shdr.c | 2 +- rtemstoolkit/elftoolchain/libelf/libelf_xlate.c | 2 +- rtemstoolkit/elftoolchain/libelf/os.FreeBSD.mk | 2 +- rtemstoolkit/elftoolchain/libelf/os.NetBSD.mk | 2 +- 120 files changed, 434 insertions(+), 306 deletions(-) delete mode 100644 rtemstoolkit/elftoolchain/libelf/README delete mode 100644 rtemstoolkit/elftoolchain/libelf/README.build diff --git a/rtemstoolkit/elftoolchain/common/Makefile b/rtemstoolkit/elftoolchain/common/Makefile index d13e806..b7b5372 100644 --- a/rtemstoolkit/elftoolchain/common/Makefile +++ b/rtemstoolkit/elftoolchain/common/Makefile @@ -1,13 +1,15 @@ -# $Id$ +# $Id: Makefile 2140 2011-11-10 14:27:03Z jkoshy $ TOP= .. INCS= elfdefinitions.h INCSDIR?= /usr/include -all obj depend: +.PHONY: all clean clobber depend obj -clean: +all depend obj: + +clean clobber: rm -f ${CLEANFILES} .include "${TOP}/mk/elftoolchain.inc.mk" diff --git a/rtemstoolkit/elftoolchain/common/_elftc.h b/rtemstoolkit/elftoolchain/common/_elftc.h index e01e7cd..9ee8db1 100644 --- a/rtemstoolkit/elftoolchain/common/_elftc.h +++ b/rtemstoolkit/elftoolchain/common/_elftc.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: _elftc.h 2064 2011-10-26 15:12:32Z jkoshy $ */ /** @@ -78,8 +78,12 @@ #endif #if defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) +#if defined(__GNUC__) +#define ELFTC_VCSID(ID) __asm__(".ident\t\"" ID "\"") +#else #define ELFTC_VCSID(ID) /**/ #endif +#endif #if defined(__NetBSD__) #define ELFTC_VCSID(ID) __RCSID(ID) diff --git a/rtemstoolkit/elftoolchain/common/elfdefinitions.h b/rtemstoolkit/elftoolchain/common/elfdefinitions.h index 2c357d1..79b6e7f 100644 --- a/rtemstoolkit/elftoolchain/common/elfdefinitions.h +++ b/rtemstoolkit/elftoolchain/common/elfdefinitions.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: elfdefinitions.h 2132 2011-11-10 08:27:41Z jkoshy $ */ /* @@ -867,12 +867,22 @@ _ELF_DEFINE_PT(PT_PHDR, 6, \ _ELF_DEFINE_PT(PT_TLS, 7, "thread local storage") \ _ELF_DEFINE_PT(PT_LOOS, 0x60000000UL, \ "start of OS-specific range") \ +_ELF_DEFINE_PT(PT_SUNW_UNWIND, 0x6464E550UL, \ + "Solaris/amd64 stack unwind tables") \ _ELF_DEFINE_PT(PT_GNU_EH_FRAME, 0x6474E550UL, \ - "GCC generated .eh_frame_hdr segment ") \ + "GCC generated .eh_frame_hdr segment") \ _ELF_DEFINE_PT(PT_GNU_STACK, 0x6474E551UL, \ "Stack flags") \ _ELF_DEFINE_PT(PT_GNU_RELRO, 0x6474E552UL, \ "Segment becomes read-only after relocation") \ +_ELF_DEFINE_PT(PT_SUNWBSS, 0x6FFFFFFAUL, \ + "A Solaris .SUNW_bss section") \ +_ELF_DEFINE_PT(PT_SUNWSTACK, 0x6FFFFFFBUL, \ + "A Solaris process stack") \ +_ELF_DEFINE_PT(PT_SUNWDTRACE, 0x6FFFFFFCUL, \ + "Used by dtrace(1)") \ +_ELF_DEFINE_PT(PT_SUNWCAP, 0x6FFFFFFDUL, \ + "Special hardware capability requirements") \ _ELF_DEFINE_PT(PT_HIOS, 0x6FFFFFFFUL, \ "end of OS-specific range") \ _ELF_DEFINE_PT(PT_LOPROC, 0x70000000UL, \ @@ -899,6 +909,8 @@ enum { /* synonyms. */ #define PT_ARM_UNWIND PT_ARM_EXIDX +#define PT_HISUNW PT_HIOS +#define PT_LOSUNW PT_SUNWBSS /* * Section flags. @@ -1589,6 +1601,7 @@ _ELF_DEFINE_RELOC(R_MIPS_GOT16, 9) \ _ELF_DEFINE_RELOC(R_MIPS_PC16, 10) \ _ELF_DEFINE_RELOC(R_MIPS_CALL16, 11) \ _ELF_DEFINE_RELOC(R_MIPS_GPREL32, 12) \ +_ELF_DEFINE_RELOC(R_MIPS_64, 18) \ _ELF_DEFINE_RELOC(R_MIPS_GOTHI16, 21) \ _ELF_DEFINE_RELOC(R_MIPS_GOTLO16, 22) \ _ELF_DEFINE_RELOC(R_MIPS_CALLHI16, 30) \ diff --git a/rtemstoolkit/elftoolchain/common/native-elf-format b/rtemstoolkit/elftoolchain/common/native-elf-format index f239e30..4b06672 100755 --- a/rtemstoolkit/elftoolchain/common/native-elf-format +++ b/rtemstoolkit/elftoolchain/common/native-elf-format @@ -1,5 +1,7 @@ #!/bin/sh # +# $Id: native-elf-format 2064 2011-10-26 15:12:32Z jkoshy $ +# # Find the native ELF format for a host platform by compiling a # test object and examining the resulting object. # @@ -17,7 +19,7 @@ touch ${tmp_c} echo "/* Generated by ${program} on `date` */" cc -c ${tmp_c} -o ${tmp_o} -readelf -h ${tmp_o} | awk ' +LANG="C" readelf -h ${tmp_o} | awk ' $1 ~ "Class:" { sub("ELF","",$2); elfclass = $2; } @@ -42,4 +44,3 @@ END { printf("#define ELFTC_ARCH %s\n", elfarch); printf("#define ELFTC_BYTEORDER ELFDATA2%s\n", elfdata); }' - diff --git a/rtemstoolkit/elftoolchain/common/os.Linux.mk b/rtemstoolkit/elftoolchain/common/os.Linux.mk index f077a88..2339e2a 100644 --- a/rtemstoolkit/elftoolchain/common/os.Linux.mk +++ b/rtemstoolkit/elftoolchain/common/os.Linux.mk @@ -1,7 +1,7 @@ # # Build recipes for Linux based operating systems. # -# $Id$ +# $Id: os.Linux.mk 2064 2011-10-26 15:12:32Z jkoshy $ _NATIVE_ELF_FORMAT = native-elf-format diff --git a/rtemstoolkit/elftoolchain/common/uthash.h b/rtemstoolkit/elftoolchain/common/uthash.h index ffdc6cd..8428b9c 100644 --- a/rtemstoolkit/elftoolchain/common/uthash.h +++ b/rtemstoolkit/elftoolchain/common/uthash.h @@ -21,6 +21,8 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* $Id: uthash.h 2064 2011-10-26 15:12:32Z jkoshy $ */ + #ifndef UTHASH_H #define UTHASH_H diff --git a/rtemstoolkit/elftoolchain/libelf/Makefile b/rtemstoolkit/elftoolchain/libelf/Makefile index 6fb27d0..41e902a 100644 --- a/rtemstoolkit/elftoolchain/libelf/Makefile +++ b/rtemstoolkit/elftoolchain/libelf/Makefile @@ -1,4 +1,4 @@ -# $Id$ +# $Id: Makefile 1345 2011-01-01 11:17:52Z jkoshy $ TOP= ${.CURDIR}/.. diff --git a/rtemstoolkit/elftoolchain/libelf/README b/rtemstoolkit/elftoolchain/libelf/README deleted file mode 100644 index 726fcc9..0000000 --- a/rtemstoolkit/elftoolchain/libelf/README +++ /dev/null @@ -1,12 +0,0 @@ -# $FreeBSD$ -# $NetBSD$ - -libelf: a BSD-licensed implementation of the ELF(3)/GELF(3) API. - -Documentation: - * Manual page elf.3 contains an overview of the library. Other - manual pages document individual APIs in the library. - * A tutorial "libelf by Example" is available at: - http://people.freebsd.org/~jkoshy/download/libelf/article.html - -For ongoing development please see http://elftoolchain.sourceforge.net/ diff --git a/rtemstoolkit/elftoolchain/libelf/README.build b/rtemstoolkit/elftoolchain/libelf/README.build deleted file mode 100644 index 7975182..0000000 --- a/rtemstoolkit/elftoolchain/libelf/README.build +++ /dev/null @@ -1,66 +0,0 @@ -: README.build -- notes on the build process - -The "Makefile" in this directory uses BSD make(1) syntax. If you are -trying to build this library on a platform that does not have a -pre-built BSD compatible make(1), then you could try porting NetBSD's -make(1). NetBSD's make(1) is available at: - - http://www.crufty.net/help/sjg/bmake.html - - -: Supporting cross builds - -In the general case, libelf may be built for a target operating system -and machine architecture that is different from the host operating -system and machine architecture that the compilation is happening on. -For example, compilation could be running on a Linux/i386 host, with -target binaries being created for a NetBSD/sparc64 system. - -To support cross building: -- The top-level "Makefile" pulls in the appropriate make rules for the - target system. - - Inside of makefiles, we determine the target OS by looking at the - contents of the ${unix} make variable. The top-level makefile then - includes any target specific makefiles if they exist. - -- Operating systems differ in the names and locations of the headers - where their ELF types are defined. They also differ in the set of - ELF types supported. - - Instead of relying on the host operating system to provide ELF related - types and symbols, we define these in header . - -- The file "_libelf_config.h" defines the 'native' architecture, byte order - and word size for libelf. - -: OS Specific Configuration : - -:: Debian :: - -The following packages are needed for the build: -- `build-essential' -- `m4' -- `freebsd-buildutils' or `freebsd5-buildutils' - -You would need to use `freebsd-make' instead of GNU make to build -the tools. You would also need to place /usr/lib/freebsd in the -shell's `PATH', preferably at the beginning. - -:: FreeBSD :: - -libelf should build out of the box on FreeBSD versions later than 6.0. - -:: NetBSD :: - -libelf should build out of the box on NetBSD versions later than 4.0. - -:: Ubuntu :: - -See the section on 'Debian' above. - - -: Porting resources on the 'net - -The 'predef' project [http://predef.sourceforge.net/] has a -comprehensive list of CPP macros predefined by various OSes. diff --git a/rtemstoolkit/elftoolchain/libelf/Version.map b/rtemstoolkit/elftoolchain/libelf/Version.map index 18e6473..2c595ea 100644 --- a/rtemstoolkit/elftoolchain/libelf/Version.map +++ b/rtemstoolkit/elftoolchain/libelf/Version.map @@ -1,4 +1,6 @@ /* + * $Id: Version.map 2033 2011-10-23 09:21:13Z jkoshy $ + * * $FreeBSD: src/lib/libelf/Version.map,v 1.3 2007/04/29 14:05:22 deischen Exp $ */ FBSD_1.0 { @@ -93,14 +95,3 @@ global: local: *; }; - -/* - * Private symbols, mostly test hooks - */ -FBSDprivate_1.0 { -global: - _libelf_set_error; - _libelf_get_max_error; - _libelf_get_no_error_message; - _libelf_get_unknown_error_message; -}; diff --git a/rtemstoolkit/elftoolchain/libelf/_libelf.h b/rtemstoolkit/elftoolchain/libelf/_libelf.h index 4470e40..ef15642 100644 --- a/rtemstoolkit/elftoolchain/libelf/_libelf.h +++ b/rtemstoolkit/elftoolchain/libelf/_libelf.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2006,2008-2010 Joseph Koshy + * Copyright (c) 2006,2008-2011 Joseph Koshy * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: _libelf.h 1921 2011-09-23 08:04:02Z jkoshy $ */ #ifndef __LIBELF_H_ @@ -66,15 +66,17 @@ extern struct _libelf_globals _libelf; #define LIBELF_ADJUST_AR_SIZE(S) (((S) + 1U) & ~1U) /* - * Flags for library internal use. These use the upper 16 bits of a - * flags field. + * Flags for library internal use. These use the upper 16 bits of the + * `e_flags' field. */ -#define LIBELF_F_DATA_MALLOCED 0x010000 /* whether data was malloc'ed */ -#define LIBELF_F_MMAP 0x020000 /* whether e_rawfile was mmap'ed */ -#define LIBELF_F_SHDRS_LOADED 0x040000 /* whether all shdrs were read in */ -#define LIBELF_F_AR_VARIANT_SVR4 0x080000 /* BSD style ar(1) archive */ -#define LIBELF_F_AR_HEADER 0x100000 /* translated header available */ -#define LIBELF_F_MASK 0x00FFFF /* Flags defined by the API. */ +#define LIBELF_F_API_MASK 0x00FFFF /* Flags defined by the API. */ +#define LIBELF_F_AR_HEADER 0x010000 /* translated header available */ +#define LIBELF_F_AR_VARIANT_SVR4 0x020000 /* BSD style ar(1) archive */ +#define LIBELF_F_DATA_MALLOCED 0x040000 /* whether data was malloc'ed */ +#define LIBELF_F_RAWFILE_MALLOC 0x080000 /* whether e_rawfile was malloc'ed */ +#define LIBELF_F_RAWFILE_MMAP 0x100000 /* whether e_rawfile was mmap'ed */ +#define LIBELF_F_SHDRS_LOADED 0x200000 /* whether all shdrs were read in */ +#define LIBELF_F_SPECIAL_FILE 0x400000 /* non-regular file */ struct _Elf { int e_activations; /* activation count */ @@ -82,7 +84,7 @@ struct _Elf { int e_class; /* ELFCLASS* */ Elf_Cmd e_cmd; /* ELF_C_* used at creation time */ int e_fd; /* associated file descriptor */ - unsigned int e_flags; /* ELF_F_*, LIBELF_F_* flags */ + unsigned int e_flags; /* ELF_F_* & LIBELF_F_* flags */ Elf_Kind e_kind; /* ELF_K_* */ Elf *e_parent; /* non-NULL for archive members */ char *e_rawfile; /* uninterpreted bytes */ diff --git a/rtemstoolkit/elftoolchain/libelf/_libelf_ar.h b/rtemstoolkit/elftoolchain/libelf/_libelf_ar.h index 2de929b..d6b15a7 100644 --- a/rtemstoolkit/elftoolchain/libelf/_libelf_ar.h +++ b/rtemstoolkit/elftoolchain/libelf/_libelf_ar.h @@ -22,6 +22,8 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $Id: _libelf_ar.h 2032 2011-10-23 09:07:00Z jkoshy $ */ #ifndef __LIBELF_AR_H_ diff --git a/rtemstoolkit/elftoolchain/libelf/_libelf_config.h b/rtemstoolkit/elftoolchain/libelf/_libelf_config.h index 9e4f21a..120f090 100644 --- a/rtemstoolkit/elftoolchain/libelf/_libelf_config.h +++ b/rtemstoolkit/elftoolchain/libelf/_libelf_config.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008 Joseph Koshy + * Copyright (c) 2008-2011 Joseph Koshy * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -22,6 +22,8 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $Id: _libelf_config.h 2032 2011-10-23 09:07:00Z jkoshy $ */ #ifdef __FreeBSD__ @@ -113,6 +115,30 @@ #endif /* __NetBSD__ */ +#ifdef __APPLE__ + +#define LIBELF_VCSID(ID) + +#if defined(__amd64__) + +#define LIBELF_ARCH EM_X86_64 +#define LIBELF_BYTEORDER ELFDATA2LSB +#define LIBELF_CLASS ELFCLASS64 + +#elif defined(__i386__) + +#define LIBELF_ARCH EM_386 +#define LIBELF_BYTEORDER ELFDATA2LSB +#define LIBELF_CLASS ELFCLASS32 + +#else +#error Unknown Apple architecture. +#endif + +#define roundup2 roundup + +#endif /* __APPLE__ */ + /* * GNU & Linux compatibility. * @@ -147,3 +173,25 @@ #define roundup2 roundup #endif /* defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) */ + +#if defined(__WIN32__) || defined(__CYGWIN__) + +#define LIBELF_VCSID(ID) + +#if defined(__amd64__) + +#define LIBELF_ARCH EM_X86_64 +#define LIBELF_BYTEORDER ELFDATA2LSB +#define LIBELF_CLASS ELFCLASS64 + +#elif defined(__i386__) + +#define LIBELF_ARCH EM_386 +#define LIBELF_BYTEORDER ELFDATA2LSB +#define LIBELF_CLASS ELFCLASS32 + +#else +#error Unknown Apple architecture. +#endif + +#endif /* __APPLE__ */ diff --git a/rtemstoolkit/elftoolchain/libelf/elf.3 b/rtemstoolkit/elftoolchain/libelf/elf.3 index f4d872a..5d86f60 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf.3 1730 2011-08-14 10:03:34Z jkoshy $ .\" .Dd August 14, 2011 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf.c b/rtemstoolkit/elftoolchain/libelf/elf.c index d7cf30f..e3ef7f3 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf.c +++ b/rtemstoolkit/elftoolchain/libelf/elf.c @@ -28,7 +28,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf.c 1345 2011-01-01 11:17:52Z jkoshy $"); struct _libelf_globals _libelf = { .libelf_arch = LIBELF_ARCH, diff --git a/rtemstoolkit/elftoolchain/libelf/elf_begin.3 b/rtemstoolkit/elftoolchain/libelf/elf_begin.3 index ec865c1..5a013a4 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_begin.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_begin.3 @@ -21,9 +21,9 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_begin.3 1925 2011-09-23 09:34:05Z jkoshy $ .\" -.Dd July 20, 2011 +.Dd September 23, 2011 .Os .Dt ELF_BEGIN 3 .Sh NAME @@ -87,7 +87,7 @@ and .Ar elf . It can be used for both .Xr ar 1 -archives and for regular ELF files. +archives and for ELF objects. .Pp If argument .Ar elf @@ -134,7 +134,7 @@ then the value of the argument is ignored. .It Dv ELF_C_RDWR This command is used to prepare an ELF file for reading and writing. -This command is not valid for +This command is not supported for .Xr ar 1 archives. .Pp @@ -170,8 +170,7 @@ Argument should have been opened for writing. Argument .Ar elf -is ignored, and the previous contents of file referenced by -argument +is ignored, and the previous contents of file referenced by argument .Ar fd are overwritten. .El @@ -248,8 +247,9 @@ The archive denoted by argument .Ar elf could not be parsed. .It Bq Er ELF_E_ARGUMENT -An unrecognized value was specified in argument -.Ar cmd . +The value in argument +.Ar cmd +was unrecognized. .It Bq Er ELF_E_ARGUMENT A non-null value for argument .Ar elf @@ -276,11 +276,22 @@ archive was opened with with .Ar cmd set to .Dv ELF_C_RDWR . +.It Bq Er ELF_E_ARGUMENT +The file referenced by argument +.Ar fd +was empty. +.It Bq Er ELF_E_ARGUMENT +The underlying file for argument +.Ar fd +was of an unsupported type. .It Bq Er ELF_E_IO -Function -.Fn elf_begin -was unable to truncate a file opened for writing using -.Dv ELF_C_WRITE . +The file descriptor in argument +.Ar fd +was invalid. +.It Bq Er ELF_E_IO +The file descriptor in argument +.Ar fd +could not be read or written to. .It Bq Er ELF_E_RESOURCE An out of memory condition was encountered. .It Bq Er ELF_E_SEQUENCE diff --git a/rtemstoolkit/elftoolchain/libelf/elf_begin.c b/rtemstoolkit/elftoolchain/libelf/elf_begin.c index e7ebcb4..a6c9e4a 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_begin.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_begin.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2006,2008 Joseph Koshy + * Copyright (c) 2006,2008-2011 Joseph Koshy * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,69 +32,186 @@ #include #include +#include #include #include #include +#include #include #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_begin.c 1923 2011-09-23 09:01:13Z jkoshy $"); + +#define _LIBELF_INITSIZE (64*1024) + +/* + * Read from a device file, pipe or socket. + */ +static void * +_libelf_read_special_file(int fd, size_t *fsz) +{ + ssize_t readsz; + size_t bufsz, datasz; + unsigned char *buf, *t; + + datasz = 0; + readsz = 0; + bufsz = _LIBELF_INITSIZE; + if ((buf = malloc(bufsz)) == NULL) + goto resourceerror; + + /* + * Read data from the file descriptor till we reach EOF, or + * till an error is encountered. + */ + do { + /* Check if we need to expand the data buffer. */ + if (datasz == bufsz) { + bufsz *= 2; + if ((t = realloc(buf, bufsz)) == NULL) + goto resourceerror; + buf = t; + } + + do { + readsz = bufsz - datasz; + t = buf + datasz; + if ((readsz = read(fd, t, readsz)) <= 0) + break; + datasz += readsz; + } while (datasz < bufsz); + + } while (readsz > 0); + + if (readsz < 0) { + LIBELF_SET_ERROR(IO, errno); + goto error; + } + + assert(readsz == 0); + + /* + * Free up extra buffer space. + */ + if (bufsz > datasz) { + if (datasz > 0) { + if ((t = realloc(buf, datasz)) == NULL) + goto resourceerror; + buf = t; + } else { /* Zero bytes read. */ + LIBELF_SET_ERROR(ARGUMENT, 0); + free(buf); + buf = NULL; + } + } + + *fsz = datasz; + return (buf); + +resourceerror: + LIBELF_SET_ERROR(RESOURCE, 0); +error: + if (buf != NULL) + free(buf); + return (NULL); +} + static Elf * _libelf_open_object(int fd, Elf_Cmd c) { Elf *e; void *m; + mode_t mode; + size_t fsize; struct stat sb; + unsigned int flags; + + assert(c == ELF_C_READ || c == ELF_C_RDWR || c == ELF_C_WRITE); - /* - * 'Raw' files are always mapped with 'PROT_READ'. At - * elf_update(3) time for files opened with ELF_C_RDWR the - * mapping is unmapped, file data is written to using write(2) - * and then the raw data is immediately mapped back in. - */ if (fstat(fd, &sb) < 0) { LIBELF_SET_ERROR(IO, errno); return (NULL); } + mode = sb.st_mode; + fsize = (size_t) sb.st_size; + /* - * Restrict elf_begin(3) to regular files. - * - * In some operating systems, some special files can appear to - * contain ELF objects (for example, /dev/ksyms in NetBSD). - * If such files need to be processed using libelf, - * applications can use elf_memory(3) on an appropriately - * populated memory arena. + * Reject unsupported file types. */ - if (!S_ISREG(sb.st_mode)) { + if (!S_ISREG(mode) && !S_ISCHR(mode) && !S_ISFIFO(mode) && + !S_ISSOCK(mode)) { LIBELF_SET_ERROR(ARGUMENT, 0); return (NULL); } + /* + * For ELF_C_WRITE mode, allocate and return a descriptor. + */ + if (c == ELF_C_WRITE) { + if ((e = _libelf_allocate_elf()) != NULL) { + _libelf_init_elf(e, ELF_K_ELF); + e->e_byteorder = LIBELF_PRIVATE(byteorder); + e->e_fd = fd; + e->e_cmd = c; + if (!S_ISREG(mode)) + e->e_flags |= LIBELF_F_SPECIAL_FILE; + } + + return (e); + } + + + /* + * ELF_C_READ and ELF_C_RDWR mode. + */ m = NULL; - if ((m = mmap(NULL, (size_t) sb.st_size, PROT_READ, MAP_PRIVATE, fd, - (off_t) 0)) == MAP_FAILED) { - LIBELF_SET_ERROR(IO, errno); + flags = 0; + if (S_ISREG(mode)) { + /* + * Always map regular files in with 'PROT_READ' + * permissions. + * + * For objects opened in ELF_C_RDWR mode, when + * elf_update(3) is called, we remove this mapping, + * write file data out using write(2), and map the new + * contents back. + */ + if ((m = mmap(NULL, fsize, PROT_READ, MAP_PRIVATE, fd, + (off_t) 0)) == MAP_FAILED) { + LIBELF_SET_ERROR(IO, errno); + return (NULL); + } + + flags = LIBELF_F_RAWFILE_MMAP; + } else if ((m = _libelf_read_special_file(fd, &fsize)) != NULL) + flags = LIBELF_F_RAWFILE_MALLOC | LIBELF_F_SPECIAL_FILE; + else return (NULL); - } - if ((e = elf_memory(m, (size_t) sb.st_size)) == NULL) { - (void) munmap(m, (size_t) sb.st_size); + if ((e = elf_memory(m, fsize)) == NULL) { + assert((flags & LIBELF_F_RAWFILE_MALLOC) || + (flags & LIBELF_F_RAWFILE_MMAP)); + if (flags & LIBELF_F_RAWFILE_MMAP) + (void) munmap(m, fsize); + else + free(m); return (NULL); } - e->e_flags |= LIBELF_F_MMAP; - e->e_fd = fd; - e->e_cmd = c; - + /* ar(1) archives aren't supported in RDWR mode. */ if (c == ELF_C_RDWR && e->e_kind == ELF_K_AR) { (void) elf_end(e); LIBELF_SET_ERROR(ARGUMENT, 0); return (NULL); } + e->e_flags |= flags; + e->e_fd = fd; + e->e_cmd = c; + return (e); } @@ -115,28 +232,12 @@ elf_begin(int fd, Elf_Cmd c, Elf *a) return (NULL); case ELF_C_WRITE: - - if (a != NULL) { /* not allowed for ar(1) archives. */ - LIBELF_SET_ERROR(ARGUMENT, 0); - return (NULL); - } - /* - * Check writeability of `fd' immediately and fail if - * not writeable. + * The ELF_C_WRITE command is required to ignore the + * descriptor passed in. */ - if (ftruncate(fd, (off_t) 0) < 0) { - LIBELF_SET_ERROR(IO, errno); - return (NULL); - } - - if ((e = _libelf_allocate_elf()) != NULL) { - _libelf_init_elf(e, ELF_K_ELF); - e->e_byteorder = LIBELF_PRIVATE(byteorder); - e->e_fd = fd; - e->e_cmd = c; - } - return (e); + a = NULL; + break; case ELF_C_RDWR: if (a != NULL) { /* not allowed for ar(1) archives. */ diff --git a/rtemstoolkit/elftoolchain/libelf/elf_cntl.3 b/rtemstoolkit/elftoolchain/libelf/elf_cntl.3 index 7391f19..32649d1 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_cntl.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_cntl.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_cntl.3 289 2009-01-08 08:26:08Z jkoshy $ .\" .Dd August 9, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_cntl.c b/rtemstoolkit/elftoolchain/libelf/elf_cntl.c index 797934b..2021917 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_cntl.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_cntl.c @@ -28,7 +28,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_cntl.c 189 2008-07-20 10:38:08Z jkoshy $"); int elf_cntl(Elf *e, Elf_Cmd c) diff --git a/rtemstoolkit/elftoolchain/libelf/elf_data.c b/rtemstoolkit/elftoolchain/libelf/elf_data.c index 77e58ac..5ac6453 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_data.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_data.c @@ -31,7 +31,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_data.c 1765 2011-08-22 05:59:05Z jkoshy $"); Elf_Data * elf_getdata(Elf_Scn *s, Elf_Data *d) diff --git a/rtemstoolkit/elftoolchain/libelf/elf_end.3 b/rtemstoolkit/elftoolchain/libelf/elf_end.3 index 5130c92..8649faa 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_end.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_end.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_end.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd June 29, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_end.c b/rtemstoolkit/elftoolchain/libelf/elf_end.c index 488cdb0..136ed9a 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_end.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_end.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2006,2008 Joseph Koshy + * Copyright (c) 2006,2008-2009,2011 Joseph Koshy * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -34,7 +34,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_end.c 1922 2011-09-23 08:04:33Z jkoshy $"); int elf_end(Elf *e) @@ -76,8 +76,12 @@ elf_end(Elf *e) break; } - if (e->e_flags & LIBELF_F_MMAP) - (void) munmap(e->e_rawfile, e->e_rawsize); + if (e->e_rawfile) { + if (e->e_flags & LIBELF_F_RAWFILE_MMAP) + (void) munmap(e->e_rawfile, e->e_rawsize); + else if (e->e_flags & LIBELF_F_RAWFILE_MALLOC) + free(e->e_rawfile); + } sv = e; if ((e = e->e_parent) != NULL) diff --git a/rtemstoolkit/elftoolchain/libelf/elf_errmsg.3 b/rtemstoolkit/elftoolchain/libelf/elf_errmsg.3 index 88cabf4..822ba6a 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_errmsg.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_errmsg.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_errmsg.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd June 11, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_errmsg.c b/rtemstoolkit/elftoolchain/libelf/elf_errmsg.c index 258e002..7a6e552 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_errmsg.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_errmsg.c @@ -32,7 +32,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_errmsg.c 1345 2011-01-01 11:17:52Z jkoshy $"); /* * Retrieve a human readable translation for an error message. diff --git a/rtemstoolkit/elftoolchain/libelf/elf_errno.c b/rtemstoolkit/elftoolchain/libelf/elf_errno.c index f20e7bc..95e91b9 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_errno.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_errno.c @@ -30,7 +30,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_errno.c 1345 2011-01-01 11:17:52Z jkoshy $"); int elf_errno(void) diff --git a/rtemstoolkit/elftoolchain/libelf/elf_fill.3 b/rtemstoolkit/elftoolchain/libelf/elf_fill.3 index b26e91e..ab42a42 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_fill.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_fill.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_fill.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd June 11, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_fill.c b/rtemstoolkit/elftoolchain/libelf/elf_fill.c index 50ef2db..ac9e02e 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_fill.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_fill.c @@ -30,7 +30,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_fill.c 189 2008-07-20 10:38:08Z jkoshy $"); void elf_fill(int fill) diff --git a/rtemstoolkit/elftoolchain/libelf/elf_flag.c b/rtemstoolkit/elftoolchain/libelf/elf_flag.c index b4eab78..9d31719 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_flag.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_flag.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2006,2008 Joseph Koshy + * Copyright (c) 2006,2008-2009,2011 Joseph Koshy * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,7 +30,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_flag.c 1918 2011-09-22 10:42:06Z jkoshy $"); unsigned int elf_flagarhdr(Elf_Arhdr *a, Elf_Cmd c, unsigned int flags) @@ -51,7 +51,7 @@ elf_flagarhdr(Elf_Arhdr *a, Elf_Cmd c, unsigned int flags) else r = a->ar_flags &= ~flags; - return (r & LIBELF_F_MASK); + return (r & LIBELF_F_API_MASK); } unsigned int @@ -73,7 +73,7 @@ elf_flagdata(Elf_Data *d, Elf_Cmd c, unsigned int flags) else r = d->d_flags &= ~flags; - return (r & LIBELF_F_MASK); + return (r & LIBELF_F_API_MASK); } unsigned int @@ -135,7 +135,7 @@ elf_flagelf(Elf *e, Elf_Cmd c, unsigned int flags) r = e->e_flags |= flags; else r = e->e_flags &= ~flags; - return (r & LIBELF_F_MASK); + return (r & LIBELF_F_API_MASK); } unsigned int @@ -185,7 +185,7 @@ elf_flagscn(Elf_Scn *s, Elf_Cmd c, unsigned int flags) r = s->s_flags |= flags; else r = s->s_flags &= ~flags; - return (r & LIBELF_F_MASK); + return (r & LIBELF_F_API_MASK); } unsigned int diff --git a/rtemstoolkit/elftoolchain/libelf/elf_flagdata.3 b/rtemstoolkit/elftoolchain/libelf/elf_flagdata.3 index 5c197e8..d4fd420 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_flagdata.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_flagdata.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_flagdata.3 221 2008-08-10 04:56:27Z jkoshy $ .\" .Dd October 22, 2007 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_getarhdr.3 b/rtemstoolkit/elftoolchain/libelf/elf_getarhdr.3 index d5970e7..1aab71c 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_getarhdr.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_getarhdr.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_getarhdr.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd August 15, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_getarhdr.c b/rtemstoolkit/elftoolchain/libelf/elf_getarhdr.c index 7f4d514..43ceafd 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_getarhdr.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_getarhdr.c @@ -30,7 +30,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_getarhdr.c 1341 2011-01-01 04:28:29Z jkoshy $"); Elf_Arhdr * elf_getarhdr(Elf *e) diff --git a/rtemstoolkit/elftoolchain/libelf/elf_getarsym.3 b/rtemstoolkit/elftoolchain/libelf/elf_getarsym.3 index b1ed5db..cda0511 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_getarsym.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_getarsym.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_getarsym.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd August 15, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_getarsym.c b/rtemstoolkit/elftoolchain/libelf/elf_getarsym.c index 5709178..1852262 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_getarsym.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_getarsym.c @@ -30,7 +30,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_getarsym.c 1360 2011-01-08 08:27:41Z jkoshy $"); Elf_Arsym * elf_getarsym(Elf *ar, size_t *ptr) diff --git a/rtemstoolkit/elftoolchain/libelf/elf_getbase.3 b/rtemstoolkit/elftoolchain/libelf/elf_getbase.3 index c1cd4ae..fa17353 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_getbase.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_getbase.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_getbase.3 978 2010-06-06 12:40:19Z jkoshy $ .\" .Dd June 6, 2010 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_getbase.c b/rtemstoolkit/elftoolchain/libelf/elf_getbase.c index 0d5479e..30058ca 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_getbase.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_getbase.c @@ -30,7 +30,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_getbase.c 977 2010-06-06 11:50:31Z jkoshy $"); off_t elf_getbase(Elf *e) diff --git a/rtemstoolkit/elftoolchain/libelf/elf_getdata.3 b/rtemstoolkit/elftoolchain/libelf/elf_getdata.3 index d3a83c1..8816a5a 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_getdata.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_getdata.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_getdata.3 1766 2011-08-22 06:01:03Z jkoshy $ .\" .Dd January 26, 2011 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_getident.3 b/rtemstoolkit/elftoolchain/libelf/elf_getident.3 index 6e9ed47..01d7f97 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_getident.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_getident.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_getident.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd July 3, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_getident.c b/rtemstoolkit/elftoolchain/libelf/elf_getident.c index b368e02..c17f3a5 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_getident.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_getident.c @@ -32,7 +32,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_getident.c 189 2008-07-20 10:38:08Z jkoshy $"); char * elf_getident(Elf *e, size_t *sz) diff --git a/rtemstoolkit/elftoolchain/libelf/elf_getphdrnum.3 b/rtemstoolkit/elftoolchain/libelf/elf_getphdrnum.3 index 55d51ea..f0fae5e 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_getphdrnum.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_getphdrnum.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_getphdrnum.3 467 2009-08-05 18:18:49Z jkoshy $ .\" .Dd August 5, 2009 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_getphnum.3 b/rtemstoolkit/elftoolchain/libelf/elf_getphnum.3 index 97aa9bc..95c7540 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_getphnum.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_getphnum.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_getphnum.3 467 2009-08-05 18:18:49Z jkoshy $ .\" .Dd August 5, 2009 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_getscn.3 b/rtemstoolkit/elftoolchain/libelf/elf_getscn.3 index ba53da7..0afe443 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_getscn.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_getscn.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_getscn.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd October 22, 2007 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_getshdrnum.3 b/rtemstoolkit/elftoolchain/libelf/elf_getshdrnum.3 index 00da4ca..e2bf354 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_getshdrnum.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_getshdrnum.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_getshdrnum.3 467 2009-08-05 18:18:49Z jkoshy $ .\" .Dd August 4, 2009 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_getshdrstrndx.3 b/rtemstoolkit/elftoolchain/libelf/elf_getshdrstrndx.3 index 51c80fc..b02e715 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_getshdrstrndx.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_getshdrstrndx.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_getshdrstrndx.3 467 2009-08-05 18:18:49Z jkoshy $ .\" .Dd August 5, 2009 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_getshnum.3 b/rtemstoolkit/elftoolchain/libelf/elf_getshnum.3 index 8521c7f..615aa71 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_getshnum.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_getshnum.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_getshnum.3 467 2009-08-05 18:18:49Z jkoshy $ .\" .Dd August 5, 2009 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_getshstrndx.3 b/rtemstoolkit/elftoolchain/libelf/elf_getshstrndx.3 index 534ddfb..71c6f95 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_getshstrndx.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_getshstrndx.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_getshstrndx.3 467 2009-08-05 18:18:49Z jkoshy $ .\" .Dd August 5, 2009 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_hash.3 b/rtemstoolkit/elftoolchain/libelf/elf_hash.3 index 70c4ac5..f099558 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_hash.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_hash.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_hash.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd August 15, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_hash.c b/rtemstoolkit/elftoolchain/libelf/elf_hash.c index 8f3f276..12c764d 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_hash.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_hash.c @@ -30,7 +30,7 @@ #include "_libelf_config.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_hash.c 189 2008-07-20 10:38:08Z jkoshy $"); /* * This elf_hash function is defined by the System V ABI. diff --git a/rtemstoolkit/elftoolchain/libelf/elf_kind.3 b/rtemstoolkit/elftoolchain/libelf/elf_kind.3 index d5275d2..a5bbf9d 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_kind.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_kind.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_kind.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd June 1, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_kind.c b/rtemstoolkit/elftoolchain/libelf/elf_kind.c index 16098bd..0b4251a 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_kind.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_kind.c @@ -30,7 +30,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_kind.c 189 2008-07-20 10:38:08Z jkoshy $"); Elf_Kind elf_kind(Elf *e) diff --git a/rtemstoolkit/elftoolchain/libelf/elf_memory.3 b/rtemstoolkit/elftoolchain/libelf/elf_memory.3 index 7943d5e..2f9da44 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_memory.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_memory.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_memory.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd June 28, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_memory.c b/rtemstoolkit/elftoolchain/libelf/elf_memory.c index c7990cc..691beaf 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_memory.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_memory.c @@ -32,7 +32,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_memory.c 189 2008-07-20 10:38:08Z jkoshy $"); Elf * elf_memory(char *image, size_t sz) diff --git a/rtemstoolkit/elftoolchain/libelf/elf_next.3 b/rtemstoolkit/elftoolchain/libelf/elf_next.3 index d36538a..859d06c 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_next.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_next.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_next.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd June 17, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_next.c b/rtemstoolkit/elftoolchain/libelf/elf_next.c index bcf87b7..d6ca552 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_next.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_next.c @@ -32,7 +32,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_next.c 1678 2011-07-28 04:36:34Z jkoshy $"); Elf_Cmd elf_next(Elf *e) diff --git a/rtemstoolkit/elftoolchain/libelf/elf_phnum.c b/rtemstoolkit/elftoolchain/libelf/elf_phnum.c index 84488da..d63c490 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_phnum.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_phnum.c @@ -31,7 +31,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_phnum.c 466 2009-08-04 17:17:42Z jkoshy $"); static int _libelf_getphdrnum(Elf *e, size_t *phnum) diff --git a/rtemstoolkit/elftoolchain/libelf/elf_rand.3 b/rtemstoolkit/elftoolchain/libelf/elf_rand.3 index 1190e1c..e5affd6 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_rand.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_rand.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_rand.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd June 17, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_rand.c b/rtemstoolkit/elftoolchain/libelf/elf_rand.c index 953ff4d..2e7328a 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_rand.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_rand.c @@ -31,7 +31,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_rand.c 189 2008-07-20 10:38:08Z jkoshy $"); off_t elf_rand(Elf *ar, off_t offset) diff --git a/rtemstoolkit/elftoolchain/libelf/elf_rawfile.3 b/rtemstoolkit/elftoolchain/libelf/elf_rawfile.3 index 3b0b929..a713b42 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_rawfile.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_rawfile.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_rawfile.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd July 3, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_rawfile.c b/rtemstoolkit/elftoolchain/libelf/elf_rawfile.c index cce0637..22a9f95 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_rawfile.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_rawfile.c @@ -30,7 +30,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_rawfile.c 189 2008-07-20 10:38:08Z jkoshy $"); char * elf_rawfile(Elf *e, size_t *sz) diff --git a/rtemstoolkit/elftoolchain/libelf/elf_scn.c b/rtemstoolkit/elftoolchain/libelf/elf_scn.c index 232efaf..80444fd 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_scn.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_scn.c @@ -36,7 +36,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_scn.c 1077 2010-08-09 15:37:40Z jkoshy $"); /* * Load an ELF section table and create a list of Elf_Scn structures. @@ -95,7 +95,7 @@ _libelf_load_section_headers(Elf *e, void *ehdr) if (!STAILQ_EMPTY(&e->e_u.e_elf.e_scn)) { assert(STAILQ_FIRST(&e->e_u.e_elf.e_scn) == STAILQ_LAST(&e->e_u.e_elf.e_scn, _Elf_Scn, s_next)); - + i = 1; src += fsz; } diff --git a/rtemstoolkit/elftoolchain/libelf/elf_shnum.c b/rtemstoolkit/elftoolchain/libelf/elf_shnum.c index ba0447e..515027a 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_shnum.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_shnum.c @@ -31,7 +31,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_shnum.c 466 2009-08-04 17:17:42Z jkoshy $"); static int _libelf_getshdrnum(Elf *e, size_t *shnum) diff --git a/rtemstoolkit/elftoolchain/libelf/elf_shstrndx.c b/rtemstoolkit/elftoolchain/libelf/elf_shstrndx.c index 0fe2f9f..bac14b4 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_shstrndx.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_shstrndx.c @@ -31,7 +31,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_shstrndx.c 466 2009-08-04 17:17:42Z jkoshy $"); static int _libelf_getshdrstrndx(Elf *e, size_t *strndx) diff --git a/rtemstoolkit/elftoolchain/libelf/elf_strptr.3 b/rtemstoolkit/elftoolchain/libelf/elf_strptr.3 index e4882e9..31e0f83 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_strptr.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_strptr.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_strptr.3 1081 2010-08-14 02:23:48Z jkoshy $ .\" .Dd December 16, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_strptr.c b/rtemstoolkit/elftoolchain/libelf/elf_strptr.c index b96a7dd..bfa39de 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_strptr.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_strptr.c @@ -29,7 +29,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_strptr.c 189 2008-07-20 10:38:08Z jkoshy $"); /* * Convert an ELF section#,offset pair to a string pointer. diff --git a/rtemstoolkit/elftoolchain/libelf/elf_types.m4 b/rtemstoolkit/elftoolchain/libelf/elf_types.m4 index e23cfd9..9e9680d 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_types.m4 +++ b/rtemstoolkit/elftoolchain/libelf/elf_types.m4 @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: elf_types.m4 321 2009-03-07 16:59:14Z jkoshy $ */ /* diff --git a/rtemstoolkit/elftoolchain/libelf/elf_update.3 b/rtemstoolkit/elftoolchain/libelf/elf_update.3 index 71b3437..40a1e40 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_update.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_update.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_update.3 1729 2011-08-14 09:13:00Z jkoshy $ .\" .Dd August 14, 2011 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/elf_update.c b/rtemstoolkit/elftoolchain/libelf/elf_update.c index 34b944e..9806131 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_update.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_update.c @@ -25,6 +25,7 @@ */ #include +#include #include #include @@ -36,7 +37,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_update.c 1922 2011-09-23 08:04:33Z jkoshy $"); /* * Layout strategy: @@ -986,7 +987,7 @@ _libelf_write_elf(Elf *e, off_t newsize, struct _Elf_Extent_List *extents) struct _Elf_Extent *ex; assert(e->e_kind == ELF_K_ELF); - assert(e->e_cmd != ELF_C_READ); + assert(e->e_cmd == ELF_C_RDWR || e->e_cmd == ELF_C_WRITE); assert(e->e_fd >= 0); if ((newfile = malloc((size_t) newsize)) == NULL) { @@ -1037,35 +1038,57 @@ _libelf_write_elf(Elf *e, off_t newsize, struct _Elf_Extent_List *extents) assert(rc == newsize); /* - * Write out the constructed contents and remap the file in - * read-only. + * For regular files, throw away existing file content and + * unmap any existing mappings. */ - - if (e->e_rawfile && munmap(e->e_rawfile, e->e_rawsize) < 0) { - LIBELF_SET_ERROR(IO, errno); - goto error; + if ((e->e_flags & LIBELF_F_SPECIAL_FILE) == 0) { + if (ftruncate(e->e_fd, (off_t) 0) < 0 || + lseek(e->e_fd, (off_t) 0, SEEK_SET)) { + LIBELF_SET_ERROR(IO, errno); + goto error; + } + if (e->e_flags & LIBELF_F_RAWFILE_MMAP) { + assert(e->e_rawfile != NULL); + assert(e->e_cmd == ELF_C_RDWR); + if (munmap(e->e_rawfile, e->e_rawsize) < 0) { + LIBELF_SET_ERROR(IO, errno); + goto error; + } + } } - if (write(e->e_fd, newfile, (size_t) newsize) != newsize || - lseek(e->e_fd, (off_t) 0, SEEK_SET) < 0) { + /* + * Write out the new contents. + */ + if (write(e->e_fd, newfile, (size_t) newsize) != newsize) { LIBELF_SET_ERROR(IO, errno); goto error; } - if (e->e_cmd != ELF_C_WRITE) { - - if (e->e_rawsize > (size_t) newsize && - ftruncate(e->e_fd, newsize) < 0) { - LIBELF_SET_ERROR(IO, errno); - goto error; + /* + * For files opened in ELF_C_RDWR mode, set up the new 'raw' + * contents. + */ + if (e->e_cmd == ELF_C_RDWR) { + assert(e->e_rawfile != NULL); + if (e->e_flags & LIBELF_F_RAWFILE_MMAP) { + if ((e->e_rawfile = mmap(NULL, (size_t) newsize, + PROT_READ, MAP_PRIVATE, e->e_fd, (off_t) 0)) == + MAP_FAILED) { + LIBELF_SET_ERROR(IO, errno); + goto error; + } + } else if (e->e_flags & LIBELF_F_RAWFILE_MALLOC) { + free(e->e_rawfile); + e->e_rawfile = newfile; + newfile = NULL; } - if ((e->e_rawfile = mmap(NULL, (size_t) newsize, PROT_READ, - MAP_PRIVATE, e->e_fd, (off_t) 0)) == MAP_FAILED) { - LIBELF_SET_ERROR(IO, errno); - goto error; - } + /* Record the new size of the file. */ e->e_rawsize = newsize; + } else { + /* File opened in ELF_C_WRITE mode. */ + assert(e->e_rawfile == NULL); } /* @@ -1095,7 +1118,9 @@ _libelf_write_elf(Elf *e, off_t newsize, struct _Elf_Extent_List *extents) e->e_u.e_elf.e_phdr.e_phdr64 = NULL; } - free(newfile); + /* Free the temporary buffer. */ + if (newfile) + free(newfile); return (rc); diff --git a/rtemstoolkit/elftoolchain/libelf/elf_version.3 b/rtemstoolkit/elftoolchain/libelf/elf_version.3 index 3c5e01a..b09fb47 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_version.3 +++ b/rtemstoolkit/elftoolchain/libelf/elf_version.3 @@ -21,9 +21,9 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: elf_version.3 2123 2011-11-09 15:40:09Z jkoshy $ .\" -.Dd June 1, 2006 +.Dd November 9, 2011 .Os .Dt ELF_VERSION 3 .Sh NAME @@ -80,7 +80,7 @@ operating version and check for an error using the following code snippet: .Bd -literal -offset indent if (elf_version(EV_CURRENT) == EV_NONE) - err(EX_SOFTWARE, "ELF library too old"); + err(EXIT_FAILURE, "ELF library too old"); .Ed .Sh ERRORS Function diff --git a/rtemstoolkit/elftoolchain/libelf/elf_version.c b/rtemstoolkit/elftoolchain/libelf/elf_version.c index 71b3108..48950f4 100644 --- a/rtemstoolkit/elftoolchain/libelf/elf_version.c +++ b/rtemstoolkit/elftoolchain/libelf/elf_version.c @@ -30,7 +30,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: elf_version.c 189 2008-07-20 10:38:08Z jkoshy $"); unsigned int elf_version(unsigned int v) diff --git a/rtemstoolkit/elftoolchain/libelf/gelf.3 b/rtemstoolkit/elftoolchain/libelf/gelf.3 index 42dc938..a5d68ce 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf.3 +++ b/rtemstoolkit/elftoolchain/libelf/gelf.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: gelf.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd September 1, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/gelf.h b/rtemstoolkit/elftoolchain/libelf/gelf.h index cb5135c..0a7dc24 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf.h +++ b/rtemstoolkit/elftoolchain/libelf/gelf.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: gelf.h 1168 2010-09-04 01:03:25Z jkoshy $ */ #ifndef _GELF_H_ diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_cap.c b/rtemstoolkit/elftoolchain/libelf/gelf_cap.c index 8ed864e..af0b388 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_cap.c +++ b/rtemstoolkit/elftoolchain/libelf/gelf_cap.c @@ -31,7 +31,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: gelf_cap.c 1166 2010-09-04 00:54:36Z jkoshy $"); GElf_Cap * gelf_getcap(Elf_Data *d, int ndx, GElf_Cap *dst) diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_checksum.3 b/rtemstoolkit/elftoolchain/libelf/gelf_checksum.3 index 03d4022..e5f845f 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_checksum.3 +++ b/rtemstoolkit/elftoolchain/libelf/gelf_checksum.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: gelf_checksum.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd August 29, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_checksum.c b/rtemstoolkit/elftoolchain/libelf/gelf_checksum.c index 10c7b47..30fbb97 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_checksum.c +++ b/rtemstoolkit/elftoolchain/libelf/gelf_checksum.c @@ -31,7 +31,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: gelf_checksum.c 189 2008-07-20 10:38:08Z jkoshy $"); long elf32_checksum(Elf *e) diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_dyn.c b/rtemstoolkit/elftoolchain/libelf/gelf_dyn.c index fd568aa..6a2885c 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_dyn.c +++ b/rtemstoolkit/elftoolchain/libelf/gelf_dyn.c @@ -31,7 +31,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: gelf_dyn.c 189 2008-07-20 10:38:08Z jkoshy $"); GElf_Dyn * gelf_getdyn(Elf_Data *d, int ndx, GElf_Dyn *dst) diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_ehdr.c b/rtemstoolkit/elftoolchain/libelf/gelf_ehdr.c index b237295..37ccce8 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_ehdr.c +++ b/rtemstoolkit/elftoolchain/libelf/gelf_ehdr.c @@ -33,7 +33,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: gelf_ehdr.c 1678 2011-07-28 04:36:34Z jkoshy $"); Elf32_Ehdr * elf32_getehdr(Elf *e) diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_fsize.3 b/rtemstoolkit/elftoolchain/libelf/gelf_fsize.3 index 48b7320..ac7996f 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_fsize.3 +++ b/rtemstoolkit/elftoolchain/libelf/gelf_fsize.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: gelf_fsize.3 317 2009-03-06 17:29:22Z jkoshy $ .\" .Dd February 5, 2008 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_fsize.c b/rtemstoolkit/elftoolchain/libelf/gelf_fsize.c index c02e91b..0e38d14 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_fsize.c +++ b/rtemstoolkit/elftoolchain/libelf/gelf_fsize.c @@ -31,7 +31,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: gelf_fsize.c 189 2008-07-20 10:38:08Z jkoshy $"); size_t elf32_fsize(Elf_Type t, size_t c, unsigned int v) diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_getcap.3 b/rtemstoolkit/elftoolchain/libelf/gelf_getcap.3 index 960bf8f..ed8eb02 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_getcap.3 +++ b/rtemstoolkit/elftoolchain/libelf/gelf_getcap.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: gelf_getcap.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd August 29, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_getclass.3 b/rtemstoolkit/elftoolchain/libelf/gelf_getclass.3 index 84cc652..3504569 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_getclass.3 +++ b/rtemstoolkit/elftoolchain/libelf/gelf_getclass.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: gelf_getclass.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd July 3, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_getclass.c b/rtemstoolkit/elftoolchain/libelf/gelf_getclass.c index 82fd50e..349a9cd 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_getclass.c +++ b/rtemstoolkit/elftoolchain/libelf/gelf_getclass.c @@ -30,7 +30,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: gelf_getclass.c 189 2008-07-20 10:38:08Z jkoshy $"); int gelf_getclass(Elf *e) diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_getdyn.3 b/rtemstoolkit/elftoolchain/libelf/gelf_getdyn.3 index 0624824..f8c1778 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_getdyn.3 +++ b/rtemstoolkit/elftoolchain/libelf/gelf_getdyn.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: gelf_getdyn.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd August 29, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_getehdr.3 b/rtemstoolkit/elftoolchain/libelf/gelf_getehdr.3 index 2f81239..56bdcd4 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_getehdr.3 +++ b/rtemstoolkit/elftoolchain/libelf/gelf_getehdr.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: gelf_getehdr.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd December 16, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_getmove.3 b/rtemstoolkit/elftoolchain/libelf/gelf_getmove.3 index a3e70c0..871a040 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_getmove.3 +++ b/rtemstoolkit/elftoolchain/libelf/gelf_getmove.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: gelf_getmove.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd August 29, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_getphdr.3 b/rtemstoolkit/elftoolchain/libelf/gelf_getphdr.3 index fe863f2..f2d38aa 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_getphdr.3 +++ b/rtemstoolkit/elftoolchain/libelf/gelf_getphdr.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: gelf_getphdr.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd October 21, 2007 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_getrel.3 b/rtemstoolkit/elftoolchain/libelf/gelf_getrel.3 index 66aefa1..c7566e6 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_getrel.3 +++ b/rtemstoolkit/elftoolchain/libelf/gelf_getrel.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: gelf_getrel.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd August 29, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_getrela.3 b/rtemstoolkit/elftoolchain/libelf/gelf_getrela.3 index 341c821..c77d52a 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_getrela.3 +++ b/rtemstoolkit/elftoolchain/libelf/gelf_getrela.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: gelf_getrela.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd August 29, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_getshdr.3 b/rtemstoolkit/elftoolchain/libelf/gelf_getshdr.3 index cef1dc3..e92d414 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_getshdr.3 +++ b/rtemstoolkit/elftoolchain/libelf/gelf_getshdr.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: gelf_getshdr.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd August 27, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_getsym.3 b/rtemstoolkit/elftoolchain/libelf/gelf_getsym.3 index 4ce8a38..98d886f 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_getsym.3 +++ b/rtemstoolkit/elftoolchain/libelf/gelf_getsym.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: gelf_getsym.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd August 29, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_getsyminfo.3 b/rtemstoolkit/elftoolchain/libelf/gelf_getsyminfo.3 index ed60335..a1169f8 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_getsyminfo.3 +++ b/rtemstoolkit/elftoolchain/libelf/gelf_getsyminfo.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: gelf_getsyminfo.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd August 29, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_getsymshndx.3 b/rtemstoolkit/elftoolchain/libelf/gelf_getsymshndx.3 index 7d5a19c..b635aac 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_getsymshndx.3 +++ b/rtemstoolkit/elftoolchain/libelf/gelf_getsymshndx.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: gelf_getsymshndx.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd November 5, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_move.c b/rtemstoolkit/elftoolchain/libelf/gelf_move.c index da99c10..753aba9 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_move.c +++ b/rtemstoolkit/elftoolchain/libelf/gelf_move.c @@ -31,7 +31,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: gelf_move.c 1166 2010-09-04 00:54:36Z jkoshy $"); GElf_Move * gelf_getmove(Elf_Data *d, int ndx, GElf_Move *dst) diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_newehdr.3 b/rtemstoolkit/elftoolchain/libelf/gelf_newehdr.3 index 88fc0d1..180fea9 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_newehdr.3 +++ b/rtemstoolkit/elftoolchain/libelf/gelf_newehdr.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: gelf_newehdr.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd October 22, 2007 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_newphdr.3 b/rtemstoolkit/elftoolchain/libelf/gelf_newphdr.3 index b8e7072..931385e 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_newphdr.3 +++ b/rtemstoolkit/elftoolchain/libelf/gelf_newphdr.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: gelf_newphdr.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd October 22, 2007 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_phdr.c b/rtemstoolkit/elftoolchain/libelf/gelf_phdr.c index 0a9ae5f..47000d8 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_phdr.c +++ b/rtemstoolkit/elftoolchain/libelf/gelf_phdr.c @@ -31,7 +31,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: gelf_phdr.c 189 2008-07-20 10:38:08Z jkoshy $"); Elf32_Phdr * elf32_getphdr(Elf *e) diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_rel.c b/rtemstoolkit/elftoolchain/libelf/gelf_rel.c index dcff3d1..7d0b6af 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_rel.c +++ b/rtemstoolkit/elftoolchain/libelf/gelf_rel.c @@ -31,7 +31,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: gelf_rel.c 189 2008-07-20 10:38:08Z jkoshy $"); GElf_Rel * gelf_getrel(Elf_Data *d, int ndx, GElf_Rel *dst) diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_rela.c b/rtemstoolkit/elftoolchain/libelf/gelf_rela.c index 56e57a4..722c1ad 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_rela.c +++ b/rtemstoolkit/elftoolchain/libelf/gelf_rela.c @@ -31,7 +31,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: gelf_rela.c 189 2008-07-20 10:38:08Z jkoshy $"); GElf_Rela * gelf_getrela(Elf_Data *d, int ndx, GElf_Rela *dst) diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_shdr.c b/rtemstoolkit/elftoolchain/libelf/gelf_shdr.c index 9aabef0..47e56e9 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_shdr.c +++ b/rtemstoolkit/elftoolchain/libelf/gelf_shdr.c @@ -32,7 +32,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: gelf_shdr.c 189 2008-07-20 10:38:08Z jkoshy $"); Elf32_Shdr * elf32_getshdr(Elf_Scn *s) diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_sym.c b/rtemstoolkit/elftoolchain/libelf/gelf_sym.c index 86a34a8..3f84a17 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_sym.c +++ b/rtemstoolkit/elftoolchain/libelf/gelf_sym.c @@ -31,7 +31,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: gelf_sym.c 189 2008-07-20 10:38:08Z jkoshy $"); GElf_Sym * gelf_getsym(Elf_Data *d, int ndx, GElf_Sym *dst) diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_syminfo.c b/rtemstoolkit/elftoolchain/libelf/gelf_syminfo.c index 57ad5be..2e8d9d8 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_syminfo.c +++ b/rtemstoolkit/elftoolchain/libelf/gelf_syminfo.c @@ -31,7 +31,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: gelf_syminfo.c 1166 2010-09-04 00:54:36Z jkoshy $"); GElf_Syminfo * gelf_getsyminfo(Elf_Data *d, int ndx, GElf_Syminfo *dst) diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_symshndx.c b/rtemstoolkit/elftoolchain/libelf/gelf_symshndx.c index 4a8a6d3..ab3549c 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_symshndx.c +++ b/rtemstoolkit/elftoolchain/libelf/gelf_symshndx.c @@ -31,7 +31,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: gelf_symshndx.c 189 2008-07-20 10:38:08Z jkoshy $"); GElf_Sym * gelf_getsymshndx(Elf_Data *d, Elf_Data *id, int ndx, GElf_Sym *dst, diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_update_ehdr.3 b/rtemstoolkit/elftoolchain/libelf/gelf_update_ehdr.3 index 6bba9cd..f5e041d 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_update_ehdr.3 +++ b/rtemstoolkit/elftoolchain/libelf/gelf_update_ehdr.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: gelf_update_ehdr.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd August 27, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_xlate.c b/rtemstoolkit/elftoolchain/libelf/gelf_xlate.c index 6573a02..6cdf705 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_xlate.c +++ b/rtemstoolkit/elftoolchain/libelf/gelf_xlate.c @@ -32,7 +32,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: gelf_xlate.c 1678 2011-07-28 04:36:34Z jkoshy $"); Elf_Data * elf32_xlatetof(Elf_Data *dst, const Elf_Data *src, unsigned int encoding) diff --git a/rtemstoolkit/elftoolchain/libelf/gelf_xlatetof.3 b/rtemstoolkit/elftoolchain/libelf/gelf_xlatetof.3 index c7443c8..ca90002 100644 --- a/rtemstoolkit/elftoolchain/libelf/gelf_xlatetof.3 +++ b/rtemstoolkit/elftoolchain/libelf/gelf_xlatetof.3 @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id$ +.\" $Id: gelf_xlatetof.3 189 2008-07-20 10:38:08Z jkoshy $ .\" .Dd July 24, 2006 .Os diff --git a/rtemstoolkit/elftoolchain/libelf/libelf.h b/rtemstoolkit/elftoolchain/libelf/libelf.h index 3974cf1..60b0f1c 100644 --- a/rtemstoolkit/elftoolchain/libelf/libelf.h +++ b/rtemstoolkit/elftoolchain/libelf/libelf.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: libelf.h 1345 2011-01-01 11:17:52Z jkoshy $ */ #ifndef _LIBELF_H_ diff --git a/rtemstoolkit/elftoolchain/libelf/libelf_align.c b/rtemstoolkit/elftoolchain/libelf/libelf_align.c index 34a2845..55a65f9 100644 --- a/rtemstoolkit/elftoolchain/libelf/libelf_align.c +++ b/rtemstoolkit/elftoolchain/libelf/libelf_align.c @@ -32,7 +32,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: libelf_align.c 1169 2010-09-04 01:06:31Z jkoshy $"); struct align { int a32; diff --git a/rtemstoolkit/elftoolchain/libelf/libelf_allocate.c b/rtemstoolkit/elftoolchain/libelf/libelf_allocate.c index 2ebcf05..a753e8e 100644 --- a/rtemstoolkit/elftoolchain/libelf/libelf_allocate.c +++ b/rtemstoolkit/elftoolchain/libelf/libelf_allocate.c @@ -40,7 +40,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: libelf_allocate.c 1341 2011-01-01 04:28:29Z jkoshy $"); Elf * _libelf_allocate_elf(void) diff --git a/rtemstoolkit/elftoolchain/libelf/libelf_ar.c b/rtemstoolkit/elftoolchain/libelf/libelf_ar.c index 879a570..14b383d 100644 --- a/rtemstoolkit/elftoolchain/libelf/libelf_ar.c +++ b/rtemstoolkit/elftoolchain/libelf/libelf_ar.c @@ -35,7 +35,7 @@ #include "_libelf.h" #include "_libelf_ar.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: libelf_ar.c 1341 2011-01-01 04:28:29Z jkoshy $"); #define LIBELF_NALLOC_SIZE 16 diff --git a/rtemstoolkit/elftoolchain/libelf/libelf_ar_util.c b/rtemstoolkit/elftoolchain/libelf/libelf_ar_util.c index f26a04a..7051fe8 100644 --- a/rtemstoolkit/elftoolchain/libelf/libelf_ar_util.c +++ b/rtemstoolkit/elftoolchain/libelf/libelf_ar_util.c @@ -34,7 +34,7 @@ #include "_libelf.h" #include "_libelf_ar.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: libelf_ar_util.c 2066 2011-10-26 15:40:28Z jkoshy $"); /* * Convert a string bounded by `start' and `start+sz' (exclusive) to a diff --git a/rtemstoolkit/elftoolchain/libelf/libelf_checksum.c b/rtemstoolkit/elftoolchain/libelf/libelf_checksum.c index dbedf98..0bece9a 100644 --- a/rtemstoolkit/elftoolchain/libelf/libelf_checksum.c +++ b/rtemstoolkit/elftoolchain/libelf/libelf_checksum.c @@ -30,7 +30,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: libelf_checksum.c 189 2008-07-20 10:38:08Z jkoshy $"); static unsigned long _libelf_sum(unsigned long c, const unsigned char *s, size_t size) diff --git a/rtemstoolkit/elftoolchain/libelf/libelf_convert.m4 b/rtemstoolkit/elftoolchain/libelf/libelf_convert.m4 index 4b68607..9b1679a 100644 --- a/rtemstoolkit/elftoolchain/libelf/libelf_convert.m4 +++ b/rtemstoolkit/elftoolchain/libelf/libelf_convert.m4 @@ -32,7 +32,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: libelf_convert.m4 1734 2011-08-16 09:55:07Z jkoshy $"); /* WARNING: GENERATED FROM __file__. */ diff --git a/rtemstoolkit/elftoolchain/libelf/libelf_data.c b/rtemstoolkit/elftoolchain/libelf/libelf_data.c index c5424f4..8044c74 100644 --- a/rtemstoolkit/elftoolchain/libelf/libelf_data.c +++ b/rtemstoolkit/elftoolchain/libelf/libelf_data.c @@ -30,7 +30,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: libelf_data.c 1264 2010-11-12 14:53:23Z jkoshy $"); int _libelf_xlate_shtype(uint32_t sht) diff --git a/rtemstoolkit/elftoolchain/libelf/libelf_ehdr.c b/rtemstoolkit/elftoolchain/libelf/libelf_ehdr.c index 8b04fc0..affe541 100644 --- a/rtemstoolkit/elftoolchain/libelf/libelf_ehdr.c +++ b/rtemstoolkit/elftoolchain/libelf/libelf_ehdr.c @@ -33,7 +33,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: libelf_ehdr.c 1677 2011-07-28 04:35:53Z jkoshy $"); /* * Retrieve counts for sections, phdrs and the section string table index diff --git a/rtemstoolkit/elftoolchain/libelf/libelf_extended.c b/rtemstoolkit/elftoolchain/libelf/libelf_extended.c index 985f7d5..10590bb 100644 --- a/rtemstoolkit/elftoolchain/libelf/libelf_extended.c +++ b/rtemstoolkit/elftoolchain/libelf/libelf_extended.c @@ -31,7 +31,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: libelf_extended.c 1360 2011-01-08 08:27:41Z jkoshy $"); /* * Retrieve section #0, allocating a new section if needed. diff --git a/rtemstoolkit/elftoolchain/libelf/libelf_fsize.m4 b/rtemstoolkit/elftoolchain/libelf/libelf_fsize.m4 index 436fbcf..4829789 100644 --- a/rtemstoolkit/elftoolchain/libelf/libelf_fsize.m4 +++ b/rtemstoolkit/elftoolchain/libelf/libelf_fsize.m4 @@ -28,7 +28,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: libelf_fsize.m4 1724 2011-08-13 05:35:42Z jkoshy $"); /* WARNING: GENERATED FROM __file__. */ diff --git a/rtemstoolkit/elftoolchain/libelf/libelf_msize.m4 b/rtemstoolkit/elftoolchain/libelf/libelf_msize.m4 index 4340947..95621fb 100644 --- a/rtemstoolkit/elftoolchain/libelf/libelf_msize.m4 +++ b/rtemstoolkit/elftoolchain/libelf/libelf_msize.m4 @@ -32,7 +32,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: libelf_msize.m4 1724 2011-08-13 05:35:42Z jkoshy $"); /* WARNING: GENERATED FROM __file__. */ diff --git a/rtemstoolkit/elftoolchain/libelf/libelf_phdr.c b/rtemstoolkit/elftoolchain/libelf/libelf_phdr.c index e01b8ee..5a5bb5f 100644 --- a/rtemstoolkit/elftoolchain/libelf/libelf_phdr.c +++ b/rtemstoolkit/elftoolchain/libelf/libelf_phdr.c @@ -33,7 +33,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: libelf_phdr.c 1677 2011-07-28 04:35:53Z jkoshy $"); void * _libelf_getphdr(Elf *e, int ec) diff --git a/rtemstoolkit/elftoolchain/libelf/libelf_shdr.c b/rtemstoolkit/elftoolchain/libelf/libelf_shdr.c index c96e59d..a696cef 100644 --- a/rtemstoolkit/elftoolchain/libelf/libelf_shdr.c +++ b/rtemstoolkit/elftoolchain/libelf/libelf_shdr.c @@ -31,7 +31,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: libelf_shdr.c 189 2008-07-20 10:38:08Z jkoshy $"); void * _libelf_getshdr(Elf_Scn *s, int ec) diff --git a/rtemstoolkit/elftoolchain/libelf/libelf_xlate.c b/rtemstoolkit/elftoolchain/libelf/libelf_xlate.c index 4633af9..ace4e09 100644 --- a/rtemstoolkit/elftoolchain/libelf/libelf_xlate.c +++ b/rtemstoolkit/elftoolchain/libelf/libelf_xlate.c @@ -31,7 +31,7 @@ #include "_libelf.h" -LIBELF_VCSID("$Id$"); +LIBELF_VCSID("$Id: libelf_xlate.c 316 2009-02-28 16:08:44Z jkoshy $"); /* * Translate to/from the file representation of ELF objects. diff --git a/rtemstoolkit/elftoolchain/libelf/os.FreeBSD.mk b/rtemstoolkit/elftoolchain/libelf/os.FreeBSD.mk index 209b6fa..72834b7 100644 --- a/rtemstoolkit/elftoolchain/libelf/os.FreeBSD.mk +++ b/rtemstoolkit/elftoolchain/libelf/os.FreeBSD.mk @@ -1,7 +1,7 @@ # # Building for a FreeBSD target. # -# $Id$ +# $Id: os.FreeBSD.mk 710 2010-02-17 14:21:38Z jkoshy $ # Symbol versioning support [FreeBSD 7.X and later] VERSION_MAP= ${.CURDIR}/Version.map diff --git a/rtemstoolkit/elftoolchain/libelf/os.NetBSD.mk b/rtemstoolkit/elftoolchain/libelf/os.NetBSD.mk index 3c7d6f7..96b8335 100644 --- a/rtemstoolkit/elftoolchain/libelf/os.NetBSD.mk +++ b/rtemstoolkit/elftoolchain/libelf/os.NetBSD.mk @@ -1,7 +1,7 @@ # # Build recipes for NetBSD. # -# $Id$ +# $Id: os.NetBSD.mk 710 2010-02-17 14:21:38Z jkoshy $ # MKLINT= no # lint dies with a sigbus -- cgit v1.2.3