make the bpendtsleep: label only active if KERN_SYNCH_BPENDTSLEEP_LABEL

is defined.  if this option is present in the Makefile CFLAGS and we are
using GCC4, build kern_synch.c with -fno-reorder-blocks, so that this
actually works.

XXX be nice if KERN_SYNCH_BPENDTSLEEP_LABEL was a normal 'defflag' option
XXX but for now take the easy way out and make it checkable in CFLAGS.
This commit is contained in:
mrg 2006-09-07 18:41:28 +00:00
parent 50ea065348
commit baafcdbb23
2 changed files with 13 additions and 5 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile.kern.inc,v 1.84 2006/08/27 06:49:27 simonb Exp $ # $NetBSD: Makefile.kern.inc,v 1.85 2006/09/07 18:41:28 mrg Exp $
# #
# This file contains common `MI' targets and definitions and it is included # This file contains common `MI' targets and definitions and it is included
# at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}. # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@ -86,6 +86,13 @@ AFLAGS+= ${CPUFLAGS} -D_LOCORE -Wa,-fatal-warnings
CFLAGS+= -fno-strict-aliasing CFLAGS+= -fno-strict-aliasing
.endif .endif
# If we want the bpendtsleep: label in kern_synch.c, we need to use
# -fno-reorder-blocks. Don't make this a config(1) defflag without
# making sure this fragment remains valid.
.if ${HAVE_GCC} > 3 && !empty(${CFLAGS:M-DKERN_SYNCH_BPENDTSLEEP_LABEL})
CFLAGS.kern_synch.c+= -fno-reorder-blocks
.endif
# Use the per-source COPTS variables to add -g to just those # Use the per-source COPTS variables to add -g to just those
# files that match the shell patterns given in ${DEBUGLIST} # files that match the shell patterns given in ${DEBUGLIST}
# #

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_synch.c,v 1.166 2006/09/02 06:32:09 christos Exp $ */ /* $NetBSD: kern_synch.c,v 1.167 2006/09/07 18:41:28 mrg Exp $ */
/*- /*-
* Copyright (c) 1999, 2000, 2004 The NetBSD Foundation, Inc. * Copyright (c) 1999, 2000, 2004 The NetBSD Foundation, Inc.
@ -76,7 +76,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.166 2006/09/02 06:32:09 christos Exp $"); __KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.167 2006/09/07 18:41:28 mrg Exp $");
#include "opt_ddb.h" #include "opt_ddb.h"
#include "opt_ktrace.h" #include "opt_ktrace.h"
@ -560,12 +560,13 @@ ltsleep(volatile const void *ident, int priority, const char *wmesg, int timo,
else else
mi_switch(l, NULL); mi_switch(l, NULL);
#if defined(DDB) && !defined(GPROF) && \ #ifdef KERN_SYNCH_BPENDTSLEEP_LABEL
!defined(__m68k__) && !defined(__vax__)
/* /*
* XXX * XXX
* gcc4 optimizer will duplicate this asm statement on some arch * gcc4 optimizer will duplicate this asm statement on some arch
* and it will cause a multiple symbol definition error in gas. * and it will cause a multiple symbol definition error in gas.
* the kernel Makefile is setup to use -fno-reorder-blocks if
* this option is set.
*/ */
/* handy breakpoint location after process "wakes" */ /* handy breakpoint location after process "wakes" */
__asm(".globl bpendtsleep\nbpendtsleep:"); __asm(".globl bpendtsleep\nbpendtsleep:");