![]() |
![]() |
#1 |
Registered User
Join Date: May 2017
Location: AmigaLand
Posts: 459
|
Another Vasm question
Hi,
How do you make this without making Vasm shout "error 39 : illegal relocation" ? add.l #label1-label0,a1 Thanks, |
![]() |
![]() |
#2 |
Registered User
Join Date: May 2017
Location: AmigaLand
Posts: 459
|
Ok, got it. The pb seems to be found in section. If label1 & label0 are not in the same section than the instruction, vasm don't recognize the labels. Why ? I don't know, because it's a relative value.
|
![]() |
![]() |
#3 |
Registered User
Join Date: Dec 2019
Location: Newcastle
Posts: 67
|
This is do to linker relocation, Vasm is unable to calculate the offset between the 2 labels as that is done at link time.
|
![]() |
![]() |
#4 |
Registered User
Join Date: May 2017
Location: AmigaLand
Posts: 459
|
|
![]() |
![]() |
#5 |
Registered User
Join Date: Dec 2019
Location: Newcastle
Posts: 67
|
I think this is an issue with Vasm, are both labels in the same file?
I may be wrong, but I am sure this has been discussed before on this forum somewhere. |
![]() |
![]() |
#6 |
This cat is no more
Join Date: Dec 2004
Location: FRANCE
Age: 52
Posts: 8,386
|
workaround: define a
Code:
diff: dc.l label1-label0 Code:
add.l diff,a1 |
![]() |
![]() |
#7 | |
Registered User
Join Date: May 2017
Location: AmigaLand
Posts: 459
|
Quote:
Yes they are in same include file and same section too. Thanks for the tip. (too bad to waste 4 bytes though). Last edited by LeCaravage; 27 January 2021 at 20:45. |
|
![]() |
![]() |
#8 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,552
|
Quote:
Code:
frank@nerthus cat tst.s code add.l #label1-label0,a1 data label0: dc.b 1,2,3 label1: frank@nerthus vasmm68k_mot tst.s vasm 1.8i (c) in 2002-2020 Volker Barthelmann vasm M68k/CPU32/ColdFire cpu backend 2.3m (c) 2002-2020 Frank Wille vasm motorola syntax module 3.14a (c) 2002-2020 Frank Wille vasm test output module 1.0 (c) 2002 Volker Barthelmann CODE(acrx2): 2 bytes DATA(adrw1): 3 bytes Code:
frank@nerthus cat tst.s xref label1 code label0: add.l #label1-label0,a1 data label1: frank@nerthus vasmm68k_mot -quiet tst.s frank@nerthus more a.out Sections: section CODE (attr=<acrx> align=2): (...) 0: symbol: label0 LAB (0x0) sec=CODE 0: data(6): d3 fc 00 00 00 02 rpc(2,0-31,0xffffffff,0x2,label1 LAB (0x0) EXPORT REF sec=DATA ) There is no such restriction. Please check your code again or provide an example which reproduces the error. Probably one or both of your labels is undefined or both are in different sections. |
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Vasm “so.” directive | Curbie | Coders. General | 9 | 09 April 2020 20:55 |
vasm and comments | xxxxx | Coders. Asm / Hardware | 10 | 03 February 2015 12:59 |
vasm question | marduk_kurios | Coders. Asm / Hardware | 7 | 14 February 2014 20:06 |
vasm fsincos | dalton | Coders. Asm / Hardware | 4 | 03 September 2012 10:35 |
vasm 1.5 RFC | phx | Coders. General | 30 | 11 December 2010 02:08 |
|
|