Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/x68k/stand Rewrite limit check using cross-build to...



details:   https://anonhg.NetBSD.org/src/rev/0974e0ebf23b
branches:  trunk
changeset: 467172:0974e0ebf23b
user:      isaki <isaki%NetBSD.org@localhost>
date:      Thu Jan 16 13:15:47 2020 +0000

description:
Rewrite limit check using cross-build tools.
This eliminates use of hosts tr(1) and bc(1).
(But I'm going to remove this again soon due to other reason)

diffstat:

 sys/arch/x68k/stand/boot_ufs/Makefile      |  14 ++++++--------
 sys/arch/x68k/stand/boot_ustar/Makefile    |  18 +++++++-----------
 sys/arch/x68k/stand/xxboot/Makefile.xxboot |  20 +++++++++-----------
 3 files changed, 22 insertions(+), 30 deletions(-)

diffs (100 lines):

diff -r b7e545ec6507 -r 0974e0ebf23b sys/arch/x68k/stand/boot_ufs/Makefile
--- a/sys/arch/x68k/stand/boot_ufs/Makefile     Thu Jan 16 12:56:39 2020 +0000
+++ b/sys/arch/x68k/stand/boot_ufs/Makefile     Thu Jan 16 13:15:47 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.30 2017/04/08 19:53:23 christos Exp $
+#      $NetBSD: Makefile,v 1.31 2020/01/16 13:15:47 isaki Exp $
 
 NOMAN=         # defined
 
@@ -59,13 +59,11 @@
        :
        $(LD) $(LINKFLAGS) -o $(PROG).x $(OBJS) $(LDADD) >$(PROG).map
        @grep first_kbyte $(PROG).map
-       @if [ `(echo ibase=16;                                          \
-               ${TOOL_SED} -n  -e '/[  ]first_kbyte/{'                 \
-                       -e 's/.*0x\([0-9a-fA-F]*\).*/\1-$(TEXT)-400/p'  \
-                       -e '}' $(PROG).map |                            \
-               tr a-f A-F) | bc` -gt 0 ];                              \
-       then echo '$(BOOT): first_kbyte exceeds the first killobyte';   \
-               exit 1;                                                 \
+       @if [ `${TOOL_AWK}                                                 \
+           '/first_kbyte/ {print "eval(eval("$$1")-eval(0x'$(TEXT)'))"}'  \
+           $(PROG).map | ${TOOL_M4} -` -gt 1024 ];                        \
+       then echo '$(BOOT): first_kbyte exceeds the first killobyte';      \
+           exit 1;                                                        \
        fi
        mv -f $(PROG).x $(PROG)
 
diff -r b7e545ec6507 -r 0974e0ebf23b sys/arch/x68k/stand/boot_ustar/Makefile
--- a/sys/arch/x68k/stand/boot_ustar/Makefile   Thu Jan 16 12:56:39 2020 +0000
+++ b/sys/arch/x68k/stand/boot_ustar/Makefile   Thu Jan 16 13:15:47 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.24 2017/04/08 19:53:23 christos Exp $
+#      $NetBSD: Makefile,v 1.25 2020/01/16 13:15:47 isaki Exp $
 
 NOMAN=         # defined
 
@@ -50,19 +50,15 @@
        ${_MKTARGET_LINK}
        $(LD) $(LINKFLAGS) -o ${PROG} $(OBJS) $(LDADD) > $(PROG).map
        @grep first_kbyte $(PROG).map
-       @if [ `(echo ibase=16;                                             \
-           ${TOOL_SED} -n                                                 \
-               's/^.*0x\([0-9a-f]*\).* first_kbyte$$/\1-$(TEXT)-400/p'    \
-               $(PROG).map |                                              \
-           tr a-f A-F) | bc` -gt 0 ];                                     \
+       @if [ `${TOOL_AWK}                                                 \
+           '/first_kbyte/ {print "eval(eval("$$1")-eval(0x'$(TEXT)'))"}'  \
+           $(PROG).map | ${TOOL_M4} -` -gt 1024 ];                        \
        then echo '$(BOOT): first_kbyte exceeds the first killobyte';      \
            rm $(PROG) ; exit 1;                                           \
        fi
-       @if [ `(echo ibase=16;                                             \
-           ${TOOL_SED} -n                                                 \
-               's/^.*0x\([0-9a-f]*\).* _edata *= *\.$$/\1-$(TEXT)-2000/p' \
-               $(PROG).map |                                              \
-           tr a-f A-F) | bc` -gt 0 ];                                     \
+       @if [ `${TOOL_AWK}                                                 \
+           '/_edata/ {print "eval(eval("$$1")-eval(0x'$(TEXT)'))"}'       \
+           $(PROG).map | ${TOOL_M4} -` -gt 8192 ];                        \
        then echo '$(BOOT): text+data is too large';                       \
            rm $(PROG) ; exit 1;                                           \
        fi
diff -r b7e545ec6507 -r 0974e0ebf23b sys/arch/x68k/stand/xxboot/Makefile.xxboot
--- a/sys/arch/x68k/stand/xxboot/Makefile.xxboot        Thu Jan 16 12:56:39 2020 +0000
+++ b/sys/arch/x68k/stand/xxboot/Makefile.xxboot        Thu Jan 16 13:15:47 2020 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.xxboot,v 1.5 2020/01/16 12:54:16 isaki Exp $
+#      $NetBSD: Makefile.xxboot,v 1.6 2020/01/16 13:15:47 isaki Exp $
 
 NOMAN=         # defined
 
@@ -64,19 +64,17 @@
        ${_MKTARGET_LINK}
        $(LD) $(LINKFLAGS) -o ${PROG} $(OBJS) $(LDLIBS) > $(PROG).map
        @grep first_kbyte $(PROG).map
-       @if [ `(echo ibase=16;                                             \
-           ${TOOL_SED} -n                                                 \
-               's/^.*0x\([0-9a-f]*\).* first_kbyte$$/\1-$(TEXT)-400/p'    \
-               $(PROG).map |                                              \
-           tr a-f A-F) | bc` -gt 0 ];                                     \
+       @if [ `${TOOL_AWK}                                                 \
+           '/first_kbyte/ {print "eval(eval("$$1")-eval(0x'$(TEXT)'))"}'  \
+           $(PROG).map | ${TOOL_M4} -` -gt 1024 ];                        \
        then echo '$(BOOT): first_kbyte exceeds the first killobyte';      \
            rm $(PROG) ; exit 1;                                           \
        fi
-       @if [ `(echo ibase=16;                                             \
-           ${TOOL_SED} -n                                                 \
-               's/^.*0x\([0-9a-f]*\).* _edata *= *\.$$/\1-$(TEXT)-$(TEXTDATASIZE)/p' \
-               $(PROG).map |                                              \
-           tr a-f A-F) | bc` -gt 0 ];                                     \
+       @if [ `${TOOL_AWK}                                                 \
+           '/_edata/ {print "eval(eval("$$1")-eval(0x'$(TEXT)'))"}'       \
+           $(PROG).map | ${TOOL_M4} -`                                    \
+           -gt                                                            \
+           `echo 'eval(0x$(TEXTDATASIZE))' | ${TOOL_M4} -` ];             \
        then echo '$(BOOT): text+data is too large';                       \
            rm $(PROG) ; exit 1;                                           \
        fi



Home | Main Index | Thread Index | Old Index