https://sourceware.org/bugzilla/show_bug.cgi?id=34024

--- Comment #4 from Austin <zhenhangwang at huawei dot com> ---
(In reply to H.J. Lu from comment #3)
> (In reply to Austin from comment #2)
> > (In reply to H.J. Lu from comment #1)
> > > What is in tmp_main.ver?
> > 
> > Ah, sorry, this was my oversight. 
> > tmp_main.ver:
> > 
> > ```
> > SECTIONS { .rodata : ALIGN(4) { __crc_hello = .; LONG(0x05d25769); } }
> > ```
> 
> Please try
> 
> SECTIONS { .rodata (READONLY) : ALIGN(4) { __crc_hello = .;
> LONG(0x05d25769); } 
> }

Ths.I think it could solve the current case, and I debug the code, I want to
modify it.

diff --git a/ld/ldlang.c b/ld/ldlang.c
index f7760fed69b..2163056ebe4 100644
--- a/ld/ldlang.c
+++ b/ld/ldlang.c
@@ -2408,6 +2408,9 @@ sort_def_symbol (struct bfd_link_hash_entry *hash_entry,
 static void
 init_os (lang_output_section_statement_type *s, flagword flags)
 {
+  if (strcmp (s->name, ".rodata") == 1) {
+    flags |= SEC_READONLY;
+  }
   if (strcmp (s->name, DISCARD_SECTION_NAME) == 0)
     einfo (_("%F%P: illegal use of `%s' section\n"), DISCARD_SECTION_NAME);

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Reply via email to