From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 43338 invoked by alias); 1 Sep 2016 09:43:12 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 43288 invoked by uid 89); 1 Sep 2016 09:43:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=bonus X-Spam-User: qpsmtpd, 2 recipients X-HELO: foss.arm.com Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 01 Sep 2016 09:43:02 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 81AB1A5E; Thu, 1 Sep 2016 02:43:00 -0700 (PDT) Received: from e105689-lin.cambridge.arm.com (e105689-lin.cambridge.arm.com [10.2.207.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 441B13F303; Thu, 1 Sep 2016 02:42:59 -0700 (PDT) Subject: Re: [PATCH 1/3] Move AARCH64 ILP32 rejection handling To: Andrew Pinski , gdb-patches@sourceware.org, binutils@sourceware.org References: <1472516750-30743-1-git-send-email-apinski@cavium.com> <1472715400-43043-1-git-send-email-apinski@cavium.com> <1472715400-43043-2-git-send-email-apinski@cavium.com> From: "Richard Earnshaw (lists)" Message-ID: <2cad9002-f670-dc82-842a-859c469e8519@arm.com> Date: Thu, 01 Sep 2016 09:43:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <1472715400-43043-2-git-send-email-apinski@cavium.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SW-Source: 2016-09/txt/msg00010.txt.bz2 On 01/09/16 08:36, Andrew Pinski wrote: > For AARCH64 ILP32, we reject compatibility too > early on to support gdb ILP32. This patch > moves ILP32 rejection from compatible > to elfNN_aarch64_merge_private_bfd_data > which allows aarch64 and aarch64:ilp32 > to be handled correctly with gdb. > An added bonus is that we can have an error > message on why two object files are rejected. > > OK? Tested both binutils and gdb. > You haven't explained why you've dropped these tests: - /* Otherwise if either a or b is the 'default' machine - then it can be polymorphed into the other. */ - if (a->the_default) - return b; - - if (b->the_default) - return a; - - /* So far all newer cores are - supersets of previous cores. */ - if (a->mach < b->mach) - return b; - else if (a->mach > b->mach) - return a; R. > Thanks, > Andrew Pinski > > 2016-08-31 Andrew Pinski > > * cpu-aarch64.c (compatible): > Don't reject different mach or ILP32 here. > * elfnn-aarch64.c (elfNN_aarch64_merge_private_bfd_data): > Add an error message on why endianess is rejected. > Reject different ILP32/LP64 settings. > > Signed-off-by: Andrew Pinski > --- > bfd/ChangeLog | 8 ++++++++ > bfd/cpu-aarch64.c | 28 +++------------------------- > bfd/elfnn-aarch64.c | 17 ++++++++++++++++- > 3 files changed, 27 insertions(+), 26 deletions(-) > > diff --git a/bfd/ChangeLog b/bfd/ChangeLog > index 59dfb2c..77b2b6b 100644 > --- a/bfd/ChangeLog > +++ b/bfd/ChangeLog > @@ -1,3 +1,11 @@ > +2016-08-31 Andrew Pinski > + > + * cpu-aarch64.c (compatible): > + Don't reject different mach or ILP32 here. > + * elfnn-aarch64.c (elfNN_aarch64_merge_private_bfd_data): > + Add an error message on why endianess is rejected. > + Reject different ILP32/LP64 settings. > + > 2016-08-31 Alan Modra > > * elf64-ppc.c (group_sections): Delete stub14_group_size. Instead, > diff --git a/bfd/cpu-aarch64.c b/bfd/cpu-aarch64.c > index 596d241..6fb9133 100644 > --- a/bfd/cpu-aarch64.c > +++ b/bfd/cpu-aarch64.c > @@ -34,31 +34,9 @@ compatible (const bfd_arch_info_type * a, const bfd_arch_info_type * b) > if (a->arch != b->arch) > return NULL; > > - /* If a & b are for the same machine then all is well. */ > - if (a->mach == b->mach) > - return a; > - > - /* Don't allow mixing ilp32 with lp64. */ > - if ((a->mach & bfd_mach_aarch64_ilp32) != (b->mach & bfd_mach_aarch64_ilp32)) > - return NULL; > - > - /* Otherwise if either a or b is the 'default' machine > - then it can be polymorphed into the other. */ > - if (a->the_default) > - return b; > - > - if (b->the_default) > - return a; > - > - /* So far all newer cores are > - supersets of previous cores. */ > - if (a->mach < b->mach) > - return b; > - else if (a->mach > b->mach) > - return a; > - > - /* Never reached! */ > - return NULL; > + /* Machine compatibility is checked in > + elfNN_aarch64_merge_private_bfd_data. */ > + return a; > } > > static struct > diff --git a/bfd/elfnn-aarch64.c b/bfd/elfnn-aarch64.c > index 3435a3d..1e27501 100644 > --- a/bfd/elfnn-aarch64.c > +++ b/bfd/elfnn-aarch64.c > @@ -6530,11 +6530,26 @@ elfNN_aarch64_merge_private_bfd_data (bfd *ibfd, bfd *obfd) > > /* Check if we have the same endianess. */ > if (!_bfd_generic_verify_endian_match (ibfd, obfd)) > - return FALSE; > + { > + (*_bfd_error_handler) > + (_("%B: endianness incompatible with that of the selected emulation"), > + ibfd); > + return FALSE; > + } > > if (!is_aarch64_elf (ibfd) || !is_aarch64_elf (obfd)) > return TRUE; > > + /* Don't allow mixing ilp32 with lp64. */ > + if ((bfd_get_arch_info (ibfd)->mach & bfd_mach_aarch64_ilp32) > + != (bfd_get_arch_info (obfd)->mach & bfd_mach_aarch64_ilp32)) > + { > + (*_bfd_error_handler) > + (_("%B: ABI is incompatible with that of the selected emulation: \"%s\" != \"%s\""), > + ibfd, bfd_get_target (ibfd), bfd_get_target (obfd)); > + return FALSE; > + } > + > /* The input BFD must have had its flags initialised. */ > /* The following seems bogus to me -- The flags are initialized in > the assembler but I don't think an elf_flags_init field is >