Make the .rsrc section read only.
authorNick Clifton <nickc@redhat.com>
Mon, 17 Apr 2023 16:19:21 +0000 (17:19 +0100)
committerNick Clifton <nickc@redhat.com>
Mon, 17 Apr 2023 16:19:21 +0000 (17:19 +0100)
  PR 30142
  * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Do not force the .rsrc section to be writeable.
  * rescoff.c (write_coff_file): Add the SEC_READONLY flag to the .rsrc section.

bfd/ChangeLog
bfd/peXXigen.c
binutils/ChangeLog
binutils/rescoff.c

index d9fe0d31a8dc3f8edcd3ad5d7c70c94b2a78f2ea..0d2d9cf2fff658de0baa37c4b03fc7443c640afd 100644 (file)
@@ -1,3 +1,9 @@
+2023-04-17  Nick Clifton  <nickc@redhat.com>
+
+       PR 30142
+       * peXXigen.c (_bfd_XXi_swap_scnhdr_out): Do not force the .rsrc
+       section to be writeable.
+
 2023-03-30  Nick Clifton  <nickc@redhat.com>
 
        PR 30285
index d240e018a391792e4f94db6636975f117a337e72..da53f349dd03792978e15a99393f62b9874d806e 100644 (file)
@@ -999,7 +999,7 @@ _bfd_XXi_swap_scnhdr_out (bfd * abfd, void * in, void * out)
        { ".pdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA },
        { ".rdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA },
        { ".reloc", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_DISCARDABLE },
-       { ".rsrc",  IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE },
+       { ".rsrc",  IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA },
        { ".text" , IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE },
        { ".tls",   IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE },
        { ".xdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA },
index 3b6f045e78ac17149d897960aaa693039ef8d5e3..f705b6c4622226adfb17ab5fdb34531540e722d0 100644 (file)
@@ -1,3 +1,9 @@
+2023-04-17  Nick Clifton  <nickc@redhat.com>
+
+       PR 30142
+       * rescoff.c (write_coff_file): Add the SEC_READONLY flag to the
+       .rsrc section. 
+
 2023-04-11  Nick Clifton  <nickc@redhat.com>
 
        PR 30327
index 40a8f452a1fc57150d58e5d69ef347b4e12b72fb..5a99a284c1401b5e00aaecfb04cf25051956f5b6 100644 (file)
@@ -477,7 +477,7 @@ write_coff_file (const char *filename, const char *target,
 
   sec = bfd_make_section_with_flags (abfd, ".rsrc",
                                     (SEC_HAS_CONTENTS | SEC_ALLOC
-                                     | SEC_LOAD | SEC_DATA));
+                                     | SEC_LOAD | SEC_DATA | SEC_READONLY));
   if (sec == NULL)
     bfd_fatal ("bfd_make_section");