[PATCH 11/17] bfd / PE/COFF / sh: permit SEC_READONLY
Jan Beulich
jbeulich@suse.com
Mon Aug 4 09:22:50 GMT 2025
Without this, even the default .text section would end up with the
IMAGE_SCN_MEM_WRITE flag, which is clearly wrong. (Afaict the flag,
oddly enough, doesn't affect the final linked binary, so there likely
are more anomalies.)
This is just so the target won't need excluding in a forthcoming new
testcase, which uses the .rva directive.
--- a/bfd/coff-sh.c
+++ b/bfd/coff-sh.c
@@ -3023,7 +3023,8 @@ CREATE_BIG_COFF_TARGET_VEC (sh_coff_vec,
#ifdef COFF_WITH_PE
CREATE_LITTLE_COFF_TARGET_VEC (TARGET_SYM, TARGET_SHL_NAME, BFD_IS_RELAXABLE,
- SEC_CODE | SEC_DATA, '_', NULL, COFF_SWAP_TABLE);
+ SEC_CODE | SEC_DATA | SEC_READONLY, '_', NULL,
+ COFF_SWAP_TABLE);
#else
CREATE_LITTLE_COFF_TARGET_VEC (TARGET_SYM, TARGET_SHL_NAME, BFD_IS_RELAXABLE,
0, '_', NULL, COFF_SWAP_TABLE)
More information about the Binutils
mailing list