2 * Copyright (c) 1996-2009 Barton P. Miller
4 * We provide the Paradyn Parallel Performance Tools (below
5 * described as "Paradyn") on an AS IS basis, and do not warrant its
6 * validity or performance. We reserve the right to update, modify,
7 * or discontinue this software at any time. We shall have no
8 * obligation to supply such updates or modifications or any other
9 * form of support to you.
11 * By your use of Paradyn, you understand and agree that we (or any
12 * other person or entity with proprietary rights in Paradyn) are
13 * under no obligation to provide either maintenance services,
14 * update services, notices of latent defects, or correction of
15 * defects for Paradyn.
17 * This library is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Lesser General Public
19 * License as published by the Free Software Foundation; either
20 * version 2.1 of the License, or (at your option) any later version.
22 * This library is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25 * Lesser General Public License for more details.
27 * You should have received a copy of the GNU Lesser General Public
28 * License along with this library; if not, write to the Free Software
29 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
32 /* -*- Mode: C; indent-tabs-mode: true -*- */
33 // Since the author of this file chose to use tabs instead of spaces
34 // for the indentation mode, the above line switches users into tabs
35 // mode with emacs when editing this file.
37 /* $Id: addLibrary.h,v 1.8 2006/03/14 22:57:22 legendre Exp $ */
39 #if defined(sparc_sun_solaris2_4)
51 typedef struct _Elf_element{
64 Elf_element *newElfFileSec;
65 Elf32_Phdr *newElfFilePhdr;
66 Elf32_Ehdr *newElfFileEhdr;
73 unsigned int newPhdrAddr;
74 unsigned int newPhdrOffset;
76 unsigned int phdrSize;
78 unsigned int textSegEndIndx;
79 unsigned int dataSegStartIndx;
83 int findSection(const char *name);
84 void updateDynamic(Elf_Data*newData,unsigned int hashOff, unsigned int dynsymOff, unsigned int dynstrOff);
85 void updateProgramHeaders(Elf32_Phdr *phdr, unsigned int dynstrOffset);
86 void addStr(Elf_Data* newData, Elf_Data* oldData, const char *str);
87 int writeNewElf(char* filename, const char* libname);
88 unsigned int findEndOfTextSegment();
89 unsigned int findStartOfDataSegment();
91 int findNewPhdrAddr();
92 int findNewPhdrOffset();
95 void fixUpPhdrForDynamic();
97 void updateSymbols(Elf_Data* symtabData,Elf_Data* strData, unsigned int dynAddr);
100 unsigned int _pageSize, realPageSize;
102 int driver(Elf *elf, char *newfilename, const char *libname);