From patchwork Wed Aug 17 11:19:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joe Seymour X-Patchwork-Id: 660061 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3sDmwd3Sjsz9t0F for ; Wed, 17 Aug 2016 21:19:59 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=IJbI9/Ac; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:cc:message-id:date:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=n8QRNDUNnLmkSJ+a Vpeel3R9vFTltRcc0RurOsYAGFeZzZPQ42PgjFJrBpNPPvPzLET7H2E7BbMc4QHg d+f7hC8tXCzimHxEhSlfjrLTwmTjsRhejSZPc0I4QUJ1sOV1Mqo1wkM8dZQQHM0Q vcGl3xQWP1QV9X5M/JTFHTNFGVw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :subject:to:cc:message-id:date:mime-version:content-type :content-transfer-encoding; s=default; bh=jkYkmeSZpcia89kEfrgArD HqeKs=; b=IJbI9/Acm/n74DDG24G1NoMISAzqmbeG/PxJoB5dsWVFojIz6pALmP mcClQm8V1ZuBZDdekw8bWT6vYTSKPjrVTX+FBG0i22asljYfQ8AO95Fzhxdb2CRO 28Gkrm8xTQMWSEkJCi5nDmWeQ+u/o7rI3oUNEzt9RmLQzpuAy/S0A= Received: (qmail 11856 invoked by alias); 17 Aug 2016 11:19:53 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 11841 invoked by uid 89); 17 Aug 2016 11:19:52 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=joe, __SIZE_TYPE__, __size_type__, achieved X-HELO: mail-wm0-f45.google.com Received: from mail-wm0-f45.google.com (HELO mail-wm0-f45.google.com) (74.125.82.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 Aug 2016 11:19:42 +0000 Received: by mail-wm0-f45.google.com with SMTP id o80so225628693wme.1 for ; Wed, 17 Aug 2016 04:19:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:cc:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=Sy6W3tFcifY5mCMTSze3Pp8KRf8wbhCtGUV8BzO86XY=; b=lemXklhMeJnjkb7z5U3gCbbbIfqUYGoxkms+kP4QSCKgIvi8V5JiZbWdDMRS0UNizc i4Pk0d8AzzTo1ROHFBd/j/2SVdBKhME9Fi7u8bJw9VyY9oxbJ78i61qkf7egc5omjRLv OOqm44sLceRfhezz4JS01bYhG1bIUJk4/LTn2J67vBHXff/1xpMj6VFmaZUdphkzxQvU +20Yw3oNaYmlh6Q4HRjyA/bZMGEoH+6rVl1zIJZM3rETps5Ex88awErKSJkybw272R7m z/nDM/o+ARJ94JAt3rKPO4bHlVoilrCmu0RGBveqlLzG0B5tZGOCShnAueOgGYAunH5a +dEw== X-Gm-Message-State: AEkooutHd0JyL3Z7E/KQCXedaAjDgrSyy+2v9lIWGT/ht9IOFC1UJl7QE5AICeOUEehrkTjp X-Received: by 10.194.133.200 with SMTP id pe8mr40912330wjb.14.1471432780080; Wed, 17 Aug 2016 04:19:40 -0700 (PDT) Received: from [10.0.39.100] ([31.24.222.134]) by smtp.gmail.com with ESMTPSA id v189sm26155350wmv.12.2016.08.17.04.19.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Aug 2016 04:19:39 -0700 (PDT) From: Joe Seymour Subject: transaction_safe exceptions prevent libstdc++ building for some targets To: libstdc++@gcc.gnu.org Cc: gcc-patches@gcc.gnu.org, Torvald Riegel Message-ID: Date: Wed, 17 Aug 2016 12:19:38 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 ../configure --target=msp430-elf --enable-languages=c,c++ && make -j4 Results in the msp430 -mlarge multilib failing to build with... > configure: error: Unknown underlying type for size_t > make[1]: *** [configure-target-libstdc++-v3] Error 1 This relates to... > commit 13143e139230dc4d72710a6c4c312105aeddce4f > Author: torvald > Date: Fri Jan 15 22:42:41 2016 +0000 > > libstdc++: Make certain exceptions transaction_safe. https://gcc.gnu.org/ml/libstdc++/2016-01/msg00015.html ...which iterates through a list of types at configure time, looking for one matching __SIZE_TYPE__. The following patch (wip) allows the build to proceed (to the next error), by adding __int20 to the list of types to try. - Is this an acceptable solution? - There's a comment above GLIBCXX_CHECK_SIZE_T_MANGLING, saying that it was copied from libitm. Should that be updated too, even if it's irrelevant for msp430? Proceeding past that build error, all multilibs then fail to build with... > ../../../../../libstdc++-v3/src/c++11/cow-stdexcept.cc:274:3: error: static assertion failed: Pointers must be 32 bits or 64 bits wide > static_assert(sizeof(uint64_t) == sizeof(void*) The assert fails because msp430 has 16-bit or 20-bit pointers. The same error can be reproduced for the rl78-elf target, which has 16-bit pointers. Disabling the original changes for targets with unsupported pointer sizes seems like a reasonable solution to me, but I can't see an existing mechanism to do so? Do others agree? More generally, it might be useful to have a mechanism to disable transactional memory for some targets. I've observed things like register_tm_clones taking up space in ARM Cortex-M binaries. Presumably, this would be achieved by adding an --{enable,disable}-transactional-memory argument to configure? I'm happy to work on a patch, if this is acceptable in principle. Thanks, 2016-08-XX Joe Seymour * acinclude.m4 (GLIBCXX_CHCK_SIZE_T_MANGLING): Try __int20. * configure: Regenerate. if test $glibcxx_cv_size_t_mangling = x; then diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index b0f88cb..7332d3e 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -4405,9 +4405,13 @@ AC_DEFUN([GLIBCXX_CHECK_SIZE_T_MANGLING], [ [extern __SIZE_TYPE__ x; extern unsigned long long x;], [glibcxx_cv_size_t_mangling=y], [ AC_TRY_COMPILE([], - [extern __SIZE_TYPE__ x; extern unsigned short x;], - [glibcxx_cv_size_t_mangling=t], - [glibcxx_cv_size_t_mangling=x]) + [extern __SIZE_TYPE__ x; extern unsigned long long x;], + [glibcxx_cv_size_t_mangling=y], [ + AC_TRY_COMPILE([], + [extern __SIZE_TYPE__ x; extern __int20 unsigned x;], + [glibcxx_cv_size_t_mangling=u6uint20], + [glibcxx_cv_size_t_mangling=x]) + ]) ]) ]) ]) diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index 41797a9..7ab84eb 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -80475,13 +80475,28 @@ else int main () { -extern __SIZE_TYPE__ x; extern unsigned short x; +extern __SIZE_TYPE__ x; extern unsigned long long x; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - glibcxx_cv_size_t_mangling=t + glibcxx_cv_size_t_mangling=y +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +extern __SIZE_TYPE__ x; extern __int20 unsigned x; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + glibcxx_cv_size_t_mangling=u6uint20 else glibcxx_cv_size_t_mangling=x fi @@ -80497,6 +80512,9 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_size_t_mangling" >&5 $as_echo "$glibcxx_cv_size_t_mangling" >&6; }