Blame SOURCES/elfutils-0.176-dwelf_elf_e_machine_string.patch

c0e8f3
From cd2a24f2b66ad51294fad0b08a4d037b2d966d21 Mon Sep 17 00:00:00 2001
c0e8f3
From: Mark Wielaard <mark@klomp.org>
c0e8f3
Date: Tue, 6 Aug 2019 18:39:46 +0200
c0e8f3
Subject: [PATCH] dwelf_elf_e_machine_string backport for 0.176 - eu-readelf
c0e8f3
 only.
c0e8f3
c0e8f3
---
c0e8f3
 libdwelf/dwelf_elf_e_machine_string.c   | 404 ++++++++++++++++++++++++
c0e8f3
 src/Makefile.am                         |   2 +
c0e8f3
 src/readelf.c                           |   9 +-
c0e8f3
 tests/Makefile.am                       |  11 +-
c0e8f3
 tests/dwelf_elf_e_machine_string_test.c |  66 ++++
c0e8f3
 tests/run-dwelf_elf_e_machine_string.sh |  31 ++
c0e8f3
 6 files changed, 519 insertions(+), 4 deletions(-)
c0e8f3
 create mode 100644 libdwelf/dwelf_elf_e_machine_string.c
c0e8f3
 create mode 100644 tests/dwelf_elf_e_machine_string_test.c
c0e8f3
 create mode 100755 tests/run-dwelf_elf_e_machine_string.sh
