/[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.77 Revision 1.78
1/* 1/*
2 * Copyright 2003-2005 Gentoo Foundation 2 * Copyright 2003-2005 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.77 2005/06/08 05:43:01 vapier Exp $ 4 * $Header: /var/cvsroot/gentoo-projects/pax-utils/scanelf.c,v 1.78 2005/06/08 22:23:16 vapier Exp $
5 * 5 *
6 ******************************************************************** 6 ********************************************************************
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as 8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the 9 * published by the Free Software Foundation; either version 2 of the
33#include <dirent.h> 33#include <dirent.h>
34#include <getopt.h> 34#include <getopt.h>
35#include <assert.h> 35#include <assert.h>
36#include "paxelf.h" 36#include "paxelf.h"
37 37
38static const char *rcsid = "$Id: scanelf.c,v 1.77 2005/06/08 05:43:01 vapier Exp $"; 38static const char *rcsid = "$Id: scanelf.c,v 1.78 2005/06/08 22:23:16 vapier Exp $";
39#define argv0 "scanelf" 39#define argv0 "scanelf"
40 40
41#define IS_MODIFIER(c) (c == '%' || c == '#') 41#define IS_MODIFIER(c) (c == '%' || c == '#')
42 42
43 43
285 uint ## B ## _t memsz; \ 285 uint ## B ## _t memsz; \
286 if (EGET(phdr[p].p_type) != PT_LOAD) continue; \ 286 if (EGET(phdr[p].p_type) != PT_LOAD) continue; \
287 if (EGET(phdr[p].p_flags) & PF_W) continue; \ 287 if (EGET(phdr[p].p_flags) & PF_W) continue; \
288 vaddr = EGET(phdr[p].p_vaddr); \ 288 vaddr = EGET(phdr[p].p_vaddr); \
289 memsz = EGET(phdr[p].p_memsz); \ 289 memsz = EGET(phdr[p].p_memsz); \
290 *found_textrels = 1; \
291 /* now see if any of the relocs are in the PT_LOAD */ \ 290 /* now see if any of the relocs are in the PT_LOAD */ \
292 for (r = 0; r < rmax; ++r) { \ 291 for (r = 0; r < rmax; ++r) { \
293 unsigned long sym_max; \ 292 unsigned long sym_max; \
294 Elf ## B ## _Addr offset_tmp; \ 293 Elf ## B ## _Addr offset_tmp; \
295 Elf ## B ## _Sym *func; \ 294 Elf ## B ## _Sym *func; \
303 r_offset = EGET(rela[r].r_offset); \ 302 r_offset = EGET(rela[r].r_offset); \
304 r_info = EGET(rela[r].r_info); \ 303 r_info = EGET(rela[r].r_info); \
305 } \ 304 } \
306 /* make sure this relocation is inside of the .text */ \ 305 /* make sure this relocation is inside of the .text */ \
307 if (r_offset < vaddr || r_offset >= vaddr + memsz) continue; \ 306 if (r_offset < vaddr || r_offset >= vaddr + memsz) continue; \
307 *found_textrels = 1; \
308 /* locate this relocation symbol name */ \ 308 /* locate this relocation symbol name */ \
309 sym = SYM ## B (elf->data + EGET(symtab->sh_offset)); \ 309 sym = SYM ## B (elf->data + EGET(symtab->sh_offset)); \
310 sym_max = ELF ## B ## _R_SYM(r_info); \ 310 sym_max = ELF ## B ## _R_SYM(r_info); \
311 if (sym_max * EGET(symtab->sh_entsize) < symtab->sh_size) \ 311 if (sym_max * EGET(symtab->sh_entsize) < symtab->sh_size) \
312 sym += sym_max; \ 312 sym += sym_max; \

Legend:
Removed from v.1.77  
changed lines
  Added in v.1.78

  ViewVC Help
Powered by ViewVC 1.1.20