Description of problem: I have built the kernel with debug info, when I: $ objdump -S -j .text vmlinux I didn't see source listing mixed with instructions. I tried objdump from a self built binutils-2.29.1, there is no such problem. Version-Release number of selected component (if applicable): binutils-2.27-24.fc26.x86_64 How reproducible: Always Steps to Reproduce: 1. build kernel with debug info 2. objdump with -S to disassemble vmlinux with source 3. Actual results: no source code listed with instruction Expected results: source code listed with instruction Additional info:
Hi Aaron, Never having built a kernel, with or without debugging, please can you tell how to do this ? Alternatively, does it have to be the kernel that you disassemble ? Is the same problem present if you try to disassemble an ordinary program, eg hello world ? Cheers Nick
Good point Nick, we probably do not need the trouble of building the kernel. Take the below code as an example: static int f(int a) { return a*a; } int main(void) { return f(5); } $ cc -g -o hello hello.c With objdump shipped with Fedora 26: $ objdump -S -j .text hello ... ... 0000000000400487 <f>: static int f(int a) { 400487: 55 push %rbp 400488: 48 89 e5 mov %rsp,%rbp 40048b: 89 7d fc mov %edi,-0x4(%rbp) return a*a; 40048e: 8b 45 fc mov -0x4(%rbp),%eax 400491: 0f af 45 fc imul -0x4(%rbp),%eax } 400495: 5d pop %rbp 400496: c3 retq 0000000000400497 <main>: int main(void) { 400497: 55 push %rbp 400498: 48 89 e5 mov %rsp,%rbp 40049b: bf 05 00 00 00 mov $0x5,%edi 4004a0: e8 e2 ff ff ff callq 400487 <f> 4004a5: 5d pop %rbp 4004a6: c3 retq 4004a7: 66 0f 1f 84 00 00 00 nopw 0x0(%rax,%rax,1) 4004ae: 00 00 00000000004004b0 <__libc_csu_init>: 4004b0: 41 57 push %r15 4004b2: 41 56 push %r14 ... ... Note the source that calls to f(5) is missing in main. As a comparison, with objdump of binutils-2.29.1: ... ... 0000000000400487 <f>: static int f(int a) { 400487: 55 push %rbp 400488: 48 89 e5 mov %rsp,%rbp 40048b: 89 7d fc mov %edi,-0x4(%rbp) return a*a; 40048e: 8b 45 fc mov -0x4(%rbp),%eax 400491: 0f af 45 fc imul -0x4(%rbp),%eax } 400495: 5d pop %rbp 400496: c3 retq 0000000000400497 <main>: int main(void) { 400497: 55 push %rbp 400498: 48 89 e5 mov %rsp,%rbp return f(5); 40049b: bf 05 00 00 00 mov $0x5,%edi 4004a0: e8 e2 ff ff ff callq 400487 <f> } 4004a5: 5d pop %rbp 4004a6: c3 retq 4004a7: 66 0f 1f 84 00 00 00 nopw 0x0(%rax,%rax,1) 4004ae: 00 00 00000000004004b0 <__libc_csu_init>: 4004b0: 41 57 push %r15 4004b2: 41 56 push %r14 ... ... Note there is the 'return f(5);' listed in the disassembly of main. I'm not entirely sure if this is the same problem as the kernel built since the problem here is less severe in that it at least showed some source for function f(), only missed in main(). While in the disassembly of the kernel's vmlinux image, there are a lot of functions missing source listing entirely.
BTW, objdump from Fedora 25's binutils-2.26.1-1.fc25.x86_64 shows similar output as binutils-2.29.1.
Hi Aaron, Ah this old banana. Yes, I remember this problem now. Fortunately there is a fix. I have imported the patch into the F26 binutils and if you try out binutils-2.27-28.fc26 you should find that it works. Cheers Nick
Works for me, thanks!
It's been a while, I wonder when will this be pushed to update?
binutils-2.27-28.fc26 has been submitted as an update to Fedora 26. https://bodhi.fedoraproject.org/updates/FEDORA-2017-d1f8de129b
binutils-2.27-28.fc26 has been pushed to the Fedora 26 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2017-d1f8de129b
binutils-2.27-28.fc26 has been pushed to the Fedora 26 stable repository. If problems still persist, please make note of it in this bug report.