In Clang or LLVM, how to correctly declare an external variable that is case sensitive to a processor? For example, I would like to express the following declarations (as in https://github.com/mit-pdos/xv6-public/blob/master/proc.h#L27 ):
extern struct cpu *cpu asm("%gs:0");
It seems that the code above is compiled but not related as expected. I port xv6 to Rust, and as a step I port it to Clang 3.8.0 (instead of GCC). But during build, the linker issued the following error message:
ld -m elf_i386 -T kernel.ld -o kernel entry.o bio.o console.o exec.o file.o fs.o ide.o ioapic.o kalloc.o kbd.o lapic.o log.o main.o mp.o picirq.o pipe.o proc.o sleeplock.o spinlock.o string.o swtch.o syscall.o sysfile.o sysproc.o timer.o trapasm.o trap.o uart.o vectors.o vm.o -b binary initcode entryother console.o: In function `panic': .../console.c:114: undefined reference to `%gs:0'
source share