diff -Nur elf2flt-453398f917d167f8c308c8f997270c48ae8f8b12.orig/elf2flt.c elf2flt-453398f917d167f8c308c8f997270c48ae8f8b12/elf2flt.c --- elf2flt-453398f917d167f8c308c8f997270c48ae8f8b12.orig/elf2flt.c 2021-02-08 14:02:15.000000000 +0100 +++ elf2flt-453398f917d167f8c308c8f997270c48ae8f8b12/elf2flt.c 2021-04-09 20:40:19.386179197 +0200 @@ -424,7 +424,8 @@ */ if ((!pic_with_got || ALWAYS_RELOC_TEXT) && ((a->flags & SEC_CODE) || - ((a->flags & (SEC_DATA | SEC_READONLY)) == (SEC_DATA | SEC_READONLY)))) + ((a->flags & (SEC_DATA | SEC_READONLY | SEC_RELOC)) == + (SEC_DATA | SEC_READONLY | SEC_RELOC)))) sectionp = text + (a->vma - text_vma); else if (a->flags & SEC_DATA) sectionp = data + (a->vma - data_vma); @@ -1861,7 +1862,9 @@ bfd_size_type sec_size; bfd_vma sec_vma; - if (s->flags & SEC_CODE) { + if ((s->flags & SEC_CODE) || + ((s->flags & (SEC_DATA | SEC_READONLY | SEC_RELOC)) == + (SEC_DATA | SEC_READONLY | SEC_RELOC))) { vma = &text_vma; len = &text_len; } else if (s->flags & SEC_DATA) { @@ -1896,7 +1899,9 @@ /* Read in all text sections. */ for (s = abs_bfd->sections; s != NULL; s = s->next) - if (s->flags & SEC_CODE) + if ((s->flags & SEC_CODE) || + ((s->flags & (SEC_DATA | SEC_READONLY | SEC_RELOC)) == + (SEC_DATA | SEC_READONLY | SEC_RELOC))) if (!bfd_get_section_contents(abs_bfd, s, text + (s->vma - text_vma), 0, bfd_section_size(abs_bfd, s))) @@ -1922,7 +1927,9 @@ /* Read in all data sections. */ for (s = abs_bfd->sections; s != NULL; s = s->next) - if (s->flags & SEC_DATA) + if ((s->flags & SEC_DATA) && + ((s->flags & (SEC_READONLY | SEC_RELOC)) != + (SEC_READONLY | SEC_RELOC))) if (!bfd_get_section_contents(abs_bfd, s, data + (s->vma - data_vma), 0, bfd_section_size(abs_bfd, s)))