Issue #18062 has been updated by vo.x (Vit Ondruch).


I should probably include a few more lines from the log which include the build options:

~~~
gcc -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -D_FORTIFY_SOURCE=2 -fstack-protector-strong -fno-strict-overflow -fvisibility=hidden -fexcess-precision=standard -DRUBY_EXPORT -I. -I.ext/include/x86_64-linux -I./include -I. -I./enc/unicode/12.1.0    -o vm.o -c vm.c
gcc -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fPIC -m64 -L. -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fstack-protector-strong -rdynamic -Wl,-export-dynamic -fstack-protector-strong  main.o dmydln.o miniinit.o dmyext.o abrt.o array.o ast.o bignum.o class.o compar.o compile.o complex.o cont.o debug.o debug_counter.o dir.o dln_find.o encoding.o enum.o enumerator.o error.o eval.o file.o gc.o hash.o inits.o io.o iseq.o load.o marshal.o math.o memory_view.o mjit.o mjit_compile.o node.o numeric.o object.o pack.o parse.o proc.o process.o ractor.o random.o range.o rational.o re.o regcomp.
 o regenc.o regerror.o regexec.o regparse.o regsyntax.o ruby.o scheduler.o signal.o sprintf.o st.o strftime.o string.o struct.o symbol.o thread.o time.o transcode.o transient_heap.o util.o variable.o version.o vm.o vm_backtrace.o vm_dump.o vm_sync.o vm_trace.o coroutine/amd64/Context.o probes.o enc/ascii.o enc/us_ascii.o enc/unicode.o enc/utf_8.o enc/trans/newline.o setproctitle.o strlcat.o strlcpy.o addr2line.o  -lz -lpthread -lrt -lrt -lgmp -ldl -lcrypt -lm  -lm   -o miniruby
~~~

----------------------------------------
Bug #18062: Ruby with enabled LTO segfaults during build
https://bugs.ruby-lang.org/issues/18062#change-93138

* Author: vo.x (Vit Ondruch)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
After a while, I am trying to enable LTO for Ruby in Fedora. Previously I hit #17052, but now I observe issues much earlier during compliation already:

~~~
./miniruby -I./lib -I. -I.ext/common  ./tool/generic_erb.rb -c -o encdb.h ./template/encdb.h.tmpl ./enc enc
<internal:gc>:240: [BUG] Segmentation fault at 0x0000000000000004
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-linux]
-- Control frame information -----------------------------------------------
c:0003 p:0008 s:0011 e:000008 CLASS  <internal:gc>:240
c:0002 p:0015 s:0006 e:000005 TOP    <internal:gc>:235 [FINISH]
c:0001 p:0000 s:0003 E:000230 (none) [FINISH]
-- Ruby level backtrace information ----------------------------------------
<internal:gc>:235:in `<internal:gc>'
<internal:gc>:240:in `<module:ObjectSpace>'
-- Machine register context ------------------------------------------------
 RIP: 0x00005585da1c832a RBP: 0x000022f100140003 RSP: 0x00007ffd6460a6a0
 RAX: 0x0000000000000001 RBX: 0x00000000000022f1 RCX: 0x00005585dade5d90
 RDX: 0x000022f100140003 RDI: 0x00005585dae0c2d8 RSI: 0x0000000000000000
  R8: 0x0000000000000000  R9: 0x00007ffd6460a6e0 R10: 0x00005585daebbe50
 R11: 0x00007f00a785baa0 R12: 0x0000000000000000 R13: 0x00005585dade5d90
 R14: 0x00005585dae0c2d8 R15: 0x00005585dade5d90 EFL: 0x0000000000010202
-- C level backtrace information -------------------------------------------
./miniruby(rb_print_backtrace+0x19) [0x5585da1cdba9]
./miniruby(rb_vm_bugreport+0x215) [0x5585da1d1a05]
./miniruby(rb_bug_for_fatal_signal+0xf4) [0x5585da004fc4]
./miniruby(sigsegv+0x4d) [0x5585da13709d]
[0x7f00a76a4760]
./miniruby(vm_ccs_push.part.0.lto_priv.0+0x2a) [0x5585da1c832a]
./miniruby(vm_search_cc+0xfe) [0x5585da1a7b7e]
./miniruby(vm_search_method_slowpath0.lto_priv.0+0x40) [0x5585da1a7d30]
./miniruby(vm_sendish.lto_priv.0+0x6e4) [0x5585da1aeff4]
./miniruby(vm_exec_core.lto_priv.0+0xa8) [0x5585da1b25b8]
./miniruby(rb_vm_exec+0x110) [0x5585da1c9ea0]
./miniruby(ruby_opt_init+0x6f) [0x5585da1355af]
./miniruby(load_file_internal+0x4b2) [0x5585da1376e2]
./miniruby(rb_ensure+0x106) [0x5585da00d5a6]
./miniruby(process_options+0x19e5) [0x5585da139a65]
./miniruby(ruby_process_options+0x151) [0x5585da13a551]
./miniruby(ruby_options+0x119) [0x5585da012de9]
./miniruby(main+0x57) [0x5585d9f8a1e7]
-- Other runtime information -----------------------------------------------
* Loaded script: ./miniruby
* Loaded features:
    0 enumerator.so
    1 thread.rb
    2 rational.so
    3 complex.so
    4 ruby2_keywords.rb
