[PATCH v2 08/28] gas/write.c: add missing flag SEC_HAS_CONTENT on object attributes section

Matthieu Longo matthieu.longo@arm.com
Fri May 2 10:32:40 GMT 2025


A section with a content should have this flag set. bfd_set_section_contents,
which is used inside _bfd_elf_write_section_build_attributes, will ignore the
content of the section if the flag SEC_HAS_CONTENT is not set.
---
 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