Linker imports are not handled correctly for o65 files
Linker imports are not being relocated correctly. In the example, __BSS_RUN__
is replaced with zeros.
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- Byron Lathi mentioned in issue super6502#7 (closed)
mentioned in issue super6502#7 (closed)
- Author Owner
It seems like they are intended to be relocated in the relocation tables, but the relocation table entries are kind of useless.
- Author Owner
.export _init .import __BSS_RUN__ .segment "BSS" bss_addr: .res 1 .segment "STARTUP" _init: lda #<__BSS_RUN__ lda #>__BSS_RUN__ lda #<bss_addr lda #>bss_addr
byron@byron-desktop ~/Projects/cc65_bug $ make mkdir -p lists/./ cc65/bin/cl65 -T -t none -I. --cpu "65C02" -l lists/test.s.list -c test.s -o test.o cc65/bin/cl65 -T -t none -I. --cpu "65C02" -C o65.ld -m test.map -v test.o -o test.o65 Found a BSS! Seg addr: 0 Seg Flags: 60a Seg Start: 8000 Seg Load: 8000 Found a BSS! Seg addr: 0 Seg Flags: 60a Seg Start: 8000 Seg Load: 8000 Opened 'test.o65'... Writing 'STARTUP' In O65 writeexpr OP: 82 Val: 8000 Nearest: 8000 Nearest: 0 Val: 0 Found a BSS! Seg addr: 0 Seg Flags: 60a Seg Start: 8000 Seg Load: 8000 In seg/sec ref reloc type: 24 reloc masked: 20 reloc_low In O65 writeexpr OP: 82 Val: 8000 Nearest: 8000 Nearest: 0 Val: 0 Found a BSS! Seg addr: 0 Seg Flags: 60a Seg Start: 8000 Seg Load: 8000 In seg/sec ref reloc type: 44 reloc masked: 40 reloc_high: 0 In O65 writeexpr OP: 83 Val: 8000 Val: 8000 Found a BSS! Seg addr: 0 Seg Flags: 60a Seg Start: 8000 Seg Load: 8000 In seg/sec ref reloc type: 24 reloc masked: 20 reloc_low In O65 writeexpr OP: 83 Val: 8000 Val: 8000 Found a BSS! Seg addr: 0 Seg Flags: 60a Seg Start: 8000 Seg Load: 8000 In seg/sec ref reloc type: 44 reloc masked: 40 reloc_high: 0 Writing 'CODE' Writing 'BSS' Writing 'ZEROPAGE' cc65/bin/cl65 -T -t none -I. --cpu "65C02" -C bin.ld -m test.map -v test.o -o test.bin Opened 'test.bin'... Dumping 'ZP' Writing 'ZEROPAGE' Dumping 'STACK' Dumping 'KERNEL' Writing 'STARTUP' Writing 'CODE' Writing 'BSS' Dumping 'USER' Dumping 'IO' Dumping 'ROM'
An address which is in the BSS section is given an op of 83, while the __BSS_RUN__ symbol is given an op of 82. Why?
- Byron Lathi assigned to @bslathi19
assigned to @bslathi19
- Author Owner
It's because 0x82 is a symbol and 0x83 is a section.
Collapse replies - Author Owner
__BSS_RUN__
is a symbol, and thebss_addr
is actually a section, which is kinda backwards from what I thought.
- Author Owner
What is CvtMemoryToSegment doing, and why is it setting the value to 0?
Collapse replies - Author Owner
line 286
Edited by Byron Lathi
- Author Owner
Commenting this line out seems to solve the issue, at least in this simple case. I am not sure of the repercussions, but those can be discovered later (tm)
- Byron Lathi closed
closed