d1bbc4
commit 28b5f578ae772bb2404c3847e4e22ad1c407af54
d1bbc4
Author: Mark Wielaard <mark@klomp.org>
d1bbc4
Date:   Tue Apr 30 13:00:17 2019 +0200
d1bbc4
d1bbc4
    libelf: If xlate can only convert the ELF note header, just do that.
d1bbc4
    
d1bbc4
    When we started parsing new style ELF_T_NHDR8 notes we added extra
d1bbc4
    checks on alignment and padding. When those failed we would stop
d1bbc4
    converting and just return the rest of the ELF Note unconverted.
d1bbc4
    In the case were we just had enough data for just the ELF Note header
d1bbc4
    and the destionation and source weren't the same we would then
d1bbc4
    accidentially throw away the Note header conversion we just did.
d1bbc4
    
d1bbc4
    Fix that by indicating we did correctly convert just the header.
d1bbc4
    
d1bbc4
    Adds testcase that compares parsing ELF notes with gelf_getnote
d1bbc4
    and parsing the raw data by hand using elf32_xlatetom using just
d1bbc4
    the Note header and ignoring the (raw) note data.
d1bbc4
    
d1bbc4
    Signed-off-by: Mark Wielaard <mark@klomp.org>
d1bbc4
d1bbc4
diff --git a/libelf/note_xlate.h b/libelf/note_xlate.h
d1bbc4
index bc9950f..7e2784b 100644
d1bbc4
--- a/libelf/note_xlate.h
d1bbc4
+++ b/libelf/note_xlate.h
d1bbc4
@@ -47,13 +47,25 @@ elf_cvt_note (void *dest, const void *src, size_t len, int encode,
d1bbc4
       note_len += n->n_namesz;
d1bbc4
       note_len = nhdr8 ? NOTE_ALIGN8 (note_len) : NOTE_ALIGN4 (note_len);
d1bbc4
       if (note_len > len || note_len < sizeof *n)
d1bbc4
-	break;
d1bbc4
+	{
d1bbc4
+	  /* Header was translated, nothing else.  */
d1bbc4
+	  len -= sizeof *n;
d1bbc4
+	  src += sizeof *n;
d1bbc4
+	  dest += sizeof *n;
d1bbc4
+	  break;
d1bbc4
+	}
d1bbc4
 
d1bbc4
       /* data as a whole needs to be aligned.  */
d1bbc4
       note_len += n->n_descsz;
d1bbc4
       note_len = nhdr8 ? NOTE_ALIGN8 (note_len) : NOTE_ALIGN4 (note_len);
d1bbc4
       if (note_len > len || note_len < sizeof *n)
d1bbc4
-	break;
d1bbc4
+	{
d1bbc4
+	  /* Header was translated, nothing else.  */
d1bbc4
+	  len -= sizeof *n;
d1bbc4
+	  src += sizeof *n;
d1bbc4
+	  dest += sizeof *n;
d1bbc4
+	  break;
d1bbc4
+	}
d1bbc4
 
d1bbc4
       /* Copy or skip the note data.  */
d1bbc4
       size_t note_data_len = note_len - sizeof *n;
d1bbc4
diff --git a/tests/Makefile.am b/tests/Makefile.am
d1bbc4
index 1b0c7d3..498c1db 100644
d1bbc4
--- a/tests/Makefile.am
d1bbc4
+++ b/tests/Makefile.am
d1bbc4
@@ -60,7 +60,7 @@ check_PROGRAMS = arextract arsymtest newfile saridx scnnames sectiondump \
d1bbc4
 		  fillfile dwarf_default_lower_bound dwarf-die-addr-die \
d1bbc4
 		  get-units-invalid get-units-split attr-integrate-skel \
d1bbc4
 		  all-dwarf-ranges unit-info next_cfi \
d1bbc4
-		  elfcopy addsections
d1bbc4
+		  elfcopy addsections xlate_notes
d1bbc4
 
d1bbc4
 asm_TESTS = asm-tst1 asm-tst2 asm-tst3 asm-tst4 asm-tst5 \
d1bbc4
 	    asm-tst6 asm-tst7 asm-tst8 asm-tst9
d1bbc4
@@ -159,7 +159,7 @@ TESTS = run-arextract.sh run-arsymtest.sh run-ar.sh newfile test-nlist \
d1bbc4
 	run-next-cfi.sh run-next-cfi-self.sh \
d1bbc4
 	run-copyadd-sections.sh run-copymany-sections.sh \
d1bbc4
 	run-typeiter-many.sh run-strip-test-many.sh \
d1bbc4
-	run-strip-version.sh
d1bbc4
+	run-strip-version.sh run-xlate-note.sh
d1bbc4
 
d1bbc4
 if !BIARCH
d1bbc4
 export ELFUTILS_DISABLE_BIARCH = 1
d1bbc4
@@ -423,7 +423,8 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \
d1bbc4
 	     testfile-debug-rel-ppc64-g.o.bz2 \
d1bbc4
 	     testfile-debug-rel-ppc64-z.o.bz2 \
d1bbc4
 	     testfile-debug-rel-ppc64.o.bz2 \
d1bbc4
-	     run-strip-version.sh testfile-version.bz2
d1bbc4
+	     run-strip-version.sh testfile-version.bz2 \
d1bbc4
+	     run-xlate-note.sh
d1bbc4
 
d1bbc4
 if USE_VALGRIND
d1bbc4
 valgrind_cmd='valgrind -q --leak-check=full --error-exitcode=1'
d1bbc4
@@ -593,6 +594,7 @@ unit_info_LDADD = $(libdw)
d1bbc4
 next_cfi_LDADD = $(libelf) $(libdw)
d1bbc4
 elfcopy_LDADD = $(libelf)
d1bbc4
 addsections_LDADD = $(libelf)
d1bbc4
+xlate_notes_LDADD = $(libelf)
d1bbc4
 
d1bbc4
 # We want to test the libelf header against the system elf.h header.
d1bbc4
 # Don't include any -I CPPFLAGS. Except when we install our own elf.h.
d1bbc4
diff --git a/tests/run-xlate-note.sh b/tests/run-xlate-note.sh
d1bbc4
new file mode 100755
d1bbc4
index 0000000..a907418
d1bbc4
--- /dev/null
d1bbc4
+++ b/tests/run-xlate-note.sh
d1bbc4
@@ -0,0 +1,93 @@
d1bbc4
+# Copyright (C) 2019 Red Hat, Inc.
d1bbc4
+# This file is part of elfutils.
d1bbc4
+#
d1bbc4
+# This file is free software; you can redistribute it and/or modify
d1bbc4
+# it under the terms of the GNU General Public License as published by
d1bbc4
+# the Free Software Foundation; either version 3 of the License, or
d1bbc4
+# (at your option) any later version.
d1bbc4
+#
d1bbc4
+# elfutils is distributed in the hope that it will be useful, but
d1bbc4
+# WITHOUT ANY WARRANTY; without even the implied warranty of
d1bbc4
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
d1bbc4
+# GNU General Public License for more details.
d1bbc4
+#
d1bbc4
+# You should have received a copy of the GNU General Public License
d1bbc4
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
d1bbc4
+
d1bbc4
+. $srcdir/test-subr.sh
d1bbc4
+
d1bbc4
+testfiles testfileppc32
d1bbc4
+testrun_compare ${abs_top_builddir}/tests/xlate_notes testfileppc32 << EOF
d1bbc4
+Notes in section 2:
d1bbc4
+type: 1,1, namesz: 4,4, descsz: 16,16
d1bbc4
+Notes in section 3:
d1bbc4
+type: 3,3, namesz: 4,4, descsz: 20,20
d1bbc4
+EOF
d1bbc4
+
d1bbc4
+testfiles testfileppc64
d1bbc4
+testrun_compare ${abs_top_builddir}/tests/xlate_notes testfileppc64 << EOF
d1bbc4
+Notes in section 2:
d1bbc4
+type: 1,1, namesz: 4,4, descsz: 16,16
d1bbc4
+Notes in section 3:
d1bbc4
+type: 3,3, namesz: 4,4, descsz: 20,20
d1bbc4
+EOF
d1bbc4
+
d1bbc4
+testfiles testfiles390
d1bbc4
+testrun_compare ${abs_top_builddir}/tests/xlate_notes testfiles390 << EOF
d1bbc4
+Notes in section 2:
d1bbc4
+type: 1,1, namesz: 4,4, descsz: 16,16
d1bbc4
+Notes in section 3:
d1bbc4
+type: 3,3, namesz: 4,4, descsz: 20,20
d1bbc4
+EOF
d1bbc4
+
d1bbc4
+testfiles testfiles390x
d1bbc4
+testrun_compare ${abs_top_builddir}/tests/xlate_notes testfiles390x << EOF
d1bbc4
+Notes in section 2:
d1bbc4
+type: 1,1, namesz: 4,4, descsz: 16,16
d1bbc4
+Notes in section 3:
d1bbc4
+type: 3,3, namesz: 4,4, descsz: 20,20
d1bbc4
+EOF
d1bbc4
+
d1bbc4
+testfiles testfileaarch64
d1bbc4
+testrun_compare ${abs_top_builddir}/tests/xlate_notes testfileaarch64 << EOF
d1bbc4
+Notes in section 2:
d1bbc4
+type: 1,1, namesz: 4,4, descsz: 16,16
d1bbc4
+Notes in section 3:
d1bbc4
+type: 3,3, namesz: 4,4, descsz: 20,20
d1bbc4
+EOF
d1bbc4
+
d1bbc4
+testfiles testfilearm
d1bbc4
+testrun_compare ${abs_top_builddir}/tests/xlate_notes testfilearm << EOF
d1bbc4
+Notes in section 2:
d1bbc4
+type: 1,1, namesz: 4,4, descsz: 16,16
d1bbc4
+Notes in section 3:
d1bbc4
+type: 3,3, namesz: 4,4, descsz: 20,20
d1bbc4
+EOF
d1bbc4
+
d1bbc4
+testfiles testfile_gnu_props.32be.o
d1bbc4
+testrun_compare ${abs_top_builddir}/tests/xlate_notes testfile_gnu_props.32be.o << EOF
d1bbc4
+Notes in section 4:
d1bbc4
+type: 5,5, namesz: 4,4, descsz: 12,12
d1bbc4
+type: 5,5, namesz: 4,4, descsz: 8,8
d1bbc4
+EOF
d1bbc4
+
d1bbc4
+testfiles testfile_gnu_props.32le.o
d1bbc4
+testrun_compare ${abs_top_builddir}/tests/xlate_notes testfile_gnu_props.32le.o << EOF
d1bbc4
+Notes in section 4:
d1bbc4
+type: 5,5, namesz: 4,4, descsz: 12,12
d1bbc4
+type: 5,5, namesz: 4,4, descsz: 8,8
d1bbc4
+EOF
d1bbc4
+
d1bbc4
+testfiles testfile_gnu_props.64be.o
d1bbc4
+testrun_compare ${abs_top_builddir}/tests/xlate_notes testfile_gnu_props.64be.o << EOF
d1bbc4
+Notes in section 4:
d1bbc4
+type: 5,5, namesz: 4,4, descsz: 16,16
d1bbc4
+type: 5,5, namesz: 4,4, descsz: 8,8
d1bbc4
+EOF
d1bbc4
+
d1bbc4
+testfiles testfile_gnu_props.64le.o
d1bbc4
+testrun_compare ${abs_top_builddir}/tests/xlate_notes testfile_gnu_props.64le.o << EOF
d1bbc4
+Notes in section 4:
d1bbc4
+type: 5,5, namesz: 4,4, descsz: 16,16
d1bbc4
+type: 5,5, namesz: 4,4, descsz: 8,8
d1bbc4
+EOF
d1bbc4
diff --git a/tests/xlate_notes.c b/tests/xlate_notes.c
d1bbc4
new file mode 100644
d1bbc4
index 0000000..90a4ae2
d1bbc4
--- /dev/null
d1bbc4
+++ b/tests/xlate_notes.c
d1bbc4
@@ -0,0 +1,157 @@
d1bbc4
+/* Test program for extracting ELF Note headers and getting whole notes.
d1bbc4
+   Copyright (C) 2019 Red Hat, Inc.
d1bbc4
+   This file is part of elfutils.
d1bbc4
+
d1bbc4
+   This file is free software; you can redistribute it and/or modify
d1bbc4
+   it under the terms of the GNU General Public License as published by
d1bbc4
+   the Free Software Foundation; either version 3 of the License, or
d1bbc4
+   (at your option) any later version.
d1bbc4
+
d1bbc4
+   elfutils is distributed in the hope that it will be useful, but
d1bbc4
+   WITHOUT ANY WARRANTY; without even the implied warranty of
d1bbc4
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
d1bbc4
+   GNU General Public License for more details.
d1bbc4
+
d1bbc4
+   You should have received a copy of the GNU General Public License
d1bbc4
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
d1bbc4
+
d1bbc4
+#ifdef HAVE_CONFIG_H
d1bbc4
+# include <config.h>
d1bbc4
+#endif
d1bbc4
+
d1bbc4
+#include <errno.h>
d1bbc4
+#include <fcntl.h>
d1bbc4
+#include <inttypes.h>
d1bbc4
+#include <stdio.h>
d1bbc4
+#include <stdlib.h>
d1bbc4
+#include <string.h>
d1bbc4
+#include <unistd.h>
d1bbc4
+
d1bbc4
+#include ELFUTILS_HEADER(elf)
d1bbc4
+#include <gelf.h>
d1bbc4
+
d1bbc4
+int
d1bbc4
+main (int argc, char *argv[])
d1bbc4
+{
d1bbc4
+  if (argc != 2)
d1bbc4
+    {
d1bbc4
+      printf ("No ELF file given as argument\n");
d1bbc4
+      exit (1);
d1bbc4
+    }
d1bbc4
+
d1bbc4
+  const char *fname = argv[1];
d1bbc4
+
d1bbc4
+  // Initialize libelf.
d1bbc4
+  elf_version (EV_CURRENT);
d1bbc4
+
d1bbc4
+  /* Read the ELF from disk now.  */
d1bbc4
+  int fd = open (fname, O_RDONLY);
d1bbc4
+  if (fd == -1)
d1bbc4
+    {
d1bbc4
+      printf ("cannot open '%s': %s\n", fname, strerror (errno));
d1bbc4
+      exit (1);
d1bbc4
+    }
d1bbc4
+
d1bbc4
+  Elf *elf = elf_begin (fd, ELF_C_READ, NULL);
d1bbc4
+  if (elf == NULL)
d1bbc4
+    {
d1bbc4
+      printf ("cannot create ELF descriptor: %s\n", elf_errmsg (-1));
d1bbc4
+      exit (1);
d1bbc4
+    }
d1bbc4
+
d1bbc4
+  GElf_Ehdr ehdr;
d1bbc4
+  if (gelf_getehdr (elf, &ehdr) == NULL)
d1bbc4
+    {
d1bbc4
+      printf ("cannot get Ehdr: %s\n", elf_errmsg (-1));
d1bbc4
+      exit (1);
d1bbc4
+    }
d1bbc4
+
d1bbc4
+  /* Search for all SHT_NOTE sections.  */
d1bbc4
+  Elf_Scn *scn = NULL;
d1bbc4
+  while ((scn = elf_nextscn (elf, scn)) != NULL)
d1bbc4
+    {
d1bbc4
+      /* Get the header.  */
d1bbc4
+      GElf_Shdr shdr;
d1bbc4
+      if (gelf_getshdr (scn, &shdr) == NULL)
d1bbc4
+	{
d1bbc4
+	  printf ("couldn't get shdr: %s\n", elf_errmsg (-1));
d1bbc4
+	  exit (1);
d1bbc4
+	}
d1bbc4
+
d1bbc4
+      if (shdr.sh_type == SHT_NOTE)
d1bbc4
+	{
d1bbc4
+	  printf ("Notes in section %zd:\n", elf_ndxscn (scn));
d1bbc4
+
d1bbc4
+	  Elf_Data *raw = elf_rawdata (scn, NULL);
d1bbc4
+	  if (raw == NULL)
d1bbc4
+	    {
d1bbc4
+	      printf ("couldn't get raw data: %s\n", elf_errmsg (-1));
d1bbc4
+	      exit (1);
d1bbc4
+	    }
d1bbc4
+
d1bbc4
+	  Elf_Data *data = elf_getdata (scn, NULL);
d1bbc4
+	  if (data == NULL)
d1bbc4
+	    {
d1bbc4
+	      printf ("couldn't get data: %s\n", elf_errmsg (-1));
d1bbc4
+	      exit (1);
d1bbc4
+	    }
d1bbc4
+
d1bbc4
+	  size_t off = 0;
d1bbc4
+	  size_t next;
d1bbc4
+	  GElf_Nhdr nhdr;
d1bbc4
+	  size_t n_off;
d1bbc4
+	  size_t d_off;
d1bbc4
+	  while ((next = gelf_getnote (data, off, &nhdr, &n_off, &d_off)) > 0)
d1bbc4
+	    {
d1bbc4
+	      /* Now just get the note header "raw" (don't
d1bbc4
+		 copy/translate the note data). This only handles
d1bbc4
+		 traditional GNU ELF Notes, so we still use the next
d1bbc4
+		 from gelf_getnote (padding is different for new style
d1bbc4
+		 ELF_T_NHDR8 notes).  */
d1bbc4
+	      Elf32_Nhdr nh;
d1bbc4
+	      Elf_Data src =
d1bbc4
+                {
d1bbc4
+                  .d_version = EV_CURRENT, .d_type = ELF_T_NHDR,
d1bbc4
+		  .d_size = sizeof nh
d1bbc4
+                };
d1bbc4
+	      Elf_Data dst = src;
d1bbc4
+	      src.d_buf = raw->d_buf + off;
d1bbc4
+	      dst.d_buf = &nh;
d1bbc4
+
d1bbc4
+	      if (elf32_xlatetom (&dst, &src, ehdr.e_ident[EI_DATA]) == NULL)
d1bbc4
+		{
d1bbc4
+		  printf ("couldn't xlate note: %s\n", elf_errmsg (-1));
d1bbc4
+		  exit (1);
d1bbc4
+		}
d1bbc4
+
d1bbc4
+	      printf ("type: %" PRId32 ",%" PRId32
d1bbc4
+		      ", namesz: %" PRId32 ",%" PRId32
d1bbc4
+		      ", descsz: %" PRId32 ",%" PRId32 "\n",
d1bbc4
+		      nhdr.n_type, nh.n_type,
d1bbc4
+		      nhdr.n_namesz, nh.n_namesz,
d1bbc4
+		      nhdr.n_descsz, nh.n_descsz);
d1bbc4
+
d1bbc4
+	      if (nhdr.n_type != nh.n_type
d1bbc4
+		  || nhdr.n_namesz != nh.n_namesz
d1bbc4
+		  || nhdr.n_descsz != nh.n_descsz)
d1bbc4
+		{
d1bbc4
+		  printf ("Nhdrs not equal!\n");
d1bbc4
+		  exit (1);
d1bbc4
+		}
d1bbc4
+
d1bbc4
+	      off = next;
d1bbc4
+	    }
d1bbc4
+	}
d1bbc4
+
d1bbc4
+    }
d1bbc4
+
d1bbc4
+  if (elf_end (elf) != 0)
d1bbc4
+    {
d1bbc4
+      printf ("failure in elf_end: %s\n", elf_errmsg (-1));
d1bbc4
+      exit (1);
d1bbc4
+    }
d1bbc4
+
d1bbc4
+  close (fd);
d1bbc4
+
d1bbc4
+  return 0;
d1bbc4
+}
d1bbc4
diff -ur elfutils-0.176.orig/tests/Makefile.in elfutils-0.176/tests/Makefile.in
d1bbc4
--- elfutils-0.176.orig/tests/Makefile.in	2019-04-30 22:42:49.534655124 +0200
d1bbc4
+++ elfutils-0.176/tests/Makefile.in	2019-04-30 22:46:30.046656790 +0200
d1bbc4
@@ -131,8 +131,8 @@
d1bbc4
 	get-units-invalid$(EXEEXT) get-units-split$(EXEEXT) \
