This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Fix PR target/81361
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 18 Sep 2017 10:30:30 +0200
- Subject: Re: [patch] Fix PR target/81361
- Authentication-results: sourceware.org; auth=none
- Authentication-results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
- Authentication-results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jakub at redhat dot com
- Dmarc-filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2C448C057FAF
- References: <2507479.MzcqCaxoQO@polaris>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Mon, Sep 18, 2017 at 09:50:45AM +0200, Eric Botcazou wrote:
> .set L$set$24,LEFDE3-LASFDE3
> .long L$set$24 # FDE Length
> LASFDE3:
> .long LASFDE3-EH_frame1 # FDE CIE offset
> .quad LCOLDB1-. # FDE initial location
> .set L$set$25,LCOLDE1-LCOLDB1
> .quad L$set$25 # FDE address range
> .byte 0x8 # uleb128 0x8; Augmentation size
> .quad LLSDAC5-. # Language Specific Data Area
> .byte 0x1 # DW_CFA_set_loc
> .quad LCFI1-.
> .byte 0xe # DW_CFA_def_cfa_offset
> .byte 0x10 # uleb128 0x10
> .byte 0x83 # DW_CFA_offset, column 0x3
> .byte 0x2 # uleb128 0x2
>
> Note the DW_CFA_set_loc operation: it's the only case where the compiler emits
> it (DW_CFA_advance_loc4 is usually emitted) and is the source of the problem,
> since it appears that the PC-relative relocation is not applied to the operand
> of the DW_CFA_set_loc (unlike to the 2 other cases in the FDE).
That sounds like a Darwin bug in handling of DW_CFA_set_loc in .eh_frame
section, the encoding/size of the DW_CFA_set_loc operand is an encoded
pointer, always absolute address in .debug_frame section, and whatever the
CIE augmentation says should be used otherwise, i.e. the same as e.g. FDE
initial location pointer. As that is LCOLDB1-. in the same FDE, it means
LCFI1-. is right.
That said, there is indeed no reason to emit DW_CFA_set_loc when we have a
label, so your patch is ok for trunk. That doesn't mean Darwin shouldn't be
fixed. libgcc unwind-dw2.c for DW_CFA_set_loc uses read_encoded_value
and so I believe should DTRT.
> This DW_CFA_set_loc instruction is emitted by add_cfis_to_fde for the second
> FDE generated for the cold part of a function but doesn't seem necessary any
> more, since there is a label (LCOLDB1) to be used now (this can also be seen
> on Linux with the -fno-dwarf2-cfi-asm option).
>
> Bootstrapped/regtested on x86-64/Linux by me and various versions of Darwin by
> Iain, Dominique and myself. OK for the mainline?
>
>
> 2017-09-18 Eric Botcazou <ebotcazou@adacore.com>
>
> PR target/81361
> * dwarf2cfi.c (add_cfis_to_fde): Do not generate DW_CFA_set_loc
> after switching to a new text section.
Jakub