Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com From: "Ralf Habacker" To: "Jason Tishler" , Subject: RE: rebase and ME Date: Thu, 8 Aug 2002 10:47:03 +0200 Message-ID: <009e01c23eb8$2bdddca0$651c440a@BRAMSCHE> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 In-Reply-To: <20020806202759.GF1892@tishler.net> Importance: Normal > On Tue, Aug 06, 2002 at 04:04:13PM -0400, Jason Tishler wrote: > > On Tue, Aug 06, 2002 at 08:58:28PM +0200, Ralf Habacker wrote: > > > > Please try the appended patched rebase. > > > > > > > I haven't got any comments. Does this rebase not work ? > > > > Sorry, I've been backed up debugging an ipc-daemon problem. I will try > > your version under 2000 tomorrow morning. > > Actually, I just found some time. Your version seems to rebase fine, > but SEGVs on known problematic (stripped) DLLs: > > $ cp /usr/bin/cygcurl-2.dll . > $ strip cygcurl-2.dll > $ ./rebase -l cygcurl-2.dll > cygcurl-2.dll ImageBase: 10000000 ImageSize: 00020000 > ^^^^^^^^ > $ ./rebase -d -b 0x68000000 cygcurl-2.dll > Segmentation fault (core dumped) > > Note that stripping cygcurl-2.dll seems to whack the ImageSize. > > Without stripping we get the following: > > $ cp /usr/bin/cygcurl-2.dll . > $ ./rebase -l cygcurl-2.dll > cygcurl-2.dll ImageBase: 10000000 ImageSize: 00069000 > $ ../rebase/rebase -d -b 0x68000000 cygcurl-2.dll > $ ./rebase -l cygcurl-2.dll > cygcurl-2.dll ImageBase: 67f90000 ImageSize: 00069000 > > Can you fix this problem? > The reason for this is, that the dll contains relocations, which are located in sections, which are removed by stripping. Unfortunally the relocations for this sections aren't removed, so rebase writes to non existant locations. See below This are the sections of the stripped dll. See the VMA's Sections: Idx Name Size VMA LMA File off Algn 0 .text 00016000 10001000 10001000 00000400 2**2 CONTENTS, ALLOC, LOAD, READONLY, CODE, DATA 1 .data 00000400 10017000 10017000 00016400 2**2 CONTENTS, ALLOC, LOAD, DATA 2 .bss 0000035c 10018000 10018000 00000000 2**2 ALLOC 3 .edata 00000c00 10019000 10019000 00016800 2**2 CONTENTS, ALLOC, LOAD, DATA 4 .idata 00001000 1001a000 1001a000 00017400 2**2 CONTENTS, ALLOC, LOAD, DATA 5 .reloc 00001200 1001b000 1001b000 00018400 2**2 CONTENTS, ALLOC, LOAD, DATA The relocations points to the relative virtual addresses (RVA), (substrate the ImageBase (0x10000000) from the above VMA-entries th get the rva). For example the first virtual adress 0x00001000 below mentioned points into the .text segment. The second and ... too until (2) 0x00017000, which points into the data segment. Virtual Address: 00001000 Virtual Address: 00002000 Virtual Address: 00015000 Virtual Address: 00016000 (2) Virtual Address: 00017000 And there is the problem: If you look into the sections, you will not find a section with a rva of 0x1d000 and the relocation points into the nirvana. So it seems that "strip" contains a bug. Virtual Address: 0001d000 Virtual Address: 0001f000 Virtual Address: 00044000 Can anyone tell me, which dll's are affected by this problem , so that I can identify, what's going wrong with stripping ? Ralf -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/