ENV
fedora 29 x86_64
gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2)
code:
#include <stdio.h>;
int main(int argc, char *argv[]) {
int n;
for (n=0; n<10; n++) {
printf("Print Number: %d\n";, n);
}
return 0;
}
compile:
gcc h.c -o h.g -g
And I also tried -fcf-protection=full
, follow this link.
gcc h.c -o h.bg -fcf-protection=full -g
Problem
When using gdb ./h.g
or gdb ./h.bg
, I got warning: Loadable section ".note.gnu.property" outside of ELF segments
.
the result of readelf
:
[user@localhost myctest]$ readelf --segments h.g | tail -n 14
Section to Segment mapping:
Segment Sections...
00
01 .interp
02 .interp .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt
03 .init .plt .text .fini
04 .rodata .eh_frame_hdr .eh_frame
05 .init_array .fini_array .dynamic .got .got.plt .data .bss
06 .dynamic
07 .note.ABI-tag .note.gnu.build-id
08 .eh_frame_hdr
09
10 .init_array .fini_array .dynamic .got
[user@localhost myctest]$ readelf --segments h.bg | tail -n 15
Section to Segment mapping:
Segment Sections...
00
01 .interp
02 .interp .note.gnu.property .note.ABI-tag .note.gnu.build-id .gnu.hash .dynsym .dynstr .gnu.version .gnu.version_r .rela.dyn .rela.plt
03 .init .plt .plt.sec .text .fini
04 .rodata .eh_frame_hdr .eh_frame
05 .init_array .fini_array .dynamic .got .got.plt .data .bss
06 .dynamic
07 .note.gnu.property
08 .note.ABI-tag .note.gnu.build-id
09 .eh_frame_hdr
10
11 .init_array .fini_array .dynamic .got
We can see that .note.gnu.property
exists in file h.bg, but it still gets warning.
DOC: (warning-loadable-section-my-section-outside-of-elf-segments) does not have solution.
EDIT
I put readelf --all
output to codepad. h.g, h.bg.
I am confused about this. Any clues to remove the warning? Thank you.