| 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.139 2006/04/11 02:47:34 vapier Exp $ |
4 | * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.140 2006/04/15 07:52: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 | #ifdef __linux__ |
11 | #ifdef __linux__ |
| 12 | #include <glob.h> |
12 | #include <glob.h> |
| 13 | #endif |
13 | #endif |
| 14 | static const char *rcsid = "$Id: scanelf.c,v 1.139 2006/04/11 02:47:34 vapier Exp $"; |
14 | static const char *rcsid = "$Id: scanelf.c,v 1.140 2006/04/15 07:52:00 vapier Exp $"; |
| 15 | #define argv0 "scanelf" |
15 | #define argv0 "scanelf" |
| 16 | |
16 | |
| 17 | #define IS_MODIFIER(c) (c == '%' || c == '#' || c == '+') |
17 | #define IS_MODIFIER(c) (c == '%' || c == '#' || c == '+') |
| 18 | |
18 | |
| 19 | #define do_state(option, flag) \ |
19 | #define do_state(option, flag) \ |
| … | |
… | |
| 880 | next_sym = strchr(this_sym, ','); \ |
880 | next_sym = strchr(this_sym, ','); \ |
| 881 | if (next_sym == NULL) \ |
881 | if (next_sym == NULL) \ |
| 882 | next_sym = this_sym + strlen(this_sym); \ |
882 | next_sym = this_sym + strlen(this_sym); \ |
| 883 | /* do we want a defined symbol ? */ \ |
883 | /* do we want a defined symbol ? */ \ |
| 884 | if (*this_sym == '+') { \ |
884 | if (*this_sym == '+') { \ |
| 885 | if (sym->st_value == 0) \ |
885 | if (sym->st_shndx == SHN_UNDEF) \ |
| 886 | goto skip_this_sym##B; \ |
886 | goto skip_this_sym##B; \ |
| 887 | ++this_sym; \ |
887 | ++this_sym; \ |
| 888 | /* do we want an undefined symbol ? */ \ |
888 | /* do we want an undefined symbol ? */ \ |
| 889 | } else if (*this_sym == '-') { \ |
889 | } else if (*this_sym == '-') { \ |
| 890 | if (sym->st_value != 0) \ |
890 | if (sym->st_shndx != SHN_UNDEF) \ |
| 891 | goto skip_this_sym##B; \ |
891 | goto skip_this_sym##B; \ |
| 892 | ++this_sym; \ |
892 | ++this_sym; \ |
| 893 | } \ |
893 | } \ |
| 894 | /* ok, lets compare the name now */ \ |
894 | /* ok, lets compare the name now */ \ |
| 895 | if ((strncmp(this_sym, symname, (next_sym-this_sym)) == 0 && symname[next_sym-this_sym] == '\0') || \ |
895 | if ((strncmp(this_sym, symname, (next_sym-this_sym)) == 0 && symname[next_sym-this_sym] == '\0') || \ |