delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/16/18:38:58

From: "Christopher Nelson" <paradox AT gye DOT satnet DOT net>
To: <djgpp AT delorie DOT com>
Subject: Re: RELOC_REL32
Date: Fri, 16 Apr 1999 17:31:53 -0600
Message-ID: <01be8861$4f03b1c0$LocalHost@thendren>
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.71.1712.3
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Reply-To: djgpp AT delorie DOT com

>
>> *(long *)section+r->r_vaddr += section;
>> *(long *)section+r->r_vaddr -= (section - section_header.s_paddr);
>
>more like *(long *)section+r->r_vaddr += symbol_addr -
this_section->new_paddr;


say i allocate the data for "section" at 0x100, and it's original paddr was
0x4. say the symbol has a vaddr of 0x32 in the relocation entry, and in
real-life it's at say 0x200.

then, if i understand this, is should come up with:

address = 0x200 - 0x100;

or,

*(long *)0x100+0x32 += 0x200 - 0x100;


>> One of the functions that gets output to .xptfunc references both
>> _malloc and _memset, but they aren't statically linked into the
>> object, so, what is it that I need to do to get _malloc and
>> _memset's real addresses correctly patched into the file?

>You need to find out their real addresses somehow, or defer those
>relocations until you can know.

allright, so, this sounds like i can do this:

long *p = (long *)malloc;

*(long *)section+r->r_vaddr += p - section;

for symbol malloc.

    -={C}=-

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019