From patchwork Wed Aug 18 20:00:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 44696 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 19A6F3890007 for ; Wed, 18 Aug 2021 20:02:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 19A6F3890007 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1629316921; bh=JZYfR9rvCMpQ4cqGyaPwSVvbdkZcR4jNq6OvnScx4yo=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=m0qVXj3qOF24IPjYyo1IkJxmPvVh12/bUN5flzgFARG5hGCmpwluiovTTplXKAlyW 0jX3mxV7uujt8BLnOtfKB9VhKXywpeHGxtP9FNX+pPTq4jJ1/a3j6NcYdoLs6h8uAp BMEGw+OkM4H25zY9ciIebvA+Omv5RkxHOUxCtYnI= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by sourceware.org (Postfix) with ESMTPS id 463C7385F017; Wed, 18 Aug 2021 20:00:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 463C7385F017 Received: by mail-pj1-x102d.google.com with SMTP id hv22-20020a17090ae416b0290178c579e424so3124230pjb.3; Wed, 18 Aug 2021 13:00:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JZYfR9rvCMpQ4cqGyaPwSVvbdkZcR4jNq6OvnScx4yo=; b=UUpK+iXZ78UEj1Eguu9blM/OpUWQjxkjn/bjsAvmnXgjGfgDpZx+h7lJ6EdCvropwJ CO1glYz1XHH6KfngFylwvgKXDrVJFquSQakS9+qkD58o+0lQ6fVXx5kDv0dGTtbSJg3M 53JX3RJrkoixzlgSeyGBqS2/piZgzFot8wwSFh4NSMwSgVPUGyhzUeAUUzkdvked/02I yOF6BVoNOLXTQP4CzfyCoGfhJN9lrS1+9gYwkupGBeoYhZWeMn/Nv8AofgJFMq7m5YS7 6jWxmUv24defpQdKWUC+41D+snsyYQly2Jpw8ctX8rR2tccjmqpe7KHOSjyFLYz60mA4 aYkg== X-Gm-Message-State: AOAM532r/rogxZjL4arwUiHpV4GtA0TA8lGjHCQrvu4KU2yv9SWDxkhr VF+BIcq13GH27FbdccnCkqw= X-Google-Smtp-Source: ABdhPJxEAePOnvL7ZTyDKBE1hAa9iGwGoF8ibsz6kwFzmm7eAQU8WxPQdbyNmIMrssobnI4l+eJsSw== X-Received: by 2002:a17:90a:cc01:: with SMTP id b1mr10830032pju.236.1629316826431; Wed, 18 Aug 2021 13:00:26 -0700 (PDT) Received: from gnu-cfl-2.localdomain ([172.58.38.240]) by smtp.gmail.com with ESMTPSA id q13sm5954023pjq.10.2021.08.18.13.00.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Aug 2021 13:00:26 -0700 (PDT) Received: from gnu-cfl-2.. (localhost [IPv6:::1]) by gnu-cfl-2.localdomain (Postfix) with ESMTP id BDAE3C0386; Wed, 18 Aug 2021 13:00:24 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v4 1/2] Add declare_object_symbol_alias for assembly codes [BZ #28128] Date: Wed, 18 Aug 2021 13:00:23 -0700 Message-Id: <20210818200024.3240116-2-hjl.tools@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210818200024.3240116-1-hjl.tools@gmail.com> References: <20210818200024.3240116-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3032.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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-Patchwork-Original-From: "H.J. Lu via Libc-alpha" From: "H.J. Lu" Reply-To: "H.J. Lu" Cc: gdb@sourceware.org Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" There are 2 problems in: #define declare_symbol_alias(symbol, original, type, size) \ declare_symbol_alias_1 (symbol, original, type, size) #ifdef __ASSEMBLER__ # define declare_symbol_alias_1(symbol, original, type, size) \ strong_alias (original, symbol); \ .type C_SYMBOL_NAME (symbol), %##type; \ .size C_SYMBOL_NAME (symbol), size 1. .type and .size are substituted by arguments. 2. %##type is expanded to "% type" due to the GCC bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101613 But assembler doesn't support "% type". Workaround BZ #28128 by 1. Don't define declare_symbol_alias for assembly codes. 2. Define declare_object_symbol_alias for assembly codes. --- include/libc-symbols.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/include/libc-symbols.h b/include/libc-symbols.h index d41ecf4384..1678071d77 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -324,14 +324,16 @@ for linking") This is only necessary when defining something in assembly, or playing funny alias games where the size should be other than what the compiler thinks it is. */ -#define declare_symbol_alias(symbol, original, type, size) \ - declare_symbol_alias_1 (symbol, original, type, size) #ifdef __ASSEMBLER__ -# define declare_symbol_alias_1(symbol, original, type, size) \ +# define declare_object_symbol_alias(symbol, original, size) \ + declare_object_symbol_alias_1 (symbol, original, size) +# define declare_object_symbol_alias_1(symbol, original, s_size) \ strong_alias (original, symbol); \ - .type C_SYMBOL_NAME (symbol), %##type; \ - .size C_SYMBOL_NAME (symbol), size + .type C_SYMBOL_NAME (symbol), %object; \ + .size C_SYMBOL_NAME (symbol), s_size #else /* Not __ASSEMBLER__. */ +# define declare_symbol_alias(symbol, original, type, size) \ + declare_symbol_alias_1 (symbol, original, type, size) # define declare_symbol_alias_1(symbol, original, type, size) \ asm (".globl " __SYMBOL_PREFIX #symbol \ "\n\t" declare_symbol_alias_1_alias (symbol, original) \