diff options
| author | Mitchell Horne <[email protected]> | 2023-08-06 10:45:36 +0530 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2023-08-06 11:06:02 +0530 |
| commit | 94197a8c49751eabe73ff2849fce183ac8ead3fd (patch) | |
| tree | 52e4e7de1ac5705cb4a0a49680c5c26bd8dcda49 | |
| parent | f46a5643bc4a524975261b694814bf5d14bc2d71 (diff) | |
fw_base.S: Fix assembler error with clang 16+
Attempting to build OpenSBI with clang 16 and the following command:
$ make LLVM=1 PLATFORM=generic
Results in the following error:
AS platform/generic/firmware/fw_dynamic.o
/tmp/fw_dynamic-d000a6.s:429:9: error: symbol '_fw_start' can not be undefined in a subtraction expression
.dword _fw_rw_start - _fw_start
Work around this issue by eliminating the __fw_rw_offset variable and
performing the offset calculation at run-time instead. This takes
advantage of the fact that the a4 register contains the value of
_fw_start.
Signed-off-by: Mitchell Horne <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
| -rw-r--r-- | firmware/fw_base.S | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/firmware/fw_base.S b/firmware/fw_base.S index b9474239..ca34b4cc 100644 --- a/firmware/fw_base.S +++ b/firmware/fw_base.S @@ -309,8 +309,8 @@ _scratch_init: REG_S a5, SBI_SCRATCH_FW_SIZE_OFFSET(tp) /* Store R/W section's offset in scratch space */ - lla a4, __fw_rw_offset - REG_L a5, 0(a4) + lla a5, _fw_rw_start + sub a5, a5, a4 REG_S a5, SBI_SCRATCH_FW_RW_OFFSET(tp) /* Store fw_heap_offset and fw_heap_size in scratch space */ @@ -536,8 +536,6 @@ _link_start: RISCV_PTR FW_TEXT_START _link_end: RISCV_PTR _fw_reloc_end -__fw_rw_offset: - RISCV_PTR _fw_rw_start - _fw_start .section .entry, "ax", %progbits .align 3 |
