| 1 | /* |
1 | /* |
| 2 | * Copyright 2003 Ned Ludd <solar@gentoo.org> |
2 | * Copyright 2003 Ned Ludd <solar@gentoo.org> |
| 3 | * Copyright 1999-2005 Gentoo Foundation |
3 | * Copyright 1999-2005 Gentoo Foundation |
| 4 | * Distributed under the terms of the GNU General Public License v2 |
4 | * Distributed under the terms of the GNU General Public License v2 |
| 5 | * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.28 2005/04/05 03:41:27 solar Exp $ |
5 | * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.29 2005/04/05 04:25:54 vapier Exp $ |
| 6 | * |
6 | * |
| 7 | ******************************************************************** |
7 | ******************************************************************** |
| 8 | * This program is free software; you can redistribute it and/or |
8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of the |
10 | * published by the Free Software Foundation; either version 2 of the |
| … | |
… | |
| 33 | #include <getopt.h> |
33 | #include <getopt.h> |
| 34 | #include <assert.h> |
34 | #include <assert.h> |
| 35 | |
35 | |
| 36 | #include "paxelf.h" |
36 | #include "paxelf.h" |
| 37 | |
37 | |
| 38 | static const char *rcsid = "$Id: scanelf.c,v 1.28 2005/04/05 03:41:27 solar Exp $"; |
38 | static const char *rcsid = "$Id: scanelf.c,v 1.29 2005/04/05 04:25:54 vapier Exp $"; |
| 39 | |
39 | |
| 40 | |
40 | |
| 41 | /* helper functions for showing errors */ |
41 | /* helper functions for showing errors */ |
| 42 | #define argv0 "scanelf" /*((*argv != NULL) ? argv[0] : __FILE__ "\b\b")*/ |
42 | #define argv0 "scanelf" /*((*argv != NULL) ? argv[0] : __FILE__ "\b\b")*/ |
| 43 | #define warn(fmt, args...) \ |
43 | #define warn(fmt, args...) \ |
| … | |
… | |
| 212 | printf(" - "); |
212 | printf(" - "); |
| 213 | } |
213 | } |
| 214 | |
214 | |
| 215 | if (find_sym) { |
215 | if (find_sym) { |
| 216 | void *symtab_void, *strtab_void; |
216 | void *symtab_void, *strtab_void; |
| 217 | char found_sym = 0; |
|
|
| 218 | char *versioned_symname = malloc(strlen(find_sym)+1); |
217 | char *versioned_symname = malloc(strlen(find_sym)+2); |
| 219 | |
218 | |
| 220 | sprintf(versioned_symname, "%s@", find_sym); |
219 | sprintf(versioned_symname, "%s@", find_sym); |
| 221 | symtab_void = elf_findsecbyname(elf, ".symtab"); |
220 | symtab_void = elf_findsecbyname(elf, ".symtab"); |
| 222 | strtab_void = elf_findsecbyname(elf, ".strtab"); |
221 | strtab_void = elf_findsecbyname(elf, ".strtab"); |
| 223 | |
222 | |
| … | |
… | |
| 247 | } } |
246 | } } |
| 248 | FIND_SYM(32) |
247 | FIND_SYM(32) |
| 249 | FIND_SYM(64) |
248 | FIND_SYM(64) |
| 250 | } |
249 | } |
| 251 | free(versioned_symname); |
250 | free(versioned_symname); |
| 252 | if (*find_sym != '*') |
251 | if (*find_sym != '*') { |
| 253 | printf(" %s ", (found_sym == 0) ? "-" : find_sym); |
252 | if (found_sym) |
|
|
253 | printf(" %s ", find_sym); |
|
|
254 | else if (!be_quiet) |
|
|
255 | printf(" - "); |
| 254 | } |
256 | } |
|
|
257 | } |
| 255 | |
258 | |
| 256 | if (!be_quiet || found_pax || found_stack || found_textrel || found_rpath) |
259 | if (!be_quiet || found_pax || found_stack || found_textrel || found_rpath || found_sym) |
| 257 | printf("%s\n", filename); |
260 | printf("%s\n", filename); |
| 258 | |
261 | |
| 259 | unreadelf(elf); |
262 | unreadelf(elf); |
| 260 | } |
263 | } |
| 261 | |
264 | |