11 January 2020, 19:31 | #1 |
Registered User
Join Date: Jan 2020
Location: Launceston
Posts: 3
|
VLINK / VBCC / VASM linking order issue
Hi, Ive setup a build system that uses vasm to assemble files, vc/vbcc to compile files and vlink to link them all in amiga hunk format. Im not including the startup.o / mstartup.o as i dont want to use the C code as the initial startup. I pass one of the asm->.o files as the first object code to the linker but still it insists on putting the .c->.o file as the startup even though it is literally just this
int SomeFunction() { int i = 10; i++; return i; } (Its just a test function for now). Everything suggests that amiga linking should use the first .o as the entry point? Am I doing something wrong? Also i couldnt find the source code to the startup.o/mstartup.o files so i cant alter these to my requirements either Many Thanks |
12 January 2020, 02:24 | #2 | |||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
|
Quote:
Quote:
Quote:
|
|||
12 January 2020, 07:38 | #3 |
Registered User
Join Date: Jan 2020
Location: Launceston
Posts: 3
|
Ahh, that starts to throw more information onto the issue
Code:
Assembling: System.asm l:\catfish\amiga\rubyfire\tools\bin\vasmm68k_mot.exe -m68000 -Fhunk -linedebug -spaces -phxass -opt-fconst -nowarn=62 -I"../Includes" -I"Includes" -I"Libs/Catfish/Includes" -o "Libs/Catfish/Build/System.o" Libs/Catfish/Src/System.asm Compiling: System.c l:\catfish\amiga\rubyfire\tools\bin\vc.exe +aos68k_win -g -c -I"../../tools/bin/targets/m68k-amigaos/include" -I"../Includes" -I"Includes" -I"Libs/Catfish/Includes" -o "Libs/Catfish/Build/System_c.o" Libs/Catfish/Src/System.c Assembling: main.asm l:\catfish\amiga\rubyfire\tools\bin\vasmm68k_mot.exe -m68000 -Fhunk -linedebug -spaces -phxass -opt-fconst -nowarn=62 -I"../Includes" -I"Includes" -I"Libs/Catfish/Includes" -o "Build/main.o" Src/main.asm Linking: blah.exe l:\catfish\amiga\rubyfire\tools\bin\vlink -bamigahunk -x -Bstatic -Cvbcc -nostdlib -M "Build/main.o" "Libs/Catfish/Build/System.o" "Libs/Catfish/Build/System_c.o" -L"../../tools/bin/targets/m68k-amigaos/lib" -lvc -o blah.exe Files: main.asm: GameCode 0(38), Variables 0(18) hex System.asm: Framework 0(dc), Variables 0(3c) hex Libs\Catfish\Src\System.c: CODE 0(8) hex Section mapping (numbers in hex): ------------------------------ 00000000 GameCode (size 38) 00000000 - 00000038 main.asm(GameCode) ------------------------------ 00000000 Framework (size dc) 00000000 - 000000dc System.asm(Framework) ------------------------------ 00000000 CODE (size 8) 00000000 - 00000008 Libs\Catfish\Src\System.c(CODE) ------------------------------ 00000000 Variables (size 3c) 00000000 - 0000003c System.asm(Variables) ------------------------------ 00000000 Variables (size 18, allocated 0) 00000000 - 00000018 main.asm(Variables) Symbols of GameCode: Startup: local reloc, value 0x0, size 0 Symbols of Framework: SYS_Takeover: global reloc, value 0x0, size 0 _SYS_ReleaseWBMessage: local reloc, value 0x6a, size 0 SYS_DisplayGUIMessage: local reloc, value 0x30, size 0 _SYS_AllocMemory: local reloc, value 0x86, size 0 SYS_Release: global reloc, value 0x2a, size 0 _SYS_GetWBMessage: local reloc, value 0x32, size 0 Symbols of CODE: l1: local reloc, value 0x4, size 0 _SomeFunction: global reloc, value 0x0, size 0 Symbols of Variables: _SYSERROR_UnableAllocChip: local reloc, value 0x0, size 0 _SYSERROR_UnableAllocFast: local reloc, value 0x1e, size 0 Symbols of Variables: SYS_Details: local reloc, value 0x0, size 0 The start of the main.asm is Code:
SECTION GameCode, CODE_F Startup: jsr _SomeFunction Cheers |
12 January 2020, 15:03 | #4 | ||||||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
|
Quote:
Quote:
Quote:
Note, that the linker will not merge sections with different names and/or types (unless specifying the -sc option to merge all code, or -sd to merge all data/bss). This might be important if you want to use PC-relative references between your code parts. Quote:
(Side note: There is never a reason to use code_f instead of code, except you don't want anybody to run your code on a Chip-RAM-only system.) Quote:
Quote:
|
||||||
13 January 2020, 13:57 | #5 | |
Registered User
Join Date: Sep 2019
Location: Essen/Germany
Age: 55
Posts: 463
|
Quote:
If you plan to call C functions from your asm code, you may still need to write a regular "main()" module as your entrypoint and call your asm from there, as the compiler startup does some additional stuff in the background before it calls main, like initializing static variables etc.. |
|
13 January 2020, 18:10 | #6 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
|
Quote:
Initialising the clib, or running constructors, would be the main reason for a startup code. And not even all clib functions would need it. The string functions or ctype could still be used. |
|
14 January 2020, 07:10 | #7 |
Registered User
Join Date: Jan 2020
Location: Launceston
Posts: 3
|
Thanks everyone. Ive sorted my issues, mostly it was a case of red herring where the debugger wasnt stopping on the breakpoint so it looked like it wasnt doing what it was supposed to.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
vasm / vlink undefined symbol | zeGouky | Coders. General | 2 | 02 January 2019 08:49 |
Vasm/Vlink odd issue linking | roondar | Coders. Asm / Hardware | 7 | 10 December 2017 20:19 |
Trying out vlink and vasm | cla | Coders. General | 2 | 30 September 2016 20:30 |
VLINK multiple VASM objects | roondar | Coders. Asm / Hardware | 2 | 24 April 2016 01:03 |
Help linking VASM object code | clenched | Coders. Asm / Hardware | 2 | 24 May 2013 22:32 |
|
|