https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81968

--- Comment #39 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to r...@cebitec.uni-bielefeld.de from comment #38)
> >> --- Comment #33 from rguenther at suse dot de <rguenther at suse dot de> 
> >> ---
> > [...]
> >>>* Invalid sh_info:
> >>>
> >>>FAIL: g++.dg/lto/pr42987 cp_lto_pr42987_0.o-cp_lto_pr42987_1.o link, 
> >>>-flto
> >>>-flto-partition=none -g 
> >>>FAIL: g++.dg/lto/pr42987 cp_lto_pr42987_0.o-cp_lto_pr42987_1.o link, 
> >>>-flto -g 
> >>>
> >>>ld: fatal: file /var/tmp//ccXwdzGddebugobjtem: section
> >>>[6].rel.gnu.debuglto_.debug_info: has invalid sh_info: 9
> >>>ld: fatal: file /var/tmp//ccuVJOVbdebugobjtem: section
> >>>[6].rel.gnu.debuglto_.debug_info: has invalid sh_info: 8
> >>>
> >>>  seen during the ld -r -o ccrIZb_ddebugobj ccSerOuddebugobjtem
> >>>  cc5b3Arcdebugobjtem step:
> >>>
> >>>ccSerOuddebugobjtem: .rel.gnu.debuglto_.debug_info: sh_info: 9: does
> >>>not point
> >>>to a valid section
> >>>
> >>>Section Header[6]:  sh_name: .rel.gnu.debuglto_.debug_info
> >>>    sh_addr:      0               sh_flags:   0
> >>>    sh_size:      0x8             sh_type:    [ SHT_REL ]
> >>>    sh_offset:    0x11c8          sh_entsize: 0x8 (1 entry)
> >>>    sh_link:      5               sh_info:    9
> >>>    sh_addralign: 0x4       
> >>>
> >>>  But there's no section 9 any longer.
> >>
> >> I fixed that in the posted patch for the hpux issue(s). 
> >
> > Good: I'll try to merge the two after the christmas holidays.
> 
> I've used the attached patch, with mixed results:
> 
> * No changes on SPARC (which wasn't affected by this issue in the first
>   place).
> 
> * On x86, of the previous 32 ld: fatal: has invalid sh_info errors, 16
>   are now gone.
> 
>   However, I've many (1284 in g++.log) instances of
> 
> ld: warning: symbol .symtab[2] has invalid section index; ignored:
>         (file /var/tmp//ccyttLYbdebugobjtem value=9);
> 
>   Those links end with
> 
> ld: fatal: file /var/tmp//ccyttLYbdebugobjtem: section
> [6].rel.gnu.debuglto_.debug_info: has invalid sh_info: 9
> 
>   and ld SEGVing, again in the ld -r step.
> 
>   The warnings are from symtab entries like
> 
> Symbol Table Section:  .symtab
>   index  value size  type bind oth ver shndx         name
>     [0]      0    0  NOTY LOCL  D    0 UNDEF         
>     [1]      0    0  FILE LOCL  D    0 ABS           pr42987_0.C
>     [2]      0    0  NOTY LOCL  D    0 9             
> 
>   and section 9 doesn't exist, where the input object (cp_lto_pr42987_0.o)
> has

Just guessing that it maybe doesn't like NOTYPE on local defs?  I would
expect that before the partial link step that section 9 would exist.

Does

Index: libiberty/simple-object-elf.c
===================================================================
--- libiberty/simple-object-elf.c       (revision 256070)
+++ libiberty/simple-object-elf.c       (working copy)
@@ -1400,9 +1400,9 @@ simple_object_elf_copy_lto_debug_section
                                           gnu_lto - strings);
                          ELF_SET_FIELD (type_functions, ei_class, Sym,
                                         ent, st_shndx, Elf_Half, SHN_UNDEF);
+                         *st_info = ELF_ST_INFO (bind, STT_NOTYPE);
                        }
                      *st_other = other;
-                     *st_info = ELF_ST_INFO (bind, STT_NOTYPE);
                      ELF_SET_FIELD (type_functions, ei_class, Sym,
                                     ent, st_value, Elf_Addr, 0);
                      ELF_SET_FIELD (type_functions, ei_class, Sym,

fix these errors?

> 
> Section Header[9]:  sh_name: .gnu.debuglto_.debug_info
>     sh_addr:      0               sh_flags:   0
>     sh_size:      0x3d4           sh_type:    [ SHT_PROGBITS ]
>     sh_offset:    0x7fb           sh_entsize: 0
>     sh_link:      0               sh_info:    0
>     sh_addralign: 0x1       
> 
> Symbol Table Section:  .symtab
>   index  value size  type bind oth ver shndx / name
>     [0]      0    0  NOTY LOCL  D    0 UNDEF          
>     [1]      0    0  FILE LOCL  D    0 ABS            pr42987_0.C
>     [2]      0    0  SECT LOCL  D    0 .text          
>     [3]      0    0  SECT LOCL  D    0 .gnu.debuglto_.debug_info 
> 
>       Rainer

Reply via email to