Module Name:    src
Committed By:   gutteridge
Date:           Fri Nov  1 00:35:53 UTC 2024

Modified Files:
        src/usr.bin/elf2aout: elf2aout.c

Log Message:
elf2aout.c: switch to use htobe32(3)

As discussed on tech-toolchain. Tested with virt68k tools build on
Fedora 40. (Relevant to PR lib/58674.)


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/usr.bin/elf2aout/elf2aout.c

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

Modified files:

Index: src/usr.bin/elf2aout/elf2aout.c
diff -u src/usr.bin/elf2aout/elf2aout.c:1.24 src/usr.bin/elf2aout/elf2aout.c:1.25
--- src/usr.bin/elf2aout/elf2aout.c:1.24	Mon Oct 28 13:06:34 2024
+++ src/usr.bin/elf2aout/elf2aout.c	Fri Nov  1 00:35:53 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf2aout.c,v 1.24 2024/10/28 13:06:34 kre Exp $	*/
+/*	$NetBSD: elf2aout.c,v 1.25 2024/11/01 00:35:53 gutteridge Exp $	*/
 
 /*
  * Copyright (c) 1995
@@ -43,6 +43,7 @@
 #endif
 
 #include <sys/types.h>
+#include <sys/endian.h>
 #include <sys/exec_aout.h>
 #include <sys/exec_elf.h>
 
@@ -56,8 +57,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#include <arpa/inet.h>
-
 
 struct sect {
 	/* should be unsigned long, but assume no a.out binaries on LP64 */
@@ -372,7 +371,7 @@ main(int argc, char **argv)
 
 	/* We now have enough information to cons up an a.out header... */
 	mid = get_mid(&ex);
-	aex.a_midmag = (u_long)htonl(((u_long)symflag << 26)
+	aex.a_midmag = (u_long)htobe32(((u_long)symflag << 26)
 	    | ((u_long)mid << 16) | magic);
 
 	aex.a_text = text.len;

Reply via email to