This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Why doesn't objdump display assembly code mixed with source code?
Hi PRC,
I change the linker script to:
There are two problems with your amended linker script:
1. It does not include all of the DWARF2 debugging sections.
In particular the .debug_loc section is missing which is
needed in order for objdump to be able to display the
source code alongside the disassembly.
2. It allows the dwarf sections to be placed at non-zero
address which corrupts their behaviour.
Please try the attached amended version of your script which should
provide the desired results.
Cheers
Nick
OUTPUT_ARCH(mips)
ENTRY(main)
SECTIONS
{
.text 0x80051000 :
{
*(.text)
*(.rodata*)
}
.data :
{
*(.data)
*(.sdata)
}
.sbss :
{
*(.sbss)
*(.scommon)
}
.bss :
{
*(.bss)
*(COMMON)
}
.pdr :
{
*(.pdr)
}
.mdebug.eabi32 :
{
*(.mdebug.eabi32)
}
.debug_info 0 :
{
*(.debug_info)
}
.debug_line 0 :
{
*(.debug_line)
}
.debug_frame 0 :
{
*(.debug_frame)
}
.debug_pubnames 0 :
{
*(.debug_pubnames)
}
.debug_aranges 0 :
{
*(.debug_aranges)
}
.debug_abbrev 0 :
{
*(.debug_abbrev)
}
.debug_loc 0 :
{
*(.debug_loc)
}
.debug_str 0 :
{
*(.debug_str)
}
}