From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 29CE81F5AE for ; Tue, 20 Jul 2021 21:04:21 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 64D2B398D410 for ; Tue, 20 Jul 2021 21:04:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 64D2B398D410 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1626815060; bh=vhEk1EPc+ZYUUn7kfzji9is9CpB0GJs19TqD003V6Vs=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=mfWjA4cIb9d9vkXF/R/wpEe1J+r/RxKziFOIIU6f2DhVffBzUWJwZzBx+J4y1LrwF JirRptWVBtNwu4WUnjNANICstG31BquUZDEtQyzRzWD49WVRcusmkbC9FYUa2Eds5s CJAveNDqjSGkt3c7xmeWL4ERfIDmdINj101OeRd4= Received: from smtprelay-out1.synopsys.com (smtprelay-out1.synopsys.com [149.117.87.133]) by sourceware.org (Postfix) with ESMTPS id 6543C398D401 for ; Tue, 20 Jul 2021 20:58:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6543C398D401 Received: from mailhost.synopsys.com (sv2-mailhost2.synopsys.com [10.205.2.134]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mailhost.synopsys.com", Issuer "SNPSica2" (verified OK)) by smtprelay-out1.synopsys.com (Postfix) with ESMTPS id 8C97EC378C; Tue, 20 Jul 2021 20:58:12 +0000 (UTC) Received: from vineetg-Latitude-7400.internal.synopsys.com (snps-fugpbdpduq.internal.synopsys.com [10.202.17.37]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client did not present a certificate) by mailhost.synopsys.com (Postfix) with ESMTPSA id BDDC7A026B; Tue, 20 Jul 2021 20:58:11 +0000 (UTC) X-SNPS-Relay: synopsys.com To: libc-alpha@sourceware.org Subject: [PATCH 2/2] ARC: elf: make type safe Date: Tue, 20 Jul 2021 13:58:00 -0700 Message-Id: <20210720205800.1056218-3-vgupta@synopsys.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210720205800.1056218-1-vgupta@synopsys.com> References: <20210720205800.1056218-1-vgupta@synopsys.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: , From: Vineet Gupta via Libc-alpha Reply-To: Vineet Gupta Cc: Vineet Gupta , linux-snps-arc@lists.infradead.org Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" Signed-off-by: Vineet Gupta --- sysdeps/arc/dl-machine.h | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/sysdeps/arc/dl-machine.h b/sysdeps/arc/dl-machine.h index 60b49af0d5ca..e6ce7f0ff6d9 100644 --- a/sysdeps/arc/dl-machine.h +++ b/sysdeps/arc/dl-machine.h @@ -86,7 +86,7 @@ /* Return nonzero iff ELF header is compatible with the running host. */ static inline int -elf_machine_matches_host (const Elf32_Ehdr *ehdr) +elf_machine_matches_host (const ElfW(Ehdr) *ehdr) { return (ehdr->e_machine == EM_ARCV2 /* ARC HS. */ || ehdr->e_machine == EM_ARC_COMPACT); /* ARC 700. */ @@ -124,7 +124,7 @@ static inline int __attribute__ ((always_inline)) elf_machine_runtime_setup (struct link_map *l, int lazy, int profile) { - extern void _dl_runtime_resolve (Elf32_Word); + extern void _dl_runtime_resolve (void); if (l->l_info[DT_JMPREL] && lazy) { @@ -202,7 +202,7 @@ __start: \n\ /* A reloc type used for ld.so cmdline arg lookups to reject PLT entries. */ #define ELF_MACHINE_JMP_SLOT R_ARC_JUMP_SLOT -/* ARC uses Elf32_Rela relocations. */ +/* ARC uses Rela relocations. */ #define ELF_MACHINE_NO_REL 1 #define ELF_MACHINE_NO_RELA 0 @@ -211,19 +211,14 @@ __start: \n\ static inline ElfW(Addr) elf_machine_fixup_plt (struct link_map *map, lookup_t t, const ElfW(Sym) *refsym, const ElfW(Sym) *sym, - const Elf32_Rela *reloc, + const ElfW(Rela) *reloc, ElfW(Addr) *reloc_addr, ElfW(Addr) value) { return *reloc_addr = value; } /* Return the final value of a plt relocation. */ -static inline ElfW(Addr) -elf_machine_plt_value (struct link_map *map, const Elf32_Rela *reloc, - ElfW(Addr) value) -{ - return value; -} +#define elf_machine_plt_value(map, reloc, value) (value) /* Names of the architecture-specific auditing callback functions. */ #define ARCH_LA_PLTENTER arc_gnu_pltenter @@ -239,8 +234,9 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc, const ElfW(Sym) *sym, const struct r_found_version *version, void *const reloc_addr_arg, int skip_ifunc) { + ElfW(Addr) r_info = reloc->r_info; + const unsigned long int r_type = ELFW (R_TYPE) (r_info); ElfW(Addr) *const reloc_addr = reloc_addr_arg; - const unsigned int r_type = ELF32_R_TYPE (reloc->r_info); if (__glibc_unlikely (r_type == R_ARC_RELATIVE)) *reloc_addr += map->l_addr; @@ -334,11 +330,12 @@ elf_machine_lazy_rel (struct link_map *map, ElfW(Addr) l_addr, const ElfW(Rela) *reloc, int skip_ifunc) { ElfW(Addr) *const reloc_addr = (void *) (l_addr + reloc->r_offset); + const unsigned int r_type = ELFW (R_TYPE) (reloc->r_info); - if (ELF32_R_TYPE (reloc->r_info) == R_ARC_JUMP_SLOT) + if (r_type == R_ARC_JUMP_SLOT) *reloc_addr += l_addr; else - _dl_reloc_bad_type (map, ELF32_R_TYPE (reloc->r_info), 1); + _dl_reloc_bad_type (map, r_type, 1); } #endif /* RESOLVE_MAP */ -- 2.25.1