From: Nick Clifton <nickc@sourceware.org>
To: bfd-cvs@sourceware.org
Subject: [binutils-gdb] Make the .rsrc section read only.
Date: Mon, 17 Apr 2023 16:20:07 +0000 (GMT) [thread overview]
Message-ID: <20230417162007.2CA7B3858C53@sourceware.org> (raw)
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c53c6186c8d69586a71a7f8284a9ed7fa8cb207f
commit c53c6186c8d69586a71a7f8284a9ed7fa8cb207f
Author: Nick Clifton <nickc@redhat.com>
Date: Mon Apr 17 17:19:21 2023 +0100
Make the .rsrc section read only.
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.
Diff:
---
bfd/ChangeLog | 6 ++++++
bfd/peXXigen.c | 2 +-
binutils/ChangeLog | 6 ++++++
binutils/rescoff.c | 2 +-
4 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index d9fe0d31a8d..0d2d9cf2fff 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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
diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index d240e018a39..da53f349dd0 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -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 },
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 3b6f045e78a..f705b6c4622 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -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
diff --git a/binutils/rescoff.c b/binutils/rescoff.c
index 40a8f452a1f..5a99a284c14 100644
--- a/binutils/rescoff.c
+++ b/binutils/rescoff.c
@@ -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");
reply other threads:[~2023-04-17 16:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230417162007.2CA7B3858C53@sourceware.org \
--to=nickc@sourceware.org \
--cc=bfd-cvs@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).