From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 39124 invoked by alias); 21 Oct 2015 17:23:54 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 38607 invoked by uid 89); 21 Oct 2015 17:23:54 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f180.google.com Received: from mail-ob0-f180.google.com (HELO mail-ob0-f180.google.com) (209.85.214.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 21 Oct 2015 17:23:52 +0000 Received: by obbwb3 with SMTP id wb3so47129466obb.0 for ; Wed, 21 Oct 2015 10:23:51 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.182.22.229 with SMTP id h5mr7489206obf.26.1445448230881; Wed, 21 Oct 2015 10:23:50 -0700 (PDT) Received: by 10.76.72.3 with HTTP; Wed, 21 Oct 2015 10:23:50 -0700 (PDT) In-Reply-To: <5627C8B2.6020901@redhat.com> References: <1445376433-14658-1-git-send-email-rth@redhat.com> <1445376433-14658-14-git-send-email-rth@redhat.com> <5627C8B2.6020901@redhat.com> Date: Wed, 21 Oct 2015 17:25:00 -0000 Message-ID: Subject: Re: [PATCH v2 13/13] Add hook for modifying debug info for address spaces From: "H.J. Lu" To: Richard Henderson Cc: GCC Patches , Richard Biener Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg02119.txt.bz2 On Wed, Oct 21, 2015 at 10:17 AM, Richard Henderson wrote: > On 10/21/2015 04:53 AM, H.J. Lu wrote: >> >> On Tue, Oct 20, 2015 at 2:27 PM, Richard Henderson wrote: >>> >>> --- >>> gcc/config/i386/i386.c | 21 +++++++++++++++++++++ >>> gcc/doc/tm.texi | 7 +++++++ >>> gcc/doc/tm.texi.in | 2 ++ >>> gcc/dwarf2out.c | 48 >>> +++++++++++++++++++++++++++++------------------- >>> gcc/target.def | 10 ++++++++++ >>> gcc/targhooks.c | 8 ++++++++ >>> gcc/targhooks.h | 1 + >>> 7 files changed, 78 insertions(+), 19 deletions(-) >>> >>> diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c >>> index 8f833d1..9fb0fac 100644 >>> --- a/gcc/config/i386/i386.c >>> +++ b/gcc/config/i386/i386.c >>> @@ -53707,6 +53707,27 @@ ix86_addr_space_convert (rtx op, tree from_type, >>> tree to_type) >>> #undef TARGET_ADDR_SPACE_CONVERT >>> #define TARGET_ADDR_SPACE_CONVERT ix86_addr_space_convert >>> >>> +static int >>> +ix86_addr_space_debug (addr_space_t as) >>> +{ >>> + /* Represent debugging for address spaces with DW_AT_segment, >>> + and the dwarf register for fsbase/gsbase. */ >>> + if (as == ADDR_SPACE_SEG_TLS) >>> + as = DEFAULT_TLS_SEG_REG; >>> + >>> + /* ??? These register numbers are defined in the x86-64 abi, >>> + but there is no corresponding definition for the i386 abi. >>> + That said, {58,59} appear to be reserved, so perhaps best >>> + to use the same numbers in the 32-bit abi. */ >>> + if (as == ADDR_SPACE_SEG_FS) >>> + return ~58; /* dwarf fsbase */ >>> + else if (as == ADDR_SPACE_SEG_GS) >>> + return ~59; /* dwarf gsbase */ >>> + gcc_unreachable (); >>> +} >> >> >> This is wrong for i386 psABI. Please use the DWARF register >> numbers listed in Table 2.14: DWARF Register Number Mapping >> in Intel386 psABI: >> >> https://github.com/hjl-tools/x86-psABI/wiki/X86-psABI >> >> Segment Register ES 40 %es >> Segment Register CS 41 %cs >> Segment Register SS 42 %ss >> Segment Register DS 43 %ds >> Segment Register FS 44 %fs >> Segment Register GS 45 %gs > > > I'm not looking for the segment register (aka descriptor), I'm looking for > the segment base. Not the same thing. > > As I note in the comment, there is no such definition in the i386 psabi, > while there is in the x86-64 psabi. We can define them as 93 and 94. 50-92 were used for other registers before and have been deprecated now. But some old tools may still use them. -- H.J.