"objdump -d -l -j .text" may give wrong function name when __attribute__((section)) is used: [hjl@gnu-13 objdump]$ cat x.c static void bar () { } __attribute__((section(".init.text"), noinline)) static void foo () { } [hjl@gnu-13 objdump]$ make gcc -g -c -o x.o x.c objdump -d -r -l -j .text x.o x.o: file format elf64-x86-64 Disassembly of section .text: 0000000000000000 <bar>: foo(): /export/home/hjl/bugs/binutils/objdump/x.c:2 0: 55 push %rbp 1: 48 89 e5 mov %rsp,%rbp 4: c9 leaveq 5: c3 retq [hjl@gnu-13 objdump]$
A patch is posted at http://sourceware.org/ml/binutils/2006-02/msg00169.html
The posted patch almost works. Instead of returning the wrong line number info, it now returns no info much of the time. :( BTW an easier test is to do 'objdump -d -S mm/vmscan.o' and see if the source listing is OK.
I think it may be a compiler bug. Please upload your mm/vmscan.o if "objdump -d -S" doesn't work.
The gcc bug is http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26364
This patch http://sourceware.org/ml/binutils/2006-02/msg00295.html should work much better.
Fixed with this patch (and verified): 2006-03-05 H.J. Lu <hongjiu.lu@intel.com> Alan Modra <amodra@bigpond.net.au> PR binutils/2338 * dwarf2.c (loadable_section): New struct. (dwarf2_debug): Add loadable_section_count and loadable_sections. (new_line_sorts_after): New. (add_line_info): Use new_line_sorts_after to compare line addresses. (check_function_name): Removed. (unset_sections): New. (place_sections): New. (_bfd_dwarf2_find_nearest_line): Updated. Call place_sections and unset_sections on relocatable files. (_bfd_dwarf2_find_line): Likewise.