Hi,
I have following code which will be built with options
"-ffunction-sections -fdata-sections -Wl,--gc-sections
-Wl,-Map=test.map":
#include <stdlib.h>
static int unusedint=5;
static int usedint=1;
int unused(void) {
return 1;
}
int foo(void) {
return usedint;
}
int main(void) {
if (foo())
exit(0);
else
abort();
}
According to the generated map file, the function named "unused" is
discarded in final .out file.
Discarded input sections
.text.unused 0x00000000 0x10 gcsec-1.o
But when check .debug_info section of .out file, I can still see entry
for this deadstripped function:
<0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
< c> DW_AT_producer : (indirect string, offset: 0xe): GNU C
4.8.0 20120612 (experimental) -fpreprocessed -mthumb -mcpu=cortex-m3
-g2 -ffunction-sections -fdata-sections -fno-inline
............
<1><79>: Abbrev Number: 4 (DW_TAG_subprogram)
<7a> DW_AT_external : 1
<7a> DW_AT_name : (indirect string, offset: 0x8d): unused
<7e> DW_AT_decl_file : 1
<7f> DW_AT_decl_line : 16
<80> DW_AT_prototyped : 1
<80> DW_AT_type : <0x48>
<84> DW_AT_low_pc : 0x0
<88> DW_AT_high_pc : 0x0
<8c> DW_AT_frame_base : 1 byte block: 9c (DW_OP_call_frame_cfa)
<8e> Unknown AT value: 2117: 1
Is this expected behavior? Why not remove this entry? Thanks in
advance for any help.
BR,
Terry