From owner-freebsd-current Mon Apr 5 1:36:26 1999 Delivered-To: freebsd-current@freebsd.org Received: from alcanet.com.au (news.alcanet.com.au [203.62.196.10]) by hub.freebsd.org (Postfix) with ESMTP id B74ED14E0B for ; Mon, 5 Apr 1999 01:36:21 -0700 (PDT) (envelope-from peter.jeremy@auss2.alcatel.com.au) Received: by border.alcanet.com.au id <40328>; Mon, 5 Apr 1999 18:21:20 +1000 Date: Mon, 5 Apr 1999 18:34:16 +1000 From: Peter Jeremy Subject: Re: different systat -vmstat output when using egcs to compile kernel To: dillon@apollo.backplane.com Cc: andreas@klemm.gtn.com, freebsd-current@FreeBSD.ORG Message-Id: <99Apr5.182120est.40328@border.alcanet.com.au> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Matthew Dillon wrote: >:The problem is that cpp (from gcc 2.8.1) _does_not_ remove >:backslash-newline sequences from string constants (and maybe elsewhere >:as well). This causes problems with the DEVICE_NAMES macro defined in >:vector.h and used in vector.s. ... > I suggest using ANSI string constants instead of K&R string constants. > > This is perfectly legal: > > char *s = "abcdefghi"; > > char *s = "abc" "def" "ghi"; > > char *s = "abc" > "def" > "ghi"; Currently we have something like: #define DEVICE_NAMES "\ clk0 irqnn\0\ rtc0 irqnn\0\ pci irqnn\0\ pci irqnn\0\ pci irqnn\0\ " .ascii DEVICE_NAMES Which expands and assembles into something like: 000020: 5c 6e 63 6c 6b 30 20 69 72 71 6e 6e 00 5c 6e 72 |\nclk0 irqnn.\nr| 000030: 74 63 30 20 69 72 71 6e 6e 00 5c 6e 70 63 69 20 |tc0 irqnn.\npci | 000040: 69 72 71 6e 6e 00 5c 6e 70 63 69 20 69 72 71 6e |irqnn.\npci irqn| Surprisingly, ANSI-C string concatenation _does_ work in gas, so the following works correctly: #define DEVICE_NAMES \ "clk0 irqnn\0" \ "rtc0 irqnn\0" \ "pci irqnn\0" \ "pci irqnn\0" \ "pci irqnn\0" .ascii DEVICE_NAMES This suggests that what's needed is a patch to config to make it generate ANSI strings. The following (untested) patch should do it: Index: mkglue.c =================================================================== RCS file: /home/CVSROOT/./src/usr.sbin/config/mkglue.c,v retrieving revision 1.14 diff -u -r1.14 mkglue.c --- mkglue.c 1998/04/02 04:25:39 1.14 +++ mkglue.c 1999/04/05 08:31:55 @@ -368,17 +368,17 @@ fprintf(fp, " * Macros for interrupt vector routines\n"); fprintf(fp, " * Generated by config program\n"); fprintf(fp, " */\n\n"); - fprintf(fp, "#define\tDEVICE_NAMES \"\\\n"); - fprintf(fp, "clk0 irqnn\\0\\\n"); - fprintf(fp, "rtc0 irqnn\\0\\\n"); - fprintf(fp, "pci irqnn\\0\\\n"); - fprintf(fp, "pci irqnn\\0\\\n"); - fprintf(fp, "pci irqnn\\0\\\n"); - fprintf(fp, "pci irqnn\\0\\\n"); - fprintf(fp, "ipi irqnn\\0\\\n"); - fprintf(fp, "ipi irqnn\\0\\\n"); - fprintf(fp, "ipi irqnn\\0\\\n"); - fprintf(fp, "ipi irqnn\\0\\\n"); + fprintf(fp, "#define\tDEVICE_NAMES \\\n"); + fprintf(fp, "\"clk0 irqnn\\0\" \\\n"); + fprintf(fp, "\"rtc0 irqnn\\0\" \\\n"); + fprintf(fp, "\"pci irqnn\\0\" \\\n"); + fprintf(fp, "\"pci irqnn\\0\" \\\n"); + fprintf(fp, "\"pci irqnn\\0\" \\\n"); + fprintf(fp, "\"pci irqnn\\0\" \\\n"); + fprintf(fp, "\"ipi irqnn\\0\" \\\n"); + fprintf(fp, "\"ipi irqnn\\0\" \\\n"); + fprintf(fp, "\"ipi irqnn\\0\" \\\n"); + fprintf(fp, "\"ipi irqnn\\0\" \\\n"); dev_id = 10; vector_devtab(fp, "bio", &dev_id); vector_devtab(fp, "tty", &dev_id); @@ -386,7 +386,7 @@ vector_devtab(fp, "cam", &dev_id); vector_devtab(fp, "ha", &dev_id); vector_devtab(fp, "null", &dev_id); - fprintf(fp, "\"\n\n"); + fprintf(fp, "\n"); fprintf(fp, "#define\tNR_DEVICES\t%d\n", dev_id); (void) fclose(fp); moveifchanged(path("vector.h.new"), path("vector.h")); @@ -406,7 +406,7 @@ mp = dp->d_conn; if (mp == NULL || mp == TO_NEXUS || !eq(mp->d_name, "isa")) continue; - fprintf(fp, "%s%d irqnn\\0\\\n", dp->d_name, dp->d_unit); + fprintf(fp, "\"%s%d irqnn\\0\" \\\n", dp->d_name, dp->d_unit); (*dev_idp)++; } } Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message