Module Name:    src
Committed By:   jmcneill
Date:           Fri May 21 21:52:16 UTC 2021

Modified Files:
        src/sys/lib/libsa: loadfile.c loadfile.h

Log Message:
Capture the endianness of the ELF file loaded in 'netbsd_elf_data', the
same way we do already for the class in 'netbsd_elf_class'.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/lib/libsa/loadfile.c
cvs rdiff -u -r1.14 -r1.15 src/sys/lib/libsa/loadfile.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/lib/libsa/loadfile.c
diff -u src/sys/lib/libsa/loadfile.c:1.32 src/sys/lib/libsa/loadfile.c:1.33
--- src/sys/lib/libsa/loadfile.c:1.32	Fri Apr  5 20:09:29 2019
+++ src/sys/lib/libsa/loadfile.c	Fri May 21 21:52:15 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: loadfile.c,v 1.32 2019/04/05 20:09:29 christos Exp $ */
+/* $NetBSD: loadfile.c,v 1.33 2021/05/21 21:52:15 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -84,6 +84,7 @@
 
 uint32_t	netbsd_version;
 u_int		netbsd_elf_class;
+u_int		netbsd_elf_data;
 
 /*
  * Open 'filename', read in program and return the opened file
@@ -159,6 +160,7 @@ fdloadfile(int fd, u_long *marks, int fl
 	if (memcmp(hdr.elf32.e_ident, ELFMAG, SELFMAG) == 0 &&
 	    hdr.elf32.e_ident[EI_CLASS] == ELFCLASS32) {
 	    	netbsd_elf_class = ELFCLASS32;
+		netbsd_elf_data = hdr.elf32.e_ident[EI_DATA];
 		rval = loadfile_elf32(fd, &hdr.elf32, marks, flags);
 	} else
 #endif
@@ -166,6 +168,7 @@ fdloadfile(int fd, u_long *marks, int fl
 	if (memcmp(hdr.elf64.e_ident, ELFMAG, SELFMAG) == 0 &&
 	    hdr.elf64.e_ident[EI_CLASS] == ELFCLASS64) {
 	    	netbsd_elf_class = ELFCLASS64;
+		netbsd_elf_data = hdr.elf64.e_ident[EI_DATA];
 		rval = loadfile_elf64(fd, &hdr.elf64, marks, flags);
 	} else
 #endif

Index: src/sys/lib/libsa/loadfile.h
diff -u src/sys/lib/libsa/loadfile.h:1.14 src/sys/lib/libsa/loadfile.h:1.15
--- src/sys/lib/libsa/loadfile.h:1.14	Sat Oct  7 10:26:39 2017
+++ src/sys/lib/libsa/loadfile.h	Fri May 21 21:52:15 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: loadfile.h,v 1.14 2017/10/07 10:26:39 maxv Exp $	 */
+/*	$NetBSD: loadfile.h,v 1.15 2021/05/21 21:52:15 jmcneill Exp $	 */
 
 /*-
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -93,3 +93,4 @@ int loadfile_aout(int, struct exec *, u_
 
 extern uint32_t netbsd_version;
 extern u_int netbsd_elf_class;
+extern u_int netbsd_elf_data;

Reply via email to