public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PE fake section for C_SECTION syms
@ 2023-03-21 22:41 Alan Modra
  0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2023-03-21 22:41 UTC (permalink / raw)
  To: binutils

It's an odd thing to have objdump -x show a different section table
to objdump -h, but that can happen if swapping in symbols leads to
creating sections.  Setting SEC_LINKER_CREATED stops the display of
these sections, so that you get shown what is in the object file.

	* peXXigen.c (_bfd_XXi_swap_sym_in): Set SEC_LINKER_CREATED on
	fake section created for C_SECTION syms.  Don't zero asection
	fields that are already zero.

diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index d59a97f0d11..42f2d21cee3 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -189,7 +189,8 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1)
 	    }
 	  memcpy (sec_name, name, name_len);
 
-	  flags = SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD;
+	  flags = (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_DATA | SEC_LOAD
+		   | SEC_LINKER_CREATED);
 	  sec = bfd_make_section_anyway_with_flags (abfd, sec_name, flags);
 	  if (sec == NULL)
 	    {
@@ -198,18 +199,7 @@ _bfd_XXi_swap_sym_in (bfd * abfd, void * ext1, void * in1)
 	      return;
 	    }
 
-	  sec->vma = 0;
-	  sec->lma = 0;
-	  sec->size = 0;
-	  sec->filepos = 0;
-	  sec->rel_filepos = 0;
-	  sec->reloc_count = 0;
-	  sec->line_filepos = 0;
-	  sec->lineno_count = 0;
-	  sec->userdata = NULL;
-	  sec->next = NULL;
 	  sec->alignment_power = 2;
-
 	  sec->target_index = unused_section_number;
 
 	  in->n_scnum = unused_section_number;

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-21 22:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-21 22:41 PE fake section for C_SECTION syms Alan Modra

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).