Mail Archives: djgpp/2004/08/08/13:16:02
Werner Schönenberger <werner DOT schoenenberger AT gmx DOT ch> wrote:
[...]
> 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.
I object to these being called "progamming techniques". Their correct
name is "bloody hacks". And like all bloody hacks, they will come
back to haunt you one day. Looks like for your particular project,
that day has come.
The source of your problem is given right there in "info gas symbols":
_Warning:_ `as' does not place symbols in the object file in the
same order they were declared. This may break some debuggers.
Expecting .comm symbols, of all things, to remain ordered, strikes me
as begging for problems. By their very nature, common symbols will be
gone over and reorganized by the linker. If you don't want that,
use structs to hold them in, i.e. in C parlance, instead of
/* globals */
int a;
unsigned long b;
char c;
do
/* global struct */
struct {
int a;
unsigned long b;
char c;
} struct_of_globals;
> 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.
Well, as the old saying goes: "Don't do that, then!".
I suggest you take this on to the real authors of the software you're
dealing with: the GNU binutils people. DJGPP is just a port of these
programs to DOS, but this issue is quite independent of that.
Actually I'ld venture a guess you'll see exactly the same behaviour if
you build your original code using GNU binutils on Sun boxes.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -