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 466173858C66 for ; Wed, 28 Jun 2023 08:42:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 466173858C66 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1687941778; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PIjcrHlxED62x6TRv01BBHrXZB3AuTAknwT+2fzMXbw=; b=gP/YbPDp/HDZ4vH9mppJ/yROya/Wk9gyvuPbxVYJdb7Wt1frYBWPhjLz7BobaHrWnVXw/6 GzHIcFRBbSipC0FVCEc6yc0kdDuOJy8ARNZWCU5MKgcqoLmYpWVlYTykI2j7BZKoQNfpBC n+cAAz4SqJznjw86MWVActWwKhZmPEY= 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) From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20B=C3=A9rat?= 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 List-Id: 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) -- 2.41.0