From patchwork Wed Aug 18 00:12:47 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: 44684 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 1893E3853800 for ; Wed, 18 Aug 2021 00:14:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1893E3853800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1629245666; 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=nt2yawxqgfluldGwu5qPsDlwYgNhw7AOdTrMOwF3K7LY+JxYUAqF+kuYXD0ha0/g0 T13R332LlNRlif7KpGBiOW0xPDXLkZaVSBGt9ONcpHVZsw894/OHApPhQWJhwmmWSC 3cSb3B8cJzKG9GtlKLKtjNeh3AkW0L1jQa9xYsy0= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id 1E271385501B; Wed, 18 Aug 2021 00:12:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1E271385501B Received: by mail-pf1-x434.google.com with SMTP id g14so389037pfm.1; Tue, 17 Aug 2021 17:12:51 -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=ibKZhBEYWebOuvQMztiElKcRVC1+mLIkP4nm1ZM/45LnIwCNUgMeDVYUawvemKnH1s HI0CjUwUT4VouMLmtdJJxAfWFnDyL2tcoWCzXCQTOcStPrpgVHufoMh4yA9EPfNCXxgP wCnQmpJuNOh8WtLuVJlU9M5BLmkZe8P3EFLc+GX2bA9hkZsqj4YiYNK3Qm1icdwv2ABa O0Q+zRrbRISge/qx8P+QGG5HQe06dvDJeIoXwyXP8yH6YFfpyzMO37uVqd+Ene71LYTW Js2UCbuBV44kY+j+bd457/DB9K9UUu38ITdrwZakrojBZXjgXMGIXC+VkMMyl846Yh5I Zalg== X-Gm-Message-State: AOAM531NvWJaGeEEAy1MUVYXrHR15AbDJJZZrp44pGp23U8W5t5Al2h2 noJ0Ar1wLIvByTK5b/E4jIo= X-Google-Smtp-Source: ABdhPJz8CaE0RpSgznTl1BvlvVyRA5sb2R8kCajQLBJr29nQQvDUanF3LTfBZ3Yg81oX9p6S1ucjog== X-Received: by 2002:a63:150e:: with SMTP id v14mr6069980pgl.126.1629245570256; Tue, 17 Aug 2021 17:12:50 -0700 (PDT) Received: from gnu-cfl-2.localdomain ([172.58.38.240]) by smtp.gmail.com with ESMTPSA id s2sm3664808pfw.193.2021.08.17.17.12.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Aug 2021 17:12:49 -0700 (PDT) Received: from gnu-cfl-2.. (localhost [IPv6:::1]) by gnu-cfl-2.localdomain (Postfix) with ESMTP id 7B67CC0330; Tue, 17 Aug 2021 17:12:48 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v3 1/2] Add declare_object_symbol_alias for assembly codes [BZ #28128] Date: Tue, 17 Aug 2021 17:12:47 -0700 Message-Id: <20210818001248.638207-2-hjl.tools@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210818001248.638207-1-hjl.tools@gmail.com> References: <20210818001248.638207-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) \