/[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.123 Revision 1.124
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.123 2006/02/12 16:51:21 solar Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.124 2006/02/16 03:07:44 solar 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.123 2006/02/12 16:51:21 solar Exp $"; 12static const char *rcsid = "$Id: scanelf.c,v 1.124 2006/02/16 03:07:44 solar 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
51static char show_soname = 0; 51static char show_soname = 0;
52static char show_textrels = 0; 52static char show_textrels = 0;
53static char show_banner = 1; 53static char show_banner = 1;
54static char be_quiet = 0; 54static char be_quiet = 0;
55static char be_verbose = 0; 55static char be_verbose = 0;
56static char be_wewy_wewy_quiet = 0; 56static char be_very_quiet = 0;
57static char *find_sym = NULL, *versioned_symname = NULL; 57static char *find_sym = NULL, *versioned_symname = NULL;
58static char *find_lib = NULL; 58static char *find_lib = NULL;
59static char *find_section = NULL;
59static char *out_format = NULL; 60static char *out_format = NULL;
60static char *search_path = NULL; 61static char *search_path = NULL;
61static char fix_elf = 0; 62static char fix_elf = 0;
62static char gmatch = 0; 63static char gmatch = 0;
63static char use_ldcache = 0; 64static char use_ldcache = 0;
127 if (!*ret) { 128 if (!*ret) {
128 static char *paxflags; 129 static char *paxflags;
129 paxflags = pax_short_hf_flags(EI_PAX_FLAGS(elf)); 130 paxflags = pax_short_hf_flags(EI_PAX_FLAGS(elf));
130 if (!be_quiet || (be_quiet && EI_PAX_FLAGS(elf))) { 131 if (!be_quiet || (be_quiet && EI_PAX_FLAGS(elf))) {
131 *found_pax = 1; 132 *found_pax = 1;
132 return (be_wewy_wewy_quiet ? NULL : paxflags); 133 return (be_very_quiet ? NULL : paxflags);
133 } 134 }
134 strncpy(ret, paxflags, sizeof(ret)); 135 strncpy(ret, paxflags, sizeof(ret));
135 } 136 }
136 137
137 if (be_wewy_wewy_quiet || (be_quiet && !shown)) 138 if (be_very_quiet || (be_quiet && !shown))
138 return NULL; 139 return NULL;
139 else 140 else
140 return ret; 141 return ret;
141} 142}
142 143
230 } \ 231 } \
231 } 232 }
232 SHOW_PHDR(32) 233 SHOW_PHDR(32)
233 SHOW_PHDR(64) 234 SHOW_PHDR(64)
234 235
235 if (be_wewy_wewy_quiet || (be_quiet && !shown)) 236 if (be_very_quiet || (be_quiet && !shown))
236 return NULL; 237 return NULL;
237 else 238 else
238 return ret; 239 return ret;
239} 240}
240static const char *scanelf_file_textrel(elfobj *elf, char *found_textrel) 241static const char *scanelf_file_textrel(elfobj *elf, char *found_textrel)
258 dyn = DYN ## B (elf->data + offset); \ 259 dyn = DYN ## B (elf->data + offset); \
259 while (EGET(dyn->d_tag) != DT_NULL) { \ 260 while (EGET(dyn->d_tag) != DT_NULL) { \
260 if (EGET(dyn->d_tag) == DT_TEXTREL) { /*dyn->d_tag != DT_FLAGS)*/ \ 261 if (EGET(dyn->d_tag) == DT_TEXTREL) { /*dyn->d_tag != DT_FLAGS)*/ \
261 *found_textrel = 1; \ 262 *found_textrel = 1; \
262 /*if (dyn->d_un.d_val & DF_TEXTREL)*/ \ 263 /*if (dyn->d_un.d_val & DF_TEXTREL)*/ \
263 return (be_wewy_wewy_quiet ? NULL : ret); \ 264 return (be_very_quiet ? NULL : ret); \
264 } \ 265 } \
265 ++dyn; \ 266 ++dyn; \
266 } \ 267 } \
267 } } 268 } }
268 SHOW_TEXTREL(32) 269 SHOW_TEXTREL(32)
269 SHOW_TEXTREL(64) 270 SHOW_TEXTREL(64)
270 } 271 }
271 272
272 if (be_quiet || be_wewy_wewy_quiet) 273 if (be_quiet || be_very_quiet)
273 return NULL; 274 return NULL;
274 else 275 else
275 return " - "; 276 return " - ";
276} 277}
277static char *scanelf_file_textrels(elfobj *elf, char *found_textrels, char *found_textrel) 278static char *scanelf_file_textrels(elfobj *elf, char *found_textrels, char *found_textrel)
525 } } 526 } }
526 SHOW_RPATH(32) 527 SHOW_RPATH(32)
527 SHOW_RPATH(64) 528 SHOW_RPATH(64)
528 } 529 }
529 530
530 if (be_wewy_wewy_quiet) return; 531 if (be_very_quiet) return;
531 532
532 if (rpath && runpath) { 533 if (rpath && runpath) {
533 if (!strcmp(rpath, runpath)) { 534 if (!strcmp(rpath, runpath)) {
534 xstrcat(ret, runpath, ret_len); 535 xstrcat(ret, runpath, ret_len);
535 } else { 536 } else {
664 ++dyn; \ 665 ++dyn; \
665 continue; \ 666 continue; \
666 } \ 667 } \
667 needed = (char*)(elf->data + offset); \ 668 needed = (char*)(elf->data + offset); \
668 if (op == 0) { \ 669 if (op == 0) { \
669 if (!be_wewy_wewy_quiet) { \ 670 if (!be_very_quiet) { \
670 if (*found_needed) xchrcat(ret, ',', ret_len); \ 671 if (*found_needed) xchrcat(ret, ',', ret_len); \
671 if (use_ldcache) \ 672 if (use_ldcache) \
672 if ((p = lookup_cache_lib(elf, needed)) != NULL) \ 673 if ((p = lookup_cache_lib(elf, needed)) != NULL) \
673 needed = p; \ 674 needed = p; \
674 xstrcat(ret, needed, ret_len); \ 675 xstrcat(ret, needed, ret_len); \
675 } \ 676 } \
676 *found_needed = 1; \ 677 *found_needed = 1; \
677 } else { \ 678 } else { \
678 if (!strncmp(find_lib, needed, strlen( !gmatch ? needed : find_lib))) { \ 679 if (!strncmp(find_lib, needed, strlen( !gmatch ? needed : find_lib))) { \
679 *found_lib = 1; \ 680 *found_lib = 1; \
680 return (be_wewy_wewy_quiet ? NULL : needed); \ 681 return (be_very_quiet ? NULL : needed); \
681 } \ 682 } \
682 } \ 683 } \
683 } \ 684 } \
684 ++dyn; \ 685 ++dyn; \
685 } \ 686 } \
703 if (strtbl_void) { 704 if (strtbl_void) {
704#define SHOW_INTERP(B) \ 705#define SHOW_INTERP(B) \
705 if (elf->elf_class == ELFCLASS ## B) { \ 706 if (elf->elf_class == ELFCLASS ## B) { \
706 Elf ## B ## _Shdr *strtbl = SHDR ## B (strtbl_void); \ 707 Elf ## B ## _Shdr *strtbl = SHDR ## B (strtbl_void); \
707 *found_interp = 1; \ 708 *found_interp = 1; \
708 return (be_wewy_wewy_quiet ? NULL : elf->data + EGET(strtbl->sh_offset)); \ 709 return (be_very_quiet ? NULL : elf->data + EGET(strtbl->sh_offset)); \
709 } 710 }
710 SHOW_INTERP(32) 711 SHOW_INTERP(32)
711 SHOW_INTERP(64) 712 SHOW_INTERP(64)
712 } 713 }
713 return NULL; 714 return NULL;
735 if (EGET(dyn->d_tag) == DT_BIND_NOW || \ 736 if (EGET(dyn->d_tag) == DT_BIND_NOW || \
736 (EGET(dyn->d_tag) == DT_FLAGS && EGET(dyn->d_un.d_val) & DF_BIND_NOW)) \ 737 (EGET(dyn->d_tag) == DT_FLAGS && EGET(dyn->d_un.d_val) & DF_BIND_NOW)) \
737 { \ 738 { \
738 if (be_quiet) return NULL; \ 739 if (be_quiet) return NULL; \
739 *found_bind = 1; \ 740 *found_bind = 1; \
740 return (char *)(be_wewy_wewy_quiet ? NULL : "NOW"); \ 741 return (char *)(be_very_quiet ? NULL : "NOW"); \
741 } \ 742 } \
742 ++dyn; \ 743 ++dyn; \
743 } \ 744 } \
744 } \ 745 } \
745 } 746 }
746 SHOW_BIND(32) 747 SHOW_BIND(32)
747 SHOW_BIND(64) 748 SHOW_BIND(64)
748 749
749 if (be_wewy_wewy_quiet) return NULL; 750 if (be_very_quiet) return NULL;
750 751
751 if (be_quiet && !fstat(elf->fd, &s) && !(s.st_mode & S_ISUID || s.st_mode & S_ISGID)) { 752 if (be_quiet && !fstat(elf->fd, &s) && !(s.st_mode & S_ISUID || s.st_mode & S_ISGID)) {
752 return NULL; 753 return NULL;
753 } else { 754 } else {
754 *found_bind = 1; 755 *found_bind = 1;
788 ++dyn; \ 789 ++dyn; \
789 continue; \ 790 continue; \
790 } \ 791 } \
791 soname = (char*)(elf->data + offset); \ 792 soname = (char*)(elf->data + offset); \
792 *found_soname = 1; \ 793 *found_soname = 1; \
793 return (be_wewy_wewy_quiet ? NULL : soname); \ 794 return (be_very_quiet ? NULL : soname); \
794 } \ 795 } \
795 ++dyn; \ 796 ++dyn; \
796 } \ 797 } \
797 } } 798 } }
798 SHOW_SONAME(32) 799 SHOW_SONAME(32)
859 FIND_SYM(32) 860 FIND_SYM(32)
860 FIND_SYM(64) 861 FIND_SYM(64)
861 } 862 }
862 863
863break_out: 864break_out:
864 if (be_wewy_wewy_quiet) return NULL; 865 if (be_very_quiet) return NULL;
865 866
866 if (*find_sym != '*' && *found_sym) 867 if (*find_sym != '*' && *found_sym)
867 return ret; 868 return ret;
868 if (be_quiet) 869 if (be_quiet)
869 return NULL; 870 return NULL;
870 else 871 else
871 return (char *)" - "; 872 return (char *)" - ";
872} 873}
873 874
874 875
876static char *scanelf_file_sections(elfobj *elf, char *found_section)
877{
878 if (!find_section)
879 return NULL;
880
881#define FIND_SECTION(B) \
882 if (elf->elf_class == ELFCLASS ## B) { \
883 Elf ## B ## _Shdr *section; \
884 section = SHDR ## B (elf_findsecbyname(elf, find_section)); \
885 if (section != NULL) \
886 *found_section = 1; \
887 }
888 FIND_SECTION(32)
889 FIND_SECTION(64)
890
891
892 if (be_very_quiet) return NULL;
893
894 if (*found_section)
895 return find_section;
896
897 if (be_quiet)
898 return NULL;
899 else
900 return (char *)" - ";
901}
902
875/* scan an elf file and show all the fun stuff */ 903/* scan an elf file and show all the fun stuff */
876#define prints(str) write(fileno(stdout), str, strlen(str)) 904#define prints(str) write(fileno(stdout), str, strlen(str))
877static int scanelf_elfobj(elfobj *elf) 905static int scanelf_elfobj(elfobj *elf)
878{ 906{
879 unsigned long i; 907 unsigned long i;
880 char found_pax, found_phdr, found_relro, found_load, found_textrel, 908 char found_pax, found_phdr, found_relro, found_load, found_textrel,
881 found_rpath, found_needed, found_interp, found_bind, found_soname, 909 found_rpath, found_needed, found_interp, found_bind, found_soname,
882 found_sym, found_lib, found_file, found_textrels; 910 found_sym, found_lib, found_file, found_textrels, found_section;
883 static char *out_buffer = NULL; 911 static char *out_buffer = NULL;
884 static size_t out_len; 912 static size_t out_len;
885 913
886 found_pax = found_phdr = found_relro = found_load = found_textrel = \ 914 found_pax = found_phdr = found_relro = found_load = found_textrel = \
887 found_rpath = found_needed = found_interp = found_bind = found_soname = \ 915 found_rpath = found_needed = found_interp = found_bind = found_soname = \
888 found_sym = found_lib = found_file = found_textrels = 0; 916 found_sym = found_lib = found_file = found_textrels = found_section = 0;
889 917
890 if (be_verbose > 2) 918 if (be_verbose > 2)
891 printf("%s: scanning file {%s,%s}\n", elf->filename, 919 printf("%s: scanning file {%s,%s}\n", elf->filename,
892 get_elfeitype(EI_CLASS, elf->elf_class), 920 get_elfeitype(EI_CLASS, elf->elf_class),
893 get_elfeitype(EI_DATA, elf->data[EI_DATA])); 921 get_elfeitype(EI_DATA, elf->data[EI_DATA]));
922 case 'b': prints("BIND "); break; 950 case 'b': prints("BIND "); break;
923 case 'S': prints("SONAME "); break; 951 case 'S': prints("SONAME "); break;
924 case 's': prints("SYM "); break; 952 case 's': prints("SYM "); break;
925 case 'N': prints("LIB "); break; 953 case 'N': prints("LIB "); break;
926 case 'T': prints("TEXTRELS "); break; 954 case 'T': prints("TEXTRELS "); break;
955 case 'k': break;
927 default: warnf("'%c' has no title ?", out_format[i]); 956 default: warnf("'%c' has no title ?", out_format[i]);
928 } 957 }
929 } 958 }
930 if (!found_file) prints("FILE "); 959 if (!found_file) prints("FILE ");
931 prints("\n"); 960 prints("\n");
942 xchrcat(&out_buffer, out_format[i], &out_len); 971 xchrcat(&out_buffer, out_format[i], &out_len);
943 continue; 972 continue;
944 } 973 }
945 974
946 out = NULL; 975 out = NULL;
947 be_wewy_wewy_quiet = (out_format[i] == '#'); 976 be_very_quiet = (out_format[i] == '#');
948 switch (out_format[++i]) { 977 switch (out_format[++i]) {
949 case '%': 978 case '%':
950 case '#': 979 case '#':
951 xchrcat(&out_buffer, out_format[i], &out_len); break; 980 xchrcat(&out_buffer, out_format[i], &out_len); break;
952 case 'F': 981 case 'F':
953 found_file = 1; 982 found_file = 1;
954 if (be_wewy_wewy_quiet) break; 983 if (be_very_quiet) break;
955 xstrcat(&out_buffer, elf->filename, &out_len); 984 xstrcat(&out_buffer, elf->filename, &out_len);
956 break; 985 break;
957 case 'p': 986 case 'p':
958 found_file = 1; 987 found_file = 1;
959 if (be_wewy_wewy_quiet) break; 988 if (be_very_quiet) break;
960 tmp = elf->filename; 989 tmp = elf->filename;
961 if (search_path) { 990 if (search_path) {
962 ssize_t len_search = strlen(search_path); 991 ssize_t len_search = strlen(search_path);
963 ssize_t len_file = strlen(elf->filename); 992 ssize_t len_file = strlen(elf->filename);
964 if (!strncmp(elf->filename, search_path, len_search) && \ 993 if (!strncmp(elf->filename, search_path, len_search) && \
968 } 997 }
969 xstrcat(&out_buffer, tmp, &out_len); 998 xstrcat(&out_buffer, tmp, &out_len);
970 break; 999 break;
971 case 'f': 1000 case 'f':
972 found_file = 1; 1001 found_file = 1;
973 if (be_wewy_wewy_quiet) break; 1002 if (be_very_quiet) break;
974 tmp = strrchr(elf->filename, '/'); 1003 tmp = strrchr(elf->filename, '/');
975 tmp = (tmp == NULL ? elf->filename : tmp+1); 1004 tmp = (tmp == NULL ? elf->filename : tmp+1);
976 xstrcat(&out_buffer, tmp, &out_len); 1005 xstrcat(&out_buffer, tmp, &out_len);
977 break; 1006 break;
978 case 'o': out = get_elfetype(elf); break; 1007 case 'o': out = get_elfetype(elf); break;
985 case 'N': out = scanelf_file_needed_lib(elf, &found_needed, &found_lib, (out_format[i]=='N'), &out_buffer, &out_len); break; 1014 case 'N': out = scanelf_file_needed_lib(elf, &found_needed, &found_lib, (out_format[i]=='N'), &out_buffer, &out_len); break;
986 case 'i': out = scanelf_file_interp(elf, &found_interp); break; 1015 case 'i': out = scanelf_file_interp(elf, &found_interp); break;
987 case 'b': out = scanelf_file_bind(elf, &found_bind); break; 1016 case 'b': out = scanelf_file_bind(elf, &found_bind); break;
988 case 'S': out = scanelf_file_soname(elf, &found_soname); break; 1017 case 'S': out = scanelf_file_soname(elf, &found_soname); break;
989 case 's': out = scanelf_file_sym(elf, &found_sym); break; 1018 case 's': out = scanelf_file_sym(elf, &found_sym); break;
1019 case 'k': out = scanelf_file_sections(elf, &found_section); break;
990 default: warnf("'%c' has no scan code?", out_format[i]); 1020 default: warnf("'%c' has no scan code?", out_format[i]);
991 } 1021 }
992 if (out) { 1022 if (out) {
993 /* hack for comma delimited output like `scanelf -s sym1,sym2,sym3` */ 1023 /* hack for comma delimited output like `scanelf -s sym1,sym2,sym3` */
994 if (out_format[i] == 's' && (tmp=strchr(out,',')) != NULL) 1024 if (out_format[i] == 's' && (tmp=strchr(out,',')) != NULL)
999 } 1029 }
1000 1030
1001#define FOUND_SOMETHING() \ 1031#define FOUND_SOMETHING() \
1002 (found_pax || found_phdr || found_relro || found_load || found_textrel || \ 1032 (found_pax || found_phdr || found_relro || found_load || found_textrel || \
1003 found_rpath || found_needed || found_interp || found_bind || \ 1033 found_rpath || found_needed || found_interp || found_bind || \
1004 found_soname || found_sym || found_lib || found_textrels) 1034 found_soname || found_sym || found_lib || found_textrels || found_section )
1005 1035
1006 if (!found_file && (!be_quiet || (be_quiet && FOUND_SOMETHING()))) { 1036 if (!found_file && (!be_quiet || (be_quiet && FOUND_SOMETHING()))) {
1007 xchrcat(&out_buffer, ' ', &out_len); 1037 xchrcat(&out_buffer, ' ', &out_len);
1008 xstrcat(&out_buffer, elf->filename, &out_len); 1038 xstrcat(&out_buffer, elf->filename, &out_len);
1009 } 1039 }
1293 free(path); 1323 free(path);
1294} 1324}
1295 1325
1296 1326
1297/* usage / invocation handling functions */ 1327/* usage / invocation handling functions */
1298#define PARSE_FLAGS "plRmyAXxetrnLibSs:gN:TaqvF:f:o:M:E:BhV" 1328#define PARSE_FLAGS "plRmyAXxetrnLibSs:k:gN:TaqvF:f:o:M:E:BhV"
1299#define a_argument required_argument 1329#define a_argument required_argument
1300static struct option const long_opts[] = { 1330static struct option const long_opts[] = {
1301 {"path", no_argument, NULL, 'p'}, 1331 {"path", no_argument, NULL, 'p'},
1302 {"ldpath", no_argument, NULL, 'l'}, 1332 {"ldpath", no_argument, NULL, 'l'},
1303 {"recursive", no_argument, NULL, 'R'}, 1333 {"recursive", no_argument, NULL, 'R'},
1313 {"needed", no_argument, NULL, 'n'}, 1343 {"needed", no_argument, NULL, 'n'},
1314 {"interp", no_argument, NULL, 'i'}, 1344 {"interp", no_argument, NULL, 'i'},
1315 {"bind", no_argument, NULL, 'b'}, 1345 {"bind", no_argument, NULL, 'b'},
1316 {"soname", no_argument, NULL, 'S'}, 1346 {"soname", no_argument, NULL, 'S'},
1317 {"symbol", a_argument, NULL, 's'}, 1347 {"symbol", a_argument, NULL, 's'},
1348 {"section", a_argument, NULL, 'k'},
1318 {"lib", a_argument, NULL, 'N'}, 1349 {"lib", a_argument, NULL, 'N'},
1319 {"gmatch", no_argument, NULL, 'g'}, 1350 {"gmatch", no_argument, NULL, 'g'},
1320 {"textrels", no_argument, NULL, 'T'}, 1351 {"textrels", no_argument, NULL, 'T'},
1321 {"etype", a_argument, NULL, 'E'}, 1352 {"etype", a_argument, NULL, 'E'},
1322 {"bits", a_argument, NULL, 'M'}, 1353 {"bits", a_argument, NULL, 'M'},
1348 "Print NEEDED information", 1379 "Print NEEDED information",
1349 "Print INTERP information", 1380 "Print INTERP information",
1350 "Print BIND information", 1381 "Print BIND information",
1351 "Print SONAME information", 1382 "Print SONAME information",
1352 "Find a specified symbol", 1383 "Find a specified symbol",
1384 "Find a specified section",
1353 "Find a specified library", 1385 "Find a specified library",
1354 "Use strncmp to match libraries. (use with -N)", 1386 "Use strncmp to match libraries. (use with -N)",
1355 "Locate cause of TEXTREL", 1387 "Locate cause of TEXTREL",
1356 "Print only ELF files matching numeric constant type", 1388 "Print only ELF files matching numeric constant type",
1357 "Print only ELF files matching numeric bits", 1389 "Print only ELF files matching numeric bits",
1374 printf("* Scan ELF binaries for stuff\n\n" 1406 printf("* Scan ELF binaries for stuff\n\n"
1375 "Usage: %s [options] <dir1/file1> [dir2 dirN file2 fileN ...]\n\n", argv0); 1407 "Usage: %s [options] <dir1/file1> [dir2 dirN file2 fileN ...]\n\n", argv0);
1376 printf("Options: -[%s]\n", PARSE_FLAGS); 1408 printf("Options: -[%s]\n", PARSE_FLAGS);
1377 for (i = 0; long_opts[i].name; ++i) 1409 for (i = 0; long_opts[i].name; ++i)
1378 if (long_opts[i].has_arg == no_argument) 1410 if (long_opts[i].has_arg == no_argument)
1379 printf(" -%c, --%-13s* %s\n", long_opts[i].val, 1411 printf(" -%c, --%-14s* %s\n", long_opts[i].val,
1380 long_opts[i].name, opts_help[i]); 1412 long_opts[i].name, opts_help[i]);
1381 else 1413 else
1382 printf(" -%c, --%-6s <arg> * %s\n", long_opts[i].val, 1414 printf(" -%c, --%-7s <arg> * %s\n", long_opts[i].val,
1383 long_opts[i].name, opts_help[i]); 1415 long_opts[i].name, opts_help[i]);
1384 1416
1385 if (status != EXIT_SUCCESS) 1417 if (status != EXIT_SUCCESS)
1386 exit(status); 1418 exit(status);
1387 1419
1433 if ((fp = freopen(optarg, "w", stdout)) == NULL) 1465 if ((fp = freopen(optarg, "w", stdout)) == NULL)
1434 err("Could not open output stream '%s': %s", optarg, strerror(errno)); 1466 err("Could not open output stream '%s': %s", optarg, strerror(errno));
1435 SET_STDOUT(fp); 1467 SET_STDOUT(fp);
1436 break; 1468 break;
1437 } 1469 }
1438 1470 case 'k':
1471 if (find_section) warn("You can not specify -k twice");
1472 find_section = optarg;
1473 break;
1439 case 's': { 1474 case 's': {
1440 if (find_sym) warn("You prob don't want to specify -s twice"); 1475 if (find_sym) warn("You prob don't want to specify -s twice");
1441 find_sym = optarg; 1476 find_sym = optarg;
1442 versioned_symname = (char*)xmalloc(sizeof(char) * (strlen(find_sym)+1+1)); 1477 versioned_symname = (char*)xmalloc(sizeof(char) * (strlen(find_sym)+1+1));
1443 sprintf(versioned_symname, "%s@", find_sym); 1478 sprintf(versioned_symname, "%s@", find_sym);
1499 case '%': break; 1534 case '%': break;
1500 case '#': break; 1535 case '#': break;
1501 case 'F': break; 1536 case 'F': break;
1502 case 'p': break; 1537 case 'p': break;
1503 case 'f': break; 1538 case 'f': break;
1539 case 'k': break;
1504 case 's': break; 1540 case 's': break;
1505 case 'N': break; 1541 case 'N': break;
1506 case 'o': break; 1542 case 'o': break;
1507 case 'x': show_pax = 1; break; 1543 case 'x': show_pax = 1; break;
1508 case 'e': show_phdr = 1; break; 1544 case 'e': show_phdr = 1; break;
1532 if (show_interp) xstrcat(&out_format, "%i ", &fmt_len); 1568 if (show_interp) xstrcat(&out_format, "%i ", &fmt_len);
1533 if (show_bind) xstrcat(&out_format, "%b ", &fmt_len); 1569 if (show_bind) xstrcat(&out_format, "%b ", &fmt_len);
1534 if (show_soname) xstrcat(&out_format, "%S ", &fmt_len); 1570 if (show_soname) xstrcat(&out_format, "%S ", &fmt_len);
1535 if (show_textrels) xstrcat(&out_format, "%T ", &fmt_len); 1571 if (show_textrels) xstrcat(&out_format, "%T ", &fmt_len);
1536 if (find_sym) xstrcat(&out_format, "%s ", &fmt_len); 1572 if (find_sym) xstrcat(&out_format, "%s ", &fmt_len);
1573 if (find_section) xstrcat(&out_format, "%k ", &fmt_len);
1537 if (find_lib) xstrcat(&out_format, "%N ", &fmt_len); 1574 if (find_lib) xstrcat(&out_format, "%N ", &fmt_len);
1538 if (!be_quiet) xstrcat(&out_format, "%F ", &fmt_len); 1575 if (!be_quiet) xstrcat(&out_format, "%F ", &fmt_len);
1539 } 1576 }
1540 if (be_verbose > 2) printf("Format: %s\n", out_format); 1577 if (be_verbose > 2) printf("Format: %s\n", out_format);
1541 1578

Legend:
Removed from v.1.123  
changed lines
  Added in v.1.124

  ViewVC Help
Powered by ViewVC 1.1.20