From patchwork Wed Jun 28 08:42:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Berat X-Patchwork-Id: 71757 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 347703856DCA for ; Wed, 28 Jun 2023 08:46:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 347703856DCA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1687941965; bh=PIjcrHlxED62x6TRv01BBHrXZB3AuTAknwT+2fzMXbw=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=JvJtoHMIRTp6u9nMjgn+Zt4DscjIQoveZ5aTv3qX7PuvXufBzi05ULWMZO2HTRQqt DE82wwSsOb6sJD/FOWXBdMTKQxuosbVByQhKkX3bTZ5k4tNulqgQtvhPc/XW2ISF5s 3ESC0e9FJN7owwpMziGixYQH1SZ6MxiIy8w7ncDM= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org 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 466173858C66 for ; Wed, 28 Jun 2023 08:42:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 466173858C66 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-669-holbpF3XPPC_VNdyZOnLIw-1; Wed, 28 Jun 2023 04:42:57 -0400 X-MC-Unique: holbpF3XPPC_VNdyZOnLIw-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7052492E4C0; Wed, 28 Jun 2023 08:42:57 +0000 (UTC) Received: from Nymeria-redhat.redhat.com (unknown [10.39.193.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C7358492B02; Wed, 28 Jun 2023 08:42:56 +0000 (UTC) To: libc-alpha@sourceware.org Cc: siddhesh@gotplt.org, fberat@redhat.com Subject: [PATCH v3 06/16] asprintf_chk: Ensure compatibility for both s390x and ppc64le Date: Wed, 28 Jun 2023 10:42:36 +0200 Message-ID: <20230628084246.778302-7-fberat@redhat.com> In-Reply-To: <20230628084246.778302-1-fberat@redhat.com> References: <20230628084246.778302-1-fberat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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-Patchwork-Original-From: =?utf-8?q?Fr=C3=A9d=C3=A9ric_B=C3=A9rat_via_Libc-alpha?= From: Frederic Berat Reply-To: =?utf-8?b?RnLDqWTDqXJpYyBCw6lyYXQ=?= Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" If ldbl_* macros are used for asprintf, ABI gets broken on s390x, if it isn't, ppc64le isn't building due to multiple asm redirections. This is due to the inclusion of bits/stdio-lbdl.h for ppc64le whereas it isn't for s390x. This header creates redirections, which are not compatible with the ones generated using libc_hidden_builtin_def. Yet, we can't use libc_hidden_ldbl_proto on s390x since it will not create a simple strong alias (e.g. as done on x86_64), but a versioned alias, leading to ABI breakage. --- debug/asprintf_chk.c | 12 ++++++++++++ include/stdio.h | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/debug/asprintf_chk.c b/debug/asprintf_chk.c index 06d112de00..7da1cddacb 100644 --- a/debug/asprintf_chk.c +++ b/debug/asprintf_chk.c @@ -36,5 +36,17 @@ ___asprintf_chk (char **result_ptr, int flag, const char *format, ...) return ret; } +#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 +/* This is needed since is included in this case, leading to + * multiple asm redirection of the same symbol + */ ldbl_hidden_def (___asprintf_chk, __asprintf_chk) ldbl_strong_alias (___asprintf_chk, __asprintf_chk) +#else +/* Yet, we can't use ldbl_* macros on some systems, even if they don't fall in + * the first case as this leads to ABI breakage due to the long_double_symbol + * aliasing, which is versionned. + */ +strong_alias (___asprintf_chk, __asprintf_chk) +libc_hidden_builtin_def (__asprintf_chk) +#endif diff --git a/include/stdio.h b/include/stdio.h index 3afb0ff77b..6755877911 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -279,7 +279,12 @@ rtld_hidden_proto (__libc_fatal) libc_hidden_proto (__fgets_unlocked_chk) +#if defined __LDBL_COMPAT || __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 libc_hidden_ldbl_proto (__asprintf_chk) +#else +libc_hidden_proto (__asprintf_chk) +#endif + libc_hidden_ldbl_proto (__fprintf_chk) libc_hidden_ldbl_proto (__sprintf_chk) libc_hidden_ldbl_proto (__vsprintf_chk)