d1bbc4
 	attr-integrate-skel$(EXEEXT) all-dwarf-ranges$(EXEEXT) \
d1bbc4
 	unit-info$(EXEEXT) next_cfi$(EXEEXT) elfcopy$(EXEEXT) \
d1bbc4
-	addsections$(EXEEXT) $(am__EXEEXT_1) $(am__EXEEXT_2) \
d1bbc4
-	$(am__EXEEXT_4)
d1bbc4
+	addsections$(EXEEXT) xlate_notes$(EXEEXT) $(am__EXEEXT_1) \
d1bbc4
+	$(am__EXEEXT_2) $(am__EXEEXT_4)
d1bbc4
 @BIARCH_TRUE@am__append_5 = backtrace-child-biarch
d1bbc4
 TESTS = run-arextract.sh run-arsymtest.sh run-ar.sh newfile$(EXEEXT) \
d1bbc4
 	test-nlist$(EXEEXT) update1$(EXEEXT) update2$(EXEEXT) \
d1bbc4
@@ -211,8 +211,8 @@
d1bbc4
 	run-unit-info.sh run-reloc-bpf.sh run-next-cfi.sh \
d1bbc4
 	run-next-cfi-self.sh run-copyadd-sections.sh \
d1bbc4
 	run-copymany-sections.sh run-typeiter-many.sh \
