From: "Christopher Nelson" To: Subject: Fw: RELOC_XXXXX (sorry, my last post was accidentally html...) Date: Sun, 18 Apr 1999 08:39:34 -0600 Message-ID: <01be89a9$473b4ea0$LocalHost@thendren> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit 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 Thanks for all the help you've given me up to now, but I have discovered another problem that I can't find the solution too, and is related to the same area. The DOCS say: RELOC_ADDR32 To do this relocation, you must perform the following steps: a.. Get the address of the symbol referred to. b.. Add the value currently stored in the location being adjusted. c.. Store the value back into the location being adjusted. This is fine if the object contains only one section, but when it contains multiple sections, it leaves a little bit of specification. According to the paragraph above in the instructions, "If the symbol is in the same object, the symbol table will have entries that refer to the sections themselves (always there and always private) that will be referred to. When you relocate the section itself, these symbols will reflect its new location." The symbol I'm trying to adjust in this instance is a global integer located in a section called .xptdata. This is the code I use to readjust a RELOC_ADDR32: (the 'a' below is a loop variable that goes from 0 to file_header.f_nscns-1) unsigned long *sc; unsigned long offset, new_base; unsigned long orig; sc = (unsigned long *)sections[a].data; offset = r->r_vaddr; // - sections[a].header.s_paddr; new_base = (unsigned long)sections[sym_table[r->r_symndx].e_scnum-1].data; *(sc+offset) += (unsigned long)new_base; The description above doesn't say whether I should use the base address of the section that the variable is contained in (which sounds reasonable) or whether it needs to be in the section that contains the reloc entry. (or, in other words, if the value i add in is the base of the section where the variable is found, or the base of the section that the relocation entry is part of.) The problem is, this doesn't seem to work. The relocated code executes fine, but the address for the variable is 0x40, which is definitely not right. This is the offset that I get in the r->r_vaddr member too. What am I overlooking? -={C}=-