From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 9EDE1385840A for ; Mon, 14 Feb 2022 12:16:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9EDE1385840A Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-549-EJZoBY1pORSDqhd8m5kBJg-1; Mon, 14 Feb 2022 07:16:53 -0500 X-MC-Unique: EJZoBY1pORSDqhd8m5kBJg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CAD752FD16; Mon, 14 Feb 2022 12:16:52 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.195.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F3E8A70D29; Mon, 14 Feb 2022 12:16:51 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] Linux: Consolidate auxiliary vector parsing (redo) References: <87y22hqh2w.fsf@oldenburg.str.redhat.com> <662fface-5af4-5094-a0ae-b37e56de837d@linaro.org> Date: Mon, 14 Feb 2022 13:16:50 +0100 In-Reply-To: <662fface-5af4-5094-a0ae-b37e56de837d@linaro.org> (Adhemerval Zanella's message of "Mon, 14 Feb 2022 08:44:50 -0300") Message-ID: <87ee4563t9.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Feb 2022 12:16:59 -0000 * Adhemerval Zanella: > I still think this approach is still fragile since we don't how if this > will be the only optimization option gcc will make loops to memset. We > already have a similar problem on _dl_start, but it is slight different > since the clear memory should be done before self-relocation. Also for > memset.c itself there is no much we can do, so we need to resort on > -fno-tree-loop-distribute-patterns. > > However in this case I think it would be better to avoid hacking the > compiler and expect it does not generate broken code and instead assume > memset *might* be generate and work around it. We already have the > hack on sysdeps/generic/symbol-hacks.h, so I think we should do something > similiar: > > 1. Add a __memset_generic internal symbol on all ports to avoid the > iFUNC plt (which seems to be cause of this issue). > > 2. Add a symbol redirection to call such symbol when required (most > likely in the dl-start.h as H.J has suggested. > > So we don't need to handle this specific issue everytime we hack into > the loader code. But this isn't a new problem, right? I also don't think an assembler-based symbol redirect is more portable than -fno-tree-loop-distribute-patterns. We need to build these parts with -ffreestanding, and we need a portable way (across GCC and Clang) to redirect the four required functions ('memcpy', 'memmove', 'memset' and 'memcmp', according to the GCC manual). Thanks, Florian