diff --git a/Makefile b/Makefile index d80bada5..437da0a7 100644 --- a/Makefile +++ b/Makefile @@ -108,8 +108,7 @@ kernel/sys/version.o: ${KERNEL_SOURCES} kernel/symbols.o: ${KERNEL_ASMOBJS} ${KERNEL_OBJS} util/gensym.krk -rm -f kernel/symbols.o - ${CC} -T kernel/arch/${ARCH}/link.ld ${KERNEL_CFLAGS} -o misaka-kernel.64 ${KERNEL_ASMOBJS} ${KERNEL_OBJS} - ${NM} misaka-kernel.64 -g | kuroko util/gensym.krk > kernel/symbols.S + ${NM} misaka-kernel.64 -g -f p ${KERNEL_ASMOBJS} ${KERNEL_OBJS} | sort | kuroko util/gensym.krk > kernel/symbols.S ${CC} -c kernel/symbols.S -o $@ kernel/%.o: kernel/%.S diff --git a/util/gensym.krk b/util/gensym.krk index 64ac73c3..5b6b7c84 100755 --- a/util/gensym.krk +++ b/util/gensym.krk @@ -15,7 +15,9 @@ def entry(sym): print(f'.asciz "{sym}"') let ignore = ['abs','kernel_symbols_start','kernel_symbols_end'] -let lines = [x.strip().split(' ')[2] for x in fileio.stdin.readlines() if x not in ignore] +let source = [x.strip() for x in fileio.stdin.readlines()] +let symbols = [x.split()[0] for x in source if not x.endswith(':')] +let lines = [x for x in symbols if x not in ignore] print('.section .symbols') print()