From patchwork Tue Jul 20 20:58:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vineet Gupta X-Patchwork-Id: 1507757 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=bHZxH3yb; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.a=rsa-sha256 header.s=mail header.b=Q7OcOZ0d; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 ozlabs.org (Postfix) with ESMTPS id 4GTrf828fkz9sWd for ; Wed, 21 Jul 2021 06:58:23 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kQWvKoYz2GUnX5DUQB4gKA6DjWWbxMDF4f76pcYftE0=; b=bHZxH3ybuAXWRv p/qgoU95DlTI19ReFyIZ60acH6j1/MKCfclzMVoatmjyyZhWL+Y9teLjwbl0EQKlrwyBlD7wcNi61 YzWapPzTOq8Qf3hRh9RVVLWJ5eNDfCXZl/i2twFJ1aiovckYU8m4QIKDUyazWWQJqIJAhcpevWm9v qwwl5NmWGFyhDhldoBuQXK03D5jG/edKBaqu+KuAj1yvIW1iifMDm7YxmjN284FLzaUcw72+O5y35 d3DNA7Rm3QJI4fC3HO2DJNJb55maVY8dh+gcj15axRTWK8gsGMFjqQFXzCiuS4PM9+mZU6f4VXry4 3mhrmGDtmCQAgStkODgg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m5won-00Dvrj-Iv; Tue, 20 Jul 2021 20:58:21 +0000 Received: from smtprelay-out1.synopsys.com ([149.117.87.133]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m5woj-00DvoT-Ol for linux-snps-arc@lists.infradead.org; Tue, 20 Jul 2021 20:58:19 +0000 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1626814692; bh=zLQ2I6C/YUm1wJ18njXY0jHFDdykM8lQJRoiRj0s5qw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q7OcOZ0d3VvMa2QQ4bdGy3aSPXRHWQjHQBJjlzDdaGhaaDYlzVQFRXzw/NuNhq+Pf aQurMDtovxnd5+qpx6g8QPOr7aEFdkGnSI08SGSEkGxRdikmQ99vpkFaGo+IwuzdEj 0NKz8aMlMC55+HCA4qzBpPc732x8g0Ga1wyTQCj2gipUy3oJDF3n0iQ64poXJk3fG4 9iQC1X3T/N4chMqDMOgSPiGe8HeKffSkl49j4DWlhZX6MmlQJZiX9IdA33FqnQdqEg Olkki/3NfVwN/4Sly0I0zUHvCsNl9WSN03fmRWepHcQy2cmeNtZgcKmPLBd7GUDNFO sGqKg0Wt32K3A== 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 From: Vineet Gupta To: libc-alpha@sourceware.org Cc: linux-snps-arc@lists.infradead.org, Vineet Gupta 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210720_135817_908120_9976E369 X-CRM114-Status: GOOD ( 12.28 ) X-Spam-Score: -0.2 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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 @@ Content analysis details: (-0.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [149.117.87.133 listed in wl.mailspike.net] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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 */