19 May 2020, 00:53 | #1 |
Registered User
Join Date: Feb 2018
Location: Northumberland, UK
Posts: 272
|
vasm/vlink issue causing Guru 81000005
Evening!
I'm getting a strange crash when exiting my program, which all I can narrow it down to is the order in which I have my object files linked. The files which I'm referring to below are all sprite data files, which contain a section at the bottom like this: Code:
************** SECTION ChipData,DATA_C ************** CNOP 0,8 SpriteData: INCLUDE "data/sprite.background.64x48x4.s" END Code:
$(OBJDIR)/startup.o \ $(OBJDIR)/main.o \ $(OBJDIR)/utility.o \ $(OBJDIR)/macros.o \ $(OBJDIR)/copper.o \ $(OBJDIR)/display.o \ $(OBJDIR)/sprites.o \ $(OBJDIR)/background.o \ $(OBJDIR)/character.o \ $(OBJDIR)/input.o Code:
$(OBJDIR)/startup.o \ $(OBJDIR)/main.o \ $(OBJDIR)/utility.o \ $(OBJDIR)/macros.o \ $(OBJDIR)/copper.o \ $(OBJDIR)/display.o \ $(OBJDIR)/sprites.o \ $(OBJDIR)/background.o \ $(OBJDIR)/input.o Another issue, if I move background.o further up the list: Code:
$(OBJDIR)/startup.o \ $(OBJDIR)/main.o \ $(OBJDIR)/background.o \ $(OBJDIR)/utility.o \ $(OBJDIR)/macros.o \ $(OBJDIR)/copper.o \ $(OBJDIR)/display.o \ $(OBJDIR)/sprites.o \ $(OBJDIR)/input.o If I move background.o below the copper.o object file, which contains my copper list: Code:
$(OBJDIR)/startup.o \ $(OBJDIR)/main.o \ $(OBJDIR)/utility.o \ $(OBJDIR)/macros.o \ $(OBJDIR)/copper.o \ $(OBJDIR)/background.o \ $(OBJDIR)/display.o \ $(OBJDIR)/sprites.o \ $(OBJDIR)/input.o Any ideas? I've been looking at this, and the vlink docs all day and don't understand why the ordering has such an effect on the execution of the code. Thanks. Edit: Here's a link to the executables that are crashing. Everything works absolutely fine, until I exit (LMB): Link Last edited by DanielAllsopp; 19 May 2020 at 01:23. Reason: Added link to files. |
19 May 2020, 02:03 | #2 |
OCS forever!
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
|
It won’t be anything to do with vlink. It will almost certainly be a buffer overrun in your code. When you change the order of linking you are changing which bit of code your buffer overrun is writing. Tricky to find :/
Comment out subroutines until it exits cleanly and then go from there. |
19 May 2020, 10:05 | #3 |
Registered User
Join Date: Sep 2019
Location: Essen/Germany
Age: 55
Posts: 463
|
Are you using 'bsr.s'? I had a similar problem because the offset was to big, when the target was to far away, and got no error or warning, so I thought the code would work and in assembly it usually worked because the code was more compact and the offset worked. When using 'jsr' instead it works.
|
19 May 2020, 11:16 | #4 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
Quote:
|
||
19 May 2020, 11:23 | #5 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Quote:
Code:
frank@miriel cat bsr1.s code bsr.s x rts frank@miriel cat bsr2.s code ds.b 200 xdef x x: rts frank@miriel vasmm68k_mot -quiet -Fhunk bsr1.s -o bsr1.o frank@miriel vasmm68k_mot -quiet -Fhunk bsr2.s -o bsr2.o frank@miriel vlink -bamigahunk bsr1.o bsr2.o Error 28: bsr1.o (CODE+0x1): Relative reference to relocatable symbol x=0xcc + 0xffffffffffffffff (value to write: 0xca) doesn't fit into 8 bits. |
|
19 May 2020, 14:35 | #6 | ||
Registered User
Join Date: Feb 2018
Location: Northumberland, UK
Posts: 272
|
Quote:
It did take some tracking down though! Thanks for the tip Antiriad_UK! Quote:
Code:
*--- save int+dma ---* lea $dff000,a6 bsr.s WaitEOF ;wait out the current frame move.l $1c(a6),-(sp) ;save intena+intreq move.w 2(a6),-(sp) ;and dma move.l $6c(a4),-(sp) ;and also the VB int vector for sport. bsr.s AllOff ;turn off all interrupts+DMA *--- call main ---* movem.l a4-a6,-(sp) bsr Main movem.l (sp)+,a4-a6 *--- restore all ---* Code:
error 2029 in line 50 of "startup.s": branch destination out of range I've fixed it by shuffling some bsr calls around, but it would be nice to know why this causes and issue. I usually use bsr by itself. Are there advantages to using bsr.s? Thanks again for the help by the way. |
||
19 May 2020, 15:16 | #7 |
Lemon. / Core Design
Join Date: Mar 2016
Location: Tier 5
Posts: 1,212
|
|
19 May 2020, 16:17 | #8 |
Registered User
Join Date: Feb 2018
Location: Northumberland, UK
Posts: 272
|
|
19 May 2020, 18:07 | #9 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
|
20 May 2020, 00:37 | #10 |
OCS forever!
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
|
This is a good time for this question. I like having vasm optimize things and I also turn on the option to output the optimisations (-showopt) so that I can learn and then manually change them. But I can't seem to hide the bsr optmizations (message 2054) which I would be happy to let the assembler do without my input. Ideally I always want the assembler to optmize my bsr functions but I don't want 1000 messages about it (for example when I assemble your ptreplay I get loads of bsr optimization messages). Is there a way to show optmizations but also hide output of bsr optimizations?
|
20 May 2020, 11:11 | #11 |
Registered User
Join Date: Sep 2019
Location: Essen/Germany
Age: 55
Posts: 463
|
|
20 May 2020, 17:27 | #12 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
|
20 May 2020, 17:34 | #13 |
OCS forever!
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
|
|
21 May 2020, 10:56 | #14 |
OCS forever!
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
VLINK / VBCC / VASM linking order issue | adrianpbrown | Coders. C/C++ | 6 | 14 January 2020 07:10 |
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 |
|
|