d1bbc4
-	run-strip-test-many.sh run-strip-version.sh $(am__EXEEXT_2) \
d1bbc4
-	$(am__append_8) $(am__EXEEXT_5)
d1bbc4
+	run-strip-test-many.sh run-strip-version.sh run-xlate-note.sh \
d1bbc4
+	$(am__EXEEXT_2) $(am__append_8) $(am__EXEEXT_5)
d1bbc4
 @STANDALONE_FALSE@am__append_6 = msg_tst system-elf-libelf-test
d1bbc4
 @STANDALONE_FALSE@am__append_7 = msg_tst system-elf-libelf-test
d1bbc4
 @LZMA_TRUE@am__append_8 = run-readelf-s.sh run-dwflsyms.sh
d1bbc4
@@ -606,6 +606,9 @@
d1bbc4
 vendorelf_SOURCES = vendorelf.c
d1bbc4
 vendorelf_OBJECTS = vendorelf.$(OBJEXT)
d1bbc4
 vendorelf_DEPENDENCIES = $(am__DEPENDENCIES_2)
d1bbc4
+xlate_notes_SOURCES = xlate_notes.c
d1bbc4
+xlate_notes_OBJECTS = xlate_notes.$(OBJEXT)
d1bbc4
+xlate_notes_DEPENDENCIES = $(am__DEPENDENCIES_2)
d1bbc4
 zstrptr_SOURCES = zstrptr.c
