From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by sourceware.org (Postfix) with ESMTPS id 64A3D3858C83 for ; Fri, 22 Apr 2022 22:36:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 64A3D3858C83 Received: by mail-pl1-x630.google.com with SMTP id j8so13810398pll.11 for ; Fri, 22 Apr 2022 15:36:56 -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:in-reply-to; bh=iWpYtWT0L0wGWw6U1Mfx+M5ZET9sEALbApD+q706J6o=; b=wnp31hxdpnsgM3Zx9EgZJS/bDlmU76sA+tjDNxmKgf09pniN6x1iprV5UYcFZEPdMc iYzuqPHQe8NlcRmm43MO72pDRfpEYF/qx8haQwW6HDF9ho/UsrQL1lqQPIOPQrvfi8hs /MRzGyg+Xz3t6Ax9fiEPqG+Yi9yhsnTG1MljMsak4+9xJO25fJsuH6N6S3frmvR1LfeR C7kaeiygGNkZS4acOZGcZXFwQfwuH1An4EFamT6qKiH+s/EJgZ8YQeEFd64bavU89+W2 nHgkKyWWIHlH76Kn454c8V3XyV5cZeLsHblZvwQctcoxJCkPJk5NGfLCK/vQwNrsqbpf CorQ== X-Gm-Message-State: AOAM531y2KByE85hMpur0LVhaAMXVXiyIgpO8oHTRyppeDMRx3zV9at1 XovAQhguH+2T+KjhVL9c/oP6wg== X-Google-Smtp-Source: ABdhPJwHjsiI6Z45VFYYUZV+gqZzv53VMR7L4Rc0tQj+s3wp0YXk4TDCjIU0GodDBInq0kKP2ItWZw== X-Received: by 2002:a17:903:1248:b0:151:9708:d586 with SMTP id u8-20020a170903124800b001519708d586mr6820616plh.15.1650667015226; Fri, 22 Apr 2022 15:36:55 -0700 (PDT) Received: from google.com ([2620:15c:2ce:200:8f89:e96b:b8b8:a84f]) by smtp.gmail.com with ESMTPSA id n2-20020aa79042000000b005057336554bsm3490962pfo.128.2022.04.22.15.36.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 15:36:54 -0700 (PDT) Date: Fri, 22 Apr 2022 15:36:51 -0700 From: Fangrui Song To: "H.J. Lu" Cc: libc-alpha@sourceware.org, Adhemerval Zanella Subject: Re: [PATCH v11 1/7] elf: Define DT_RELR related macros and types Message-ID: <20220422223651.frptgx3cnfgvy3e7@google.com> References: <20220422190139.2615492-1-hjl.tools@gmail.com> <20220422190139.2615492-2-hjl.tools@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20220422190139.2615492-2-hjl.tools@gmail.com> X-Spam-Status: No, score=-27.4 required=5.0 tests=BAYES_00, DKIMWL_WL_MED, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, 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: Fri, 22 Apr 2022 22:36:58 -0000 On 2022-04-22, H.J. Lu wrote: >--- > elf/elf.h | 13 +++++++++++-- > scripts/glibcelf.py | 4 ++++ > 2 files changed, 15 insertions(+), 2 deletions(-) > >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 >-- >2.35.1 > Reviewed-by: Fangrui Song