From patchwork Thu May 12 12:59:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 53868 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 E0821384B0CC for ; Thu, 12 May 2022 13:14:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E0821384B0CC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1652361292; bh=aBrO61I2MBsIk23tJxTRk14eVbt2yNamYRRLUw6KmKg=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=LLAcq/4Fb7e/lSh6QdCNYmBJMF3ij3+vd4gv//xYt8YIWxeeYZQtFwtyN5gjDTwZe dUx5cG76q/LzSrUBe9RT0/mL/mFaRqoHJgrIICjwcs/GDwxGnsuUgGCzjNwdpNngBI lt+7Ar/8TQSvUipB1x6zSeeK3vNRA2XeJXtRsGzY= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) by sourceware.org (Postfix) with ESMTPS id 49EB83836409 for ; Thu, 12 May 2022 12:59:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 49EB83836409 Received: by mail-oi1-x232.google.com with SMTP id i66so6261094oia.11 for ; Thu, 12 May 2022 05:59:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aBrO61I2MBsIk23tJxTRk14eVbt2yNamYRRLUw6KmKg=; b=5AdtdRAM2b9Te+E4jY33BLGPGiKotVSh9w0iX5CBrOCTTOvu69LasYrbuwW+GNNTcU hP8jx2ZFnPC7b+uFnqJXwIfDmvl+FElUIVWXbIHXM8TTiXVG2jT8r8zlK/sBdXHa0G5c CEHw09LpizlQOyDzC7mT1qcj5CnuRYVP8bcy4Shzdf8KdOS0AUh79s3GtndNuDaaMIuc GvXBQVx/dYIwUatdvCKVZpOSq6UF/HdOkyGzpAai42yDuQDsaNAEjXb3LdgnSPF8f2Rx cSOU+zUSu5wBVfRnSAlYiV6fmureCCSd1aWFiyq63TadDGMpNCfB47es2weabHtyV678 fXew== X-Gm-Message-State: AOAM533UUGP52Si8v/buBGwW4PkFZHhovI3vd8DhHEV89myL1g1+qLtz jBZMwqmQmZT7XyM36/Vc6kppN0yUWRbyqw== X-Google-Smtp-Source: ABdhPJx41GSjt/FAH3NEr1xOBDJtMNPHBow/Vrqod/kScOMb1AVfjOvGJbQOtkDdbaCkWXNrgdCRMw== X-Received: by 2002:a05:6808:23d2:b0:326:979a:46f3 with SMTP id bq18-20020a05680823d200b00326979a46f3mr5356711oib.207.1652360381347; Thu, 12 May 2022 05:59:41 -0700 (PDT) Received: from birita.. ([2804:431:c7ca:5fbd:6a01:8849:5cb:128b]) by smtp.gmail.com with ESMTPSA id a11-20020a056870d18b00b000edf5a12baasm1527144oac.46.2022.05.12.05.59.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 05:59:40 -0700 (PDT) To: libc-alpha@sourceware.org, Fangrui Song Subject: [PATCH v2 1/4] Add declare_object_symbol_alias for assembly codes (BZ #28128) Date: Thu, 12 May 2022 09:59:28 -0300 Message-Id: <20220512125931.523712-2-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220512125931.523712-1-adhemerval.zanella@linaro.org> References: <20220512125931.523712-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, KAM_STOCKGEN, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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 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: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Netto Reply-To: Adhemerval Zanella Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" From: "H.J. Lu" 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. Reviewed-by: Fangrui Song --- include/libc-symbols.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/include/libc-symbols.h b/include/libc-symbols.h index 662bd118b1..4bb3d8c7ba 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) \ - strong_alias (original, symbol); \ - .type C_SYMBOL_NAME (symbol), %##type; \ - .size C_SYMBOL_NAME (symbol), 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) ASM_LINE_SEP \ + .type C_SYMBOL_NAME (symbol), %object ASM_LINE_SEP \ + .size C_SYMBOL_NAME (symbol), s_size ASM_LINE_SEP #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) \