gc-sections removing required sections of elf

Nagaraju Mekala gnuuser.raj@gmail.com
Thu Feb 20 17:41:00 GMT 2014


Hi All,

   I am using gcc-4.8.3 with binutils-2.23 and newlib-1.19 for a private port.

   I am facing an issue with gc-sections. I have compiled a small
program with -O2, -g, -ffunction-sections,-fdata-sections,
-gc-sections options.

  Below is the dump of the generated elf.

    .....
   2c:	30a30000 	addik	r5, r3, 0
00000030 <_exit>:
  30:	b8000000 	bri	0	// 30 <_exit>
   ......

  When I set the breakpoint at _exit function it is setting at 0x2c
location. when I debugged GDB I found that dwarf line number
information of _exit function is missing.
  This is being deleted by garbage collector. If I remove -gc-sections
flag then it is setting breakpoint at 0x30 location correctly.

  Can anyone please let me know how can we tell the garbage collector
to not to delete .debug information of _exit function.


Thanks,
Nagaraju



More information about the Binutils mailing list