Make sure immediate operands #R0 etc are output as absolute values.

Previously it was generated as relocatable.
This commit is contained in:
Olaf Seibert 2021-11-14 23:04:30 +01:00
parent 1c37223977
commit 3c858fe45d
2 changed files with 11 additions and 0 deletions

View File

@ -531,6 +531,10 @@ void mode_extension(
store_global_displaced_offset_word(str, tr, 2, offset, sym->label);
else
store_global_offset_word(str, tr, 2, offset, sym->label);
} else if (sym->section->type == SECTION_REGISTER) {
/* Delayed action: evaluate_rec() excludes SECTION_REGISTER when
* turning symbols into EX_LIT. Do it here now. */
store_word(str, tr, 2, sym->value + offset);
} else {
/* Relative to non-external symbol. */
if (current_pc->section == sym->section) {

View File

@ -10,4 +10,11 @@ start: .word 123 ; 1 word
.word 1,,3 ; 3 words
.word 1,2,3 ; 3 words
; all the values below are not relocatable.
.word r0,wait,r1+1,wait+2,%4,%4+1 ; 0, 1, 2, 3, 4, 5
mov #r0,r0
mov #wait,r0
mov #r1+1,r0
mov #wait+2,r0
mov #%4,r0
mov #%4+1,r0