This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Debuggin info for unused sections


Hi,
?? While using -gc-sections to remove unused sections, the section is removed but the debug info in not removed.

In, 

a.c:
int main()
{
? Return 0;
}
Int fun ()
{
? Return 0;
}

gcc -g3 -ffunction-sections a.c
readelf -wL a.out 

gives:

Line Number Statements:
? Extended opcode 2: set Address to 0x400448
? Special opcode 6: advance Address by 0 to 0x400448 and Line by 1 to 2
? Special opcode 62: advance Address by 4 to 0x40044c and Line by 1 to 3
? Special opcode 76: advance Address by 5 to 0x400451 and Line by 1 to 4
? Advance PC by 2 to 0x400453
? Extended opcode 1: End of Sequence

? Extended opcode 2: set Address to 0x400453
? Special opcode 11: advance Address by 0 to 0x400453 and Line by 6 to 7
? Special opcode 62: advance Address by 4 to 0x400457 and Line by 1 to 8
? Special opcode 76: advance Address by 5 to 0x40045c and Line by 1 to 9
? Advance PC by 2 to 0x40045e
? Extended opcode 1: End of Sequence


While,
gcc -g3 -ffunction-sections -Wl,-gc-sections a.c
readelf -wL a.out
gives 

Line Number Statements:
? Extended opcode 2: set Address to 0x4003f6
? Special opcode 6: advance Address by 0 to 0x4003f6 and Line by 1 to 2
? Special opcode 62: advance Address by 4 to 0x4003fa and Line by 1 to 3
? Special opcode 76: advance Address by 5 to 0x4003ff and Line by 1 to 4
? Advance PC by 2 to 0x400401
? Extended opcode 1: End of Sequence

? Extended opcode 2: set Address to 0x0
? Special opcode 11: advance Address by 0 to 0x0 and Line by 6 to 7
? Special opcode 62: advance Address by 4 to 0x4 and Line by 1 to 8
? Special opcode 76: advance Address by 5 to 0x9 and Line by 1 to 9
? Advance PC by 2 to 0xb
? Extended opcode 1: End of Sequence


Is this expected? Can we completely remove the debug info for unused section?

Thanks,
Praveen Kaushik


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]