d1bbc4
 zstrptr_OBJECTS = zstrptr.$(OBJEXT)
d1bbc4
 zstrptr_DEPENDENCIES = $(am__DEPENDENCIES_2)
d1bbc4
@@ -683,7 +686,7 @@
d1bbc4
 	./$(DEPDIR)/update2.Po ./$(DEPDIR)/update3.Po \
d1bbc4
 	./$(DEPDIR)/update4.Po ./$(DEPDIR)/varlocs.Po \
d1bbc4
 	./$(DEPDIR)/vdsosyms.Po ./$(DEPDIR)/vendorelf.Po \
d1bbc4
-	./$(DEPDIR)/zstrptr.Po
d1bbc4
+	./$(DEPDIR)/xlate_notes.Po ./$(DEPDIR)/zstrptr.Po
d1bbc4
 am__mv = mv -f
d1bbc4
 AM_V_lt = $(am__v_lt_@AM_V@)
d1bbc4
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
d1bbc4
@@ -726,7 +729,8 @@
d1bbc4
 	showptable.c strptr.c system-elf-libelf-test.c \
d1bbc4
 	test-elf_cntl_gelf_getshdr.c test-flag-nobits.c test-nlist.c \
d1bbc4
 	typeiter.c typeiter2.c unit-info.c update1.c update2.c \
