[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] TCC riscv32 port - Deferring code generation on exter
From: |
Sam Ellicott |
Subject: |
Re: [Tinycc-devel] TCC riscv32 port - Deferring code generation on external symbol |
Date: |
Mon, 18 Apr 2022 22:25:45 -0400 |
Example code is here
```
.global _start
_start:
la gp, _global_pointer
la a0, _bss_start
la a1, _bss_end
bgeu a0, a1, 2f
1: sw zero, (a0)
addi a0, a0, 4
bltu a0, a1, 1b
2: # setup the stack
la sp, _stack_end
call main
```
For example when the `_global_pointer` symbol is encountered what is
the correct behavior? Since the symbol is defined in a separate
compilation unit, I'm assuming some sort of marker needs to be placed
in the .o file to indicate what immediate value goes there at link
time. However, I don't know what that is, or how it is generated.
Similarly for `_bss_start`, `_bss_end`, etc.
Thanks!