Closed tobiasgrosser closed 2 years ago
Maybe an implicit start of .text sections when no section is active and an instruction is read is a good thing. I believe this is how v1 handled things.
I just tested this on gcc and it seems to work just fine:
anton@whiteout ~/p/riscemu > riscv32-unknown-elf-gcc -nostdlib -mcmodel=medany test.s
/home/anton/projects/riscos/toolchain2/bin/../lib/gcc/riscv32-unknown-elf/11.1.0/../../../../riscv32-unknown-elf/bin/ld: warning: cannot find entry symbol _start; defaulting to 0000000000010054
anton@whiteout ~/p/riscemu > riscv32-unknown-elf-objdump -SFldft a.out
a.out: file format elf32-littleriscv
architecture: riscv:rv32, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x00010054
SYMBOL TABLE:
00010054 l d .text 00000000 .text
00000000 l d .riscv.attributes 00000000 .riscv.attributes
00011860 g *ABS* 00000000 __global_pointer$
00011060 g .text 00000000 __SDATA_BEGIN__
00000000 *UND* 00000000 _start
00011060 g .text 00000000 __BSS_END__
00011060 g .text 00000000 __bss_start
00011060 g .text 00000000 __DATA_BEGIN__
00011060 g .text 00000000 _edata
00011060 g .text 00000000 _end
Disassembly of section .text:
00010054 <__BSS_END__-0x100c> (File Offset: 0x54):
10054: 00100513 li a0,1
10058: 05d00893 li a7,93
1005c: 00000073 ecall
let's add this!
Cool. Thank you!
The following code works:
but
gives me an error:
Should we allow assembly code without an explicit
.text
section line?