I'm writing a toy OS for my raspberry pi, and I'm using xv6 as a reference.
My code has a compile error, when I tried to load an "entrypgdir" symbol that's defined in another file (which is in C).
_start.S:
#include "mem.h"
.globl entry
entry:
mov r0, #(V2P_NOCAST(entrypgdir))
V2P_NOCAST is a simple macro defined in a .h file as
mem.h:
#define V2P_NOCAST(va) ((va) - KERNBASE)
And the error:
$ arm-none-eabi-gcc -c -o build/_start.o source/_start.S
source/_start.S: Assembler messages:
source/_start.S:17: Error: undefined symbol entrypgdir used as an immediate value
I'm curious since that's how xv6 does it,
movl $(V2P_WO(entrypgdir)), %eax
And it compiles fine,
$ gcc -m32 -c -o entry.o entry.S
Is it something with my toolchain? Or it's not possible in ARM?