NetBSD Problem Report #38001

From mcmahill@mcmahill.net  Mon Feb 11 22:58:58 2008
Return-Path: <mcmahill@mcmahill.net>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id CD3FD63BD1C
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 11 Feb 2008 22:58:58 +0000 (UTC)
Message-Id: <20080211205657.B7DDB51237E@slashing.mcmahill.net>
Date: Mon, 11 Feb 2008 15:56:57 -0500 (EST)
From: dmcmahill@NetBSD.org
Reply-To: dmcmahill@NetBSD.org
To: gnats-bugs@gnats.NetBSD.org
Subject: wrappers need magic to disable optimization on a per file basis
X-Send-Pr-Version: 3.95

>Number:         38001
>Category:       pkg
>Synopsis:       wrappers need magic to disable optimization on a per file basis
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 11 23:00:01 +0000 2008
>Originator:     Dan McMahill
>Release:        pkgsrc as of February, 2008
>Organization:
NetBSD
>Environment:


System: NetBSD bondage 2.0_STABLE NetBSD 2.0_STABLE (BONDAGE) #0: Tue Mar 29 13:12:53 EST 2005 dan@bondage:/export/disk2/netbsd-2/obj/alpha/sys/arch/alpha/compile/BONDAGE alpha
Architecture: alpha
Machine: alpha
>Description:

It would be most useful if pkgsrc provided a magic variable that lowered the optimization level on
particular files.  For example

NOOPT_SRCS+=	lib/foo.c
NOOPT_SRCS+=	src/foo.cc

The idea is that the listed files are relative to ${WRKSRC} and the compiler wrappers will remove any -O[1-9]? flags
when compiling those particular files.

There have historically been a number of packages in pkgsrc which have had to do this and it
always involves somewhat painful patching of the makefiles in the package.  This patching takes
some effort to to ensure that the only change is to remove the optimization flag.

This is an example Makefile.am patch:

--- src/Makefile.am.orig
+++ src/Makefile.am
@@ -131,4 +131,22 @@
 CLEANFILES= ${MODELSRCS}

+##
+## workaround for g++ bugs
+CXXCOMPILE_NOOPT = $(CXXCOMPILE:-O%=)
+
+d_mos5.o : d_mos5.cc
+@am__fastdepCXX_TRUE@  if $(CXXCOMPILE_NOOPT) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
+@am__fastdepCXX_TRUE@  then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE_NOOPT) -c -o $@ $<
+
+d_mos5.obj : d_mos5.cc
+@am__fastdepCXX_TRUE@  if $(CXXCOMPILE_NOOPT) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
+@am__fastdepCXX_TRUE@  then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(CXXCOMPILE_NOOPT) -c -o $@ `$(CYGPATH_W) '$<'`
+

having the hooks directly in pkgsrc would be easier.


>How-To-Repeat:

build a package that triggers compiler errors with optimization.  


>Fix:


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.