From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) by sourceware.org (Postfix) with ESMTPS id CE6533858C50 for ; Thu, 31 Mar 2022 11:33:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CE6533858C50 Received: by mail-oi1-x22b.google.com with SMTP id w127so24910636oig.10 for ; Thu, 31 Mar 2022 04:33:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=GB77df72FQrQphcXtZxHTpJx9bTVC7CAEQh8OHGqHGk=; b=kjALAAmpZcbhiIrP6CGQJCwcuFMqzk7qqydxQvUXAbVVdA9QcNZoUsaNPbqhahu2c9 /gXy8M+3cvqHN76HfUiBHMf6l2C4zGH+uPqxIYoiWU2J1+nPt9yP6erDg4fAwvgnZ/Wq lI7VMmA+CP+Rvz/IctPUWF1M8TGf0Dqs0eGfWqL0nxnHRhNzyYftBXEqc33jBbOj9xL5 Dbe6E47p/XAtSs190yV69L6HMYxwfnYsLJ3rxmcz3rZy46Z7EvNy1PIXQ+tUP68hgI+Q gmdgLI7tdFB0oOfIDmG3LGMowLupk2N4wIgqT+RzgBcx3Qvk5yEJoxsuaVbQYiHXeL2x MjAg== X-Gm-Message-State: AOAM533D9vhqO8uBR8rRBntd01+5YiLvrCx5Z6A4p4Zs3Y/QROkT/2md wKNMIhq0hdvrLzrV4aRUppEO5w== X-Google-Smtp-Source: ABdhPJzDnaoYw/ArRV2d+nHdf3osgoSaJwzZirr6MNgqGRl0cMQnT73W6SnKKsoZ0pX3d8MdI9P4bg== X-Received: by 2002:a05:6808:314:b0:2ec:e160:ef24 with SMTP id i20-20020a056808031400b002ece160ef24mr2451589oie.196.1648726407112; Thu, 31 Mar 2022 04:33:27 -0700 (PDT) Received: from ?IPV6:2804:431:c7cb:a6c0:4bba:d935:c74c:f625? ([2804:431:c7cb:a6c0:4bba:d935:c74c:f625]) by smtp.gmail.com with ESMTPSA id e81-20020a9d01d7000000b005cdbabcbab0sm10694165ote.22.2022.03.31.04.33.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 31 Mar 2022 04:33:26 -0700 (PDT) Message-ID: Date: Thu, 31 Mar 2022 08:33:24 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH] Remove fno-unit-at-a-time make variable Content-Language: en-US To: Fangrui Song Cc: libc-alpha@sourceware.org References: <20220330050729.2176630-1-maskray@google.com> <0295bfe2-2f44-c15e-1628-acaf94fc407c@linaro.org> <20220330162311.pwg52gcrr5vnlabe@google.com> <7e7fdfdc-ddc8-cf5a-0525-f927b4ae1e39@linaro.org> <20220331034302.rzcu6gllo7ltkhjh@google.com> From: Adhemerval Zanella In-Reply-To: <20220331034302.rzcu6gllo7ltkhjh@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, BODY_8BITS, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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-List-Received-Date: Thu, 31 Mar 2022 11:33:29 -0000 On 31/03/2022 00:43, Fangrui Song wrote: > On 2022-03-30, Adhemerval Zanella wrote: >> >> >> On 30/03/2022 13:23, Fangrui Song wrote: >>> On 2022-03-30, Adhemerval Zanella wrote: >>>> >>>> >>>> On 30/03/2022 02:07, Fangrui Song wrote: >>>>> 795985e4e751 in 2003 added -fno-unit-at-a-time to errlist.c and >>>>> siglist.c to "avoid reordering assembler output". -fno-toplevel-reorder >>>>> is a rough replacement for this legacy option >>>>> (https://sourceware.org/pipermail/gcc-patches/2006-January/186801.html). >>>>> >>>>> The reordering requirement does not seem to be needed any longer. >>>> >>>> We still need them for otherwise DEFINE_COMPAT_ERRLIST used on errlist-compat.c >>>> does not create _sys_errlist and _sys_siglist with expected sizes defined by >>>> glibc ABI. >>>> >>>> I am trying to fix without resorting to compiler options. >>> >>> DEFINE_COMPAT_ERRLIST does not expand to code/data, just reordeable directives: >>> >>> >>>        .globl  __GLIBC_2_1_sys_errlist >>> .set __GLIBC_2_1_sys_errlist, _sys_errlist_internal >>>         .type   __GLIBC_2_1_sys_errlist,@object >>>         .size   __GLIBC_2_1_sys_errlist, 1000 >>>         .globl  __GLIBC_2_1__sys_errlist >>> .set __GLIBC_2_1__sys_errlist, _sys_errlist_internal >>>         .type   __GLIBC_2_1__sys_errlist,@object >>>         .size   __GLIBC_2_1__sys_errlist, 1000 >>> .symver __GLIBC_2_1_sys_nerr, sys_nerr@GLIBC_2.2.5 >>> .symver __GLIBC_2_1__sys_nerr, _sys_nerr@GLIBC_2.2.5 >>> .symver __GLIBC_2_1_sys_errlist, sys_errlist@GLIBC_2.2.5 >>> .symver __GLIBC_2_1__sys_errlist, _sys_errlist@GLIBC_2.2.5 >>>         .globl  __GLIBC_2_3_sys_errlist >>> .set __GLIBC_2_3_sys_errlist, _sys_errlist_internal >>>         .type   __GLIBC_2_3_sys_errlist,@object >>>         .size   __GLIBC_2_3_sys_errlist, 1008 >>>         .globl  __GLIBC_2_3__sys_errlist >>> .set __GLIBC_2_3__sys_errlist, _sys_errlist_internal >>>         .type   __GLIBC_2_3__sys_errlist,@object >>>         .size   __GLIBC_2_3__sys_errlist, 1008 >>> .symver __GLIBC_2_3_sys_nerr, sys_nerr@GLIBC_2.3 >>> .symver __GLIBC_2_3__sys_nerr, _sys_nerr@GLIBC_2.3 >>> .symver __GLIBC_2_3_sys_errlist, sys_errlist@GLIBC_2.3 >>> .symver __GLIBC_2_3__sys_errlist, _sys_errlist@GLIBC_2.3 >>>         .globl  __GLIBC_2_4_sys_errlist >>> >>> I do not know whether GCC would reorder these macros. Even yes, >>> that'd just change the .symtab entries in the relocatable object file. >>> The linker behavior remains the same with reordering. >> >> It does not seem to, just remove the -fno-unit-at-a-time and issue make >> check-abi and you will see that object size for the compat symbols >> reference to _sys_err_internal instead of the define compat ones. > > I see. I think this is a brittle behavior in GNU assembler. Filed > https://sourceware.org/bugzilla/show_bug.cgi?id=29012 with detailed > information. I have created a patch but I know that will not solve > glibc's problem :( It would be good to have this fixes, but unfortunately we need a way to handle this on older binutils. I am kind worried that the only possible way to actually fix this without resorting to any compiler flags is coding the array definitions in assembly direct...