On Tue, Oct 20, 2015 at 2:27 PM, Richard Henderson <r...@redhat.com> 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


-- 
H.J.

Reply via email to