d1bbc4
-	update3.c update4.c varlocs.c vdsosyms.c vendorelf.c zstrptr.c
d1bbc4
+	update3.c update4.c varlocs.c vdsosyms.c vendorelf.c \
d1bbc4
+	xlate_notes.c zstrptr.c
d1bbc4
 DIST_SOURCES = addrcfi.c addrscopes.c addsections.c aggregate_size.c \
d1bbc4
 	all-dwarf-ranges.c alldts.c allfcts.c allregs.c arextract.c \
d1bbc4
 	arls.c arsymtest.c asm-tst1.c asm-tst2.c asm-tst3.c asm-tst4.c \
d1bbc4
@@ -752,7 +756,8 @@
d1bbc4
 	showptable.c strptr.c system-elf-libelf-test.c \
d1bbc4
 	test-elf_cntl_gelf_getshdr.c test-flag-nobits.c test-nlist.c \
d1bbc4
 	typeiter.c typeiter2.c unit-info.c update1.c update2.c \
d1bbc4
-	update3.c update4.c varlocs.c vdsosyms.c vendorelf.c zstrptr.c
d1bbc4
+	update3.c update4.c varlocs.c vdsosyms.c vendorelf.c \
d1bbc4
+	xlate_notes.c zstrptr.c
d1bbc4
 am__can_run_installinfo = \
