From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2137.outbound.protection.outlook.com [40.107.223.137]) by sourceware.org (Postfix) with ESMTPS id F25F43857805 for ; Thu, 21 Oct 2021 19:33:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F25F43857805 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=cornell.edu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=cornell.edu ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OPfQ+fkNOzT3ccAF5N39X/Kfh8M+k9H7+5RPxGlycWFI5eitOR/Bfn/WEo9PGAzrcBoPY8VVrrA9jokpsVXzlErGWh6Iyyy0/61qsf8mzLs21a2Hv2BGeEVMIletRXvLhb9kTrsjTOl8qopLfbdtqOmOCW19uAypmUiRGZZUiX7b/l4vHoZCILXwMJLLkwry7e6Y3IOEtIqJr0sdbhaqrwIbFHRLfFZefJftt1Hebri7UYcfHBjrodcNcxxlJclvqbi6bdufPENOrUw6y9hurVS8GmD2Xf9p08pae+KyrFEvPjVTPl2L2I0IVUGbAs5oC3XchHr4wOYWuhNXCmi1VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=frfjW+I79I4xT8WNWRhlRzRrk0gWYfFd/UQKbUv20yw=; b=A2wsmyUuInyRKG1Fzx7RBuuQVC1VKbWJcbr61z4efqLObZjSAiGqQvgmdJ545GC+Ro8OXt2ZBlfGEWkv8bfztSX8PxcwQVC8JQm58NFcy43lH0iYg8zpqwE2XrNSi1OV0GwxuXKVyawCNhrxlnATDT6MShiJr9awJCiieOa+1S82JQRhqSjwbfvoxx2AnV9UIFsUn9K44AdK8tn3NELavkv8uxAUI/wy1WTWu+RnfzBKsHPeLlHwYO6xrdOP8EHhSDUrfzoNT1MQEKxNrKibUR2Nknt4F2S4e8UJs6adj9GlkHT6j0YPKnHm1r7NRWdDs3/IrXD1sNd2Os4Fa0AjIw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=cornell.edu; dmarc=pass action=none header.from=cornell.edu; dkim=pass header.d=cornell.edu; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cornell.edu; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=frfjW+I79I4xT8WNWRhlRzRrk0gWYfFd/UQKbUv20yw=; b=P1/KYNEveST9+Ag9pQcN+okNkAstF2kpBhjKXkRnu54lrx+2l76N0JDIk1v5x4SbmcGti993HncuOmBxKBCfU/Lef3GHsCo4gXR72IlIqg17uCpzjKkqolyf/gcAJ+5uYa6dgmUUEVUDZ31aW2vmuejrCm9PFLeuuQKikJEDYUg= Authentication-Results: cygwin.com; dkim=none (message not signed) header.d=none;cygwin.com; dmarc=none action=none header.from=cornell.edu; Received: from BN7PR04MB4388.namprd04.prod.outlook.com (2603:10b6:406:f8::19) by BN6PR04MB1029.namprd04.prod.outlook.com (2603:10b6:405:3c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18; Thu, 21 Oct 2021 19:33:58 +0000 Received: from BN7PR04MB4388.namprd04.prod.outlook.com ([fe80::d1a8:b6b3:dfd1:b093]) by BN7PR04MB4388.namprd04.prod.outlook.com ([fe80::d1a8:b6b3:dfd1:b093%6]) with mapi id 15.20.4608.018; Thu, 21 Oct 2021 19:33:58 +0000 Message-ID: <6ebe96b4-e9a7-1607-23e8-524c7560aadf@cornell.edu> Date: Thu, 21 Oct 2021 15:33:56 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: automake issue Content-Language: en-US To: cygwin-developers@cygwin.com References: <620fad2f-74b0-4a39-45e0-bb2acc00129e@cornell.edu> From: Ken Brown In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: BL0PR03CA0033.namprd03.prod.outlook.com (2603:10b6:208:2d::46) To BN7PR04MB4388.namprd04.prod.outlook.com (2603:10b6:406:f8::19) MIME-Version: 1.0 Received: from [10.13.22.5] (65.112.130.200) by BL0PR03CA0033.namprd03.prod.outlook.com (2603:10b6:208:2d::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.15 via Frontend Transport; Thu, 21 Oct 2021 19:33:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d1d53a4b-cd6a-4f31-7476-08d994c9ba36 X-MS-TrafficTypeDiagnostic: BN6PR04MB1029: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: RNKTKGXOTPdxeKcxKfB70JdtG7vnWhqKxVhW7YODlDlJESTIEstqd6/slLyVDPyQEebBgC9ZkJo2WUu76mIpTB4GgVsura4XRknd8p93M3z8+MTb4BtLGN40KjvZRiXJ80c9o5+NsM/e9dCVPVzLXJl/SHG6uOHEHAI22o48SbVO02mS9mHsOqD3WQ2jdTzM1mt0YAAZXF3AHgDIVHKxGg2lZaCgC85LFRCAmdapGBrl7BdTANLC2GbSkxctLLiFQCGemrgHJtGv5goGwWrSryTpHKAdz2SVIz0vTlfzBUzmMq9OQDlbAvxCTwTDmfT11PR5INHIORg+M1l0uplNsysw9I7iuD+lrxsD25b9NYHIdXXsE/vMrQz3VSzEaqbC2xV0Jyw/ONPgBMI9vG03tmP4fzgWaN8SE6yaoR166FSygnwY1tBcDS6TxqEwVMCa2kzs7BbJLaeGktgDfzXqmmrnOZ74MKCNlOyg5WZqBKLhbWa74LfXBcmsuV2omSFTWIoFnVhFaDq525JdZnX23+nkVJMJ+GAEfweiALKVnbX9cWokyoAFlaq/8XkcOLlYLZSPC5Vgz0Y2IztjTIjbbFyUq9F599ZDE4cj84u6SxISC/exRBaG7ajZLavc9exZlFqzKFEuuUYhflW7awypSFZw75tEVtRpWSnARWbVXKihK6Vhhl6Xn2mQEEY4JFoH9f33D33wH0kMlmo4v7CkqCM4WQn9lOwHE+EVrvycMgGhlkzpbokUMAFzvEtRlhI+OQvkLCIwydxSRRA7bUUd8WWfPfnT3dHUdS71l6UDCccm/0xJSnUdJoi/aU+x+0QoiRk0gX5UO6p479nX8JX4tA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN7PR04MB4388.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(36756003)(6916009)(53546011)(956004)(83380400001)(186003)(5660300002)(508600001)(786003)(966005)(3480700007)(16576012)(8676002)(7116003)(2616005)(316002)(31686004)(2906002)(26005)(75432002)(8936002)(66946007)(6486002)(86362001)(38100700002)(66476007)(66556008)(31696002)(21314003)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?Y1lsVHlxUklYQmtVZFYvWkllNktZK21FSDdtRmorNWZOa2RvYnY2ZnBnaWNp?= =?utf-8?B?OXVkQ3RLQitqSkZTRUJ6RkpKdHNkQ1UxQ3ZpRXpNd0oyaWt5SmtJQnl2WGh6?= =?utf-8?B?ZURIMGp3WW9WOHlTdStyaGd5VDlTaVpZNVd5ZVhCMFZiZ1BtRDZyWTNBUUxN?= =?utf-8?B?SWwydHFzMmUxK0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network-Message-Id: d1d53a4b-cd6a-4f31-7476-08d994c9ba36 X-MS-Exchange-CrossTenant-AuthSource: BN7PR04MB4388.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2021 19:33:58.5352 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5d7e4366-1b9b-45cf-8e79-b14b27df46e1 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ksb2@cornell.edu X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR04MB1029 X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, MSGID_FROM_MTA_HEADER, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin-developers@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component developers mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Oct 2021 19:34:04 -0000 On 10/21/2021 9:08 AM, Jon Turney wrote: > On 21/10/2021 11:48, Corinna Vinschen wrote: >> On Oct 20 16:58, Ken Brown wrote: >>> I was debugging with what I thought was an unoptimized build of cygwin1.dll >>> (with -O0 in CXXFLAGS), but then I discovered that malloc.cc was actually >>> compiled with -O3.  This is because of the following snippet from >>> winsup/cygwin/Makefile.am: >>> >>> # If an optimization level is explicitly set in CXXFLAGS, set -O3 for these >>> files >>> # XXX: this seems to assume it's not -O0? > > Note that this is my observation of a pre-existing issue, not something that's > introduced by the automake conversion. > >>> # >>> # (the indentation here prevents automake trying to process this as an automake >>> # conditional) >>>   ifneq "${filter -O%,$(CXXFLAGS)}" "" >>>    malloc_CFLAGS=-O3 >>>    sync_CFLAGS=-O3 >>>   endif >>> >>> I thought I could fix this by changing the snippet to >>> >>>   ifneq "${filter -O%,$(CXXFLAGS)}" "" >>>    ifeq "${filter -O0,$(CXXFLAGS)}" "" >>>     malloc_CFLAGS=-O3 >>>     sync_CFLAGS=-O3 >>>    endif >>>   endif > > Clever.  It didn't occur to me to write something like this. > >>> but this didn't work.  After running winsup/autogen.sh, >>> winsup/cygwin/Makefile.in contained >>> >>> malloc_CFLAGS = -O3 >>> sync_CFLAGS = -O3 >>> >>> unconditionally. > > Hmm.. yes.  That's disappointing.  I think it was working at some stage, so idk > if this is a automake change? > >>> So in spite of the comment above about indentation, it seems that the >>> conditional is being treated as an automake conditional. >>> >>> Does anyone know how to fix this so that -O0 really produces an unoptimized >>> build? >> >> I workaround this by setting CFLAGS=-g on the command line.  There's no >> -O then and it should work as desired.  The save thing would probably >> be something like this, though: >> >> https://stackoverflow.com/questions/4256609/makefile-conditional-with-automake-autoconf >> > > Using an automake conditional isn't good, because that can't  consider the value > of CXXFLAGS if it's overriden on the 'make' command line. > > Really, I'm not sure if this block is a good idea at all.  I did consider > removing it when converting to automake. > > I couldn't find any history which suggests these flags are here due to evidence > ('using -O3 makes this benchmark faster'), rather than guesswork ('these files > probably contain hotspots, so use -O3 to make it go faster!'). It's too bad we don't know why this was done. In the meantime, I'll work around the problem by using a private branch in which that block is removed. I tried Corinna's suggestion of setting CFLAGS=-g, but that didn't produce an unoptimized build. I still saw '-O2 -g' when building newlib and '-O2 -g -g -O2' when building cygwin. Ken