From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by sourceware.org (Postfix) with ESMTPS id 1325D385800B; Fri, 8 Oct 2021 16:52:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1325D385800B Received: by mail-pl1-x634.google.com with SMTP id y1so6510543plk.10; Fri, 08 Oct 2021 09:52:19 -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; bh=3Jrarh7IWiKz/07KiMLIJ/NlIVsea7I4VI7YtA+t5/M=; b=W+tq/vpwxdM5+CrQMAAkUxhTfuLZRWagWN/b395WdA6svZU5wv1tF8cs/Q3OOsZnmi G9fNOzowUl/mQILNqnPivjScMkksLMcflOoqNEZ0/nmxrNo164qi5rOF1l7lpYTf2oCY ZjTjKa9F8FGJin+oEp2FGrWNU8mvIMf8W+sY5VLZHo6IlD06PgBtrH9+1oXeMOdEXDb3 iJ7Ve9a4ghGylxup9tT+va8xJ9MBU+7AapLTTa7xDcE/QCgI2F20t6saDiXXrbwaVWOZ wXPP3yEY/YcziA3rvlzIlOKC20C97JbmUeIpFr+0/DbgDICf7ox33hPJ4XotwUj39ap2 5fUA== X-Gm-Message-State: AOAM532BwqAD9tvYK3L7xZ89ptcG3DuYuKYDFiS2Un5wIcMxo0AASByn VG/XGaLIYQP8BTOOAEv3F3AUDiAZFPl6dxDmCDw= X-Google-Smtp-Source: ABdhPJwsbLxYq8/qYRHz5J1zViUnGSLIYlUk7Egc4BBamvS/SQ4WX1HR2PI5uGIawMy7PtsF05EcAG5K5QpOJ8kfd2g= X-Received: by 2002:a17:90a:a60c:: with SMTP id c12mr13687953pjq.28.1633711937331; Fri, 08 Oct 2021 09:52:17 -0700 (PDT) MIME-Version: 1.0 References: <20211008065740.1485737-1-maskray@google.com> In-Reply-To: <20211008065740.1485737-1-maskray@google.com> From: "H.J. Lu" Date: Fri, 8 Oct 2021 09:51:41 -0700 Message-ID: Subject: Re: [PATCH] elf: Support DT_RELR relative relocation format [BZ #27924] To: Fangrui Song Cc: GNU C Library , Binutils Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3024.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, 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: 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: Fri, 08 Oct 2021 16:52:20 -0000 On Thu, Oct 7, 2021 at 11:58 PM Fangrui Song via Binutils wrote: > > PIC objects (especially PIE and symbolic shared objects) usually have many > relative relocations. In 2017/2018, SHT_RELR/DT_RELR was proposed on > https://groups.google.com/g/generic-abi/c/bX460iggiKg/m/GxjM0L-PBAAJ > ("Proposal for a new section type SHT_RELR") and welcomed by many parties > (including Solaris). This packed format can typically save 95% dynamic > relocation section size for PIE. The vaddr size of a PIE can be 10% smaller. > > * Chrome OS folks have carried a local patch for a while (latest version: > https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/refs/heads/main/sys-libs/glibc/files/local/glibc-2.32). > I.e. this feature has been battle tested. > * Android bionic supports DT_RELR. > * The Linux kernel has supported CONFIG_RELR since 2019-08 > (https://git.kernel.org/linus/5cf896fb6be3effd9aea455b22213e27be8bdb1d). > * A musl patch (by me) exists but is not applied: > https://www.openwall.com/lists/musl/2019/03/06/3 > > I believe upstream glibc should support DT_RELR to benefit all Linux > distributions. > > As of linker support (to the best of my knowledge): > > * LLD support DT_RELR. > * https://chromium.googlesource.com/chromiumos/overlays/chromiumos-overlay/+/refs/heads/main/sys-devel/binutils/files/ > has a gold patch. > * GNU ld feature request https://sourceware.org/bugzilla/show_bug.cgi?id=27923 > > I wish that GNU ld and gold maintainers can implement the feature as well :) This feature should be implemented in GNU linker first before getting into glibc. H.J.