public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug lto/97290] New: Segmentation fault in lto-wrapper
@ 2020-10-05 11:38 markus.rothe at rite dot cc
  2020-10-05 11:42 ` [Bug lto/97290] " marxin at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: markus.rothe at rite dot cc @ 2020-10-05 11:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97290
           Summary: Segmentation fault in lto-wrapper
           Product: gcc
           Version: 10.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: lto
          Assignee: unassigned at gcc dot gnu.org
          Reporter: markus.rothe at rite dot cc
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Hello, I get a segmentation fault when building RPMs for the AWS SDK for C++ on
Fedora 33. This version of Fedora enables LTO by default, previous versions did
not use LTO by default. So there are several layers that I had to peal apart in
order to come up with what I can show you below. I welcome any suggestions on
how to debug this problem further.

Within the cmake based build process, lto-wrapper is called and it segfaults.

To reproduce, I did the following on a Fedora 33 machine:

[ Warning, ub_EC2.cpp.o is about 700MB large. ]

$ gcc --version
gcc (GCC) 10.2.1 20200826 (Red Hat 10.2.1-3)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ mkdir -p reproduce-tmp/CMakeFiles/aws-cpp-sdk-ec2.dir/
$ cd reproduce-tmp/
$ curl -o CMakeFiles/aws-cpp-sdk-ec2.dir/
https://files.markus289.com/aifoo3/ub_EC2.cpp.o
$ curl -o -lm.res https://files.markus289.com/aifoo3/-lm.res
$ tree
.
├── -lm.res
└── CMakeFiles
    └── aws-cpp-sdk-ec2.dir
        └── ub_EC2.cpp.o

2 directories, 2 files
$ gdb
[...]
(gdb) set environment COLLECT_GCC=/usr/bin/g++
(gdb) set environment
COMPILER_PATH="/usr/libexec/gcc/x86_64-redhat-linux/10/:/usr/libexec/gcc/x86_64-redhat-linux/10/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/10/:/usr/lib/gcc/x86_64-redhat-linux/:/usr/libexec/gcc/x86_64-redhat-linux/10/:/usr/libexec/gcc/x86_64-redhat-linux/10/:/usr/libexec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/10/:/usr/lib/gcc/x86_64-redhat-linux/"
(gdb) set environment
LIBRARY_PATH="/usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/../lib64/:/lib/../lib64/../lib64/:/usr/lib/../lib64/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/10/:/usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/10/:/usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/:/lib/../lib64/:/usr/lib/../lib64/:/usr/lib/gcc/x86_64-redhat-linux/10/../../../:/lib/:/usr/lib/:/usr/lib/gcc/x86_64-redhat-linux/10/../../../:/lib/:/usr/lib/"
(gdb) set environment COLLECT_GCC_OPTIONS="-c -fno-openmp -fno-openacc -g -O2
-fPIC -O2 -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe
-Werror=format-security -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
-fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64
-mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection
-specs=/usr/lib/rpm/redhat/redhat-hardened-ld -shared -pthread -v -save-temps
-shared-libgcc -march=x86-64 -dumpdir ./ -dumpbase libaws-cpp-sdk-ec2.so.wpa
-fltrans-output-list=libaws-cpp-sdk-ec2.so.ltrans.out -fwpa=12
-fresolution=-lm.res -flinker-output=dyn -shared-libgcc"
(gdb) file /usr/libexec/gcc/x86_64-redhat-linux/10/lto-wrapper
Reading symbols from /usr/libexec/gcc/x86_64-redhat-linux/10/lto-wrapper...
Reading symbols from
/usr/lib/debug/usr/libexec/gcc/x86_64-redhat-linux/10/lto-wrapper-10.2.1-3.fc33.x86_64.debug...
(gdb) set args -fresolution=-lm.res -flinker-output=dyn
CMakeFiles/aws-cpp-sdk-ec2.dir/ub_EC2.cpp.o
(gdb) run
Starting program: /usr/libexec/gcc/x86_64-redhat-linux/10/lto-wrapper
-fresolution=-lm.res -flinker-output=dyn
CMakeFiles/aws-cpp-sdk-ec2.dir/ub_EC2.cpp.o
[Detaching after vfork from child process 109]

Program received signal SIGSEGV, Segmentation fault.
0x000000000043b314 in simple_object_elf_copy_lto_debug_sections (sobj=0x52b740,
dobj=0x52b7d0, pfn=<optimized out>, err=0x7fffffffdbf8)
    at ../../libiberty/simple-object-elf.c:1515
1515                    ELF_SET_FIELD (type_functions, ei_class, Sym,
(gdb) bt
#0  0x000000000043b314 in simple_object_elf_copy_lto_debug_sections
(sobj=0x52b740, dobj=0x52b7d0, pfn=<optimized out>, err=0x7fffffffdbf8)
    at ../../libiberty/simple-object-elf.c:1515
#1  0x0000000000439865 in simple_object_copy_lto_debug_sections (sobj=0x52b740,
dest=0x52b770 "/tmp/ccYbFOK9.debug.temp.o", 
    err=0x7fffffffdbf8, rename=1) at ../../libiberty/simple-object.c:352
#2  0x00000000004562c7 in debug_objcopy (infile=<optimized out>,
rename=rename@entry=true) at ../../gcc/lto-wrapper.c:1127
#3  0x000000000045857f in run_gcc (argc=<optimized out>, argv=<optimized out>)
at ../../gcc/lto-wrapper.c:1736
#4  0x000000000043e577 in main (argc=<optimized out>, argv=<optimized out>) at
../../gcc/lto-wrapper.c:1998
(gdb)


The error happens in the following line of code in
libiberty/simple-object-elf.c:1515:

ELF_SET_FIELD (type_functions, ei_class, Sym, ent, st_shndx, Elf_Half,
sh_map[st_shndx]);

Again, in gdb:

(gdb) info locals [copied only relevant output]
type_functions = 0x4e3d60 <elf_little_64_functions>
ei_class = 2 '\002'
ent = 0x1c75c08 "E"
st_shndx = 1851862528
sh_map = 0x1be3c50

I don't know what 'Sym' and 'Elf_Half' refer to.

Could someone please continue debugging this? I would be glad to offer more
help.

If there is need to come up with the steps that produce ub_EC2.cpp.o, then I
would write something that one can follow.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-10-07 12:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-05 11:38 [Bug lto/97290] New: Segmentation fault in lto-wrapper markus.rothe at rite dot cc
2020-10-05 11:42 ` [Bug lto/97290] " marxin at gcc dot gnu.org
2020-10-05 11:43 ` markus.rothe at rite dot cc
2020-10-05 11:44 ` marxin at gcc dot gnu.org
2020-10-05 12:07 ` marxin at gcc dot gnu.org
2020-10-05 12:49 ` markus.rothe at rite dot cc
2020-10-05 13:17 ` marxin at gcc dot gnu.org
2020-10-05 15:13 ` marxin at gcc dot gnu.org
2020-10-07  6:53 ` marxin at gcc dot gnu.org
2020-10-07 12:05 ` marxin at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).