libelf_fsize.m4 (210336) | libelf_fsize.m4 (210340) |
---|---|
1/*- 2 * Copyright (c) 2006 Joseph Koshy 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2006 Joseph Koshy 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/lib/libelf/libelf_fsize.m4 210336 2010-07-21 10:11:46Z kaiw $ | 26 * $FreeBSD: head/lib/libelf/libelf_fsize.m4 210340 2010-07-21 10:39:29Z kaiw $ |
27 */ 28 29#include <libelf.h> 30#include <osreldate.h> 31 32#include "_libelf.h" 33 34/* --- 8 unchanged lines hidden (view full) --- 43 * representations. 44 */ 45 46/* `Basic' types. */ 47define(`BYTE_SIZE', 1) 48define(`IDENT_SIZE', `EI_NIDENT') 49 50/* Types that have variable length. */ | 27 */ 28 29#include <libelf.h> 30#include <osreldate.h> 31 32#include "_libelf.h" 33 34/* --- 8 unchanged lines hidden (view full) --- 43 * representations. 44 */ 45 46/* `Basic' types. */ 47define(`BYTE_SIZE', 1) 48define(`IDENT_SIZE', `EI_NIDENT') 49 50/* Types that have variable length. */ |
51define(`GNUHASH_SIZE', 0) 52define(`NOTE_SIZE', 0) | 51define(`GNUHASH_SIZE', 1) 52define(`NOTE_SIZE', 1) |
53 54/* Currently unimplemented types. */ 55define(`MOVEP_SIZE', 0) 56 57/* Overrides for 32 bit types that do not exist. */ 58define(`XWORD_SIZE32', 0) 59define(`SXWORD_SIZE32', 0) 60 --- 79 unchanged lines hidden (view full) --- 140size_t 141_libelf_fsize(Elf_Type t, int ec, unsigned int v, size_t c) 142{ 143 size_t sz; 144 145 sz = 0; 146 if (v != EV_CURRENT) 147 LIBELF_SET_ERROR(VERSION, 0); | 53 54/* Currently unimplemented types. */ 55define(`MOVEP_SIZE', 0) 56 57/* Overrides for 32 bit types that do not exist. */ 58define(`XWORD_SIZE32', 0) 59define(`SXWORD_SIZE32', 0) 60 --- 79 unchanged lines hidden (view full) --- 140size_t 141_libelf_fsize(Elf_Type t, int ec, unsigned int v, size_t c) 142{ 143 size_t sz; 144 145 sz = 0; 146 if (v != EV_CURRENT) 147 LIBELF_SET_ERROR(VERSION, 0); |
148 else if ((int) t < ELF_T_FIRST || t > ELF_T_LAST || 149 t == ELF_T_NOTE || t == ELF_T_GNUHASH) | 148 else if ((int) t < ELF_T_FIRST || t > ELF_T_LAST) |
150 LIBELF_SET_ERROR(ARGUMENT, 0); 151 else { 152 sz = ec == ELFCLASS64 ? fsize[t].fsz64 : fsize[t].fsz32; 153 if (sz == 0) 154 LIBELF_SET_ERROR(UNIMPL, 0); 155 } 156 157 return (sz*c); 158} 159 | 149 LIBELF_SET_ERROR(ARGUMENT, 0); 150 else { 151 sz = ec == ELFCLASS64 ? fsize[t].fsz64 : fsize[t].fsz32; 152 if (sz == 0) 153 LIBELF_SET_ERROR(UNIMPL, 0); 154 } 155 156 return (sz*c); 157} 158 |