From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by sourceware.org (Postfix) with ESMTP id 1328E3948A69 for ; Tue, 19 May 2020 13:24:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1328E3948A69 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-487-sOlgEe3YPhaHJSBUl-Bg0g-1; Tue, 19 May 2020 09:24:56 -0400 X-MC-Unique: sOlgEe3YPhaHJSBUl-Bg0g-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C08E107ACCA for ; Tue, 19 May 2020 13:24:55 +0000 (UTC) Received: from calimero.vinschen.de (ovpn-112-122.ams2.redhat.com [10.36.112.122]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F25DE5D9C5 for ; Tue, 19 May 2020 13:24:54 +0000 (UTC) Received: by calimero.vinschen.de (Postfix, from userid 500) id 3C4FEA80F7E; Tue, 19 May 2020 15:24:53 +0200 (CEST) Date: Tue, 19 May 2020 15:24:53 +0200 From: Corinna Vinschen To: newlib@sourceware.org Subject: Re: [PATCH] Reimplement aligned_alloc Message-ID: <20200519132453.GW3947@calimero.vinschen.de> Reply-To: newlib@sourceware.org Mail-Followup-To: newlib@sourceware.org References: <20200519095249.22326-1-szabolcs.nagy@arm.com> MIME-Version: 1.0 In-Reply-To: <20200519095249.22326-1-szabolcs.nagy@arm.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 May 2020 13:24:59 -0000 On May 19 10:52, Szabolcs Nagy wrote: > The original implementation had multiple issues: > > - Only worked when posix_memalign was available (Linux, RTEMS). > - Violated C11 link namespace rules by calling posix_memalign. > - Failed to set errno on error. > > These can be fixed by essentially using the same implementation > for aligned_alloc as for memalign, i.e. simply calling _memalign_r > (which is always available and a "more reserved name" although > technically still not in the reserved link namespace, at least > code written in c cannot define a colliding symbol, newlib has > plenty such namespace issues so this is fine). > > It is not clear what the right policy is when MALLOC_PROVIDED is set, > currently that does not cover aligned_alloc so it is kept that way. > > Tested on aarch64-none-elf > --- > newlib/libc/stdlib/aligned_alloc.c | 62 +++++++++++++++--------------- > 1 file changed, 30 insertions(+), 32 deletions(-) Pushed. Thanks, Corinna -- Corinna Vinschen Cygwin Maintainer Red Hat