DCPUTeam / DCPUToolchain

[ARCHIVED] The code repository for the DCPU-16 Toolchain.
http://dcputoolcha.in/
MIT License
96 stars 14 forks source link

The linker does not work with compiler-generated ASM. #188

Closed jdiez17 closed 11 years ago

jdiez17 commented 11 years ago
➜  DCPUToolchain git:(master) ✗ ./dtasm/dtasm test.dasm -o test.o   
warning: expressions will not be adjusted at link or relocation time. ensure labels are not used as part of expressions.

➜  DCPUToolchain git:(master) ✗ hexdump -C test.o
00000000  4f 42 4a 45 43 54 2d 46  4f 52 4d 41 54 2d 31 2e  |OBJECT-FORMAT-1.|
00000010  32 00 63 66 75 6e 63 5f  6d 61 69 6e 00 00 00 00  |2.cfunc_main....|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
(...)

➜  DCPUToolchain git:(master) ✗ cat test.policy 
defaults
{
    direct=true
}

format(image):
    write code

➜  DCPUToolchain git:(master) ✗ ./dtld/dtld test.o -o test.bin -p test.policy
warning: skipped empty section INIT on load.
➜  DCPUToolchain git:(master) ✗ hexdump test.bin
➜  DCPUToolchain git:(master) ✗ 

Confirmed by @r4d2 as well.

patflick commented 11 years ago

i got this to work now, i added --direct to the dtld options and changed the policy file to:

defaults
{
    kernel=@KERNEL_FOLDER@/stubsys.dkrn16
    jumplist=@KERNEL_FOLDER@/stubsys.djmp16
    symbols=@KERNEL_FOLDER@/stubsys.dsym16
}

format(image):
    chain image-direct

format(image-direct):
    write code

(i.e. removed the offset 0x1000 setting)

@hach-que: this might still be a bug, but this way compiled code links correctly

Cheers!