/[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.186 Revision 1.187
1/* 1/*
2 * Copyright 2003-2007 Gentoo Foundation 2 * Copyright 2003-2007 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.186 2007/08/20 09:54:15 vapier Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.187 2007/08/25 02:46:18 vapier Exp $
5 * 5 *
6 * Copyright 2003-2007 Ned Ludd - <solar@gentoo.org> 6 * Copyright 2003-2007 Ned Ludd - <solar@gentoo.org>
7 * Copyright 2004-2007 Mike Frysinger - <vapier@gentoo.org> 7 * Copyright 2004-2007 Mike Frysinger - <vapier@gentoo.org>
8 */ 8 */
9 9
10static const char *rcsid = "$Id: scanelf.c,v 1.186 2007/08/20 09:54:15 vapier Exp $"; 10static const char *rcsid = "$Id: scanelf.c,v 1.187 2007/08/25 02:46:18 vapier Exp $";
11const char * const argv0 = "scanelf"; 11const char * const argv0 = "scanelf";
12 12
13#include "paxinc.h" 13#include "paxinc.h"
14 14
15#define IS_MODIFIER(c) (c == '%' || c == '#' || c == '+') 15#define IS_MODIFIER(c) (c == '%' || c == '#' || c == '+')
483 printf("%s", func_name); \ 483 printf("%s", func_name); \
484 } else \ 484 } else \
485 printf("(optimized out)"); \ 485 printf("(optimized out)"); \
486 printf(" [0x%lX]\n", (unsigned long)offset_tmp); \ 486 printf(" [0x%lX]\n", (unsigned long)offset_tmp); \
487 if (be_verbose && has_objdump) { \ 487 if (be_verbose && has_objdump) { \
488 Elf ## B ## _Addr end_addr = offset_tmp + EGET(func->st_size); \
488 char *sysbuf; \ 489 char *sysbuf; \
489 size_t syslen; \ 490 size_t syslen; \
490 const char sysfmt[] = "objdump -r -R -d -w -l --start-address=0x%lX --stop-address=0x%lX %s | grep --color -i -C 3 '.*[[:space:]]%lX:[[:space:]]*R_.*'\n"; \ 491 const char sysfmt[] = "objdump -r -R -d -w -l --start-address=0x%lX --stop-address=0x%lX %s | grep --color -i -C 3 '.*[[:space:]]%lX:[[:space:]]*R_.*'\n"; \
491 syslen = sizeof(sysfmt) + strlen(elf->filename) + 3 * sizeof(unsigned long) + 1; \ 492 syslen = sizeof(sysfmt) + strlen(elf->filename) + 3 * sizeof(unsigned long) + 1; \
492 sysbuf = xmalloc(syslen); \ 493 sysbuf = xmalloc(syslen); \
493 if (sysbuf) { \
494 Elf ## B ## _Addr end_addr = offset_tmp + EGET(func->st_size); \
495 if (end_addr < r_offset) \ 494 if (end_addr < r_offset) \
496 /* not uncommon when things are optimized out */ \ 495 /* not uncommon when things are optimized out */ \
497 end_addr = r_offset + 0x100; \ 496 end_addr = r_offset + 0x100; \
498 snprintf(sysbuf, syslen, sysfmt, \ 497 snprintf(sysbuf, syslen, sysfmt, \
499 (unsigned long)offset_tmp, \ 498 (unsigned long)offset_tmp, \
500 (unsigned long)end_addr, \ 499 (unsigned long)end_addr, \
501 elf->filename, \ 500 elf->filename, \
502 (unsigned long)r_offset); \ 501 (unsigned long)r_offset); \
503 fflush(stdout); \ 502 fflush(stdout); \
504 system(sysbuf); \ 503 system(sysbuf); \
505 fflush(stdout); \ 504 fflush(stdout); \
506 free(sysbuf); \ 505 free(sysbuf); \
507 } \
508 } \ 506 } \
509 } \ 507 } \
510 } } 508 } }
511 SHOW_TEXTRELS(32) 509 SHOW_TEXTRELS(32)
512 SHOW_TEXTRELS(64) 510 SHOW_TEXTRELS(64)

Legend:
Removed from v.1.186  
changed lines
  Added in v.1.187

  ViewVC Help
Powered by ViewVC 1.1.20