Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/crunch/crunchgen crunchgen(1): Clear PaX flags inste...



details:   https://anonhg.NetBSD.org/src/rev/f3d30dd8dd1c
branches:  trunk
changeset: 376582:f3d30dd8dd1c
user:      rin <rin%NetBSD.org@localhost>
date:      Fri Jun 23 02:13:03 2023 +0000

description:
crunchgen(1): Clear PaX flags instead of removing its ELF note section.

The latter results in zero-filled hole in ELF note segment for EARM,
where PaX section is not located the bottom of that segment (see
src/lib/csu/sysident.S). Fortunately, this hole does not cause real
harms for our in-kernel ELF note parser, except for noisy warnings on
DIAGNOSTIC kernels.

Bump CRUNCH_VERSION.

PR toolchain/52675

diffstat:

 usr.bin/crunch/crunchgen/crunchgen.c |  11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diffs (48 lines):

diff -r 78a5cf85afcb -r f3d30dd8dd1c usr.bin/crunch/crunchgen/crunchgen.c
--- a/usr.bin/crunch/crunchgen/crunchgen.c      Fri Jun 23 01:56:21 2023 +0000
+++ b/usr.bin/crunch/crunchgen/crunchgen.c      Fri Jun 23 02:13:03 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: crunchgen.c,v 1.94 2019/12/29 18:26:16 christos Exp $  */
+/*     $NetBSD: crunchgen.c,v 1.95 2023/06/23 02:13:03 rin Exp $       */
 /*
  * Copyright (c) 1994 University of Maryland
  * All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(lint)
-__RCSID("$NetBSD: crunchgen.c,v 1.94 2019/12/29 18:26:16 christos Exp $");
+__RCSID("$NetBSD: crunchgen.c,v 1.95 2023/06/23 02:13:03 rin Exp $");
 #endif
 
 #include <stdlib.h>
@@ -55,7 +55,7 @@
 #include <sys/param.h>
 #include <sys/utsname.h>
 
-#define CRUNCH_VERSION "20191223"
+#define CRUNCH_VERSION "20230623"
 
 #define MAXLINELEN     16384
 #define MAXFIELDS       2048
@@ -991,7 +991,7 @@ top_makefile_rules(FILE *outmk)
 
     fprintf(outmk, "PROG=%s\n\n", execfname);
 
-    fprintf(outmk, "OBJCOPY_REMOVE_FLAGS=-R .eh_frame_hdr -R .note -R .note.netbsd.pax -R .ident -R .comment -R .copyright\n\n");
+    fprintf(outmk, "OBJCOPY_REMOVE_FLAGS=-R .eh_frame_hdr -R .note -R .ident -R .comment -R .copyright\n\n");
 
     fprintf(outmk, "OBJCOPY_REMOVE_FLAGS+=-R .eh_frame\n");
     fprintf(outmk, ".if ${MACHINE} != \"sparc64\"\n");
@@ -1003,9 +1003,10 @@ top_makefile_rules(FILE *outmk)
     fprintf(outmk, "${PROG}.strip:\n");
     fprintf(outmk, "\t${MAKE} -f ${PROG}.mk ${PROG}\n");
     fprintf(outmk, "\t@[ -f ${PROG}.unstripped -a ! ${PROG} -nt ${PROG}.unstripped ] || { \\\n");
-    fprintf(outmk, "\t\t${_MKSHMSG:Uecho} \"  strip \" ${PROG}; \\\n");
+    fprintf(outmk, "\t\t${_MKSHMSG:Uecho} \"  strip and clear PaX flags \" ${PROG}; \\\n");
     fprintf(outmk, "\t\tcp ${PROG} ${PROG}.unstripped && \\\n");
     fprintf(outmk, "\t\t${OBJCOPY} -S ${OBJCOPY_REMOVE_FLAGS} ${PROG} && \\\n");
+    fprintf(outmk, "\t\t${PAXCTL} -0 ${PROG} && \\\n");
     fprintf(outmk, "\t\ttouch ${PROG}.unstripped; \\\n");
     fprintf(outmk, "\t}\n");
     fprintf(outmk, "objs: $(SUBMAKE_TARGETS)\n");



Home | Main Index | Thread Index | Old Index