svn commit: r349510 - head/contrib/elftoolchain/readelf

Leandro Lupori luporl at FreeBSD.org
Fri Jun 28 16:00:56 UTC 2019


Author: luporl
Date: Fri Jun 28 16:00:55 2019
New Revision: 349510
URL: https://svnweb.freebsd.org/changeset/base/349510

Log:
  [PowerPC64] readelf: print description for 'e_flags' in ELF header (ABI type)
  
  This prints out description text with the meaning of 'Flags' value in PowerPC64.
  
  Example:
  
  $ readelf -h ~/tmp/t1-Flag2
  ELF Header:
  
  Magic:   7f 45 4c 46 02 02 01 09 00 00 00 00 00 00 00 00
  Class:                             ELF64
  Data:                              2's complement, big endian
  Version:                           1 (current)
  OS/ABI:                            FreeBSD
  ABI Version:                       0
  Type:                              EXEC (Executable file)
  Machine:                           PowerPC 64-bit
  Version:                           0x1
  Entry point address:               0x10010000
  Start of program headers:          64 (bytes into file)
  Start of section headers:          209368 (bytes into file)
  Flags:                             0x2, OpenPOWER ELF V2 ABI
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         10
  Size of section headers:           64 (bytes)
  Number of section headers:         34
  Section header string table index: 31
  
  Submitted by:	 alfredo.junior_eldorado.org.br
  Reviewed by:	luporl
  Differential Revision:	https://reviews.freebsd.org/D20782

Modified:
  head/contrib/elftoolchain/readelf/readelf.c

Modified: head/contrib/elftoolchain/readelf/readelf.c
==============================================================================
--- head/contrib/elftoolchain/readelf/readelf.c	Fri Jun 28 15:52:40 2019	(r349509)
+++ head/contrib/elftoolchain/readelf/readelf.c	Fri Jun 28 16:00:55 2019	(r349510)
@@ -2297,8 +2297,15 @@ dump_eflags(struct readelf *re, uint64_t e_flags)
 		}
 		edesc = mips_eflags_desc;
 		break;
-	case EM_PPC:
 	case EM_PPC64:
+		switch (e_flags) {
+		case 0: printf(", Unspecified or Power ELF V1 ABI"); break;
+		case 1: printf(", Power ELF V1 ABI"); break;
+		case 2: printf(", OpenPOWER ELF V2 ABI"); break;
+		default: break;
+		}
+		/* explicit fall through*/
+	case EM_PPC:
 		edesc = powerpc_eflags_desc;
 		break;
 	case EM_RISCV:


More information about the svn-src-head mailing list