+static int getSectionKind_ELF( Elf_Shdr *hdr, int *is_bss )
+{
+ *is_bss = FALSE;
+
+ if (hdr->sh_type == SHT_PROGBITS
+ && (hdr->sh_flags & SHF_ALLOC) && (hdr->sh_flags & SHF_EXECINSTR)) {
+ /* .text-style section */
+ return SECTIONKIND_CODE_OR_RODATA;
+ }
+
+ if (hdr->sh_type == SHT_PROGBITS
+ && (hdr->sh_flags & SHF_ALLOC) && (hdr->sh_flags & SHF_WRITE)) {
+ /* .data-style section */
+ return SECTIONKIND_RWDATA;
+ }
+
+ if (hdr->sh_type == SHT_PROGBITS
+ && (hdr->sh_flags & SHF_ALLOC) && !(hdr->sh_flags & SHF_WRITE)) {
+ /* .rodata-style section */
+ return SECTIONKIND_CODE_OR_RODATA;
+ }
+
+ if (hdr->sh_type == SHT_NOBITS
+ && (hdr->sh_flags & SHF_ALLOC) && (hdr->sh_flags & SHF_WRITE)) {
+ /* .bss-style section */
+ *is_bss = TRUE;
+ return SECTIONKIND_RWDATA;
+ }
+
+ return SECTIONKIND_OTHER;
+}
+