From patchwork Thu Apr 14 19:04:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 52935 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 39889385801E for ; Thu, 14 Apr 2022 19:07:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 39889385801E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1649963242; bh=YPWzavNHkK5dzgg6jyFQfF3LGRDIPAidhwbvCr93Z98=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=x5LMZ/ffJyfhO/FMT8sshkk1KuBXoPpExAprOjqSJA/AjcG8y12kp7jkqXO2whOeu a/bCALUSY+UqOr+rtIkOgQR/oj5izzQB56Nhqp3dHAZqW2e0KJaZlMkJ2yj4qPhuTe FkrLXrXWbK3jouSiTReI4lufjHHJpl0DwWvU6LcA= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id DFA843858C53 for ; Thu, 14 Apr 2022 19:04:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DFA843858C53 Received: by mail-pf1-x430.google.com with SMTP id r10so1780540pfh.13 for ; Thu, 14 Apr 2022 12:04:10 -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:mime-version :content-transfer-encoding; bh=YPWzavNHkK5dzgg6jyFQfF3LGRDIPAidhwbvCr93Z98=; b=luozh+e/FfUkexw7Qg6Wi/DC/SDD8qdgPsHhyg2nXyF2mB+0Tu8YFBX2rKUiaH2Y5x asYXK6nlvwa2uyvwR+Y92tq+4YvHkhONZFaLU0wZxnnKAKq9GhViofs0Iyqix15+oWEJ l+EG2uUXtmvjfqVcBKSJ3MneGha4GWAP3IhRwpLuCQlr7Do41v8kBt4XR0A7qIPRkRLf 8wHI6cXWlgkPc3ZBESOxzAYIcibXXOE4NlAWpSzAuIEmAygjh117uorIlr7ON5dGao0r ct3JZhFy2KNaikNZCuXV4M3MuNrd/k6oXfVJInzuCG6BS/5HuCn+/hVx7VV3wkgwdSkr CG6w== X-Gm-Message-State: AOAM532UBrC8PoDWE5k4Zo2QIvnWqaxgvi4aODgTBqG1oNBDsRWicFz4 4DwDqy2T2JZGTgEmDcEDRu5VOW+wYLQ= X-Google-Smtp-Source: ABdhPJzt0yHVTfWNPe8Y0/N4pVh01VXhwKnVDgvZAjyZOK7L6ZMijeoCMC9D7fTXqHcH2+Xr/tpb/w== X-Received: by 2002:a63:590e:0:b0:39d:1a2b:5907 with SMTP id n14-20020a63590e000000b0039d1a2b5907mr3427535pgb.188.1649963049905; Thu, 14 Apr 2022 12:04:09 -0700 (PDT) Received: from gnu-tgl-3.localdomain ([172.58.36.153]) by smtp.gmail.com with ESMTPSA id z14-20020a17090a170e00b001cb7e69ee5csm6525719pjd.54.2022.04.14.12.04.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Apr 2022 12:04:09 -0700 (PDT) Received: from gnu-tgl-3.. (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id 01C96C0076; Thu, 14 Apr 2022 12:04:08 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v9 0/7] Support DT_RELR relative relocation format Date: Thu, 14 Apr 2022 12:04:00 -0700 Message-Id: <20220414190407.3210003-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-3021.5 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, T_SCC_BODY_TEXT_LINE, URIBL_BLACK autolearn=no 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-Patchwork-Original-From: "H.J. Lu via Libc-alpha" From: "H.J. Lu" Reply-To: "H.J. Lu" Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Changes in v9: 1. A DT_RELR shared library without DT_NEEDED works. 2. A DT_RELR shared library without DT_VERNEED works. 3. A DT_RELR shared library without libc.so on DT_NEEDED works. Changes in v8: 1. Remove the out-of-date comments in _dl_check_map_versions. 2. Change "long" to "long int". 3. Update the DT_RELR NEWS entry. Changes in v7: 1. Add GLIBC_ABI_DT_RELR support before adding DT_RELR support. 2. Update the DT_RELR NEWS entry. 3. Misc fixes. Changes in v6: 1. Move ELF_DYNAMIC_DO_RELR before ELF_DYNAMIC_DO_REL. Changes in v5: 1. Update NEWS entry with the linker option, -z pack-relative-relocs. 2. Remove elf/libc-abi-version.exp and use $(READELF) to check GLIBC_ABI_DT_RELR. Changes in v4: 1. Always enable GLIBC_ABI_DT_RELR check. 2. Use $(OBJDUMP) instead of $(NM) for GLIBC_ABI_DT_RELR check. Changes in v3: 1. Don't define SUPPORT_DT_RELR. 2. Enable DT_RELR in glibc shared libraries and position independent executables (PIE) automatically if linker supports -z pack-relative-relocs. Changes in v2: 1. Enable DT_RELR for all targets. 2. Issue an error if there is a DT_RELR entry without GLIBC_ABI_DT_RELR dependency nor GLIBC_PRIVATE definition. Fangrui Song (1): elf: Support DT_RELR relative relocation format [BZ #27924] H.J. Lu (6): elf: Define DT_RELR related macros and types Add GLIBC_ABI_DT_RELR for DT_RELR support elf: Properly handle zero DT_RELA/DT_REL values elf: Add more DT_RELR tests Add --disable-default-dt-relr NEWS: Mention DT_RELR support INSTALL | 6 +++ Makeconfig | 19 ++++++++ Makerules | 2 + NEWS | 7 ++- configure | 55 +++++++++++++++++++++ configure.ac | 18 +++++++ elf/Makefile | 107 +++++++++++++++++++++++++++++++++++++++-- elf/Versions | 5 ++ elf/dl-version.c | 51 +++++++++++++++++--- elf/dynamic-link.h | 40 ++++++++++++++- elf/elf.h | 13 ++++- elf/get-dynamic-info.h | 25 ++++++++-- elf/tst-relr-mod2.c | 46 ++++++++++++++++++ elf/tst-relr-mod3a.c | 49 +++++++++++++++++++ elf/tst-relr-mod3b.c | 22 +++++++++ elf/tst-relr-mod4a.c | 19 ++++++++ elf/tst-relr-mod4b.c | 19 ++++++++ elf/tst-relr-mod4b.map | 3 ++ elf/tst-relr-pie.c | 1 + elf/tst-relr.c | 65 +++++++++++++++++++++++++ elf/tst-relr2.c | 27 +++++++++++ elf/tst-relr3.c | 27 +++++++++++ elf/tst-relr4.c | 1 + include/link.h | 6 +++ manual/install.texi | 5 ++ scripts/abilist.awk | 2 + scripts/versions.awk | 7 ++- 27 files changed, 626 insertions(+), 21 deletions(-) create mode 100644 elf/tst-relr-mod2.c create mode 100644 elf/tst-relr-mod3a.c create mode 100644 elf/tst-relr-mod3b.c create mode 100644 elf/tst-relr-mod4a.c create mode 100644 elf/tst-relr-mod4b.c create mode 100644 elf/tst-relr-mod4b.map create mode 100644 elf/tst-relr-pie.c create mode 100644 elf/tst-relr.c create mode 100644 elf/tst-relr2.c create mode 100644 elf/tst-relr3.c create mode 100644 elf/tst-relr4.c