分类: LINUX
2013-08-11 21:18:10
内核中有一个kallsyms的模块,这个模块记录了内核非栈变量的地址,包括变量和函数。第二节主要说一下kallsyms是如何形成的。对于编译系统的介绍为什么要说到kallsyms呢?因为kallsyms涉及到最后链接得到vmlinux。在第一节的图解内核编译系统中,组成vmlinux的五个部分中就有kallsyms.o这个组件。
/usr/local/arm/3.4.1/bin/arm-linux-ld -EL -p --no-undefined -X -o .tmp_vmlinux1
-T arch/arm/kernel/vmlinux.lds
arch/arm/kernel/head.o arch/arm/kernel/init_task.o
init/built-in.o
--start-group
usr/built-in.o
arch/arm/kernel/built-in.o
arch/arm/mm/built-in.o
arch/arm/common/built-in.o
arch/arm/mach-s3c2410/built-in.o
arch/arm/nwfpe/built-in.o
kernel/built-in.o
mm/built-in.o
fs/built-in.o
ipc/built-in.o
security/built-in.o
crypto/built-in.o
lib/lib.a
arch/arm/lib/lib.a
lib/built-in.o
arch/arm/lib/built-in.o
drivers/built-in.o
sound/built-in.o
net/built-in.o
--end-group
/usr/local/arm/3.4.1/bin/arm-linux-nm -n .tmp_vmlinux1 | scripts/kallsyms > .tmp_kallsyms1.S
/usr/local/arm/3.4.1/bin/arm-linux-gcc -Wp,-MD,./..tmp_kallsyms1.o.d -D__ASSEMBLY__ -mapcs-32 -mno-thumb-interwork -D__LINUX_ARM_ARCH__=4 -march=armv4 -mtune=arm9tdmi -msoft-float -nostdinc -isystem /usr/local/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/include -D__KERNEL__ -Iinclude -mlittle-endian -c -o .tmp_kallsyms1.o .tmp_kallsyms1.S
/usr/local/arm/3.4.1/bin/arm-linux-ld -EL -p --no-undefined -X -o .tmp_vmlinux2
-T arch/arm/kernel/vmlinux.lds
arch/arm/kernel/head.o
arch/arm/kernel/init_task.o
init/built-in.o
--start-group
usr/built-in.o
arch/arm/kernel/built-in.o
arch/arm/mm/built-in.o
arch/arm/common/built-in.o
arch/arm/mach-s3c2410/built-in.o
arch/arm/nwfpe/built-in.o
kernel/built-in.o
mm/built-in.o
fs/built-in.o
ipc/built-in.o
security/built-in.o
crypto/built-in.o
lib/lib.a
arch/arm/lib/lib.a
lib/built-in.o
arch/arm/lib/built-in.o
drivers/built-in.o
sound/built-in.o
net/built-in.o
--end-group
.tmp_kallsyms1.o
/usr/local/arm/3.4.1/bin/arm-linux-nm -n .tmp_vmlinux2 | scripts/kallsyms > .tmp_kallsyms2.S
/usr/local/arm/3.4.1/bin/arm-linux-gcc -Wp,-MD,./..tmp_kallsyms2.o.d -D__ASSEMBLY__ -mapcs-32 -mno-thumb-interwork -D__LINUX_ARM_ARCH__=4 -march=armv4 -mtune=arm9tdmi -msoft-float -nostdinc -isystem /usr/local/arm/3.4.1/bin/../lib/gcc/arm-linux/3.4.1/include -D__KERNEL__ -Iinclude -mlittle-endian -c -o .tmp_kallsyms2.o .tmp_kallsyms2.S