[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#969946: binutils: ld.gold produces wrong C++ EH information on mipsel and mips64el



Control: severity -1 important

lowering the severity, please use the BFD linker if possible, CCing to the mips
porters.

On 9/9/20 9:50 AM, Vasyl Gello wrote:
> Package: binutils
> Version: 2.35-2
> Severity: serious
> Justification: Policy 2.35-2
> X-Debbugs-Cc: mattia@debian.org, debian-mips@lists.debian.org
> 
> Dear colleagues,
> 
> I encountered the following 'weird' segmentation fault in kodi-test on mipsel/mips64el:
> 
> https://buildd.debian.org/status/fetch.php?pkg=kodi&arch=mips64el&ver=2%3A18.8%2Bdfsg1-2&stamp=1599185930&raw=0
> https://buildd.debian.org/status/fetch.php?pkg=kodi&arch=mipsel&ver=2%3A18.8%2Bdfsg1-2&stamp=1599180572&raw=0
> 
> and found out that the issue is the ld.gold usage.
> 
> I created a minimal reproducer with only one failing test group and ran it against gdb.
> 
> The reproducer code is attached as a git-am style patch over clean git repo.
> Also the binaries linked with bfd and gold are attached and the DWARF2 dumps made
> with 'llvm-dwarfdump-10 --all'. The gdb script and its output are also attached to this
> message.
> 
> The root cause if an issue is that language-specific data (LSDA) pointer (the structure
> pointing to exception handler) is incorrectly encoded as an absolute pointer if ld.gold
> is used, and correctly encoded if linking is done with ld.bfd (see gdb script and gdb
> trace files)
> 
> In 'llvm-dwarfdump-10' output, the correctly-linked binary has CIE structure with
> 'zPLR' augmentation followed by augmentation data encoded with type 0x1B:
> 
> 0000014c 00000018 ffffffff CIE
>   Version:               1
>   Augmentation:          "zPLR"
>   Code alignment factor: 1
>   Data alignment factor: -4
>   Return address column: 31
>   Personality Address: 000000000001d281
>   Augmentation data:     9B 81 D2 01 00 ->1B<- 1B
> 
>   DW_CFA_def_cfa_register: reg29
>   DW_CFA_nop:
> 
> 00000168 0000002c 00000020 FDE cie=00000020 pc=fffa05b4...fffa06e0
>   LSDA Address: 00000000000190c3
>   DW_CFA_advance_loc: 16
>   DW_CFA_def_cfa_offset: +40
>   DW_CFA_advance_loc: 16
>   DW_CFA_offset: reg31 -4
>   DW_CFA_offset: reg30 -8
>   DW_CFA_offset: reg17 -12
>   DW_CFA_offset: reg16 -16
>   DW_CFA_advance_loc: 4
> 
> The ld.gold, however, encodes the CIE as absolute pointer:
> 
> 00004fcc 00000018 ffffffff CIE
>   Version:               1
>   Augmentation:          "zPLR"
>   Code alignment factor: 1
>   Data alignment factor: -4
>   Return address column: 31
>   Personality Address: 00000000000a0014
>   Augmentation data:     80 14 00 0A 00 ->00<- 0B
> 
>   DW_CFA_def_cfa_register: reg29
>   DW_CFA_nop:
> 
> 00004fe8 0000002c 00000020 FDE cie=00000020 pc=000218d8...00021a04
>   LSDA Address: 00000000000a0034
>   DW_CFA_advance_loc: 16
>   DW_CFA_def_cfa_offset: +40
>   DW_CFA_advance_loc: 16
>   DW_CFA_offset: reg31 -4
>   DW_CFA_offset: reg30 -8
>   DW_CFA_offset: reg17 -12
>   DW_CFA_offset: reg16 -16
>   DW_CFA_advance_loc: 4
> 
> Rebuilding with 'gcc -fuse-ld=bfd' fixes the particular issue but overall
> it is not a solution because linking Kodi fails on memory exhausted.
> 
> Vasyl
> 


Reply to: