From owner-p4-projects@FreeBSD.ORG Wed Nov 1 06:55:01 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7AE8116A47C; Wed, 1 Nov 2006 06:55:01 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 566CA16A403 for ; Wed, 1 Nov 2006 06:55:01 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id A74EF43D66 for ; Wed, 1 Nov 2006 06:54:51 +0000 (GMT) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id kA16spwl036446 for ; Wed, 1 Nov 2006 06:54:51 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id kA16so4X036443 for perforce@freebsd.org; Wed, 1 Nov 2006 06:54:50 GMT (envelope-from jb@freebsd.org) Date: Wed, 1 Nov 2006 06:54:50 GMT Message-Id: <200611010654.kA16so4X036443@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 108891 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 01 Nov 2006 06:55:01 -0000 http://perforce.freebsd.org/chv.cgi?CH=108891 Change 108891 by jb@jb_freebsd8 on 2006/11/01 06:53:52 IFlibbsdelf Affected files ... .. //depot/projects/dtrace/src/lib/libelf/Makefile#14 integrate .. //depot/projects/dtrace/src/lib/libelf/_libelf.h#9 integrate .. //depot/projects/dtrace/src/lib/libelf/elf_data.c#2 integrate .. //depot/projects/dtrace/src/lib/libelf/elf_getdata.3#3 integrate .. //depot/projects/dtrace/src/lib/libelf/elf_getscn.3#2 integrate .. //depot/projects/dtrace/src/lib/libelf/elf_getshnum.3#1 branch .. //depot/projects/dtrace/src/lib/libelf/elf_getshstrndx.3#1 branch .. //depot/projects/dtrace/src/lib/libelf/elf_scn.c#3 integrate .. //depot/projects/dtrace/src/lib/libelf/elf_shnum.c#1 branch .. //depot/projects/dtrace/src/lib/libelf/elf_shstrndx.c#1 branch .. //depot/projects/dtrace/src/lib/libelf/elf_update.3#4 integrate .. //depot/projects/dtrace/src/lib/libelf/elf_update.c#4 integrate .. //depot/projects/dtrace/src/lib/libelf/gelf_getmove.3#1 branch .. //depot/projects/dtrace/src/lib/libelf/gelf_getsyminfo.3#1 branch .. //depot/projects/dtrace/src/lib/libelf/gelf_newphdr.3#3 integrate .. //depot/projects/dtrace/src/lib/libelf/gelf_update.c#3 integrate .. //depot/projects/dtrace/src/lib/libelf/libelf.c#5 integrate .. //depot/projects/dtrace/src/lib/libelf/libelf.h#10 integrate .. //depot/projects/dtrace/src/lib/libelf/libelf_align.c#1 branch .. //depot/projects/dtrace/src/lib/libelf/libelf_allocate.c#5 integrate .. //depot/projects/dtrace/src/lib/libelf/libelf_convert.m4#10 integrate .. //depot/projects/dtrace/src/lib/libelf/libelf_data.c#2 integrate .. //depot/projects/dtrace/src/lib/libelf/libelf_fsize.m4#5 integrate .. //depot/projects/dtrace/src/lib/libelf/libelf_msize.m4#4 integrate .. //depot/projects/dtrace/src/lib/libelf/libelf_phdr.c#3 integrate Differences ... ==== //depot/projects/dtrace/src/lib/libelf/Makefile#14 (text+ko) ==== @@ -18,6 +18,8 @@ elf_next.c \ elf_rand.c \ elf_rawfile.c \ + elf_shnum.c \ + elf_shstrndx.c \ elf_scn.c \ elf_strptr.c \ elf_update.c \ @@ -35,6 +37,7 @@ gelf_update.c \ gelf_xlate.c \ libelf.c \ + libelf_align.c \ libelf_allocate.c \ libelf_ar.c \ libelf_checksum.c \ @@ -66,6 +69,8 @@ elf_getdata.3 \ elf_getident.3 \ elf_getscn.3 \ + elf_getshnum.3 \ + elf_getshstrndx.3 \ elf_hash.3 \ elf_kind.3 \ elf_memory.3 \ @@ -81,22 +86,18 @@ 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_newehdr.3 \ gelf_newphdr.3 \ gelf_update_ehdr.3 \ gelf_xlatetof.3 -MLINKS+= \ - gelf.3 gelf_getmove.3 \ - gelf.3 gelf_getsyminfo.3 \ - gelf.3 gelf_update_move.3 \ - gelf.3 gelf_update_syminfo.3 - MLINKS+= \ elf_errmsg.3 elf_errno.3 \ elf_flagdata.3 elf_flagehdr.3 \ @@ -109,10 +110,13 @@ elf_getscn.3 elf_ndxscn.3 \ elf_getscn.3 elf_newscn.3 \ elf_getscn.3 elf_nextscn.3 \ + elf_getshstrndx.3 elf_setshstrndx.3 \ gelf_getdyn.3 gelf_update_dyn.3 \ + gelf_getmove.3 gelf_update_move.3 \ gelf_getrel.3 gelf_update_rel.3 \ gelf_getrela.3 gelf_update_rela.3 \ gelf_getsym.3 gelf_update_sym.3 \ + gelf_getsyminfo.3 gelf_update_syminfo.3 \ gelf_update_ehdr.3 gelf_update_phdr.3 \ gelf_update_ehdr.3 gelf_update_shdr.3 \ gelf_xlatetof.3 gelf_xlatetom.3 ==== //depot/projects/dtrace/src/lib/libelf/_libelf.h#9 (text+ko) ==== @@ -146,11 +146,14 @@ int _libelf_dump64(Elf *_elf, const char *_name, const char *_outfile, unsigned int _flags); void *_libelf_ehdr(Elf *_e, int _elfclass, int _allocate); +int _libelf_falign(Elf_Type _t, int _elfclass); size_t _libelf_fsize(Elf_Type _t, int _elfclass, unsigned int _version, size_t count); void (*_libelf_get_translator(Elf_Type _t, int _direction, int _elfclass)) (char *_dst, char *_src, int _cnt, int _byteswap); void *_libelf_getphdr(Elf *_e, int _elfclass); +int _libelf_getshnum(void *_eh, int _elfclass, size_t *_shnum); +int _libelf_getshstrndx(void *_eh, int _elfclass, size_t *_shstrndx); void _libelf_init_elf(Elf *_e, Elf_Kind _kind); int _libelf_malign(Elf_Type _t, int _elfclass); size_t _libelf_msize(Elf_Type _t, int _elfclass, unsigned int _version); @@ -158,6 +161,8 @@ Elf_Data *_libelf_release_data(Elf_Data *_d); Elf *_libelf_release_elf(Elf *_e); Elf_Scn *_libelf_release_scn(Elf_Scn *_s); +int _libelf_setshnum(void *_eh, int _elfclass, size_t _shnum); +int _libelf_setshstrndx(void *_eh, int _elfclass, size_t _shstrndx); Elf_Data *_libelf_xlate(Elf_Data *_d, const Elf_Data *_s, unsigned int _encoding, int _elfclass, int _direction); int _libelf_xlate_shtype(size_t _sht); ==== //depot/projects/dtrace/src/lib/libelf/elf_data.c#2 (text+ko) ==== @@ -140,26 +140,24 @@ return (NULL); } - if (e->e_cmd == ELF_C_READ) { - LIBELF_SET_ERROR(MODE, 0); - return (NULL); - } - if ((d = malloc(sizeof(Elf_Data))) == NULL) { LIBELF_SET_ERROR(RESOURCE, errno); return (NULL); } STAILQ_INSERT_TAIL(&s->s_data, d, d_next); + d->d_flags = 0; d->d_scn = s; + d->d_align = 1; d->d_buf = NULL; d->d_off = (off_t) -1; - d->d_align = 1; d->d_size = 0; d->d_type = ELF_T_BYTE; d->d_version = LIBELF_PRIVATE(version); + (void) elf_flagscn(s, ELF_C_SET, ELF_F_DIRTY); + return (d); } ==== //depot/projects/dtrace/src/lib/libelf/elf_getdata.3#3 (text+ko) ==== @@ -145,10 +145,6 @@ .Ar data was not associated with section descriptor .Ar scn . -.It Bq Er ELF_E_MODE -Section descriptor -.Ar scn -was not associated with a file opened for writing. .It Bq Er ELF_E_RESOURCE An out of memory condition was detected. .El ==== //depot/projects/dtrace/src/lib/libelf/elf_getscn.3#2 (text+ko) ==== @@ -79,10 +79,6 @@ .Dv ( SHN_UNDEF ) on the first call to .Fn elf_newscn . -Function -.Fn elf_newscn -is only valid for ELF descriptors opened for writing or for reading -and writing. .Pp Function .Fn elf_nextscn @@ -133,10 +129,10 @@ .Ar scn was not associated with ELF descriptor .Ar elf . -.It Bq Er ELF_E_MODE -ELF descriptor +.It Bq Er ELF_E_CLASS +Descriptor .Ar elf -was not opened for writing. +was of an unknown ELF class. .El .Sh SEE ALSO .Xr elf 3 , @@ -144,4 +140,4 @@ .Xr elf_flagscn 3 , .Xr elf_getdata 3 , .Xr elf_getshdr 3 , -.Xr gelf 3+.Xr gelf 3 ==== //depot/projects/dtrace/src/lib/libelf/elf_scn.c#3 (text+ko) ==== @@ -163,12 +163,16 @@ uint16_t *pshnum; Elf_Scn *scn; - if (e == NULL || e->e_kind != ELF_K_ELF || - ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64)) { + if (e == NULL || e->e_kind != ELF_K_ELF) { LIBELF_SET_ERROR(ARGUMENT, 0); return (NULL); } + if ((ec = e->e_class) != ELFCLASS32 && ec != ELFCLASS64) { + LIBELF_SET_ERROR(CLASS, 0); + return (NULL); + } + if ((ehdr = _libelf_ehdr(e, ec, 0)) == NULL) return (NULL); @@ -195,13 +199,13 @@ assert(*pshnum == 0); if ((scn = _libelf_allocate_scn(e, SHN_UNDEF)) == NULL) return (NULL); - *pshnum++; + (*pshnum)++; } if ((scn = _libelf_allocate_scn(e, *pshnum)) == NULL) return (NULL); - *pshnum++; + (*pshnum)++; (void) elf_flagscn(scn, ELF_C_SET, ELF_F_DIRTY); ==== //depot/projects/dtrace/src/lib/libelf/elf_update.3#4 (text+ko) ==== @@ -131,7 +131,7 @@ This value must be a power of two. .It Va sh_entsize Set to the size of each entry, for sections containing fixed size -elements. +elements, or set to zero for sections without fixed size elements. For section contents of types known to the library, the application may leave this field as zero. .It Va sh_flags @@ -205,13 +205,7 @@ .Vt Elf_Data descriptor contained in argument .Ar elf -had a type or version mismatch. -.It Bq Er ELF_E_DATA -An -.Vt Elf_Data -descriptor contained in argument -.Ar elf -specified an alignment incompatible with its containing section. +specified a type incompatible with its containing section. .It Bq Er ELF_E_HEADER The ELF header in argument .Ar elf @@ -220,6 +214,12 @@ .It Bq Er ELF_E_IO An I/O error was encountered. .It Bq Er ELF_E_LAYOUT +An +.Vt Elf_Data +descriptor contained in argument +.Ar elf +specified an alignment incompatible with its containing section. +.It Bq Er ELF_E_LAYOUT Argument .Ar elf contained section descriptors that overlapped in extent. ==== //depot/projects/dtrace/src/lib/libelf/elf_update.c#4 (text+ko) ==== @@ -88,7 +88,8 @@ * `dirty'. Affected members include `d_align', `d_offset', `d_type', * and `d_size'. * - The section as a whole is `dirty', e.g., it has been allocated - * using elf_newscn(). + * using elf_newscn(), or if a new Elf_Data structure was added using + * elf_newdata(). * * Each of these conditions would result in the ELF_F_DIRTY bit being * set on the section descriptor's `s_flags' field. @@ -126,7 +127,7 @@ scn_alignment = 0; if (sh_align == 0) - sh_align = _libelf_malign(elftype, ec); + sh_align = _libelf_falign(elftype, ec); STAILQ_FOREACH_SAFE(d, &s->s_data, d_next, td) { if (d->d_type != elftype) { @@ -138,7 +139,7 @@ return (0); } if (d->d_align % sh_align) { - LIBELF_SET_ERROR(DATA, 0); + LIBELF_SET_ERROR(LAYOUT, 0); return (0); } @@ -166,9 +167,16 @@ if (scn_alignment > sh_align) sh_align = scn_alignment; - if (sh_entsize == 0) - sh_entsize = _libelf_fsize(elftype, ec, e->e_version, - 1); + /* + * If the section entry size is zero, try and fill in an + * appropriate entry size. Per the elf(5) manual page + * sections without fixed-size entries should have their + * 'sh_entsize' field set to zero. + */ + if (sh_entsize == 0 && + (sh_entsize = _libelf_fsize(elftype, ec, e->e_version, + 1)) == 1) + sh_entsize = 0; sh_size = scn_size; sh_offset = roundup(*rc, sh_align); @@ -382,7 +390,7 @@ */ if (phnum) { fsz = _libelf_fsize(ELF_T_PHDR, ec, eh_version, phnum); - align = _libelf_malign(ELF_T_PHDR, ec); + align = _libelf_falign(ELF_T_PHDR, ec); if (e->e_flags & ELF_F_LAYOUT) { /* @@ -401,7 +409,7 @@ } else phoff = roundup(rc, align); - rc = phoff + fsz * phnum; + rc = phoff + fsz; } else phoff = 0; @@ -419,7 +427,7 @@ */ if (shnum) { fsz = _libelf_fsize(ELF_T_SHDR, ec, eh_version, 1); - align = _libelf_malign(ELF_T_SHDR, ec); + align = _libelf_falign(ELF_T_SHDR, ec); if (e->e_flags & ELF_F_LAYOUT) { if (rc < shoff) { @@ -486,7 +494,7 @@ msz = _libelf_msize(elftype, ec, e->e_version); sh_off = s->s_offset; - assert(sh_off % _libelf_malign(elftype, ec) == 0); + assert(sh_off % _libelf_falign(elftype, ec) == 0); /* * If the section has a `rawdata' descriptor, and the section @@ -547,13 +555,13 @@ fsz = _libelf_fsize(elftype, ec, e->e_version, nobjects); dst.d_buf = nf + rc; - dst.d_size = fsz * nobjects; + dst.d_size = fsz; if (_libelf_xlate(&dst, d, e->e_byteorder, ec, ELF_TOFILE) == NULL) return ((off_t) -1); - rc += fsz * nobjects; + rc += fsz; } return ((off_t) rc); @@ -650,9 +658,9 @@ if (phnum != 0 && phoff != 0) { assert((unsigned) rc <= phoff); - fsz = _libelf_fsize(ELF_T_PHDR, ec, e->e_version, 1); + fsz = _libelf_fsize(ELF_T_PHDR, ec, e->e_version, phnum); - assert(phoff % _libelf_malign(ELF_T_PHDR, ec) == 0); + assert(phoff % _libelf_falign(ELF_T_PHDR, ec) == 0); assert(fsz > 0); src.d_version = dst.d_version = e->e_version; @@ -672,12 +680,13 @@ (void) memset(newfile + rc, LIBELF_PRIVATE(fillchar), phoff - rc); - rc = phoff; dst.d_buf = newfile + rc; if (_libelf_xlate(&dst, &src, e->e_byteorder, ec, ELF_TOFILE) == NULL) goto error; + + rc = phoff + fsz; } /* @@ -701,7 +710,7 @@ rc = shoff; - assert(rc % _libelf_malign(ELF_T_SHDR, ec) == 0); + assert(rc % _libelf_falign(ELF_T_SHDR, ec) == 0); src.d_type = ELF_T_SHDR; src.d_size = _libelf_msize(ELF_T_SHDR, ec, e->e_version); ==== //depot/projects/dtrace/src/lib/libelf/gelf_newphdr.3#3 (text+ko) ==== @@ -43,8 +43,13 @@ .Ft "void *" .Fn gelf_newphdr "Elf *elf" "size_t count" .Sh DESCRIPTION -These functions allocate an ELF program header +These functions allocate an ELF Program Header table for an ELF descriptor. +.Vt Elf32_Phdr +and +.Vt Elf64_Phdr +descriptors are described further in +.Xr elf 5 . .Pp Functions .Fn elf32_newphdr @@ -56,18 +61,13 @@ and .Vt Elf64_Phdr descriptors respectively, -ignoring any existing program header table +discarding any existing program header table already present in the ELF descriptor .Ar elf . A value of zero for argument .Ar count may be used to delete an existing program header table from an ELF descriptor. -.Vt Elf32_Phdr -and -.Vt Elf64_Phdr -descriptors are described in -.Xr elf 5 . .Pp Function .Fn gelf_newphdr @@ -80,7 +80,7 @@ elements depending on the ELF class of ELF descriptor .Ar elf . .Pp -The functions set the +The functions set the .Va e_phnum field of the executable header for ELF descriptor .Ar elf @@ -89,6 +89,17 @@ and also set the .Dv ELF_F_DIRTY bit on the program header table. +All members of the returned array of Phdr structures +will be initialized to zero. +.Pp +After a successful call to these functions, the pointer returned +by a prior call to +.Fn elf32_getphdr +or +.Fn elf64_getphdr +on the same descriptor +.Ar elf +will no longer be valid. .Sh RETURN VALUES The functions a valid pointer if successful, or NULL in case an error was encountered. @@ -110,8 +121,7 @@ .It Bq Er ELF_E_RESOURCE An out of memory condition was detected. .It Bq Er ELF_E_SEQUENCE -An executable header was not allocated -for writable ELF descriptor +An executable header was not allocated for ELF descriptor .Ar elf before using these APIs. .El ==== //depot/projects/dtrace/src/lib/libelf/gelf_update.c#3 (text+ko) ==== ==== //depot/projects/dtrace/src/lib/libelf/libelf.c#5 (text+ko) ==== @@ -46,65 +46,6 @@ }; -struct memalign { - int ma32; - int ma64; -}; - -#ifdef __GNUC__ -#define ALIGNMENT(N) { \ - .ma32 = __alignof__(Elf32_##N), \ - .ma64 = __alignof__(Elf64_##N) \ - } -#define ALIGN64(V) { \ - .ma32 = 0, \ - .ma64 = __alignof__(Elf64_##V) \ - } -#else -#error Need the __alignof__ builtin. -#endif -#define UNSUPPORTED() { \ - .ma32 = 0, \ - .ma64 = 0 \ - } - -static struct memalign memalign[ELF_T_NUM] = { - [ELF_T_ADDR] = ALIGNMENT(Addr), - [ELF_T_BYTE] = { .ma32 = 1, .ma64 = 1 }, - [ELF_T_CAP] = ALIGNMENT(Cap), - [ELF_T_DYN] = ALIGNMENT(Dyn), - [ELF_T_EHDR] = ALIGNMENT(Ehdr), - [ELF_T_HALF] = ALIGNMENT(Half), - [ELF_T_MOVE] = ALIGNMENT(Move), - [ELF_T_MOVEP] = UNSUPPORTED(), - [ELF_T_NOTE] = ALIGNMENT(Nhdr), - [ELF_T_OFF] = ALIGNMENT(Off), - [ELF_T_PHDR] = ALIGNMENT(Phdr), - [ELF_T_REL] = ALIGNMENT(Rel), - [ELF_T_RELA] = ALIGNMENT(Rela), - [ELF_T_SHDR] = ALIGNMENT(Shdr), - [ELF_T_SWORD] = ALIGNMENT(Sword), - [ELF_T_SXWORD] = ALIGN64(Sxword), - [ELF_T_SYMINFO] = ALIGNMENT(Syminfo), - [ELF_T_SYM] = ALIGNMENT(Sym), -#if __FreeBSD_version >= 700009 - [ELF_T_VDEF] = ALIGNMENT(Verdef), - [ELF_T_VNEED] = ALIGNMENT(Verneed), -#endif - [ELF_T_WORD] = ALIGNMENT(Word), - [ELF_T_XWORD] = ALIGN64(Xword) -}; - -int -_libelf_malign(Elf_Type t, int elfclass) -{ - if (t >= ELF_T_NUM || (int) t < 0) - return (0); - - return (elfclass == ELFCLASS32 ? memalign[t].ma32 : - memalign[t].ma64); -} - #if defined(LIBELF_TEST_HOOKS) int _libelf_get_elf_class(Elf *elf) ==== //depot/projects/dtrace/src/lib/libelf/libelf.h#10 (text+ko) ==== @@ -106,9 +106,9 @@ * `Public' members that are part of the ELF(3) API. */ uint64_t d_align; + void *d_buf; uint64_t d_off; uint64_t d_size; - void *d_buf; Elf_Type d_type; unsigned int d_version; @@ -233,6 +233,7 @@ off_t elf_rand(Elf *_elf, off_t _off); Elf_Data *elf_rawdata(Elf_Scn *_scn, Elf_Data *_data); char *elf_rawfile(Elf *_elf, size_t *_size); +int elf_setshstrndx(Elf *_elf, size_t _shnum); char *elf_strptr(Elf *_elf, size_t _section, size_t _offset); off_t elf_update(Elf *_elf, Elf_Cmd _cmd); unsigned int elf_version(unsigned int _version); ==== //depot/projects/dtrace/src/lib/libelf/libelf_allocate.c#5 (text+ko) ==== @@ -165,7 +165,7 @@ STAILQ_INIT(&s->s_data); STAILQ_INIT(&s->s_rawdata); - STAILQ_INSERT_HEAD(&e->e_u.e_elf.e_scn, s, s_next); + STAILQ_INSERT_TAIL(&e->e_u.e_elf.e_scn, s, s_next); return (s); } ==== //depot/projects/dtrace/src/lib/libelf/libelf_convert.m4#10 (text+ko) ==== @@ -223,7 +223,7 @@ include(SRCDIR`/elf_types.m4') /* - * `IGNORE'_XXX flags turn off generation of template code. + * `IGNORE'_* flags turn off generation of template code. */ define(`IGNORE', @@ -234,11 +234,15 @@ IGNORE(NOTE) ifelse(eval(OSRELDATE < 700009),1, - `IGNORE(VDEF) - IGNORE(VNEED)', + `IGNORE(CAP) + IGNORE(MOVE) + IGNORE(SYMINFO) + IGNORE(VDEF) + IGNORE(VNEED) + define(`IGNORE_LWORD', 1)', `') -define(IGNORE_BYTE, 1) +define(IGNORE_BYTE, 1) /* 'lator, leave 'em bytes alone */ define(IGNORE_SXWORD32, 1) define(IGNORE_XWORD32, 1) @@ -481,9 +485,6 @@ (void) memcpy(dst, src, count); } -#define libelf_cvt_BYTE_tom libelf_cvt_BYTE_tox -#define libelf_cvt_BYTE_tof libelf_cvt_BYTE_tox - MAKE_TYPE_CONVERTERS(ELF_TYPE_LIST) struct converters { @@ -498,7 +499,9 @@ `ifdef(`IGNORE_'$1$2, `.$3$2 = NULL', `ifdef(`BASE_'$1, - `.$3$2 = libelf_cvt_$1_$3', + `ifdef(`IGNORE_'$1, + `.$3$2 = NULL', + `.$3$2 = libelf_cvt_$1_$3')', `ifdef(`SIZEDEP_'$1, `.$3$2 = libelf_cvt_$1$2_$3', `.$3$2 = libelf_cvt$2_$1_$3')')')') @@ -518,6 +521,13 @@ static struct converters cvt[ELF_T_NUM] = { CONVERTER_NAMES(ELF_TYPE_LIST) + + [ELF_T_BYTE] = { + .tof32 = libelf_cvt_BYTE_tox, + .tom32 = libelf_cvt_BYTE_tox, + .tof64 = libelf_cvt_BYTE_tox, + .tom64 = libelf_cvt_BYTE_tox + } }; void (*_libelf_get_translator(Elf_Type t, int direction, int elfclass)) ==== //depot/projects/dtrace/src/lib/libelf/libelf_data.c#2 (text+ko) ==== @@ -66,12 +66,16 @@ case SHT_SYMTAB: return (ELF_T_SYM); #if __FreeBSD_version > 700009 - case SHT_GNU_verdef: + case SHT_GNU_verdef: /* == SHT_SUNW_verdef */ return (ELF_T_VDEF); - case SHT_GNU_verneed: + case SHT_GNU_verneed: /* == SHT_SUNW_verneed */ return (ELF_T_VNEED); - case SHT_GNU_versym: - return (ELF_T_SYM); + case SHT_GNU_versym: /* == SHT_SUNW_versym */ + return (-1); /* XXX */ + case SHT_SUNW_move: + return (ELF_T_MOVE); + case SHT_SUNW_syminfo: + return (ELF_T_SYMINFO); #endif default: return (-1); ==== //depot/projects/dtrace/src/lib/libelf/libelf_fsize.m4#5 (text+ko) ==== @@ -55,7 +55,11 @@ define(`SXWORD_SIZE32', 0) ifelse(eval(OSRELDATE < 700009),1, - `define(`VDEF_SIZE', 0) + `define(`CAP_SIZE', 0) + define(`LWORD_SIZE', 0) + define(`MOVE_SIZE', 0) + define(`SYMINFO_SIZE', 0) + define(`VDEF_SIZE', 0) define(`VNEED_SIZE', 0)',`') /* ==== //depot/projects/dtrace/src/lib/libelf/libelf_msize.m4#4 (text+ko) ==== @@ -58,7 +58,11 @@ define(XWORD_SIZE32, 0) ifelse(eval(OSRELDATE < 700009),1, - `define(`VDEF_SIZE', 0) + `define(`CAP_SIZE', 0) + define(`LWORD_SIZE', 0) + define(`MOVE_SIZE', 0) + define(`SYMINFO_SIZE', 0) + define(`VDEF_SIZE', 0) define(`VNEED_SIZE', 0)',`') define(`DEFINE_ELF_MSIZE', ==== //depot/projects/dtrace/src/lib/libelf/libelf_phdr.c#3 (text+ko) ==== @@ -135,7 +135,8 @@ assert(msz > 0); - if ((nphdr = calloc(count, msz)) == NULL) { + nphdr = NULL; + if (count > 0 && (nphdr = calloc(count, msz)) == NULL) { LIBELF_SET_ERROR(RESOURCE, 0); return (NULL); }