Skip to content

illegal instruction when compiling ocaml #12903

@mndrix

Description

@mndrix

When building OCaml 5.1.1 on OpenBSD 7.4:

$ ./configure && gmake
...
gmake[4]: Entering directory '/home/michael/src/ocaml/otherlibs/dynlink'
../../ocamlc.opt -nostdlib -I ../../stdlib -g -c -for-pack Dynlink_compilerlibs -strict-sequence -principal -absname -w +a-4-9-40-41-42-44-45-48 -warn-error +A -bin-annot -strict-formats -I byte \
          -I dynlink_compilerlibs -o dynlink_compilerlibs/binutils.cmo dynlink_compilerlibs/binutils.ml
gmake[4]: *** [Makefile:188: dynlink_compilerlibs/binutils.cmo] Illegal instruction (core dumped)

This machine has an Intel Core i7-1280P processor. I also get an illegal instruction error when building OCaml 5.1.1, 5.0.0, 4.14.1, and trunk on this machine. However, I routinely build OCaml on another OpenBSD 7.4 machine without trouble. That one has a Core i5-5200U.

Here's some info from gdb:

$ gdb ../../ocamlc.opt ocamlc.opt.core
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-unknown-openbsd7.4"...
Core was generated by `ocamlc.opt'.
Program terminated with signal 4, Illegal instruction.
Reading symbols from /usr/lib/libpthread.so.27.1...done.
Loaded symbols for /usr/lib/libpthread.so.27.1
Loaded symbols for /home/michael/src/ocaml/ocamlc.opt
Reading symbols from /usr/lib/libm.so.10.1...done.
Loaded symbols for /usr/lib/libm.so.10.1
Symbols already loaded for /usr/lib/libpthread.so.27.1
Reading symbols from /usr/lib/libc.so.97.1...done.
Loaded symbols for /usr/lib/libc.so.97.1
Reading symbols from /usr/libexec/ld.so...Error while reading shared library symbols:
Dwarf Error: wrong version in compilation unit header (is 4, should be 2) [in module /usr/libexec/ld.so]
#0  0x000003ca249101a0 in caml_startup.code_begin () from /home/michael/src/ocaml/ocamlc.opt
(gdb) bt
#0  0x000003ca249101a0 in caml_startup.code_begin () from /home/michael/src/ocaml/ocamlc.opt
#1  0x000003ca24c77948 in caml_start_program () from /home/michael/src/ocaml/ocamlc.opt
#2  0x000003ca24c771ce in caml_startup_common (argv=Variable "argv" is not available.
) at runtime/startup_nat.c:132
#3  0x000003ca24c7727d in caml_main (argv=Variable "argv" is not available.
) at runtime/startup_nat.c:139
#4  0x000003ca24c5e510 in main (argc=Unhandled dwarf expression opcode 0xa3
) at runtime/main.c:37
(gdb) info registers
rax            0x3cd0c4d8dc8    4179209588168
rbx            0x3cc6c468620    4176524772896
rcx            0x3ccb5a48df0    4177755672048
rdx            0x22     34
rsi            0x0      0
rdi            0x3cd0c4d1800    4179209558016
rbp            0x7e0329bf8e20   0x7e0329bf8e20
rsp            0x3ccb71e6018    0x3ccb71e6018
r8             0x1ff    511
r9             0x1      1
r10            0x3ccb71e6020    4177780432928
r11            0x0      0
r12            0x3ca249101a0    4166731760032
r13            0x3cc6c36f770    4176523753328
r14            0x3cd0c4d1800    4179209558016
r15            0x3ccfb5f8ce0    4178925554912
rip            0x3ca249101a0    0x3ca249101a0 <caml_startup.code_begin>
eflags         0x10202  66050
cs             0x2b     43
ss             0x23     35
ds             0x23     35
es             0x23     35
fs             0x23     35
gs             0x23     35
(gdb) x/i $rip
0x3ca249101a0 <caml_startup.code_begin>:        lea    0xfffffffffffffec0(%rsp),%r10

Do you need any additional information from gdb? I'm happy to apply patches or try anything else to help. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions