bebbo / gcc

Bebbo's gcc-6-branch for m68k-amigaos
GNU General Public License v2.0
33 stars 11 forks source link

xgcc make_relative_prefix_1 segfault on WSL2 Ubuntu #189

Closed BSzili closed 2 years ago

BSzili commented 2 years ago

I tried building the latest version of the toolchain on Ubuntu 20.04.5 LTS (I tried 18.04.6 too, but upgraded to test again) under WSL, but got stuck at building GCC. When it tries to do an xgcc dumpspecs the build stops because of a segfault. This is the output I get:

make[2]: Entering directory '/home/bszili/amiga-gcc/build-Linux/gcc/gcc'
/home/bszili/amiga-gcc/build-Linux/gcc/./gcc/xgcc -B/home/bszili/amiga-gcc/build-Linux/gcc/./gcc/ -dumpspecs > tmp-specs
/bin/bash: line 1:  2174 Segmentation fault      /home/bszili/amiga-gcc/build-Linux/gcc/./gcc/xgcc -B/home/bszili/amiga-gcc/build-Linux/gcc/./gcc/ -dumpspecs > tmp-specs
Makefile:1963: recipe for target 'specs' failed
make[2]: *** [specs] Error 139
make gcc...failed
use less "log/make gcc.log" to view the full log and search for ***
Makefile:441: recipe for target '/home/bszili/amiga-gcc/build-Linux/gcc/_done' failed
make: *** [/home/bszili/amiga-gcc/build-Linux/gcc/_done] Error 2

Running xgcc without any arguments also segafaults, this is the stacktrace I got with GDB:

Starting program: /home/bszili/amiga-gcc/build-Linux/gcc/gcc/xgcc

Program received signal SIGSEGV, Segmentation fault.
0x000000000044a749 in make_relative_prefix_1.isra ()
(gdb) bt
#0  0x000000000044a749 in make_relative_prefix_1.isra ()
bebbo/amiga-gcc#1  0x0000000000405e87 in process_command(unsigned int, cl_decoded_option*) ()
bebbo/amiga-gcc#2  0x000000000040d42a in driver::set_up_specs() const ()
bebbo/amiga-gcc#3  0x0000000000403544 in driver::main(int, char**) ()
bebbo/amiga-gcc#4  0x0000000000403851 in main ()

I wonder what could be causing it, is this a an issue with the path?

bebbo commented 2 years ago

thanks for reporting. I can reproduce your issue by using valgrind:

==33403== Memcheck, a memory error detector
==33403== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==33403== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==33403== Command: build-Linux/gcc/gcc/xgcc
==33403== 
==33403== Invalid write of size 1
==33403==    at 0x44B6DF: make_relative_prefix_1.isra.0.part.0 (in /home/stefan/amiga-gcc/build-Linux/gcc/gcc/xgcc)
...
BSzili commented 2 years ago

Thanks for the quick fix!