c0e8f3
c0e8f3
diff --git a/libdwelf/dwelf_elf_e_machine_string.c b/libdwelf/dwelf_elf_e_machine_string.c
c0e8f3
new file mode 100644
c0e8f3
index 00000000..20f33173
c0e8f3
--- /dev/null
c0e8f3
+++ b/libdwelf/dwelf_elf_e_machine_string.c
c0e8f3
@@ -0,0 +1,404 @@
c0e8f3
+/* Returns a human readable description of an ELF header e_machine value.
c0e8f3
+   Copyright (C) 2019 Red Hat, Inc.
c0e8f3
+   This file is part of elfutils.
c0e8f3
+
c0e8f3
+   This file is free software; you can redistribute it and/or modify
c0e8f3
+   it under the terms of either
c0e8f3
+
c0e8f3
+     * the GNU Lesser General Public License as published by the Free
c0e8f3
+       Software Foundation; either version 3 of the License, or (at
c0e8f3
+       your option) any later version
c0e8f3
+
c0e8f3
+   or
c0e8f3
+
c0e8f3
+     * the GNU General Public License as published by the Free
c0e8f3
+       Software Foundation; either version 2 of the License, or (at
c0e8f3
+       your option) any later version
c0e8f3
+
c0e8f3
+   or both in parallel, as here.
c0e8f3
+
c0e8f3
+   elfutils is distributed in the hope that it will be useful, but
c0e8f3
+   WITHOUT ANY WARRANTY; without even the implied warranty of
c0e8f3
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
c0e8f3
+   General Public License for more details.
c0e8f3
+
c0e8f3
+   You should have received copies of the GNU General Public License and
c0e8f3
+   the GNU Lesser General Public License along with this program.  If
c0e8f3
+   not, see <http://www.gnu.org/licenses/>.  */
c0e8f3
+
c0e8f3
+#ifdef HAVE_CONFIG_H
c0e8f3
+# include <config.h>
c0e8f3
+#endif
c0e8f3
+
c0e8f3
+#include "libdwelf.h"
c0e8f3
+
c0e8f3
+
c0e8f3
+const char *
c0e8f3
+dwelf_elf_e_machine_string (int machine)
c0e8f3
+{
c0e8f3
+  switch (machine)
c0e8f3
+    {
c0e8f3
+    case EM_NONE:
c0e8f3
+      return "None";
c0e8f3
+    case EM_M32:
c0e8f3
+      return "WE32100";
c0e8f3
+    case EM_SPARC:
c0e8f3
+      return "SPARC";
c0e8f3
+    case EM_386:
c0e8f3
+      return "Intel 80386";
c0e8f3
+    case EM_68K:
c0e8f3
+      return "M68K";
c0e8f3
+    case EM_88K:
c0e8f3
+      return "M88K";
c0e8f3
+    case EM_IAMCU:
c0e8f3
+      return "Intel MCU";
c0e8f3
+    case EM_860:
c0e8f3
+      return "Intel 80860";
c0e8f3
+    case EM_MIPS:
c0e8f3
+      return "MIPS R3000";
c0e8f3
+    case EM_S370:
c0e8f3
+      return "IBM System/370";
c0e8f3
+    case EM_MIPS_RS3_LE:
c0e8f3
+      return "MIPS R3000";
c0e8f3
+    case EM_PARISC:
c0e8f3
+      return "HPPA";
c0e8f3
+    case EM_VPP500:
c0e8f3
+      return "Fujitsu VPP500";
c0e8f3
+    case EM_SPARC32PLUS:
c0e8f3
+      return "SPARC v8+";
c0e8f3
+    case EM_960:
c0e8f3
+      return "Intel 80960";
c0e8f3
+    case EM_PPC:
c0e8f3
+      return "PowerPC";
c0e8f3
+    case EM_PPC64:
c0e8f3
+      return "PowerPC64";
c0e8f3
+    case EM_S390:
c0e8f3
+      return "IBM S/390";
c0e8f3
+    case EM_SPU:
c0e8f3
+      return "IBM SPU/SPC";
c0e8f3
+    case EM_V800:
c0e8f3
+      return "NEC V800";
c0e8f3
+    case EM_FR20:
c0e8f3
+      return "Fujitsu FR20";
c0e8f3
+    case EM_RH32:
c0e8f3
+      return "TRW RH-32";
c0e8f3
+    case EM_RCE:
c0e8f3
+      return "Motorola RCE";
c0e8f3
+    case EM_ARM:
c0e8f3
+      return "ARM";
c0e8f3
+    case EM_FAKE_ALPHA:
c0e8f3
+      return "Digital Alpha";
c0e8f3
+    case EM_SH:
c0e8f3
+      return "SH";
c0e8f3
+    case EM_SPARCV9:
c0e8f3
+      return "SPARC v9";
c0e8f3
+    case EM_TRICORE:
c0e8f3
+      return "Siemens Tricore";
c0e8f3
+    case EM_ARC:
c0e8f3
+      return "ARC";
c0e8f3
+    case EM_H8_300:
c0e8f3
+      return "H8/300";
c0e8f3
+    case EM_H8_300H:
c0e8f3
+      return "H8/300H";
c0e8f3
+    case EM_H8S:
c0e8f3
+      return "H8S";
c0e8f3
+    case EM_H8_500:
c0e8f3
+      return "H8/500";
c0e8f3
+    case EM_IA_64:
c0e8f3
+      return "Intel IA-64";
c0e8f3
+    case EM_MIPS_X:
c0e8f3
+      return "Stanford MIPS-X";
c0e8f3
+    case EM_COLDFIRE:
c0e8f3
+      return "Motorola Coldfire";
c0e8f3
+    case EM_68HC12:
c0e8f3
+      return "Motorola M68HC12";
c0e8f3
+    case EM_MMA:
c0e8f3
+      return "Fujitsu MMA Multimedia Accelerator";
c0e8f3
+    case EM_PCP:
c0e8f3
+      return "Siemens PCP";
c0e8f3
+    case EM_NCPU:
c0e8f3
+      return "Sony nCPU embeded RISC";
c0e8f3
+    case EM_NDR1:
c0e8f3
+      return "Denso NDR1 microprocessor";
c0e8f3
+    case EM_STARCORE:
c0e8f3
+      return "Motorola Star*Core processor";
c0e8f3
+    case EM_ME16:
c0e8f3
+      return "Toyota ME16 processor";
c0e8f3
+    case EM_ST100:
c0e8f3
+      return "STMicroelectronic ST100";
c0e8f3
+    case EM_TINYJ:
c0e8f3
+      return "Advanced Logic Corporation Tinyj";
c0e8f3
+    case EM_X86_64:
c0e8f3
+      return "AMD x86-64";
c0e8f3
+    case EM_PDSP:
c0e8f3
+      return "Sony DSP Processor";
c0e8f3
+    case EM_PDP10:
c0e8f3
+      return "Digital PDP-10";
c0e8f3
+    case EM_PDP11:
c0e8f3
+      return "Digital PDP-11";
c0e8f3
+    case EM_FX66:
c0e8f3
+      return "Siemens FX66 microcontroller";
c0e8f3
+    case EM_ST9PLUS:
c0e8f3
+      return "STMicroelectronics ST9+";
c0e8f3
+    case EM_ST7:
c0e8f3
+      return "STMicroelectronics ST7";
c0e8f3
+    case EM_68HC16:
c0e8f3
+      return "Motorola MC68HC16 microcontroller";
c0e8f3
+    case EM_68HC11:
c0e8f3
+      return "Motorola MC68HC11 microcontroller";
c0e8f3
+    case EM_68HC08:
c0e8f3
+      return "Motorola MC68HC08 microcontroller";
c0e8f3
+    case EM_68HC05:
c0e8f3
+      return "Motorola MC68HC05 microcontroller";
c0e8f3
+    case EM_SVX:
c0e8f3
+      return "Silicon Graphics SVx";
c0e8f3
+    case EM_ST19:
c0e8f3
+      return "STMicroelectronics ST19";
c0e8f3
+    case EM_VAX:
c0e8f3
+      return "Digital VAX";
c0e8f3
+    case EM_CRIS:
c0e8f3
+      return "Axis Communications 32-bit embedded processor";
c0e8f3
+    case EM_JAVELIN:
c0e8f3
+      return "Infineon Technologies 32-bit embedded processor";
c0e8f3
+    case EM_FIREPATH:
c0e8f3
+      return "Element 14 64-bit DSP Processor";
c0e8f3
+    case EM_ZSP:
c0e8f3
+      return "LSI Logic 16-bit DSP Processor";
c0e8f3
+    case EM_MMIX:
c0e8f3
+      return "Donald Knuth's educational 64-bit processor";
c0e8f3
+    case EM_HUANY:
c0e8f3
+      return "Harvard University machine-independent object";
c0e8f3
+    case EM_PRISM:
c0e8f3
+      return "SiTera Prism";
c0e8f3
+    case EM_AVR:
c0e8f3
+      return "Atmel AVR 8-bit microcontroller";
c0e8f3
+    case EM_FR30:
c0e8f3
+      return "Fujitsu FR30";
c0e8f3
+    case EM_D10V:
c0e8f3
+      return "Mitsubishi D10V";
c0e8f3
+    case EM_D30V:
c0e8f3
+      return "Mitsubishi D30V";
c0e8f3
+    case EM_V850:
c0e8f3
+      return "NEC v850";
c0e8f3
+    case EM_M32R:
c0e8f3
+      return "Mitsubishi M32R";
c0e8f3
+    case EM_MN10300:
c0e8f3
+      return "Matsushita MN10300";
c0e8f3
+    case EM_MN10200:
c0e8f3
+      return "Matsushita MN10200";
c0e8f3
+    case EM_PJ:
c0e8f3
+      return "picoJava";
c0e8f3
+    case EM_OPENRISC:
c0e8f3
+      return "OpenRISC";
c0e8f3
+    case EM_ARC_COMPACT:
c0e8f3
+      return "ARC International ARCompact";
c0e8f3
+    case EM_XTENSA:
c0e8f3
+      return "Tensilica Xtensa Architecture";
c0e8f3
+    case EM_VIDEOCORE:
c0e8f3
+      return "Alphamosaic VideoCore";
c0e8f3
+    case EM_TMM_GPP:
c0e8f3
+      return "Thompson Multimedia General Purpose Processor";
c0e8f3
+    case EM_NS32K:
c0e8f3
+      return "National Semiconductor 32000";
c0e8f3
+    case EM_TPC:
c0e8f3
+      return "Tenor Network TPC";
c0e8f3
+    case EM_SNP1K:
c0e8f3
+      return "Trebia SNP 1000";
c0e8f3
+    case EM_ST200:
c0e8f3
+      return "STMicroelectronics ST200";
c0e8f3
+    case EM_IP2K:
c0e8f3
+      return "Ubicom IP2xxx";
c0e8f3
+    case EM_MAX:
c0e8f3
+      return "MAX processor";
c0e8f3
+    case EM_CR:
c0e8f3
+      return "National Semiconductor CompactRISC";
c0e8f3
+    case EM_F2MC16:
c0e8f3
+      return "Fujitsu F2MC16";
c0e8f3
+    case EM_MSP430:
c0e8f3
+      return "Texas Instruments msp430";
c0e8f3
+    case EM_BLACKFIN:
c0e8f3
+      return "Analog Devices Blackfin DSP";
c0e8f3
+    case EM_SE_C33:
c0e8f3
+      return "Seiko Epson S1C33";
c0e8f3
+    case EM_SEP:
c0e8f3
+      return "Sharp embedded microprocessor";
c0e8f3
+    case EM_ARCA:
c0e8f3
+      return "Arca RISC";
c0e8f3
+    case EM_UNICORE:
c0e8f3
+      return "Unicore";
c0e8f3
+    case EM_EXCESS:
c0e8f3
+      return "eXcess configurable CPU";
c0e8f3
+    case EM_DXP:
c0e8f3
+      return "Icera Semiconductor Deep Execution Processor";
c0e8f3
+    case EM_ALTERA_NIOS2:
c0e8f3
+      return "Altera Nios II";
c0e8f3
+    case EM_CRX:
c0e8f3
+      return "National Semiconductor CompactRISC CRX";
c0e8f3
+    case EM_XGATE:
c0e8f3
+      return "Motorola XGATE";
c0e8f3
+    case EM_C166:
c0e8f3
+      return "Infineon C16x/XC16x";
c0e8f3
+    case EM_M16C:
c0e8f3
+      return "Renesas M16C";
c0e8f3
+    case EM_DSPIC30F:
c0e8f3
+      return "Microchip Technology dsPIC30F";
c0e8f3
+    case EM_CE:
c0e8f3
+      return "Freescale Communication Engine RISC";
c0e8f3
+    case EM_M32C:
c0e8f3
+      return "Renesas M32C";
c0e8f3
+    case EM_TSK3000:
c0e8f3
+      return "Altium TSK3000";
c0e8f3
+    case EM_RS08:
c0e8f3
+      return "Freescale RS08";
c0e8f3
+    case EM_SHARC:
c0e8f3
+      return "Analog Devices SHARC";
c0e8f3
+    case EM_ECOG2:
c0e8f3
+      return "Cyan Technology eCOG2";
c0e8f3
+    case EM_SCORE7:
c0e8f3
+      return "Sunplus S+core7 RISC";
c0e8f3
+    case EM_DSP24:
c0e8f3
+      return "New Japan Radio (NJR) 24-bit DSP";
c0e8f3
+    case EM_VIDEOCORE3:
c0e8f3
+      return "Broadcom VideoCore III";
c0e8f3
+    case EM_LATTICEMICO32:
c0e8f3
+      return "RISC for Lattice FPGA";
c0e8f3
+    case EM_SE_C17:
c0e8f3
+      return "Seiko Epson C17";
c0e8f3
+    case EM_TI_C6000:
c0e8f3
+      return "Texas Instruments TMS320C6000 DSP";
c0e8f3
+    case EM_TI_C2000:
c0e8f3
+      return "Texas Instruments TMS320C2000 DSP";
c0e8f3
+    case EM_TI_C5500:
c0e8f3
+      return "Texas Instruments TMS320C55x DSP";
c0e8f3
+    case EM_TI_ARP32:
c0e8f3
+      return "Texas Instruments Application Specific RISC";
c0e8f3
+    case EM_TI_PRU:
c0e8f3
+      return "Texas Instruments Programmable Realtime Unit";
c0e8f3
+    case EM_MMDSP_PLUS:
c0e8f3
+      return "STMicroelectronics 64bit VLIW DSP";
c0e8f3
+    case EM_CYPRESS_M8C:
c0e8f3
+      return "Cypress M8C";
c0e8f3
+    case EM_R32C:
c0e8f3
+      return "Renesas R32C";
c0e8f3
+    case EM_TRIMEDIA:
c0e8f3
+      return "NXP Semiconductors TriMedia";
c0e8f3
+    case EM_QDSP6:
c0e8f3
+      return "QUALCOMM DSP6";
c0e8f3
+    case EM_8051:
c0e8f3
+      return "Intel 8051 and variants";
c0e8f3
+    case EM_STXP7X:
c0e8f3
+      return "STMicroelectronics STxP7x";
c0e8f3
+    case EM_NDS32:
c0e8f3
+      return "Andes Technology compact code size embeded RISC";
c0e8f3
+    case EM_ECOG1X:
c0e8f3
+      return "Cyan Technology eCOG1X";
c0e8f3
+    case EM_MAXQ30:
c0e8f3
+      return "Dallas Semicondutor MAXQ30";
c0e8f3
+    case EM_XIMO16:
c0e8f3
+      return "New Japan Radio (NJR) 16-bit DSP";
c0e8f3
+    case EM_MANIK:
c0e8f3
+      return "M2000 Reconfigurable RISC";
c0e8f3
+    case EM_CRAYNV2:
c0e8f3
+      return "Cray NV2 vector architecture";
c0e8f3
+    case EM_RX:
c0e8f3
+      return "Renesas RX";
c0e8f3
+    case EM_METAG:
c0e8f3
+      return "Imagination Technologies META";
c0e8f3
+    case EM_MCST_ELBRUS:
c0e8f3
+      return "MCST Elbrus";
c0e8f3
+    case EM_ECOG16:
c0e8f3
+      return "Cyan Technology eCOG16";
c0e8f3
+    case EM_CR16:
c0e8f3
+      return "National Semiconductor CompactRISC";
c0e8f3
+    case EM_ETPU:
c0e8f3
+      return "Freescale Extended Time Processing Unit";
c0e8f3
+    case EM_SLE9X:
c0e8f3
+      return "Infineon Technologies SLE9X";
c0e8f3
+    case EM_L10M:
c0e8f3
+      return "Intel L10M";
c0e8f3
+    case EM_K10M:
c0e8f3
+      return "Intel K10M";
c0e8f3
+    case EM_AARCH64:
c0e8f3
+      return "AARCH64";
c0e8f3
+    case EM_AVR32:
c0e8f3
+      return "Amtel AVR32";
c0e8f3
+    case EM_STM8:
c0e8f3
+      return "STMicroelectronics STM8";
c0e8f3
+    case EM_TILE64:
c0e8f3
+      return "Tilera TILE64";
c0e8f3
+    case EM_TILEPRO:
c0e8f3
+      return "Tilera TILEPro";
c0e8f3
+    case EM_MICROBLAZE:
c0e8f3
+      return "Xilinx MicroBlaze";
c0e8f3
+    case EM_CUDA:
c0e8f3
+      return "NVIDIA CUDA";
c0e8f3
+    case EM_TILEGX:
c0e8f3
+      return "Tilera TILE-Gx";
c0e8f3
+    case EM_CLOUDSHIELD:
c0e8f3
+      return "CloudShield";
c0e8f3
+    case EM_COREA_1ST:
c0e8f3
+      return "KIPO-KAIST Core-A 1st gen";
c0e8f3
+    case EM_COREA_2ND:
c0e8f3
+      return "KIPO-KAIST Core-A 2nd gen";
c0e8f3
+    case EM_ARC_COMPACT2:
c0e8f3
+      return "Synopsys ARCompact V2";
c0e8f3
+    case EM_OPEN8:
c0e8f3
+      return "Open8 RISC";
c0e8f3
+    case EM_RL78:
c0e8f3
+      return "Renesas RL78";
c0e8f3
+    case EM_VIDEOCORE5:
c0e8f3
+      return "Broadcom VideoCore V";
c0e8f3
+    case EM_78KOR:
c0e8f3
+      return "Renesas 78KOR";
c0e8f3
+    case EM_56800EX:
c0e8f3
+      return "Freescale 56800EX DSC";
c0e8f3
+    case EM_BA1:
c0e8f3
+      return "Beyond BA1";
c0e8f3
+    case EM_BA2:
c0e8f3
+      return "Beyond BA2";
c0e8f3
+    case EM_XCORE:
c0e8f3
+      return "XMOS xCORE";
c0e8f3
+    case EM_MCHP_PIC:
c0e8f3
+      return "Microchip 8-bit PIC";
c0e8f3
+    case EM_KM32:
c0e8f3
+      return "KM211 KM32";
c0e8f3
+    case EM_KMX32:
c0e8f3
+      return "KM211 KMX32";
c0e8f3
+    case EM_EMX16:
c0e8f3
+      return "KM211 KMX16";
c0e8f3
+    case EM_EMX8:
c0e8f3
+      return "KM211 KMX8";
c0e8f3
+    case EM_KVARC:
c0e8f3
+      return "KM211 KVARC";
c0e8f3
+    case EM_CDP:
c0e8f3
+      return "Paneve CDP";
c0e8f3
+    case EM_COGE:
c0e8f3
+      return "Cognitive Smart Memory Processor";
c0e8f3
+    case EM_COOL:
c0e8f3
+      return "Bluechip CoolEngine";
c0e8f3
+    case EM_NORC:
c0e8f3
+      return "Nanoradio Optimized RISC";
c0e8f3
+    case EM_CSR_KALIMBA:
c0e8f3
+      return "CSR Kalimba";
c0e8f3
+    case EM_Z80:
c0e8f3
+      return "Zilog Z80";
c0e8f3
+    case EM_VISIUM:
c0e8f3
+      return "CDS VISIUMcore";
c0e8f3
+    case EM_FT32:
c0e8f3
+      return "FTDI Chip FT32";
c0e8f3
+    case EM_MOXIE:
c0e8f3
+      return "Moxie";
c0e8f3
+    case EM_AMDGPU:
c0e8f3
+      return "AMD GPU";
c0e8f3
+    case EM_RISCV:
c0e8f3
+      return "RISC-V";
c0e8f3
+    case EM_BPF:
c0e8f3
+      return "BPF";
c0e8f3
+
c0e8f3
+    case EM_ALPHA:
c0e8f3
+      return "Alpha";
c0e8f3
+
c0e8f3
+    default:
c0e8f3
+      return NULL;
c0e8f3
+    }
c0e8f3
+}
c0e8f3
diff --git a/src/Makefile.am b/src/Makefile.am
c0e8f3
index 2b1c0dcb..0bb20804 100644
c0e8f3
--- a/src/Makefile.am
c0e8f3
+++ b/src/Makefile.am
c0e8f3
@@ -67,6 +67,8 @@ ranlib_no_Wstack_usage = yes
c0e8f3
 ar_no_Wstack_usage = yes
