/[gentoo-projects]/pax-utils/scanelf.c
Gentoo

Diff of /pax-utils/scanelf.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.114 Revision 1.115
1/* 1/*
2 * Copyright 2003-2006 Gentoo Foundation 2 * Copyright 2003-2006 Gentoo Foundation
3 * Distributed under the terms of the GNU General Public License v2 3 * Distributed under the terms of the GNU General Public License v2
4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.114 2006/01/24 00:33:05 vapier Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.115 2006/01/24 00:34:00 vapier Exp $
5 * 5 *
6 * Copyright 2003-2006 Ned Ludd - <solar@gentoo.org> 6 * Copyright 2003-2006 Ned Ludd - <solar@gentoo.org>
7 * Copyright 2004-2006 Mike Frysinger - <vapier@gentoo.org> 7 * Copyright 2004-2006 Mike Frysinger - <vapier@gentoo.org>
8 */ 8 */
9 9
10#include "paxinc.h" 10#include "paxinc.h"
11 11
12static const char *rcsid = "$Id: scanelf.c,v 1.114 2006/01/24 00:33:05 vapier Exp $"; 12static const char *rcsid = "$Id: scanelf.c,v 1.115 2006/01/24 00:34:00 vapier Exp $";
13#define argv0 "scanelf" 13#define argv0 "scanelf"
14 14
15#define IS_MODIFIER(c) (c == '%' || c == '#') 15#define IS_MODIFIER(c) (c == '%' || c == '#')
16 16
17 17
812#define FIND_SYM(B) \ 812#define FIND_SYM(B) \
813 if (elf->elf_class == ELFCLASS ## B) { \ 813 if (elf->elf_class == ELFCLASS ## B) { \
814 Elf ## B ## _Shdr *symtab = SHDR ## B (symtab_void); \ 814 Elf ## B ## _Shdr *symtab = SHDR ## B (symtab_void); \
815 Elf ## B ## _Shdr *strtab = SHDR ## B (strtab_void); \ 815 Elf ## B ## _Shdr *strtab = SHDR ## B (strtab_void); \
816 Elf ## B ## _Sym *sym = SYM ## B (elf->data + EGET(symtab->sh_offset)); \ 816 Elf ## B ## _Sym *sym = SYM ## B (elf->data + EGET(symtab->sh_offset)); \
817 unsigned long cnt = EGET(symtab->sh_size) / EGET(symtab->sh_entsize); \ 817 unsigned long cnt = EGET(symtab->sh_entsize); \
818 char *symname; \ 818 char *symname; \
819 if (cnt) \
820 cnt = EGET(symtab->sh_size) / cnt; \
819 for (i = 0; i < cnt; ++i) { \ 821 for (i = 0; i < cnt; ++i) { \
820 if (sym->st_name) { \ 822 if (sym->st_name) { \
821 symname = (char *)(elf->data + EGET(strtab->sh_offset) + EGET(sym->st_name)); \ 823 symname = (char *)(elf->data + EGET(strtab->sh_offset) + EGET(sym->st_name)); \
822 if ((void*)symname > (void*)elf->data) { \ 824 if ((void*)symname > (void*)elf->data_end) { \
823 warn("%s: corrupt ELF symbols", elf->filename); \ 825 warnf("%s: corrupt ELF symbols", elf->filename); \
824 continue; \ 826 continue; \
825 } \ 827 } \
826 if (*find_sym == '*') { \ 828 if (*find_sym == '*') { \
827 printf("%s(%s) %5lX %15s %s\n", \ 829 printf("%s(%s) %5lX %15s %s\n", \
828 ((*found_sym == 0) ? "\n\t" : "\t"), \ 830 ((*found_sym == 0) ? "\n\t" : "\t"), \

Legend:
Removed from v.1.114  
changed lines
  Added in v.1.115

  ViewVC Help
Powered by ViewVC 1.1.20