[7/9] objdump: Support for SEC_ELF_OCTETS

Message ID 20191116232130.14278-8-ceggers@gmx.de
State Superseded
Headers show
Series
  • ELF support for targets with octets_per_byte>1
Related show

Commit Message

Christian Eggers Nov. 16, 2019, 11:21 p.m.
* objdump.c (dump_section): Use
	bfd_octets_per_byte_section() instead of bfd_octets_per_byte().
	(dump_section_header): Likewise. Show SEC_ELF_OCTETS flag if set.

Signed-off-by: Christian Eggers <ceggers@gmx.de>

---
 binutils/objdump.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

--
2.16.4

Patch

diff --git a/binutils/objdump.c b/binutils/objdump.c
index 1be3b23235..8cab4626b9 100644
--- a/binutils/objdump.c
+++ b/binutils/objdump.c
@@ -532,7 +532,7 @@  static void
 dump_section_header (bfd *abfd, asection *section, void *data)
 {
   char *comma = "";
-  unsigned int opb = bfd_octets_per_byte (abfd);
+  unsigned int opb = bfd_section_octets_per_byte (section);
   int longest_section_name = *((int *) data);

   /* Ignore linker created section.  See elfNN_ia64_object_p in
@@ -584,7 +584,11 @@  dump_section_header (bfd *abfd, asection *section, void *data)
       PF (SEC_COFF_NOREAD, "NOREAD");
     }
   else if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)
-    PF (SEC_ELF_PURECODE, "PURECODE");
+    {
+      /* Hide OCTETS flags for now (could break testsuite) */
+      PF (SEC_ELF_OCTETS, "OCTETS");
+      PF (SEC_ELF_PURECODE, "PURECODE");
+    }
   PF (SEC_THREAD_LOCAL, "THREAD_LOCAL");
   PF (SEC_GROUP, "GROUP");
   if (bfd_get_arch (abfd) == bfd_arch_mep)
@@ -3459,7 +3463,7 @@  dump_section (bfd *abfd, asection *section, void *dummy ATTRIBUTE_UNUSED)
   bfd_vma addr_offset;
   bfd_vma start_offset;
   bfd_vma stop_offset;
-  unsigned int opb = bfd_octets_per_byte (abfd);
+  unsigned int opb = bfd_section_octets_per_byte (section);
   /* Bytes per line.  */
   const int onaline = 16;
   char buf[64];