Mail Archives: djgpp/2004/08/08/09:55:47
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 -