From patchwork Fri Apr 22 19:01:33 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: 53127 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 3FB193858C51 for ; Fri, 22 Apr 2022 19:02:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3FB193858C51 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1650654124; bh=E4Fas5l64BnRB7Mn/oByyxRmxGOTmP9qyPpS0RiKqQA=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=xDeDkfxJlfCxGyTrdFv90gRyKWyyeYqNLFeTLWaMjh+c9jrDy7j65MP2gT3OdmF1o sIvyHI9R971NZ8QnbLTW8I2hKs+5xKtyMKeyy3V55sukqyEb0FhjDYWUMmNhfPpw29 fs8yihgWPIqJbLKJcTr+fe0wEvGG2DSFxg+84MLQ= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id 3F32D3858C51 for ; Fri, 22 Apr 2022 19:01:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3F32D3858C51 Received: by mail-pl1-x62a.google.com with SMTP id d15so12800444pll.10 for ; Fri, 22 Apr 2022 12:01:42 -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:in-reply-to :references:mime-version:content-transfer-encoding; bh=E4Fas5l64BnRB7Mn/oByyxRmxGOTmP9qyPpS0RiKqQA=; b=QtcTow4tegTyKBww9T3fbbP7Cn6NdshX7MjyFJYCMWpd4xKtk+24SKNEVofevWB2+A +7dAMwprW7LBo22HEHkBJqQ73qkUQOx6HfGOT1hS7hY4/CwWUg9dLn9cLN70rebKp5J8 PWu3EZMiWdMW28Il9xEhQ9kJ9aTD7kX6wBG58j+mhYoD9SyFyRlDCP0rgL18IKnzvV7h yCH0dOtfdeEj6es4j8kdrpcpXg92xor62eepEil5i13hyNWQuZKMxRz8/yw1cluYjx4w 3jgSYZy/TkP0nnlwQeqx/NJ4fYyKtTokQaWOBvni3LzLRkVvtMrSKnA/Q62aYE0RlX+c HxqQ== X-Gm-Message-State: AOAM531NZIgJ0sM+UToFOmHEbD8ThsWdfI+iJgVaqs6xl0NoGYy8RuCk OxSFn0MxqhmRfINis/s4oa3nqZgS2nA= X-Google-Smtp-Source: ABdhPJxc304yHLh9jgIQ01gk1pzQ1BzY7IReD/K27vRHqd5nfSTRu2izf+HQ/Nv77XAYwySXMXc5gg== X-Received: by 2002:a17:902:daca:b0:15c:e27e:ec12 with SMTP id q10-20020a170902daca00b0015ce27eec12mr398512plx.73.1650654101325; Fri, 22 Apr 2022 12:01:41 -0700 (PDT) Received: from gnu-tgl-3.localdomain ([172.58.35.133]) by smtp.gmail.com with ESMTPSA id f16-20020aa78b10000000b0050a81508653sm3305622pfd.198.2022.04.22.12.01.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 12:01:40 -0700 (PDT) Received: from gnu-tgl-3.. (localhost [IPv6:::1]) by gnu-tgl-3.localdomain (Postfix) with ESMTP id 61722C0287; Fri, 22 Apr 2022 12:01:39 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v11 1/7] elf: Define DT_RELR related macros and types Date: Fri, 22 Apr 2022 12:01:33 -0700 Message-Id: <20220422190139.2615492-2-hjl.tools@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220422190139.2615492-1-hjl.tools@gmail.com> References: <20220422190139.2615492-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3027.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, 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-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" --- elf/elf.h | 13 +++++++++++-- scripts/glibcelf.py | 4 ++++ 2 files changed, 15 insertions(+), 2 deletions(-) Reviewed-by: Fangrui Song diff --git a/elf/elf.h b/elf/elf.h index 0735f6b579..0195029188 100644 --- a/elf/elf.h +++ b/elf/elf.h @@ -443,7 +443,8 @@ typedef struct #define SHT_PREINIT_ARRAY 16 /* Array of pre-constructors */ #define SHT_GROUP 17 /* Section group */ #define SHT_SYMTAB_SHNDX 18 /* Extended section indices */ -#define SHT_NUM 19 /* Number of defined types. */ +#define SHT_RELR 19 /* RELR relative relocations */ +#define SHT_NUM 20 /* Number of defined types. */ #define SHT_LOOS 0x60000000 /* Start OS-specific. */ #define SHT_GNU_ATTRIBUTES 0x6ffffff5 /* Object attributes. */ #define SHT_GNU_HASH 0x6ffffff6 /* GNU-style hash table. */ @@ -662,6 +663,11 @@ typedef struct Elf64_Sxword r_addend; /* Addend */ } Elf64_Rela; +/* RELR relocation table entry */ + +typedef Elf32_Word Elf32_Relr; +typedef Elf64_Xword Elf64_Relr; + /* How to extract and insert information held in the r_info field. */ #define ELF32_R_SYM(val) ((val) >> 8) @@ -887,7 +893,10 @@ typedef struct #define DT_PREINIT_ARRAY 32 /* Array with addresses of preinit fct*/ #define DT_PREINIT_ARRAYSZ 33 /* size in bytes of DT_PREINIT_ARRAY */ #define DT_SYMTAB_SHNDX 34 /* Address of SYMTAB_SHNDX section */ -#define DT_NUM 35 /* Number used */ +#define DT_RELRSZ 35 /* Total size of RELR relative relocations */ +#define DT_RELR 36 /* Address of RELR relative relocations */ +#define DT_RELRENT 37 /* Size of one RELR relative relocaction */ +#define DT_NUM 38 /* Number used */ #define DT_LOOS 0x6000000d /* Start of OS-specific */ #define DT_HIOS 0x6ffff000 /* End of OS-specific */ #define DT_LOPROC 0x70000000 /* Start of processor-specific */ diff --git a/scripts/glibcelf.py b/scripts/glibcelf.py index 8f7d0ca184..637f632038 100644 --- a/scripts/glibcelf.py +++ b/scripts/glibcelf.py @@ -298,6 +298,7 @@ class Sht(_OpenIntEnum): SHT_PREINIT_ARRAY = 16 SHT_GROUP = 17 SHT_SYMTAB_SHNDX = 18 + SHT_RELR = 19 SHT_GNU_ATTRIBUTES = 0x6ffffff5 SHT_GNU_HASH = 0x6ffffff6 SHT_GNU_LIBLIST = 0x6ffffff7 @@ -587,6 +588,9 @@ class Dt(_OpenIntEnum): DT_PREINIT_ARRAY = 32 DT_PREINIT_ARRAYSZ = 33 DT_SYMTAB_SHNDX = 34 + DT_RELRSZ = 35 + DT_RELR = 36 + DT_RELRENT = 37 DT_GNU_PRELINKED = 0x6ffffdf5 DT_GNU_CONFLICTSZ = 0x6ffffdf6 DT_GNU_LIBLISTSZ = 0x6ffffdf7