Global data order


    %TestArrayPtr = global %struct.test* getelementptr (
           [10 x %struct.test]* %TestArray, ..........
    %TestArray = weak global [10 x %struct.test] zeroinitialize

my backend produce data declaration in the same order, so TestArrayPtr refers
to TestArray before TestArray itself is defined.

Is there a standard way to get the right ordering. I wrote my own code, but
maybe there's something better.

- Volodya

There is no way to guarantee that there isn't a cycle in the references
between globals. Does your assembler have some way of forward declaring
globals or something? If so it would be reasonable to forward declare all
globals before they are emitted. If not, then there are some programs
that your backend just won't be able to compile, e.g.:

extern void *B;
void *A = &B;
void *B = &A;