d1bbc4
   case $$AM_UPDATE_INFO_DIR in \
d1bbc4
     n|no|NO) false;; \
d1bbc4
@@ -1405,7 +1410,8 @@
d1bbc4
 	     testfile-debug-rel-ppc64-g.o.bz2 \
d1bbc4
 	     testfile-debug-rel-ppc64-z.o.bz2 \
d1bbc4
 	     testfile-debug-rel-ppc64.o.bz2 \
d1bbc4
-	     run-strip-version.sh testfile-version.bz2
d1bbc4
+	     run-strip-version.sh testfile-version.bz2 \
d1bbc4
+	     run-xlate-note.sh
d1bbc4
 
d1bbc4
 @USE_VALGRIND_TRUE@valgrind_cmd = 'valgrind -q --leak-check=full --error-exitcode=1'
d1bbc4
 installed_TESTS_ENVIRONMENT = libdir=$(DESTDIR)$(libdir); \
d1bbc4
@@ -1559,6 +1565,7 @@
d1bbc4
 next_cfi_LDADD = $(libelf) $(libdw)
d1bbc4
 elfcopy_LDADD = $(libelf)
d1bbc4
 addsections_LDADD = $(libelf)
d1bbc4
+xlate_notes_LDADD = $(libelf)
d1bbc4
 