* Process memory map:
5585d9f5d000-5585d9f85000 r--p 00000000 fc:05 137001366                  /builddir/build/BUILD/ruby-3.0.2/miniruby
5585d9f85000-5585da1f2000 r-xp 00028000 fc:05 137001366                  /builddir/build/BUILD/ruby-3.0.2/miniruby
5585da1f2000-5585da2f6000 r--p 00295000 fc:05 137001366                  /builddir/build/BUILD/ruby-3.0.2/miniruby
5585da2f6000-5585da2fd000 r--p 00398000 fc:05 137001366                  /builddir/build/BUILD/ruby-3.0.2/miniruby
5585da2fd000-5585da2fe000 rw-p 0039f000 fc:05 137001366                  /builddir/build/BUILD/ruby-3.0.2/miniruby
5585da2fe000-5585da30e000 rw-p 00000000 00:00 0 
5585dad8d000-5585daed3000 rw-p 00000000 00:00 0                          [heap]
7f00a28ae000-7f00a409b000 r--s 00000000 fc:05 137001366                  /builddir/build/BUILD/ruby-3.0.2/miniruby
7f00a409b000-7f00a409e000 r--p 00000000 fc:05 270435464                  /usr/lib64/libgcc_s-11-20210728.so.1
7f00a409e000-7f00a40b0000 r-xp 00003000 fc:05 270435464                  /usr/lib64/libgcc_s-11-20210728.so.1
7f00a40b0000-7f00a40b3000 r--p 00015000 fc:05 270435464                  /usr/lib64/libgcc_s-11-20210728.so.1
7f00a40b3000-7f00a40b4000 r--p 00017000 fc:05 270435464                  /usr/lib64/libgcc_s-11-20210728.so.1
7f00a40b4000-7f00a40b5000 rw-p 00018000 fc:05 270435464                  /usr/lib64/libgcc_s-11-20210728.so.1
7f00a40b5000-7f00a40b6000 ---p 00000000 00:00 0 
7f00a40b6000-7f00a4157000 rw-p 00000000 00:00 0 
7f00a4157000-7f00a4158000 ---p 00000000 00:00 0 
7f00a4158000-7f00a41f9000 rw-p 00000000 00:00 0 
7f00a41f9000-7f00a41fa000 ---p 00000000 00:00 0 
7f00a41fa000-7f00a429b000 rw-p 00000000 00:00 0 
7f00a429b000-7f00a429c000 ---p 00000000 00:00 0 
7f00a429c000-7f00a433d000 rw-p 00000000 00:00 0 
7f00a433d000-7f00a433e000 ---p 00000000 00:00 0 
7f00a433e000-7f00a43df000 rw-p 00000000 00:00 0 
7f00a43df000-7f00a43e0000 ---p 00000000 00:00 0 
7f00a43e0000-7f00a4481000 rw-p 00000000 00:00 0 
7f00a4481000-7f00a4482000 ---p 00000000 00:00 0 
7f00a4482000-7f00a4523000 rw-p 00000000 00:00 0 
7f00a4523000-7f00a4524000 ---p 00000000 00:00 0 
7f00a4524000-7f00a45c5000 rw-p 00000000 00:00 0 
7f00a45c5000-7f00a45c6000 ---p 00000000 00:00 0 
7f00a45c6000-7f00a4667000 rw-p 00000000 00:00 0 
7f00a4667000-7f00a4668000 ---p 00000000 00:00 0 
7f00a4668000-7f00a4709000 rw-p 00000000 00:00 0 
7f00a4709000-7f00a470a000 ---p 00000000 00:00 0 
7f00a470a000-7f00a47ab000 rw-p 00000000 00:00 0 
7f00a47ab000-7f00a47ac000 ---p 00000000 00:00 0 
7f00a47ac000-7f00a484d000 rw-p 00000000 00:00 0 
7f00a484d000-7f00a484e000 ---p 00000000 00:00 0 
7f00a484e000-7f00a48ef000 rw-p 00000000 00:00 0 
7f00a48ef000-7f00a48f0000 ---p 00000000 00:00 0 
7f00a48f0000-7f00a4991000 rw-p 00000000 00:00 0 
7f00a4991000-7f00a4992000 ---p 00000000 00:00 0 
7f00a4992000-7f00a4a33000 rw-p 00000000 00:00 0 
7f00a4a33000-7f00a4a34000 ---p 00000000 00:00 0 
7f00a4a34000-7f00a4ad5000 rw-p 00000000 00:00 0 
7f00a4ad5000-7f00a4ad6000 ---p 00000000 00:00 0 
7f00a4ad6000-7f00a4b77000 rw-p 00000000 00:00 0 
7f00a4b77000-7f00a4b78000 ---p 00000000 00:00 0 
7f00a4b78000-7f00a4c19000 rw-p 00000000 00:00 0 
7f00a4c19000-7f00a4c1a000 ---p 00000000 00:00 0 
7f00a4c1a000-7f00a4cbb000 rw-p 00000000 00:00 0 
7f00a4cbb000-7f00a4cbc000 ---p 00000000 00:00 0 
7f00a4cbc000-7f00a4d5d000 rw-p 00000000 00:00 0 
7f00a4d5d000-7f00a4d5e000 ---p 00000000 00:00 0 
7f00a4d5e000-7f00a4dff000 rw-p 00000000 00:00 0 
7f00a4dff000-7f00a4e00000 ---p 00000000 00:00 0 
7f00a4e00000-7f00a4ea1000 rw-p 00000000 00:00 0 
7f00a4ea1000-7f00a4ea2000 ---p 00000000 00:00 0 
7f00a4ea2000-7f00a4f43000 rw-p 00000000 00:00 0 
7f00a4f43000-7f00a4f44000 ---p 00000000 00:00 0 
7f00a4f44000-7f00a4fe5000 rw-p 00000000 00:00 0 
7f00a4fe5000-7f00a4fe6000 ---p 00000000 00:00 0 
7f00a4fe6000-7f00a5087000 rw-p 00000000 00:00 0 
7f00a5087000-7f00a5088000 ---p 00000000 00:00 0 
7f00a5088000-7f00a5129000 rw-p 00000000 00:00 0 
7f00a5129000-7f00a512a000 ---p 00000000 00:00 0 
7f00a512a000-7f00a51cb000 rw-p 00000000 00:00 0 
7f00a51cb000-7f00a51cc000 ---p 00000000 00:00 0 
7f00a51cc000-7f00a526d000 rw-p 00000000 00:00 0 
7f00a526d000-7f00a526e000 ---p 00000000 00:00 0 
7f00a526e000-7f00a530f000 rw-p 00000000 00:00 0 
7f00a530f000-7f00a5310000 ---p 00000000 00:00 0 
7f00a5310000-7f00a53b1000 rw-p 00000000 00:00 0 
7f00a53b1000-7f00a53b2000 ---p 00000000 00:00 0 
7f00a53b2000-7f00a5453000 rw-p 00000000 00:00 0 
7f00a5453000-7f00a5454000 ---p 00000000 00:00 0 
7f00a5454000-7f00a7662000 rw-p 00000000 00:00 0 
7f00a7662000-7f00a768e000 r--p 00000000 fc:05 270939738                  /usr/lib64/libc.so.6
7f00a768e000-7f00a7803000 r-xp 0002c000 fc:05 270939738                  /usr/lib64/libc.so.6
7f00a7803000-7f00a7857000 r--p 001a1000 fc:05 270939738                  /usr/lib64/libc.so.6
7f00a7857000-7f00a7858000 ---p 001f5000 fc:05 270939738                  /usr/lib64/libc.so.6
7f00a7858000-7f00a785b000 r--p 001f5000 fc:05 270939738                  /usr/lib64/libc.so.6
7f00a785b000-7f00a785e000 rw-p 001f8000 fc:05 270939738                  /usr/lib64/libc.so.6
7f00a785e000-7f00a786b000 rw-p 00000000 00:00 0 
7f00a786b000-7f00a787a000 r--p 00000000 fc:05 270939741                  /usr/lib64/libm.so.6
7f00a787a000-7f00a78eb000 r-xp 0000f000 fc:05 270939741                  /usr/lib64/libm.so.6
7f00a78eb000-7f00a7945000 r--p 00080000 fc:05 270939741                  /usr/lib64/libm.so.6
7f00a7945000-7f00a7946000 r--p 000d9000 fc:05 270939741                  /usr/lib64/libm.so.6
7f00a7946000-7f00a7947000 rw-p 000da000 fc:05 270939741                  /usr/lib64/libm.so.6
7f00a7947000-7f00a7949000 r--p 00000000 fc:05 271023995                  /usr/lib64/libcrypt.so.2.0.0
7f00a7949000-7f00a795d000 r-xp 00002000 fc:05 271023995                  /usr/lib64/libcrypt.so.2.0.0
7f00a795d000-7f00a7976000 r--p 00016000 fc:05 271023995                  /usr/lib64/libcrypt.so.2.0.0
7f00a7976000-7f00a7977000 ---p 0002f000 fc:05 271023995                  /usr/lib64/libcrypt.so.2.0.0
7f00a7977000-7f00a7978000 r--p 0002f000 fc:05 271023995                  /usr/lib64/libcrypt.so.2.0.0
7f00a7978000-7f00a7981000 rw-p 00000000 00:00 0 
7f00a7981000-7f00a7992000 r--p 00000000 fc:05 271068897                  /usr/lib64/libgmp.so.10.4.0
7f00a7992000-7f00a7a0a000 r-xp 00011000 fc:05 271068897                  /usr/lib64/libgmp.so.10.4.0
7f00a7a0a000-7f00a7a21000 r--p 00089000 fc:05 271068897                  /usr/lib64/libgmp.so.10.4.0
7f00a7a21000-7f00a7a23000 r--p 0009f000 fc:05 271068897                  /usr/lib64/libgmp.so.10.4.0
7f00a7a23000-7f00a7a24000 rw-p 000a1000 fc:05 271068897                  /usr/lib64/libgmp.so.10.4.0
7f00a7a24000-7f00a7a27000 r--p 00000000 fc:05 271023970                  /usr/lib64/libz.so.1.2.11
7f00a7a27000-7f00a7a35000 r-xp 00003000 fc:05 271023970                  /usr/lib64/libz.so.1.2.11
7f00a7a35000-7f00a7a3b000 r--p 00011000 fc:05 271023970                  /usr/lib64/libz.so.1.2.11
7f00a7a3b000-7f00a7a3c000 ---p 00017000 fc:05 271023970                  /usr/lib64/libz.so.1.2.11
7f00a7a3c000-7f00a7a3d000 r--p 00017000 fc:05 271023970                  /usr/lib64/libz.so.1.2.11
7f00a7a3d000-7f00a7a3e000 rw-p 00000000 00:00 0 
7f00a7a41000-7f00a7a43000 rw-p 00000000 00:00 0 
7f00a7a43000-7f00a7a44000 r--p 00000000 fc:05 270939734                  /usr/lib64/ld-linux-x86-64.so.2
7f00a7a44000-7f00a7a69000 r-xp 00001000 fc:05 270939734                  /usr/lib64/ld-linux-x86-64.so.2
7f00a7a69000-7f00a7a73000 r--p 00026000 fc:05 270939734                  /usr/lib64/ld-linux-x86-64.so.2
7f00a7a73000-7f00a7a75000 r--p 0002f000 fc:05 270939734                  /usr/lib64/ld-linux-x86-64.so.2
7f00a7a75000-7f00a7a77000 rw-p 00031000 fc:05 270939734                  /usr/lib64/ld-linux-x86-64.so.2
7ffd63e17000-7ffd64616000 rw-p 00000000 00:00 0                          [stack]
7ffd64762000-7ffd64766000 r--p 00000000 00:00 0                          [vvar]
7ffd64766000-7ffd64768000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
make: *** [uncommon.mk:1096: encdb.h] Aborted (core dumped)
~~~



---Files--------------------------------
0001-Get-rid-of-type-punning-pointer-cast.patch (998 Bytes)


-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>