delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2004/08/08/10:10:40

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Authenticated: #10658336
Mime-Version: 1.0 (Apple Message framework v618)
Message-Id: <E94D7E69-E940-11D8-9F0B-003065C18A1C@gmx.ch>
To: djgpp AT delorie DOT com
From: =?ISO-8859-1?Q?Werner_Sch=F6nenberger?= <werner DOT schoenenberger AT gmx DOT ch>
Subject: Sequence of Symbol Allocation
Date: Sun, 8 Aug 2004 15:43:20 +0200
X-Mailer: Apple Mail (2.618)
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id i78EAF1A003798
Reply-To: djgpp AT delorie DOT com

Dear List,

I am rather new to the DJGPP environment and have a specific question 
to the sequence of symbol allocation in the DJGPP environment.

A couple of month ago, I received some piece of source code that was 
developed as far as I know in a SUN environment for a Motorola 68xxx 
processor based system. About 90% of the source code was programmed in 
assembler and therefore assembler oriented programming techniques were 
used. Some people ported the SUN based development to the PC using the 
DJGPP.  Almost everything now runs well except one major problem that 
still exists: the sequence of the symbol allocation does not match to 
the sequence in the source code. After several weeks of searching, I 
still did not find a solution and so desperately need some help. The 
problem in this situation is that the original source code uses some 
programming techniques to optimize initialization or variable access. 
E.g. for initialization of global symbols it uses a loop "from address 
of variable A to address of variable Z set everything to 0".  Now after 
linkage, if the address of variable "A"  is not the first and "Z" not 
the last variable of the symbol section to initialize, it will not 
initialize correctly. Example:

Source Code:
   .comm A,2
   .comm b,2
   .comm c,4
   .comm d,2
   .comm e,8
   .comm f,2
   .comm Z,2

This will lead to a symbol list in the MAP file after linkage which 
might look like

   0x0004e670 b
   0x0004e672 f
   0x0004e674 d
   0x0004e676 Z   <--
   0x0004e678 e
   0x0004e680 A   <--
   0x0004e682 c

If now the loop tries to initalize the variables between address "A" 
and "Z", it will not succeed. There are also an unknown number of code 
examples that uses two following variables within one instruction. For 
example one single MOV command to the variable A, casted to WORD, will 
set the values for "A" and "b" of  the example above within one 
instruction. But of course this will fail if the sequence of the 
variable after the linkage does not correspond to the sequence in the 
source code.

Until now, I did not find a solution how the sequence of allocation can 
be forced to be the same as in the source code. If anybody has some 
ideas, please let me know. Any help is appreciated.

Thank you in advance.

Kind regards
Werner Schönenberger
Switzerland


- Raw text -


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