d1bbc4
 # We want to test the libelf header against the system elf.h header.
d1bbc4
 # Don't include any -I CPPFLAGS. Except when we install our own elf.h.
d1bbc4
@@ -2011,6 +2018,10 @@
d1bbc4
 	@rm -f vendorelf$(EXEEXT)
d1bbc4
 	$(AM_V_CCLD)$(LINK) $(vendorelf_OBJECTS) $(vendorelf_LDADD) $(LIBS)
d1bbc4
 
d1bbc4
+xlate_notes$(EXEEXT): $(xlate_notes_OBJECTS) $(xlate_notes_DEPENDENCIES) $(EXTRA_xlate_notes_DEPENDENCIES) 
d1bbc4
+	@rm -f xlate_notes$(EXEEXT)
d1bbc4
+	$(AM_V_CCLD)$(LINK) $(xlate_notes_OBJECTS) $(xlate_notes_LDADD) $(LIBS)
d1bbc4
+
d1bbc4
 zstrptr$(EXEEXT): $(zstrptr_OBJECTS) $(zstrptr_DEPENDENCIES) $(EXTRA_zstrptr_DEPENDENCIES) 
d1bbc4
 	@rm -f zstrptr$(EXEEXT)
d1bbc4
 	$(AM_V_CCLD)$(LINK) $(zstrptr_OBJECTS) $(zstrptr_LDADD) $(LIBS)