c0e8f3
 unstrip_no_Wstack_usage = yes
c0e8f3
 
c0e8f3
+readelf_SOURCES = readelf.c ../libdwelf/dwelf_elf_e_machine_string.c
c0e8f3
+
c0e8f3
 readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
c0e8f3
 nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl \
c0e8f3
 	   $(demanglelib)
c0e8f3
diff --git a/src/readelf.c b/src/readelf.c
c0e8f3
index 33706bde..1db88393 100644
c0e8f3
--- a/src/readelf.c
c0e8f3
+++ b/src/readelf.c
c0e8f3
@@ -57,6 +57,8 @@
c0e8f3
 
c0e8f3
 #include "../libdw/known-dwarf.h"
c0e8f3
 
c0e8f3
+extern const char *dwelf_elf_e_machine_string (int machine);
c0e8f3
+
c0e8f3
 #ifdef __linux__
c0e8f3
 #define CORE_SIGILL  SIGILL
c0e8f3
 #define CORE_SIGBUS  SIGBUS
c0e8f3
@@ -1070,7 +1072,12 @@ print_ehdr (Ebl *ebl, GElf_Ehdr *ehdr)
c0e8f3
   fputs_unlocked (gettext ("  Type:                              "), stdout);
c0e8f3
   print_file_type (ehdr->e_type);
