Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Oct 2018 15:08:41 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r339083 - head/contrib/elftoolchain/libelf
Message-ID:  <201810021508.w92F8fgs099788@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: emaste
Date: Tue Oct  2 15:08:41 2018
New Revision: 339083
URL: https://svnweb.freebsd.org/changeset/base/339083

Log:
  libelf: correct mips64el test to use ELF header
  
  libelf maintains two views of endianness: e_byteorder, and
  e_ident[EI_DATA] in the ELF header itself.  e_byteorder is not always
  kept in sync, so use the ELF header endianness to test for mips64el.
  
  PR:		231790
  Bisected by:	sbruno
  Reviewed by:	jhb
  Approved by:	re (kib)
  MFC with:	r338478
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D17380

Modified:
  head/contrib/elftoolchain/libelf/gelf_mips64el.c

Modified: head/contrib/elftoolchain/libelf/gelf_mips64el.c
==============================================================================
--- head/contrib/elftoolchain/libelf/gelf_mips64el.c	Tue Oct  2 13:45:25 2018	(r339082)
+++ head/contrib/elftoolchain/libelf/gelf_mips64el.c	Tue Oct  2 15:08:41 2018	(r339083)
@@ -34,8 +34,9 @@ int
 _libelf_is_mips64el(Elf *e)
 {
 
-	return (e->e_kind == ELF_K_ELF && e->e_byteorder == ELFDATA2LSB &&
-	    e->e_u.e_elf.e_ehdr.e_ehdr64->e_machine == EM_MIPS);
+	return (e->e_kind == ELF_K_ELF &&
+	    e->e_u.e_elf.e_ehdr.e_ehdr64->e_machine == EM_MIPS &&
+	    e->e_u.e_elf.e_ehdr.e_ehdr64->e_ident[EI_DATA] == ELFDATA2LSB);
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201810021508.w92F8fgs099788>