d1bbc4
@@ -2124,6 +2135,7 @@
d1bbc4
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varlocs.Po@am__quote@ # am--include-marker
d1bbc4
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vdsosyms.Po@am__quote@ # am--include-marker
d1bbc4
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vendorelf.Po@am__quote@ # am--include-marker
d1bbc4
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xlate_notes.Po@am__quote@ # am--include-marker
d1bbc4
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zstrptr.Po@am__quote@ # am--include-marker
d1bbc4
 
d1bbc4
 $(am__depfiles_remade):
d1bbc4
@@ -3732,6 +3744,13 @@
d1bbc4
 	--log-file $$b.log --trs-file $$b.trs \
d1bbc4
 	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
d1bbc4
 	"$$tst" $(AM_TESTS_FD_REDIRECT)
d1bbc4
+run-xlate-note.sh.log: run-xlate-note.sh
d1bbc4
+	@p='run-xlate-note.sh'; \
d1bbc4
+	b='run-xlate-note.sh'; \
d1bbc4
+	$(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \
d1bbc4
+	--log-file $$b.log --trs-file $$b.trs \
d1bbc4
+	$(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \
d1bbc4
+	"$$tst" $(AM_TESTS_FD_REDIRECT)
d1bbc4
 msg_tst.log: msg_tst$(EXEEXT)
d1bbc4
 	@p='msg_tst$(EXEEXT)'; \
d1bbc4
 	b='msg_tst'; \
d1bbc4
@@ -4027,6 +4046,7 @@
d1bbc4
 	-rm -f ./$(DEPDIR)/varlocs.Po
d1bbc4
 	-rm -f ./$(DEPDIR)/vdsosyms.Po
d1bbc4
 	-rm -f ./$(DEPDIR)/vendorelf.Po
d1bbc4
+	-rm -f ./$(DEPDIR)/xlate_notes.Po
d1bbc4
 	-rm -f ./$(DEPDIR)/zstrptr.Po
d1bbc4
 	-rm -f Makefile
d1bbc4
 distclean-am: clean-am distclean-compile distclean-generic \
d1bbc4
@@ -4176,6 +4196,7 @@
d1bbc4
 	-rm -f ./$(DEPDIR)/varlocs.Po
d1bbc4
 	-rm -f ./$(DEPDIR)/vdsosyms.Po
d1bbc4
 	-rm -f ./$(DEPDIR)/vendorelf.Po
d1bbc4
+	-rm -f ./$(DEPDIR)/xlate_notes.Po
d1bbc4
 	-rm -f ./$(DEPDIR)/zstrptr.Po
d1bbc4
 	-rm -f Makefile
d1bbc4
 maintainer-clean-am: distclean-am maintainer-clean-generic