From patchwork Fri Jun 23 09:42:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frederic Berat X-Patchwork-Id: 71568 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 41E9E385734D for ; Fri, 23 Jun 2023 09:44:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 41E9E385734D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1687513456; 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=Y6butlBxQu5Yyw02NcoC3oyfoIFiBLMI2jUwUsEoHXIW97fdNmrmsB66hAUxXa4v0 eM5c3La1eEjoLhnS8eIanVMuattWetphU6v40ovmbZbYvstP1KBWXwshvjhpGZ7vbk sf5l0Rjgs1jpvjSlmRPbX7z0FxBbcWJbiA4QwCf0= 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.133.124]) by sourceware.org (Postfix) with ESMTPS id 4B75D385828E for ; Fri, 23 Jun 2023 09:43:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4B75D385828E Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-458-SQYq9RJlOyWQi97MvfpBIQ-1; Fri, 23 Jun 2023 05:43:34 -0400 X-MC-Unique: SQYq9RJlOyWQi97MvfpBIQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 376681C05B18; Fri, 23 Jun 2023 09:43:34 +0000 (UTC) Received: from Nymeria-redhat.redhat.com (unknown [10.39.193.72]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 935F31121314; Fri, 23 Jun 2023 09:43:33 +0000 (UTC) To: libc-alpha@sourceware.org Cc: siddhesh@gotplt.org, fberat@redhat.com Subject: [PATCH v2 06/14] asprintf_chk: Ensure compatibility for both s390x and ppc64le Date: Fri, 23 Jun 2023 11:42:15 +0200 Message-ID: <20230623094223.3742673-7-fberat@redhat.com> In-Reply-To: <20230623094223.3742673-1-fberat@redhat.com> References: <20230623094223.3742673-1-fberat@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.5 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)