From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6AC97386F801; Mon, 5 Oct 2020 11:38:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6AC97386F801 From: "markus.rothe at rite dot cc" To: gcc-bugs@gcc.gnu.org Subject: [Bug lto/97290] New: Segmentation fault in lto-wrapper Date: Mon, 05 Oct 2020 11:38:16 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: lto X-Bugzilla-Version: 10.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: markus.rothe at rite dot cc X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Oct 2020 11:38:16 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97290 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 apar= t 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 segfault= s. 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 . =E2=94=9C=E2=94=80=E2=94=80 -lm.res =E2=94=94=E2=94=80=E2=94=80 CMakeFiles =E2=94=94=E2=94=80=E2=94=80 aws-cpp-sdk-ec2.dir =E2=94=94=E2=94=80=E2=94=80 ub_EC2.cpp.o 2 directories, 2 files $ gdb [...] (gdb) set environment COLLECT_GCC=3D/usr/bin/g++ (gdb) set environment COMPILER_PATH=3D"/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/libex= ec/gcc/x86_64-redhat-linux/:/usr/lib/gcc/x86_64-redhat-linux/10/:/usr/lib/g= cc/x86_64-redhat-linux/" (gdb) set environment LIBRARY_PATH=3D"/usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/../li= b64/:/lib/../lib64/../lib64/:/usr/lib/../lib64/../lib64/:/usr/lib/gcc/x86_6= 4-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-l= inux/10/:/usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/:/lib/../lib= 64/:/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=3D"-c -fno-openmp -fno-openacc -g= -O2 -fPIC -O2 -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Werror=3Dformat-security -specs=3D/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=3D/usr/lib/rpm/redhat/redhat-annobin-cc1 -m= 64 -mtune=3Dgeneric -fasynchronous-unwind-tables -fstack-clash-protection -specs=3D/usr/lib/rpm/redhat/redhat-hardened-ld -shared -pthread -v -save-t= emps -shared-libgcc -march=3Dx86-64 -dumpdir ./ -dumpbase libaws-cpp-sdk-ec2.so.= wpa -fltrans-output-list=3Dlibaws-cpp-sdk-ec2.so.ltrans.out -fwpa=3D12 -fresolution=3D-lm.res -flinker-output=3Ddyn -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=3D-lm.res -flinker-output=3Ddyn 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=3D-lm.res -flinker-output=3Ddyn 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=3D0x5= 2b740, dobj=3D0x52b7d0, pfn=3D, err=3D0x7fffffffdbf8) 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=3D0x52b740, dobj=3D0x52b7d0, pfn=3D, err=3D0x7fffffffd= bf8) at ../../libiberty/simple-object-elf.c:1515 #1 0x0000000000439865 in simple_object_copy_lto_debug_sections (sobj=3D0x5= 2b740, dest=3D0x52b770 "/tmp/ccYbFOK9.debug.temp.o",=20 err=3D0x7fffffffdbf8, rename=3D1) at ../../libiberty/simple-object.c:352 #2 0x00000000004562c7 in debug_objcopy (infile=3D, rename=3Drename@entry=3Dtrue) at ../../gcc/lto-wrapper.c:1127 #3 0x000000000045857f in run_gcc (argc=3D, argv=3D) at ../../gcc/lto-wrapper.c:1736 #4 0x000000000043e577 in main (argc=3D, argv=3D) 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 =3D 0x4e3d60 ei_class =3D 2 '\002' ent =3D 0x1c75c08 "E" st_shndx =3D 1851862528 sh_map =3D 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.=