From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by sourceware.org (Postfix) with ESMTPS id 78148383E680 for ; Sun, 22 May 2022 22:24:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 78148383E680 Received: by mail-pj1-x1030.google.com with SMTP id gg20so12436996pjb.1 for ; Sun, 22 May 2022 15:24:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to; bh=Zufg5hKohfnQYFnm5A+ykmxO7kZ1Xp+ATdLZaWYzDUo=; b=Oix0PWdcQ+t7o3Kt5Lv9KJvb1DdUhdIpnP6XRsAMYalRAXYFpm+lJJPzR+OfPNUviq ZgYw+k29IZCf8+FYox4VNeKv5mB2qgUCwR8qpStmZwoVC3BqMUa6sHS50qbxPK4EKKUA 8byF7Dj9Z9idHexuz6MVe7YCclPglwlQ/Dv+FD1E6U3eRqOvdklr7l6Osa7xrU4NZ/zj UigDrudRKTj3MJAFbzIYDZ8CUaRzoY0BnGoLXPJ/QrdiNhveb7Q8VbZGyDl6EEK6sOm3 4xrif1Ebe0XqqwrpO/PjvlCbytJEzQvTpW/iR6HkcpGSWv9WCQ8FOZlGmW5mVGsZX+Uh y4vQ== X-Gm-Message-State: AOAM532uBijHhmz7Q53ko1ddjXvRwiwv4rX8aTFWjBhI/hN9NswfdR2c bJi9XcgAix6OWfb6y8721yQsb6nWCKuLpQ== X-Google-Smtp-Source: ABdhPJwzGgKBvE4qC3Lx1A6k8Wd+0LyS8hUnLl473Ww9s7yAPxYz1MqnuujS1VpUKkWCFq+MeSwmcA== X-Received: by 2002:a17:902:ccc5:b0:15e:f75e:6ce with SMTP id z5-20020a170902ccc500b0015ef75e06cemr20068809ple.104.1653258269320; Sun, 22 May 2022 15:24:29 -0700 (PDT) Received: from google.com ([2620:15c:2ce:200:5c62:c367:5cab:9287]) by smtp.gmail.com with ESMTPSA id d2-20020a62f802000000b0050dc7628166sm5765383pfh.64.2022.05.22.15.24.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 May 2022 15:24:28 -0700 (PDT) Date: Sun, 22 May 2022 15:24:25 -0700 From: Fangrui Song To: Siddhesh Poyarekar Cc: Nicholas Guriev , libc-alpha@sourceware.org Subject: Re: [PATCH v3] elf: Rewrite long RESOLVE_MAP macro to a debug friendly function Message-ID: <20220522222425.hk5vde2erkyadxol@google.com> References: <20220514224849.d7isxwcxnxoo3jhc@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-20.5 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.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-List-Received-Date: Sun, 22 May 2022 22:24:32 -0000 On 2022-05-15, Siddhesh Poyarekar wrote: >On 15/05/2022 04:18, Fangrui Song wrote: >>On 2022-05-14, Nicholas Guriev wrote: >>>On Пн, 2022-05-09 at 19:08 +0530, Siddhesh Poyarekar wrote: >>>>Please use __always_inline instead, which adds the inline keyword as >>>>well as __attribute__ ((inline)).  That way gcc ensures that the >>>>function is *always* inlined. >>> >>>That is not necessary. My original intention was to improve the >>>debugging experience at this point. And the standard `inline` keyword >>>allows one to control optimizations with the -O flag. > >You can't build glibc with anything less than -O2, so that's a moot >point. If you don't use __always_inline here then you're not only >changing the debugging experience, but also potentially adding a >performance overhead. gdb can do well enough in most cases of inlined >functions, so __always_inlined should not hamper that. Hope that the -O2 requirement can be lifted:) The original decision might be related to guaranteed inlining and relocations in -O0 but it should be revisited nowadays... (Both FreeBSD rtld and musl rtld allow -O0). >>Looks good to me, I think the always_inline here does not affect >>performance, as shown in my testing with a large PIE with many >>R_*_RELATIVE (function call overhead is larger with a non-R_*_RELATIVE). > >If you want to make a decision based on this then please quantify it >more precisely with a microbenchmark added to benchtests. Otherwise >just add __always_inline because it is a more minimal change. TBH I'd >prefer the former because it then adds a new microbenchmark that we >can measure dynamic linker changes in future but I can live with the >latter. Thanks. I can add __always_inline. (I don't think it matters but I guess I just want to avoid a debate :))