From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x112a.google.com (mail-yw1-x112a.google.com [IPv6:2607:f8b0:4864:20::112a]) by sourceware.org (Postfix) with ESMTPS id C5B123858C51 for ; Tue, 3 May 2022 20:12:36 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C5B123858C51 Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-2f7c57ee6feso192488347b3.2 for ; Tue, 03 May 2022 13:12:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=9GFALD3kQGOr/7r2cdMZpXZ6Z4JMUPTmRG7TInItzXI=; b=i93VB73Vmcw5vomuPCmCo2vlY14+IdNjr7lI1HSrzvMD09Hz/bYgNvOpn/1pnEUoc2 YLUcSgzJpSimwxIK4ZVrnZ7V6QE/suKjNu6aFeP4h02wp68d9w3jhpZpU4JP5KeBkAmA +/O2niQV24PzEaRZgxm4WxHDLyxYHNYLzn0bi4qsi0U6WUdM8i14uSK1M1+ADjiFwx44 QH8WFEXfp9u5Uds3NObJF1zYjEHO1esHa6ZHC6KsbeKYWiIjMLvG25wLJ9XhEH3jF56u 0QpxzIOi1WozEfUcVDwfciIhyTqfDq8itMhc7EohuRl6ynCkcZNvBEH0V97eAjiFkERk KgXQ== X-Gm-Message-State: AOAM532C+zFzUkQFGlBU8K0r4jFjtyN5qLR4x3pZrifRJFLZ7HAHrt/k YcvcA9i4WYMvQPwuUGeYdC2ndnFS5o7K0CHNeq8tUUd6D8Y= X-Google-Smtp-Source: ABdhPJwT8wUG2DqQJLuc6TQ/qZJnCTeO6RksIf5OeTbYbW6qJBNVnBAG/T0X/OhyOuTEQNat2ZFw/zReGehWoh9FGQo= X-Received: by 2002:a81:ac9:0:b0:2fa:fc81:cc13 with SMTP id 192-20020a810ac9000000b002fafc81cc13mr2383931ywk.406.1651608756080; Tue, 03 May 2022 13:12:36 -0700 (PDT) MIME-Version: 1.0 References: <20220502212035.45lvk22rjui65pvq@google.com> In-Reply-To: From: =?UTF-8?B?RsSBbmctcnXDrCBTw7JuZw==?= Date: Tue, 3 May 2022 13:12:24 -0700 Message-ID: Subject: Re: [PATCH] elf: Rewrite long RESOLVE_MAP macro to a debug friendly function To: Nicholas Guriev Cc: libc-alpha@sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL 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: Tue, 03 May 2022 20:12:38 -0000 On 2022-05-03, Nicholas Guriev wrote: >On =D0=9F=D0=BD, 2022-05-02 at 14:20 -0700, Fangrui Song wrote: >> I think this is useful. Does the size of dl-reloc.os code increase or >> decrease with the change? >> > >It's an interesting thing but the file has decreased by 7472 bytes with >-Og and by 6896 bytes with -O3 optimization level (debug info enabled). >Despite that readelf(1) sees a new local symbol, _dl_resolve_map. > >When debug info is disabled with the -g0 flag, size of the file is also >reduced by 3296 and 1440 bytes respectively. This is because in the default build mode (gcc -O2 -fPIC), gcc decides to not inline _dl_resolve_map. That said, I run LD_DEBUG=3Dstatistics on a large PIE (500+MiB) and do not see meaningful cycle difference. The function has internal linkage (static) and it seems that the prevailing style doesn't use `_dl_` prefix for such functions. Otherwise the patch looks good to me.