start_kernel是内核启动时比较重要的一个函数,然而我发现一个问题,我编译出来的目标文件中的汇编代码与C源码并不完全对应,这是怎么一回事呢?

asmlinkage void __init start_kernel(void)
{
char * command_line;
extern const struct kernel_param __start___param[], __stop___param[]; /*
* Need to run as early as possible, to initialize the
* lockdep hash:
*/
lockdep_init();
smp_setup_processor_id();
debug_objects_early_init(); /*
* Set up the the initial canary ASAP:
*/
boot_init_stack_canary(); cgroup_init_early(); local_irq_disable();
early_boot_irqs_disabled = true;
/*
 * Interrupts are still disabled. Do necessary setups, then
 * enable them
 */
        boot_cpu_init();
        page_address_init();
        pr_notice("%s", linux_banner);
        setup_arch(&command_line);
        mm_init_owner(&init_mm, &init_task);
        mm_init_cpumask(&init_mm);
        setup_command_line(command_line);
        setup_nr_cpu_ids();
        setup_per_cpu_areas();
        smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
objdump -d main.o
00000337 <start_kernel>:
337: 55 push %ebp
338: 89 e5 mov %esp,%ebp
33a: 53 push %ebx
33b: 83 ec 14 sub $0x14,%esp
33e: e8 fc ff ff ff call 33f <start_kernel+0x8>
343: e8 fc ff ff ff call 344 <start_kernel+0xd>
348: ff 15 08 00 00 00 call *0x8
34e: 64 8b 1d 00 00 00 00 mov %fs:0x0,%ebx
355: ba 01 00 00 00 mov $0x1,%edx
35a: 89 d8 mov %ebx,%eax
35c: c6 05 00 00 00 00 01 movb $0x1,0x0
363: e8 fc ff ff ff call 364 <start_kernel+0x2d>
368: 89 d8 mov %ebx,%eax
36a: ba 01 00 00 00 mov $0x1,%edx
36f: e8 fc ff ff ff call 370 <start_kernel+0x39>
374: 89 d8 mov %ebx,%eax
376: ba 01 00 00 00 mov $0x1,%edx
37b: e8 fc ff ff ff call 37c <start_kernel+0x45>
380: ba 01 00 00 00 mov $0x1,%edx
385: 89 d8 mov %ebx,%eax
387: e8 fc ff ff ff call 388 <start_kernel+0x51>
38c: e8 fc ff ff ff call 38d <start_kernel+0x56>
391: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
objdump -r main.o
00000309 R_386_32          boot_command_line
0000030e R_386_32 .init.data
00000313 R_386_PC32 strlcpy
00000318 R_386_32 .init.data
0000031d R_386_PC32 parse_early_options
00000324 R_386_32 .init.data
0000033f R_386_PC32 smp_setup_processor_id
00000344 R_386_PC32 cgroup_init_early
0000034a R_386_32 pv_irq_ops
00000351 R_386_32 cpu_number
0000035e R_386_32 early_boot_irqs_disabled
00000364 R_386_PC32 set_cpu_online
00000370 R_386_PC32 set_cpu_active
0000037c R_386_PC32 set_cpu_present
00000388 R_386_PC32 set_cpu_possible
0000038d R_386_PC32 page_address_init
00000395 R_386_32 linux_banner
0000039c R_386_32 .rodata.str1.1
000003a1 R_386_PC32 printk
000003a9 R_386_PC32 setup_arch
000003ae R_386_32 init_task
000003b3 R_386_32 init_mm
000003b8 R_386_PC32 mm_init_owner
000003bd R_386_32 boot_command_line

那么,lockdep_init函数哪里去了呢,start_kernel究竟有没有调用到它呢。

首先可以肯定的是,lockdep_init没有被内核导出,因为在System.map中找不到它。

然后,在重定位信息中也找不到lockdep_init。

lockdep_init是在哪个文件中定义的?

kernel/locking/lockdep.c

但是在kernel/locking目录下并没有生成lockdep.o,这又是为什么?

void lockdep_init(void)
{
int i; /*
* Some architectures have their own start_kernel()
* code which calls lockdep_init(), while we also
* call lockdep_init() from the start_kernel() itself,
* and we want to initialize the hashes only once:
*/
if (lockdep_initialized)
return; for (i = 0; i < CLASSHASH_SIZE; i++)
INIT_LIST_HEAD(classhash_table + i); for (i = 0; i < CHAINHASH_SIZE; i++)
INIT_LIST_HEAD(chainhash_table + i); lockdep_initialized = 1;
}

Linux源码与编译出的目标文件汇编代码的一致性问题的更多相关文章

  1. Android源码中编译出指定jar包

    今天想把android源码/vendor/letv/frameworks/base/java下的源码编译成 framework-letv.jar供乐乐语音客户端使用,编译完后,发现jar包文件虽然生成 ...

  2. linux 源码编译(转)

    源代码的用处无非是以下两点;1、软件根据用户的需要加以定制;2、二次开发;注:要根据软件的许可证书约定为准,开发者许可二次开发才行;1、源码包的打包格式;源代码一般以file.tar.gz file. ...

  3. Linux 源码编译Python 3.6

    Linux 源码编译Python 3.6 1.操作系统以及版本显示 # uname -sr Linux 3.10.0-514.el7.x86_64 # uname -sr Linux 3.10.0-5 ...

  4. Linux中源码安装编译Vim

    Linux中源码安装编译Vim Linux下学习工作少不了编辑器,Vim能使你的工作效率成倍的提高.在Ubuntu上安装vim使用命令直接安装很简单.但有时还是需要自己手动编译安装.例如: vim中的 ...

  5. 从谷歌官网下载android 6.0源码、编译并刷入nexus 6p手机

    版权声明:本文为博主原创文章,未经博主允许不得转载. https://blog.csdn.net/fuchaosz/article/details/52473660 1 前言 经过一周的奋战,终于从谷 ...

  6. 【跟我一起读 linux 源码 01】boot

    计算机启动流程在我的上一个学习计划<自制操作系统>系列中,已经从完全不知道,过渡到了现在的了如指掌了,虽然有些夸张,但整个大体流程已经像过电影一样在我脑海里了,所以在看 linux 源码的 ...

  7. 【Android 系统开发】CyanogenMod 13.0 源码下载 编译 ROM 制作 ( 手机平台 : 小米4 | 编译平台 : Ubuntu 14.04 LTS 虚拟机)

                 分类: Android 系统开发(5)                                              作者同类文章X 版权声明:本文为博主原创文章 ...

  8. CentOS 7.2使用源码包编译安装MySQL 5.7.22及一些操作

    CentOS 7.2使用源码包编译安装MySQL 5.7.22及一些操作 2018年07月05日 00:28:38 String峰峰 阅读数:2614   使用yum安装的MySQL一般版本比较旧,但 ...

  9. php源码的编译

    本片文章主要介绍windows下的php源码的编译. 1.1 编译环境 软件 环境 操作系统 Windows 7 专业版 32bit Visual studio 2012 专业版 PHP 5.5.2. ...

随机推荐

  1. .net报错大全

    1.未能加载文件或程序集“Newtonsoft.Json, Version=4.5.0.0"[已解决] 解决方案:https://blog.csdn.net/mzl87/article/de ...

  2. 线程组,action to be taken after a sampler error

    continue:继续运行后面的请求 start next  thread loop:后面的请求不执行,重新循环执行 stop thread:停止所有线程(等待正在执行的线程执行完后,失败的请求后面的 ...

  3. scp指定端口 从远程机器复制目录到本机器目录

    scp -P 22622 -r root@192.168.70.63:/root/iNmon ./ -P port  注意是大写的P, port是指定数据传输用到的端口 root@192.168.70 ...

  4. js中继承的实现,原型链的知识点归纳,借用构造函数,组合继承(伪经典继承)

    博客搬迁,给你带来的不便,敬请谅解! http://www.suanliutudousi.com/2017/10/31/js%e4%b8%ad%e7%bb%a7%e6%89%bf%e7%9a%84%e ...

  5. jsp页面通过ajax取值/展示数据及分页显示

    jsp页面通过ajax从后台获取数据,在页面展示,并实现分页效果代码: [JavaScript部分代码] 1 <script> function getComposition(pageno ...

  6. oracle锁表和解锁

    1.查看锁表清空 select * from v$session t1, v$locked_object t2 where t1.sid = t2.SESSION_ID; alter system k ...

  7. windows xp .net framework 4.0 HttpWebRequest 报The underlying connection was closed,基础连接已关闭

    windows xp .net framework 4.0 HttpWebRequest 报The underlying connection was closed,基础连接已关闭,错误的解决方法 在 ...

  8. Ti 949 配置 948 i2c

    如果不想用 远端 slave,只访问948   选 i2c pass through all =1  :i2c pass through =0/1 0x0c 0x17 0x9e 如果想用远端  sla ...

  9. 小米手机 - Charles无法安装证书 因为无法读取证书

    1.不要使用小米原装的浏览器安装证书 2.使用第三方浏览器安装,如我使用的是UC浏览器 3.使用第三方浏览器安装的证书格式是".pem"格式问卷 4.将这个文件放入小米的downl ...

  10. ICPC2008哈尔滨-E-Gauss Elimination

    题目描述 Li Zhixiang have already been in “Friendship” ocean-going freighter for three months. The excit ...