From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by sourceware.org (Postfix) with ESMTPS id 37B3E385802B; Tue, 24 Aug 2021 13:38:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 37B3E385802B Received: by mail-pl1-x629.google.com with SMTP id e1so5315616plt.11; Tue, 24 Aug 2021 06:38:37 -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=j0BwW/8KvdJpkrzBvg3zn7UIegHblJmtaxlTg6SFu0KNd4PTdQ2tjUU3Bk+gPUP5oM qv174P5rI8MkOqhjARV3Idyzz2866aXvwKQx4dxujR3Mf3OXVuPqahslUgO6bD+ilmsR lv332iroO7g2bwDOxaZhuJSiqGwd6uOap4xvVcWMsknX3BD2MaTZ2w2GgnVKdu+wGt4A hD+B7BZ7YHWD2iCvOsA/VJHf2epciNp0l87XEZPOMkSYbTNSvoI8aYxf2QtBxGsgui9l BWUk7Q5H0tk7fX7djzGlsJhpI5HelelP1+RApbLemqmizwR0RD8DyF7nkqJ41vUF/UZ1 wB5w== X-Gm-Message-State: AOAM531QFxLa7aNrL3vEVwyL8k30kGh3itguOTNQaL/NH0f9P2uL7aP9 Ctw1KnlVPZkK7Q/PZGK27cU= X-Google-Smtp-Source: ABdhPJznhXhC5sggsG4h+//W/q6L1+Cn5tGdgB5VJumeuwoytb1VP0G4vpQ2uwZONjcaTpI5zxUuDA== X-Received: by 2002:a17:902:d70a:b0:136:cf93:1bca with SMTP id w10-20020a170902d70a00b00136cf931bcamr1241926ply.37.1629812316378; Tue, 24 Aug 2021 06:38:36 -0700 (PDT) Received: from gnu-cfl-2.localdomain ([172.58.38.240]) by smtp.gmail.com with ESMTPSA id p9sm19574374pfn.97.2021.08.24.06.38.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Aug 2021 06:38:36 -0700 (PDT) Received: from gnu-cfl-2.. (localhost [IPv6:::1]) by gnu-cfl-2.localdomain (Postfix) with ESMTP id A088AC031C; Tue, 24 Aug 2021 06:38:34 -0700 (PDT) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: gdb@sourceware.org, libc-coord@lists.openwall.com, Daniel Walker Subject: [PATCH v5 1/2] Add declare_object_symbol_alias for assembly codes [BZ #28128] Date: Tue, 24 Aug 2021 06:38:33 -0700 Message-Id: <20210824133834.2019570-2-hjl.tools@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210824133834.2019570-1-hjl.tools@gmail.com> References: <20210824133834.2019570-1-hjl.tools@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3032.4 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: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Aug 2021 13:38:47 -0000 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