Date: Fri, 8 Mar 2013 06:49:18 GMT From: Brooks Davis <brooks@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 222719 for review Message-ID: <201303080649.r286nIMP057613@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@222719?ac=10 Change 222719 by brooks@brooks_zenith on 2013/03/08 06:49:16 Checkpoint a work in progress change to config to allow a kernel to be build with tesla annotations when the -t argument is passed. Affected files ... .. //depot/projects/ctsrd/tesla/src/sys/conf/Makefile.amd64#2 edit .. //depot/projects/ctsrd/tesla/src/sys/conf/kern.post.mk#2 edit .. //depot/projects/ctsrd/tesla/src/usr.sbin/config/config.h#2 edit .. //depot/projects/ctsrd/tesla/src/usr.sbin/config/main.c#2 edit .. //depot/projects/ctsrd/tesla/src/usr.sbin/config/mkmakefile.c#2 edit Differences ... ==== //depot/projects/ctsrd/tesla/src/sys/conf/Makefile.amd64#2 (text+ko) ==== @@ -48,9 +48,11 @@ %OBJS +%TESLA + %FILES.c -%FILES.s +%FILES.S %FILES.m ==== //depot/projects/ctsrd/tesla/src/sys/conf/kern.post.mk#2 (text+ko) ==== @@ -83,6 +83,10 @@ kernel-all: ${KERNEL_KO} ${KERNEL_EXTRA} +.if defined(DO_TESLA) +kernel-all: ${KERNEL_KO}.instrumented +.endif + kernel-cleandir: kernel-clean kernel-cleandepend kernel-clobber: @@ -157,12 +161,30 @@ linterrs tags vers.c \ vnode_if.c vnode_if.h vnode_if_newproto.h vnode_if_typedef.h \ ${MFILES:T:S/.m$/.c/} ${MFILES:T:S/.m$/.h/} \ + ${TESLA_FILES} ${OLLS} ${INSTRLLS} ${INSTROBJS} \ + tesla.manifest ${KERNEL_KO}.instrumented \ ${CLEAN} lint: ${LNFILES} ${LINT} ${LINTKERNFLAGS} ${CFLAGS:M-[DILU]*} ${.ALLSRC} 2>&1 | \ tee -a linterrs +TESLA_CFILES= ${CFILES} ${SYSTEM_CFILES} +TESLA_FILES= ${TESLA_CFILES:T:.c=.tesla} +OLLS= ${TESLA_CFILES:T:.c=.oll} +INSTRLLS= ${TESLA_CFILES:T:.c=.instrll} +INSTROBJS= ${TESLA_CFILES:T:.c=.instro} + +tesla.manifest: ${TESLA_FILES} + cat ${TESLA_FILES} > ${.TARGET} + +tesla: ${KERNEL_KO}.instrumented + +${KERNEL_KO}.instrumented: ${INSTROBJS} + ${LD} -Bdynamic -T ${LDSCRIPT} ${LDFLAGS} --no-warn-mismatch \ + -warn-common -export-dynamic -dynamic-linker /red/herring \ + -o ${.TARGET} -X ${INSTROBJS} ${NOT_C_OBJS} vers.o hack.So + # This is a hack. BFD "optimizes" away dynamic mode if there are no # dynamic references. We could probably do a '-Bforcedynamic' mode like # in the a.out ld. For now, this works. ==== //depot/projects/ctsrd/tesla/src/usr.sbin/config/config.h#2 (text+ko) ==== @@ -164,6 +164,7 @@ extern int envmode; extern int hintmode; extern int incignore; +extern int tesla; char *get_word(FILE *); char *get_quoted_word(FILE *); ==== //depot/projects/ctsrd/tesla/src/usr.sbin/config/main.c#2 (text+ko) ==== @@ -78,6 +78,7 @@ int profiling; int found_defaults; int incignore; +int tesla; /* * Preserve old behaviour in INCLUDE_CONFIG_FILE handling (files are included @@ -114,7 +115,7 @@ printmachine = 0; kernfile = NULL; - while ((ch = getopt(argc, argv, "Cd:gmpVx:")) != -1) + while ((ch = getopt(argc, argv, "Cd:gmptVx:")) != -1) switch (ch) { case 'C': filebased = 1; @@ -134,6 +135,9 @@ case 'p': profiling++; break; + case 't': + tesla++; + break; case 'V': printf("%d\n", CONFIGVERS); exit(0); ==== //depot/projects/ctsrd/tesla/src/usr.sbin/config/mkmakefile.c#2 (text+ko) ==== @@ -69,7 +69,7 @@ static void do_clean(FILE *); static void do_rules(FILE *); static void do_xxfiles(char *, FILE *); -static void do_objs(FILE *); +static void do_tesla(FILE *); static void do_before_depend(FILE *); static int opteq(const char *, const char *); static void read_files(void); @@ -162,7 +162,9 @@ if (eq(line, "%BEFORE_DEPEND\n")) do_before_depend(ofp); else if (eq(line, "%OBJS\n")) - do_objs(ofp); + ;/* Do nothing */ + else if (eq(line, "%TESLA\n")) + do_tesla(ofp); else if (strncmp(line, "%FILES.", 7) == 0) do_xxfiles(line, ofp); else if (eq(line, "%RULES\n")) @@ -618,32 +620,13 @@ } static void -do_objs(FILE *fp) +do_tesla(FILE *fp) { - struct file_list *tp; - int lpos, len; - char *cp, och, *sp; + + if (!tesla) + return; - fprintf(fp, "OBJS="); - lpos = 6; - STAILQ_FOREACH(tp, &ftab, f_next) { - if (tp->f_flags & NO_OBJ) - continue; - sp = tail(tp->f_fn); - cp = sp + (len = strlen(sp)) - 1; - och = *cp; - *cp = 'o'; - len += strlen(tp->f_objprefix); - if (len + lpos > 72) { - lpos = 8; - fprintf(fp, "\\\n\t"); - } - fprintf(fp, "%s%s ", tp->f_objprefix, sp); - lpos += len + 1; - *cp = och; - } - if (lpos != 8) - putc('\n', fp); + fprintf(fp, "DO_TESLA=yes\n"); } static void @@ -682,6 +665,17 @@ } if (lpos != 8) putc('\n', fp); + /* locore.o is manually included in kern.pre.mk */ + fprintf(fp, "OBJS+=\t${%sFILES:T:Nlocore.%s:.%s=.o}\n", SUFF, suff, + suff); + if (tesla) { + if (strcmp(suff, "c") == 0) + fprintf(fp, "C_OBJS+=${%sFILES:T:.%s=.o}\n", + SUFF, suff); + else + fprintf(fp, "NOT_C_OBJS+=${%sFILES:T:.%s=.o}\n", + SUFF, suff); + } } static char * @@ -767,7 +761,6 @@ ftp->f_flags & NOWERROR ? "_NOWERROR" : ""); compilewith = cmd; } - *cp = och; if (strlen(ftp->f_objprefix)) fprintf(f, "\t%s $S/%s\n", compilewith, np); else @@ -777,6 +770,37 @@ fprintf(f, "\t${NORMAL_CTFCONVERT}\n\n"); else fprintf(f, "\n"); + + if (tesla && och == 'c') { + if (ftp->f_depends) + fprintf(f, "%s%soll: $S/%s%c %s\n", + ftp->f_objprefix, tail(np), np, och, + ftp->f_depends); + else + fprintf(f, "%s%soll: $S/%s%c\n", + ftp->f_objprefix, tail(np), np, och); + if (strlen(ftp->f_objprefix)) + fprintf(f, + "\t%s $S/%s -S -emit-llvm -o ${.TARGET}\n", + compilewith, np); + else + fprintf(f, "\t%s -S -emit-llvm -o ${.TARGET}\n", + compilewith); + fprintf(f, "\n"); + + if (ftp->f_depends) + fprintf(f, "%s%stesla: $S/%s%c %s\n", + ftp->f_objprefix, tail(np), np, och, + ftp->f_depends); + else + fprintf(f, "%s%stesla: $S/%s%c\n", + ftp->f_objprefix, tail(np), np, och); + fprintf(f, + "\t${TESLA} analyse $S/%s%c -o ${.TARGET} -- ${CFLAGS} ${XFLAGS} -DTESLA\n", + np, och); + fprintf(f, "\n"); + } + *cp = och; } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303080649.r286nIMP057613>