c0e8f3
 
c0e8f3
-  printf (gettext ("  Machine:                           %s\n"), ebl->name);
c0e8f3
+  const char *machine = dwelf_elf_e_machine_string (ehdr->e_machine);
c0e8f3
+  if (machine != NULL)
c0e8f3
+    printf (gettext ("  Machine:                           %s\n"), machine);
c0e8f3
+  else
c0e8f3
+    printf (gettext ("  Machine:                           <unknown>: 0x%x\n"),
c0e8f3
+	    ehdr->e_machine);
c0e8f3
 
c0e8f3
   printf (gettext ("  Version:                           %d %s\n"),
c0e8f3
 	  ehdr->e_version,
c0e8f3
diff --git a/tests/dwelf_elf_e_machine_string_test.c b/tests/dwelf_elf_e_machine_string_test.c
c0e8f3
new file mode 100644
c0e8f3
index 00000000..2f14d704
c0e8f3
--- /dev/null
c0e8f3
+++ b/tests/dwelf_elf_e_machine_string_test.c
c0e8f3
@@ -0,0 +1,66 @@
c0e8f3
+/* Test program for dwelf_elf_e_machine_string
c0e8f3
+   Copyright (C) 2019 Red Hat, Inc.
c0e8f3
+   This file is part of elfutils.
c0e8f3
+
c0e8f3
+   This file is free software; you can redistribute it and/or modify
c0e8f3
+   it under the terms of the GNU General Public License as published by
c0e8f3
+   the Free Software Foundation; either version 3 of the License, or
c0e8f3
+   (at your option) any later version.
c0e8f3
+
c0e8f3
+   elfutils is distributed in the hope that it will be useful, but
c0e8f3
+   WITHOUT ANY WARRANTY; without even the implied warranty of
c0e8f3
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
c0e8f3
+   GNU General Public License for more details.
c0e8f3
+
c0e8f3
+   You should have received a copy of the GNU General Public License
c0e8f3
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
c0e8f3
+
c0e8f3
+#ifdef HAVE_CONFIG_H
c0e8f3
+# include <config.h>
c0e8f3
+#endif
c0e8f3
+
c0e8f3
+#include <assert.h>
c0e8f3
+#include <errno.h>
c0e8f3
+#include <inttypes.h>
c0e8f3
+#include <stdio.h>
c0e8f3
+#include <stdlib.h>
c0e8f3
+#include <limits.h>
c0e8f3
+#include <string.h>
c0e8f3
+#include <unistd.h>
c0e8f3
+
c0e8f3
+#include ELFUTILS_HEADER(dwelf)
c0e8f3
+
c0e8f3
+extern const char *dwelf_elf_e_machine_string (int machine);
c0e8f3
+
c0e8f3
+int
c0e8f3
+main (int argc, char **argv)
c0e8f3
+{
c0e8f3
+  int i;
c0e8f3
+  for (i = 1; i < argc; i++)
c0e8f3
+    {
c0e8f3
+      long val;
c0e8f3
+      int em;
c0e8f3
+      const char *machine;
c0e8f3
+
c0e8f3
+      if (strncmp ("0x", argv[i], 2) == 0)
c0e8f3
+	val = strtol (&argv[i][2], NULL, 16);
c0e8f3
+      else
c0e8f3
+	val = strtol (argv[i], NULL, 10);
c0e8f3
+
c0e8f3
+      if ((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN))
c0e8f3
+           || (errno != 0 && val == 0))
c0e8f3
+	{
c0e8f3
+          perror ("strtol");
c0e8f3
+          exit (EXIT_FAILURE);
c0e8f3
+	}
c0e8f3
+
c0e8f3
+      em = val;
c0e8f3
+      assert (em == val);
c0e8f3
+
c0e8f3
+      machine = dwelf_elf_e_machine_string (em);
c0e8f3
+      printf ("0x%x %s\n", em, machine);
c0e8f3
+      assert (machine != NULL);
c0e8f3
+    }
c0e8f3
+
c0e8f3
+  return 0;
c0e8f3
+}
c0e8f3
diff --git a/tests/run-dwelf_elf_e_machine_string.sh b/tests/run-dwelf_elf_e_machine_string.sh
c0e8f3
new file mode 100755
c0e8f3
index 00000000..ba6d0e63
c0e8f3
--- /dev/null
c0e8f3
+++ b/tests/run-dwelf_elf_e_machine_string.sh
c0e8f3
@@ -0,0 +1,31 @@
c0e8f3
+#! /bin/bash
c0e8f3
+# Test to make sure all EM values in elf.h are recognized
c0e8f3
+# Copyright (C) 2019 Red Hat, Inc.
c0e8f3
+# This file is part of elfutils.
c0e8f3
+#
c0e8f3
+# This file is free software; you can redistribute it and/or modify
c0e8f3
+# it under the terms of the GNU General Public License as published by
c0e8f3
+# the Free Software Foundation; either version 3 of the License, or
c0e8f3
+# (at your option) any later version.
c0e8f3
+#
c0e8f3
+# elfutils is distributed in the hope that it will be useful, but
c0e8f3
+# WITHOUT ANY WARRANTY; without even the implied warranty of
c0e8f3
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
c0e8f3
+# GNU General Public License for more details.
c0e8f3
+#
c0e8f3
+# You should have received a copy of the GNU General Public License
c0e8f3
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
c0e8f3
+
c0e8f3
+. $srcdir/test-subr.sh
c0e8f3
+
c0e8f3
+# Get all known EM values from elf.h and pass them through the
c0e8f3
+# preprocessor to get the numbers. Call dwelf_elf_e_machine_string on
c0e8f3
+# all of them.
c0e8f3
+EM_VALUES=$(grep ^\#define\ EM_ ${abs_srcdir}/../libelf/elf.h \
c0e8f3
+            | cut -f2 -d\  | cut -f1 | grep -v ^EM_NUM$ | xargs echo)
c0e8f3
+# echo "EM_VALUES: $EM_VALUES"
c0e8f3
+EM_NUMBERS=$((cat ${abs_srcdir}/../libelf/elf.h; echo "$EM_VALUES") \
c0e8f3
+             | gcc -E - | tail -1)
c0e8f3
+# echo "EM_NUMBERS: $EM_NUMBERS"
c0e8f3
+
c0e8f3
+testrun ${abs_top_builddir}/tests/dwelf_elf_e_machine_string $EM_NUMBERS
c0e8f3
-- 
c0e8f3
2.18.1
c0e8f3
c0e8f3
--- elfutils-0.176/src/Makefile.in	2019-02-15 16:46:53.000000000 +0100
c0e8f3
+++ elfutils-0.176.e_machine/src/Makefile.in	2019-08-06 18:47:51.447720727 +0200
c0e8f3
@@ -165,8 +165,9 @@
c0e8f3
 ranlib_OBJECTS = ranlib.$(OBJEXT)
c0e8f3
 ranlib_DEPENDENCIES = libar.a $(am__DEPENDENCIES_2) $(libeu) \
c0e8f3
 	$(am__DEPENDENCIES_1)
c0e8f3
-readelf_SOURCES = readelf.c
c0e8f3
-readelf_OBJECTS = readelf.$(OBJEXT)
c0e8f3
+am_readelf_OBJECTS = readelf.$(OBJEXT) \
c0e8f3
+	dwelf_elf_e_machine_string.$(OBJEXT)
c0e8f3
+readelf_OBJECTS = $(am_readelf_OBJECTS)
c0e8f3
 readelf_DEPENDENCIES = $(am__DEPENDENCIES_3) $(libebl) \
c0e8f3
 	$(am__DEPENDENCIES_2) $(libeu) $(am__DEPENDENCIES_1)
c0e8f3
 size_SOURCES = size.c
c0e8f3
@@ -235,14 +236,19 @@
c0e8f3
 am__maybe_remake_depfiles = depfiles
c0e8f3
 am__depfiles_remade = ./$(DEPDIR)/addr2line.Po ./$(DEPDIR)/ar.Po \
c0e8f3
 	./$(DEPDIR)/arlib-argp.Po ./$(DEPDIR)/arlib.Po \
c0e8f3
-	./$(DEPDIR)/arlib2.Po ./$(DEPDIR)/elfcmp.Po \
c0e8f3
-	./$(DEPDIR)/elfcompress.Po ./$(DEPDIR)/elflint.Po \
c0e8f3
-	./$(DEPDIR)/findtextrel.Po ./$(DEPDIR)/nm.Po \
c0e8f3
-	./$(DEPDIR)/objdump.Po ./$(DEPDIR)/ranlib.Po \
c0e8f3
+	./$(DEPDIR)/arlib2.Po \
c0e8f3
+	./$(DEPDIR)/dwelf_elf_e_machine_string.Po \
c0e8f3
+	./$(DEPDIR)/elfcmp.Po ./$(DEPDIR)/elfcompress.Po \
c0e8f3
+	./$(DEPDIR)/elflint.Po ./$(DEPDIR)/findtextrel.Po \
c0e8f3
+	./$(DEPDIR)/nm.Po ./$(DEPDIR)/objdump.Po ./$(DEPDIR)/ranlib.Po \
c0e8f3
 	./$(DEPDIR)/readelf.Po ./$(DEPDIR)/size.Po \
c0e8f3
 	./$(DEPDIR)/stack.Po ./$(DEPDIR)/strings.Po \
c0e8f3
 	./$(DEPDIR)/strip.Po ./$(DEPDIR)/unstrip.Po
c0e8f3
 am__mv = mv -f
c0e8f3
+AM_V_lt = $(am__v_lt_@AM_V@)
c0e8f3
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
c0e8f3
+am__v_lt_0 = --silent
c0e8f3
+am__v_lt_1 = 
c0e8f3
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
c0e8f3
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
c0e8f3
 AM_V_CC = $(am__v_CC_@AM_V@)
c0e8f3
@@ -256,11 +262,11 @@
c0e8f3
 am__v_CCLD_0 = @echo "  CCLD    " $@;
c0e8f3
 am__v_CCLD_1 = 
c0e8f3
 SOURCES = $(libar_a_SOURCES) addr2line.c ar.c elfcmp.c elfcompress.c \
c0e8f3
-	elflint.c findtextrel.c nm.c objdump.c ranlib.c readelf.c \
c0e8f3
-	size.c stack.c strings.c strip.c unstrip.c
c0e8f3
+	elflint.c findtextrel.c nm.c objdump.c ranlib.c \
c0e8f3
+	$(readelf_SOURCES) size.c stack.c strings.c strip.c unstrip.c
c0e8f3
 DIST_SOURCES = $(libar_a_SOURCES) addr2line.c ar.c elfcmp.c \
c0e8f3
 	elfcompress.c elflint.c findtextrel.c nm.c objdump.c ranlib.c \
c0e8f3
-	readelf.c size.c stack.c strings.c strip.c unstrip.c
c0e8f3
+	$(readelf_SOURCES) size.c stack.c strings.c strip.c unstrip.c
c0e8f3
 am__can_run_installinfo = \
c0e8f3
   case $$AM_UPDATE_INFO_DIR in \
c0e8f3
     n|no|NO) false;; \
c0e8f3
@@ -490,6 +496,7 @@
c0e8f3
 ranlib_no_Wstack_usage = yes
c0e8f3
 ar_no_Wstack_usage = yes
c0e8f3
 unstrip_no_Wstack_usage = yes
c0e8f3
+readelf_SOURCES = readelf.c ../libdwelf/dwelf_elf_e_machine_string.c
c0e8f3
 readelf_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl
c0e8f3
 nm_LDADD = $(libdw) $(libebl) $(libelf) $(libeu) $(argp_LDADD) -ldl \
c0e8f3
 	   $(demanglelib)
c0e8f3
@@ -713,6 +720,7 @@
c0e8f3
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arlib-argp.Po@am__quote@ # am--include-marker
c0e8f3
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arlib.Po@am__quote@ # am--include-marker
c0e8f3
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/arlib2.Po@am__quote@ # am--include-marker
c0e8f3
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwelf_elf_e_machine_string.Po@am__quote@ # am--include-marker
c0e8f3
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfcmp.Po@am__quote@ # am--include-marker
c0e8f3
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elfcompress.Po@am__quote@ # am--include-marker
c0e8f3
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/elflint.Po@am__quote@ # am--include-marker
c0e8f3
@@ -747,6 +755,20 @@
c0e8f3
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
c0e8f3
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
c0e8f3
 
c0e8f3
+dwelf_elf_e_machine_string.o: ../libdwelf/dwelf_elf_e_machine_string.c
c0e8f3
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwelf_elf_e_machine_string.o -MD -MP -MF $(DEPDIR)/dwelf_elf_e_machine_string.Tpo -c -o dwelf_elf_e_machine_string.o `test -f '../libdwelf/dwelf_elf_e_machine_string.c' || echo '$(srcdir)/'`../libdwelf/dwelf_elf_e_machine_string.c
c0e8f3
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/dwelf_elf_e_machine_string.Tpo $(DEPDIR)/dwelf_elf_e_machine_string.Po
c0e8f3
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='../libdwelf/dwelf_elf_e_machine_string.c' object='dwelf_elf_e_machine_string.o' libtool=no @AMDEPBACKSLASH@
c0e8f3
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
c0e8f3
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwelf_elf_e_machine_string.o `test -f '../libdwelf/dwelf_elf_e_machine_string.c' || echo '$(srcdir)/'`../libdwelf/dwelf_elf_e_machine_string.c
c0e8f3
+
c0e8f3
+dwelf_elf_e_machine_string.obj: ../libdwelf/dwelf_elf_e_machine_string.c
c0e8f3
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwelf_elf_e_machine_string.obj -MD -MP -MF $(DEPDIR)/dwelf_elf_e_machine_string.Tpo -c -o dwelf_elf_e_machine_string.obj `if test -f '../libdwelf/dwelf_elf_e_machine_string.c'; then $(CYGPATH_W) '../libdwelf/dwelf_elf_e_machine_string.c'; else $(CYGPATH_W) '$(srcdir)/../libdwelf/dwelf_elf_e_machine_string.c'; fi`
c0e8f3
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/dwelf_elf_e_machine_string.Tpo $(DEPDIR)/dwelf_elf_e_machine_string.Po
c0e8f3
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='../libdwelf/dwelf_elf_e_machine_string.c' object='dwelf_elf_e_machine_string.obj' libtool=no @AMDEPBACKSLASH@
c0e8f3
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
c0e8f3
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwelf_elf_e_machine_string.obj `if test -f '../libdwelf/dwelf_elf_e_machine_string.c'; then $(CYGPATH_W) '../libdwelf/dwelf_elf_e_machine_string.c'; else $(CYGPATH_W) '$(srcdir)/../libdwelf/dwelf_elf_e_machine_string.c'; fi`
c0e8f3
+
c0e8f3
 ID: $(am__tagged_files)
c0e8f3
 	$(am__define_uniq_tagged_files); mkid -fID $$unique
c0e8f3
 tags: tags-am
c0e8f3
@@ -881,6 +903,7 @@
c0e8f3
 	-rm -f ./$(DEPDIR)/arlib-argp.Po
c0e8f3
 	-rm -f ./$(DEPDIR)/arlib.Po
c0e8f3
 	-rm -f ./$(DEPDIR)/arlib2.Po
c0e8f3
+	-rm -f ./$(DEPDIR)/dwelf_elf_e_machine_string.Po
c0e8f3
 	-rm -f ./$(DEPDIR)/elfcmp.Po
c0e8f3
 	-rm -f ./$(DEPDIR)/elfcompress.Po
c0e8f3
 	-rm -f ./$(DEPDIR)/elflint.Po
c0e8f3
@@ -944,6 +967,7 @@
c0e8f3
 	-rm -f ./$(DEPDIR)/arlib-argp.Po
c0e8f3
 	-rm -f ./$(DEPDIR)/arlib.Po
c0e8f3
 	-rm -f ./$(DEPDIR)/arlib2.Po
c0e8f3
+	-rm -f ./$(DEPDIR)/dwelf_elf_e_machine_string.Po
c0e8f3
 	-rm -f ./$(DEPDIR)/elfcmp.Po
c0e8f3
 	-rm -f ./$(DEPDIR)/elfcompress.Po
c0e8f3
 	-rm -f ./$(DEPDIR)/elflint.Po
c0e8f3
diff -ur elfutils-0.176/tests/Makefile.am elfutils-0.176.e_machine/tests/Makefile.am
c0e8f3
--- elfutils-0.176/tests/Makefile.am	2019-08-06 18:55:16.684204039 +0200
c0e8f3
+++ elfutils-0.176.e_machine/tests/Makefile.am	2019-08-06 18:46:41.154676407 +0200
c0e8f3
@@ -60,7 +60,8 @@
c0e8f3
 		  fillfile dwarf_default_lower_bound dwarf-die-addr-die \
c0e8f3
 		  get-units-invalid get-units-split attr-integrate-skel \
c0e8f3
 		  all-dwarf-ranges unit-info next_cfi \
c0e8f3
-		  elfcopy addsections xlate_notes elfrdwrnop
c0e8f3
+		  elfcopy addsections xlate_notes elfrdwrnop \
c0e8f3
+		  dwelf_elf_e_machine_string
c0e8f3
 
c0e8f3
 asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \
c0e8f3
 	    asm-tst6 asm-tst7 asm-tst8 asm-tst9
c0e8f3
@@ -160,7 +161,8 @@
c0e8f3
 	run-reverse-sections.sh run-reverse-sections-self.sh \
c0e8f3
 	run-copyadd-sections.sh run-copymany-sections.sh \
c0e8f3
 	run-typeiter-many.sh run-strip-test-many.sh \
c0e8f3
-	run-strip-version.sh run-xlate-note.sh
c0e8f3
+	run-strip-version.sh run-xlate-note.sh \
c0e8f3
+	run-dwelf_elf_e_machine_string.sh
c0e8f3
 
c0e8f3
 if !BIARCH
c0e8f3
 export ELFUTILS_DISABLE_BIARCH = 1
c0e8f3
@@ -426,7 +428,8 @@
c0e8f3
 	     testfile-debug-rel-ppc64-z.o.bz2 \
c0e8f3
 	     testfile-debug-rel-ppc64.o.bz2 \
c0e8f3
 	     run-strip-version.sh testfile-version.bz2 \
c0e8f3
-	     run-xlate-note.sh
c0e8f3
+	     run-xlate-note.sh \
c0e8f3
+	     run-dwelf_elf_e_machine_string.sh
c0e8f3
 
c0e8f3
 if USE_VALGRIND
c0e8f3
 valgrind_cmd='valgrind -q --leak-check=full --error-exitcode=1'
c0e8f3
@@ -599,6 +602,10 @@
c0e8f3
 xlate_notes_LDADD = $(libelf)
c0e8f3
 elfrdwrnop_LDADD = $(libelf)
c0e8f3
 
c0e8f3
+dwelf_elf_e_machine_string_SOURCES = dwelf_elf_e_machine_string_test.c \
c0e8f3
+	../libdwelf/dwelf_elf_e_machine_string.c
c0e8f3
+dwelf_elf_e_machine_string_LDADD = $(libelf) $(libdw)
c0e8f3
+
c0e8f3
 # We want to test the libelf header against the system elf.h header.
c0e8f3
 # Don't include any -I CPPFLAGS. Except when we install our own elf.h.
c0e8f3
 if !INSTALL_ELFH
c0e8f3
diff -ur elfutils-0.176/tests/Makefile.in elfutils-0.176.e_machine/tests/Makefile.in
c0e8f3
--- elfutils-0.176/tests/Makefile.in	2019-08-06 18:55:16.689203989 +0200
c0e8f3
+++ elfutils-0.176.e_machine/tests/Makefile.in	2019-08-06 18:47:51.876714894 +0200
c0e8f3
@@ -132,7 +132,8 @@
c0e8f3
 	attr-integrate-skel$(EXEEXT) all-dwarf-ranges$(EXEEXT) \
c0e8f3
 	unit-info$(EXEEXT) next_cfi$(EXEEXT) elfcopy$(EXEEXT) \
c0e8f3
 	addsections$(EXEEXT) xlate_notes$(EXEEXT) elfrdwrnop$(EXEEXT) \
c0e8f3
-	$(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_4)
c0e8f3
+	dwelf_elf_e_machine_string$(EXEEXT) $(am__EXEEXT_1) \
c0e8f3
+	$(am__EXEEXT_2) $(am__EXEEXT_4)
c0e8f3
 @BIARCH_TRUE@am__append_5 = backtrace-child-biarch
c0e8f3
 TESTS = run-arextract.sh run-arsymtest.sh run-ar.sh newfile$(EXEEXT) \
c0e8f3
 	test-nlist$(EXEEXT) update1$(EXEEXT) update2$(EXEEXT) \
c0e8f3
@@ -213,7 +214,8 @@
c0e8f3
 	run-reverse-sections-self.sh run-copyadd-sections.sh \
c0e8f3
 	run-copymany-sections.sh run-typeiter-many.sh \
c0e8f3
 	run-strip-test-many.sh run-strip-version.sh run-xlate-note.sh \
c0e8f3
-	$(am__EXEEXT_2) $(am__append_8) $(am__EXEEXT_5)
c0e8f3
+	run-dwelf_elf_e_machine_string.sh $(am__EXEEXT_2) \
c0e8f3
+	$(am__append_8) $(am__EXEEXT_5)
c0e8f3
 @STANDALONE_FALSE@am__append_6 = msg_tst system-elf-libelf-test
c0e8f3
 @STANDALONE_FALSE@am__append_7 = msg_tst system-elf-libelf-test
c0e8f3
 @LZMA_TRUE@am__append_8 = run-readelf-s.sh run-dwflsyms.sh
c0e8f3
@@ -389,6 +391,13 @@
c0e8f3
 dwarfcfi_SOURCES = dwarfcfi.c
c0e8f3
 dwarfcfi_OBJECTS = dwarfcfi.$(OBJEXT)
c0e8f3
 dwarfcfi_DEPENDENCIES = $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_2)
c0e8f3
+am_dwelf_elf_e_machine_string_OBJECTS =  \
c0e8f3
+	dwelf_elf_e_machine_string_test.$(OBJEXT) \
c0e8f3
+	dwelf_elf_e_machine_string.$(OBJEXT)
c0e8f3
+dwelf_elf_e_machine_string_OBJECTS =  \
c0e8f3
+	$(am_dwelf_elf_e_machine_string_OBJECTS)
c0e8f3
+dwelf_elf_e_machine_string_DEPENDENCIES = $(am__DEPENDENCIES_2) \
c0e8f3
+	$(am__DEPENDENCIES_4)
c0e8f3
 dwelfgnucompressed_SOURCES = dwelfgnucompressed.c
c0e8f3
 dwelfgnucompressed_OBJECTS = dwelfgnucompressed.$(OBJEXT)
c0e8f3
 dwelfgnucompressed_DEPENDENCIES = $(am__DEPENDENCIES_2) \
c0e8f3
@@ -653,7 +662,10 @@
c0e8f3
 	./$(DEPDIR)/dwarf-getmacros.Po ./$(DEPDIR)/dwarf-getstring.Po \
c0e8f3
 	./$(DEPDIR)/dwarf-ranges.Po \
c0e8f3
 	./$(DEPDIR)/dwarf_default_lower_bound.Po \
c0e8f3
-	./$(DEPDIR)/dwarfcfi.Po ./$(DEPDIR)/dwelfgnucompressed.Po \
c0e8f3
+	./$(DEPDIR)/dwarfcfi.Po \
c0e8f3
+	./$(DEPDIR)/dwelf_elf_e_machine_string.Po \
c0e8f3
+	./$(DEPDIR)/dwelf_elf_e_machine_string_test.Po \
c0e8f3
+	./$(DEPDIR)/dwelfgnucompressed.Po \
c0e8f3
 	./$(DEPDIR)/dwfl-addr-sect.Po \
c0e8f3
 	./$(DEPDIR)/dwfl-bug-addr-overflow.Po \
c0e8f3
 	./$(DEPDIR)/dwfl-bug-fd-leak.Po \
c0e8f3
@@ -717,15 +729,15 @@
c0e8f3
 	backtrace-dwarf.c buildid.c debugaltlink.c debuglink.c \
c0e8f3
 	deleted.c deleted-lib.c dwarf-die-addr-die.c dwarf-getmacros.c \
c0e8f3
 	dwarf-getstring.c dwarf-ranges.c dwarf_default_lower_bound.c \
c0e8f3
-	dwarfcfi.c dwelfgnucompressed.c dwfl-addr-sect.c \
c0e8f3
-	dwfl-bug-addr-overflow.c dwfl-bug-fd-leak.c \
c0e8f3
-	dwfl-bug-getmodules.c dwfl-bug-report.c dwfl-proc-attach.c \
c0e8f3
-	dwfl-report-elf-align.c dwfllines.c dwflmodtest.c dwflsyms.c \
c0e8f3
-	early-offscn.c ecp.c elfcopy.c elfgetchdr.c elfgetzdata.c \
c0e8f3
-	elfputzdata.c elfrdwrnop.c elfshphehdr.c elfstrmerge.c \
c0e8f3
-	elfstrtab.c emptyfile.c fillfile.c find-prologues.c \
c0e8f3
-	funcretval.c funcscopes.c get-aranges.c get-files.c \
c0e8f3
-	get-lines.c get-pubnames.c get-units-invalid.c \
c0e8f3
+	dwarfcfi.c $(dwelf_elf_e_machine_string_SOURCES) \
c0e8f3
+	dwelfgnucompressed.c dwfl-addr-sect.c dwfl-bug-addr-overflow.c \
c0e8f3
+	dwfl-bug-fd-leak.c dwfl-bug-getmodules.c dwfl-bug-report.c \
c0e8f3
+	dwfl-proc-attach.c dwfl-report-elf-align.c dwfllines.c \
c0e8f3
+	dwflmodtest.c dwflsyms.c early-offscn.c ecp.c elfcopy.c \
c0e8f3
+	elfgetchdr.c elfgetzdata.c elfputzdata.c elfrdwrnop.c \
c0e8f3
+	elfshphehdr.c elfstrmerge.c elfstrtab.c emptyfile.c fillfile.c \
c0e8f3
+	find-prologues.c funcretval.c funcscopes.c get-aranges.c \
c0e8f3
+	get-files.c get-lines.c get-pubnames.c get-units-invalid.c \
c0e8f3
 	get-units-split.c getsrc_die.c hash.c line2addr.c \
c0e8f3
 	low_high_pc.c msg_tst.c newdata.c newfile.c newscn.c \
c0e8f3
 	next-files.c next-lines.c next_cfi.c peel_type.c rdwrmmap.c \
c0e8f3
@@ -744,15 +756,15 @@
c0e8f3
 	backtrace-dwarf.c buildid.c debugaltlink.c debuglink.c \
c0e8f3
 	deleted.c deleted-lib.c dwarf-die-addr-die.c dwarf-getmacros.c \
c0e8f3
 	dwarf-getstring.c dwarf-ranges.c dwarf_default_lower_bound.c \
c0e8f3
-	dwarfcfi.c dwelfgnucompressed.c dwfl-addr-sect.c \
c0e8f3
-	dwfl-bug-addr-overflow.c dwfl-bug-fd-leak.c \
c0e8f3
-	dwfl-bug-getmodules.c dwfl-bug-report.c dwfl-proc-attach.c \
c0e8f3
-	dwfl-report-elf-align.c dwfllines.c dwflmodtest.c dwflsyms.c \
c0e8f3
-	early-offscn.c ecp.c elfcopy.c elfgetchdr.c elfgetzdata.c \
c0e8f3
-	elfputzdata.c elfrdwrnop.c elfshphehdr.c elfstrmerge.c \
c0e8f3
-	elfstrtab.c emptyfile.c fillfile.c find-prologues.c \
c0e8f3
-	funcretval.c funcscopes.c get-aranges.c get-files.c \
c0e8f3
-	get-lines.c get-pubnames.c get-units-invalid.c \
c0e8f3
+	dwarfcfi.c $(dwelf_elf_e_machine_string_SOURCES) \
c0e8f3
+	dwelfgnucompressed.c dwfl-addr-sect.c dwfl-bug-addr-overflow.c \
c0e8f3
+	dwfl-bug-fd-leak.c dwfl-bug-getmodules.c dwfl-bug-report.c \
c0e8f3
+	dwfl-proc-attach.c dwfl-report-elf-align.c dwfllines.c \
c0e8f3
+	dwflmodtest.c dwflsyms.c early-offscn.c ecp.c elfcopy.c \
c0e8f3
+	elfgetchdr.c elfgetzdata.c elfputzdata.c elfrdwrnop.c \
c0e8f3
+	elfshphehdr.c elfstrmerge.c elfstrtab.c emptyfile.c fillfile.c \
c0e8f3
+	find-prologues.c funcretval.c funcscopes.c get-aranges.c \
c0e8f3
+	get-files.c get-lines.c get-pubnames.c get-units-invalid.c \
c0e8f3
 	get-units-split.c getsrc_die.c hash.c line2addr.c \
c0e8f3
 	low_high_pc.c msg_tst.c newdata.c newfile.c newscn.c \
c0e8f3
 	next-files.c next-lines.c next_cfi.c peel_type.c rdwrmmap.c \
c0e8f3
@@ -1416,7 +1428,8 @@
c0e8f3
 	     testfile-debug-rel-ppc64-z.o.bz2 \
c0e8f3
 	     testfile-debug-rel-ppc64.o.bz2 \
c0e8f3
 	     run-strip-version.sh testfile-version.bz2 \
c0e8f3
-	     run-xlate-note.sh
c0e8f3
+	     run-xlate-note.sh \
c0e8f3
+	     run-dwelf_elf_e_machine_string.sh
c0e8f3
 
c0e8f3
 @USE_VALGRIND_TRUE@valgrind_cmd = 'valgrind -q --leak-check=full --error-exitcode=1'
c0e8f3
 installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir); \
c0e8f3
@@ -1572,6 +1585,10 @@
c0e8f3
 addsections_LDADD = $(libelf)
c0e8f3
 xlate_notes_LDADD = $(libelf)
c0e8f3
 elfrdwrnop_LDADD = $(libelf)
c0e8f3
+dwelf_elf_e_machine_string_SOURCES = dwelf_elf_e_machine_string_test.c \
c0e8f3
+	../libdwelf/dwelf_elf_e_machine_string.c
c0e8f3
+
c0e8f3
+dwelf_elf_e_machine_string_LDADD = $(libelf) $(libdw)
c0e8f3
 
c0e8f3
 # We want to test the libelf header against the system elf.h header.
c0e8f3
 # Don't include any -I CPPFLAGS. Except when we install our own elf.h.
c0e8f3
@@ -1760,6 +1777,10 @@
c0e8f3
 	@rm -f dwarfcfi$(EXEEXT)
c0e8f3
 	$(AM_V_CCLD)$(LINK) $(dwarfcfi_OBJECTS) $(dwarfcfi_LDADD) $(LIBS)
c0e8f3
 
c0e8f3
+dwelf_elf_e_machine_string$(EXEEXT): $(dwelf_elf_e_machine_string_OBJECTS) $(dwelf_elf_e_machine_string_DEPENDENCIES) $(EXTRA_dwelf_elf_e_machine_string_DEPENDENCIES) 
c0e8f3
+	@rm -f dwelf_elf_e_machine_string$(EXEEXT)
c0e8f3
+	$(AM_V_CCLD)$(LINK) $(dwelf_elf_e_machine_string_OBJECTS) $(dwelf_elf_e_machine_string_LDADD) $(LIBS)
c0e8f3
+
c0e8f3
 dwelfgnucompressed$(EXEEXT): $(dwelfgnucompressed_OBJECTS) $(dwelfgnucompressed_DEPENDENCIES) $(EXTRA_dwelfgnucompressed_DEPENDENCIES) 
c0e8f3
 	@rm -f dwelfgnucompressed$(EXEEXT)
c0e8f3
 	$(AM_V_CCLD)$(LINK) $(dwelfgnucompressed_OBJECTS) $(dwelfgnucompressed_LDADD) $(LIBS)
c0e8f3
@@ -2079,6 +2100,8 @@
c0e8f3
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf-ranges.Po@am__quote@ # am--include-marker
c0e8f3
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarf_default_lower_bound.Po@am__quote@ # am--include-marker
c0e8f3
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwarfcfi.Po@am__quote@ # am--include-marker
c0e8f3
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwelf_elf_e_machine_string.Po@am__quote@ # am--include-marker
c0e8f3
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwelf_elf_e_machine_string_test.Po@am__quote@ # am--include-marker
c0e8f3
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwelfgnucompressed.Po@am__quote@ # am--include-marker
c0e8f3
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl-addr-sect.Po@am__quote@ # am--include-marker
c0e8f3
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dwfl-bug-addr-overflow.Po@am__quote@ # am--include-marker
c0e8f3
@@ -2211,6 +2234,20 @@
c0e8f3
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
c0e8f3
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(deleted_lib_so_CFLAGS) $(CFLAGS) -c -o deleted_lib_so-deleted-lib.obj `if test -f 'deleted-lib.c'; then $(CYGPATH_W) 'deleted-lib.c'; else $(CYGPATH_W) '$(srcdir)/deleted-lib.c'; fi`
c0e8f3
 
c0e8f3
+dwelf_elf_e_machine_string.o: ../libdwelf/dwelf_elf_e_machine_string.c
c0e8f3
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwelf_elf_e_machine_string.o -MD -MP -MF $(DEPDIR)/dwelf_elf_e_machine_string.Tpo -c -o dwelf_elf_e_machine_string.o `test -f '../libdwelf/dwelf_elf_e_machine_string.c' || echo '$(srcdir)/'`../libdwelf/dwelf_elf_e_machine_string.c
c0e8f3
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/dwelf_elf_e_machine_string.Tpo $(DEPDIR)/dwelf_elf_e_machine_string.Po
c0e8f3
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='../libdwelf/dwelf_elf_e_machine_string.c' object='dwelf_elf_e_machine_string.o' libtool=no @AMDEPBACKSLASH@
c0e8f3
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
c0e8f3
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwelf_elf_e_machine_string.o `test -f '../libdwelf/dwelf_elf_e_machine_string.c' || echo '$(srcdir)/'`../libdwelf/dwelf_elf_e_machine_string.c
c0e8f3
+
c0e8f3
+dwelf_elf_e_machine_string.obj: ../libdwelf/dwelf_elf_e_machine_string.c
c0e8f3
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dwelf_elf_e_machine_string.obj -MD -MP -MF $(DEPDIR)/dwelf_elf_e_machine_string.Tpo -c -o dwelf_elf_e_machine_string.obj `if test -f '../libdwelf/dwelf_elf_e_machine_string.c'; then $(CYGPATH_W) '../libdwelf/dwelf_elf_e_machine_string.c'; else $(CYGPATH_W) '$(srcdir)/../libdwelf/dwelf_elf_e_machine_string.c'; fi`
c0e8f3
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/dwelf_elf_e_machine_string.Tpo $(DEPDIR)/dwelf_elf_e_machine_string.Po
c0e8f3
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='../libdwelf/dwelf_elf_e_machine_string.c' object='dwelf_elf_e_machine_string.obj' libtool=no @AMDEPBACKSLASH@
c0e8f3
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
c0e8f3
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dwelf_elf_e_machine_string.obj `if test -f '../libdwelf/dwelf_elf_e_machine_string.c'; then $(CYGPATH_W) '../libdwelf/dwelf_elf_e_machine_string.c'; else $(CYGPATH_W) '$(srcdir)/../libdwelf/dwelf_elf_e_machine_string.c'; fi`
c0e8f3
+
c0e8f3
 system_elf_libelf_test-system-elf-libelf-test.o: system-elf-libelf-test.c
c0e8f3
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(system_elf_libelf_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT system_elf_libelf_test-system-elf-libelf-test.o -MD -MP -MF $(DEPDIR)/system_elf_libelf_test-system-elf-libelf-test.Tpo -c -o system_elf_libelf_test-system-elf-libelf-test.o `test -f 'system-elf-libelf-test.c' || echo '$(srcdir)/'`system-elf-libelf-test.c
c0e8f3
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) $(DEPDIR)/system_elf_libelf_test-system-elf-libelf-test.Tpo $(DEPDIR)/system_elf_libelf_test-system-elf-libelf-test.Po
c0e8f3
@@ -3776,6 +3813,13 @@
c0e8f3
 	--log-file $$b.log --trs-file $$b.trs \
c0e8f3
 	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
c0e8f3
 	"$$tst" $(AM_TESTS_FD_REDIRECT)
c0e8f3
+run-dwelf_elf_e_machine_string.sh.log: run-dwelf_elf_e_machine_string.sh
c0e8f3
+	@p='run-dwelf_elf_e_machine_string.sh'; \
c0e8f3
+	b='run-dwelf_elf_e_machine_string.sh'; \
c0e8f3
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
c0e8f3
+	--log-file $$b.log --trs-file $$b.trs \
c0e8f3
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
c0e8f3
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
c0e8f3
 msg_tst.log: msg_tst$(EXEEXT)
c0e8f3
 	@p='msg_tst$(EXEEXT)'; \
c0e8f3
 	b='msg_tst'; \
c0e8f3
@@ -4005,6 +4049,8 @@
c0e8f3
 	-rm -f ./$(DEPDIR)/dwarf-ranges.Po
c0e8f3
 	-rm -f ./$(DEPDIR)/dwarf_default_lower_bound.Po
c0e8f3
 	-rm -f ./$(DEPDIR)/dwarfcfi.Po
c0e8f3
+	-rm -f ./$(DEPDIR)/dwelf_elf_e_machine_string.Po
c0e8f3
+	-rm -f ./$(DEPDIR)/dwelf_elf_e_machine_string_test.Po
c0e8f3
 	-rm -f ./$(DEPDIR)/dwelfgnucompressed.Po
c0e8f3
 	-rm -f ./$(DEPDIR)/dwfl-addr-sect.Po
c0e8f3
 	-rm -f ./$(DEPDIR)/dwfl-bug-addr-overflow.Po
c0e8f3
@@ -4156,6 +4202,8 @@
c0e8f3
 	-rm -f ./$(DEPDIR)/dwarf-ranges.Po
c0e8f3
 	-rm -f ./$(DEPDIR)/dwarf_default_lower_bound.Po
c0e8f3
 	-rm -f ./$(DEPDIR)/dwarfcfi.Po
c0e8f3
+	-rm -f ./$(DEPDIR)/dwelf_elf_e_machine_string.Po
c0e8f3
+	-rm -f ./$(DEPDIR)/dwelf_elf_e_machine_string_test.Po
c0e8f3
 	-rm -f ./$(DEPDIR)/dwelfgnucompressed.Po
c0e8f3
 	-rm -f ./$(DEPDIR)/dwfl-addr-sect.Po
c0e8f3
 	-rm -f ./$(DEPDIR)/dwfl-bug-addr-overflow.Po