[PATCH v1 04/14] gas/write.c: add missing flag SEC_HAS_CONTENT on object attributes section

Matthieu Longo matthieu.longo@arm.com
Fri Mar 21 17:14:38 GMT 2025


A section with a content should have this flag set. If it is not,
there is a risk that this section be ignored later by the linker.
---
 gas/write.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gas/write.c b/gas/write.c
index c725841d505..476d8e42081 100644
--- a/gas/write.c
+++ b/gas/write.c
@@ -1936,7 +1936,7 @@ create_obj_attrs_section (void)
   segT s = subseg_new (name, 0);
   elf_section_type (s)
     = get_elf_backend_data (stdoutput)->obj_attrs_section_type;
-  bfd_set_section_flags (s, SEC_READONLY | SEC_DATA);
+  bfd_set_section_flags (s, SEC_READONLY | SEC_HAS_CONTENTS | SEC_DATA);
   frag_now_fix ();
   char *p = frag_more (size);
   bfd_elf_set_obj_attr_contents (stdoutput, (bfd_byte *)p, size);
-- 
2.49.0



More information about the Binutils mailing list