From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 781F71F8C6 for ; Tue, 17 Aug 2021 01:09:51 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A9F363870866 for ; Tue, 17 Aug 2021 01:09:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A9F363870866 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1629162590; 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=e9WqAfvFDcYpiyeDi44IvNeT1Pv0H4ft5hqGftDiVLyxAXGP/TIWDtWp6HyoUHUT6 6GhCoDQt9AOkbTY4oVtDjDV/irk3+kKsjeqHf/L0Oe8GaVomCDAXMJ7WK3eFhooNrl 9ZWcnsuR9MfaJqFNoSGgclqXGbwl8phyv6zzeryI= Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by sourceware.org (Postfix) with ESMTPS id A5318384647C; Tue, 17 Aug 2021 01:06:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A5318384647C Received: by mail-pj1-x102f.google.com with SMTP id cp15-20020a17090afb8fb029017891959dcbso2053123pjb.2; Mon, 16 Aug 2021 18:06:31 -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=QMeBKznaY6mtkl8Ip2nq5P45ibU+uhdNyuYocJsW8S0wDn1hzoIpoULlG2lbAdnLGx 2nN0FIcfKhqBKVFxE7XFahuENMXq0XHJZaLZvC8g0Iss7ZCT+sW5TRRDkmhs2bDir8r5 3F6kIOec6YafKKeb3FTuAQ5uz85yeF/XpgMocRiZB0nZPxwffvJwIl6uvUisT+W/KE3u bGaD9TY/0BfGKbC2eTsQCWYmJ4DSxBa3wDWTzp5DmBxuf+TjZE97XVHX2mP/+Ocf648p wkHB8qra/XfaHYnadAXT0R7HkFrf2UxfMQt8EMdR3bvwVM4jDt+RL3gdzRTEsDCZG4eJ 7Ckg== X-Gm-Message-State: AOAM531U53jQ9OFcLCSKGRdo+lCLcbcnBnAC9+/Zxehd6ZBKjyRg+MkD yFMDdd/DQf9ZldOmFzSAveo= X-Google-Smtp-Source: ABdhPJy+ezr9eF7cgJvytmIIiIBJH5EaAeKCTYzAUCCt4qZWXnGivX2EG24p+Ws4jiVFgc79WRNezg== X-Received: by 2002:a62:520e:0:b0:3e2:1c21:f1ba with SMTP id g14-20020a62520e000000b003e21c21f1bamr908773pfb.78.1629162390840; Mon, 16 Aug 2021 18:06:30 -0700 (PDT) Received: from gnu-cfl-2.localdomain ([172.58.38.240]) by smtp.gmail.com with ESMTPSA id l12sm419683pgc.41.2021.08.16.18.06.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Aug 2021 18:06:30 -0700 (PDT) Received: from gnu-cfl-2.. (localhost [IPv6:::1]) by gnu-cfl-2.localdomain (Postfix) with ESMTP id 2A955C0330; Mon, 16 Aug 2021 18:06:29 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v2 1/2] Add declare_object_symbol_alias for assembly codes [BZ #28128] Date: Mon, 16 Aug 2021 18:06:28 -0700 Message-Id: <20210817010629.593479-2-hjl.tools@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210817010629.593479-1-hjl.tools@gmail.com> References: <20210817010629.593479-1-hjl.tools@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: , From: "H.J. Lu via Libc-alpha" Reply-To: "H.J. Lu" Cc: gdb@sourceware.org Errors-To: libc-alpha-bounces+e=80x24.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) \ -- 2.31.1