Hi Kees,
> I noticed that _after linking_ the jump offsets are correctly
> calculated and placed...........
>
> Any clue?
In a word: relocations.
Try disassembling your object file with "-dr" specified. You should see
something like this:
00000000 <intern1>:
0: 1f 43 mov #1, r15 ;r3 As==01
2: 1e 83 dec r14 ;
4: 00 24 jz $+2 ;abs 0x6
4: R_MSP430X_10_PCREL lab1
6: 03 43 nop
8: 00 3c jmp $+2 ;abs 0xa
8: R_MSP430X_10_PCREL lab2
What this means is that the JZ instruction at offset 4 and the JMP
instruction at offset 8 both have unresolved relocations against them.
At link time the linker will resolve the relocations and store the
correct values into the instructions.
The reason why the assembler generates these relocations, rather than
just resolving the jumps directly is because the linker also performs
"relaxations" where it can replace some instructions with shorter
versions. So it is possible that the distance between a jump
instruction and its destination label will change at link time. Hence
the assembler cannot know for sure exactly what value to put into the
offset field, and hence it must use a relocation instead.
Cheers
Nick
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
_______________________________________________
Mspgcc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mspgcc-users