Chew segmentation fault while building on Ubuntu/Debian

Tiberiu Chibici chibicitiberiu@gmail.com
Sat Jan 8 02:38:14 GMT 2022


Hello,

I have some more information about this issue, another person running
Ubuntu 20.04.3 LTS was able to reproduce the same issue (using WSL). Also,
I tried to debug the issue in GDB, and this seems to be the origin of the
segmentation fault. Is there anything else I can help with to get closer to
the source of the problem?

(gdb) run -f ../../../binutils-2.37/bfd/doc/doc.str <
../../../binutils-2.37/bfd/doc/../archures.c
Starting program:
/home/tibi/Nanobyte/nanobyte_os_with_interrupts/toolchain/binutils-build-2.37/bfd/doc/chew
-f ../../../binutils-2.37/bfd/doc/doc.str <
../../../binutils-2.37/bfd/doc/../archures.c
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
__strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:105
105     ../sysdeps/x86_64/multiarch/strcmp-avx2.S: No such file or
directory.
(gdb) bt
#0  __strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:105
#1  0x00005555555575a1 in lookup_word (word=0x55555555f890
"skip_past_newline") at ../../../binutils-2.37/bfd/doc/chew.c:1242
#2  0x0000555555557bce in compile (
   string=0x55555555d2bb "\tget_stuff_in_command kill_bogus_lines
catstr\n\t;\n\n: ENDDD\n\tskip_past_newline\n\t;\n\n:
EXAMPLE\n\tskip_past_newline\t\n\tget_stuff_in_command kill_bogus_lines
do_fancy_stuff tr
anslatecomments \n\tcourierize cats"...) at
../../../binutils-2.37/bfd/doc/chew.c:1429
#3  0x0000555555558447 in main (ac=3, av=0x7fffffffdc58) at
../../../binutils-2.37/bfd/doc/chew.c:1612
(gdb) info reg
rax            0x990               2448
rbx            0x0                 0
rcx            0xffffffff          4294967295
rdx            0x0                 0
rsi            0x55555555f890      93824992278672
rdi            0x55561990          1431706000
rbp            0x7fffffffda60      0x7fffffffda60
rsp            0x7fffffffda38      0x7fffffffda38
r8             0x55555555f890      93824992278672
r9             0x55555555f9b0      93824992278960
r10            0x55555555f880      93824992278656
r11            0x7ffff7f8ecc0      140737353673920
r12            0x7fffffffdc58      140737488346200
r13            0x555555557fdf      93824992247775
r14            0x0                 0
r15            0x7ffff7ffbc40      140737354120256
rip            0x7ffff7f1131e      0x7ffff7f1131e <__strcmp_avx2+30>
eflags         0x10283             [ CF SF IF RF ]
cs             0x33                51
ss             0x2b                43
ds             0x0                 0
es             0x0                 0
fs             0x0                 0
gs             0x0                 0


Thank you and best regards,
Tiberiu Chibici

On Mon, Dec 27, 2021 at 2:30 PM Tiberiu Chibici <chibicitiberiu@gmail.com>
wrote:

> Hello,
> I've been trying to build a cross compiler the last few days, and I keep
> getting this build error:
>
> /bin/bash: line 1: 31514 Segmentation fault      (core dumped) ./chew -f
> ../../../binutils-2.37/bfd/doc/doc.str <
> ../../../binutils-2.37/bfd/doc/../corefile.c > core.tmp
> /bin/bash: line 1: 31508 Segmentation fault      (core dumped) ./chew -f
> ../../../binutils-2.37/bfd/doc/doc.str <
> ../../../binutils-2.37/bfd/doc/../archures.c > archures.tmp
> /bin/bash: line 1: 31510 Segmentation fault      (core dumped) ./chew -f
> ../../../binutils-2.37/bfd/doc/doc.str <
> ../../../binutils-2.37/bfd/doc/../bfd.c > bfd.tmp
> /bin/bash: line 1: 31507 Segmentation fault      (core dumped) ./chew -f
> ../../../binutils-2.37/bfd/doc/doc.str <
> ../../../binutils-2.37/bfd/doc/../archive.c > archive.tmp
> make[4]: *** [Makefile:998: core.stamp] Error 139
> /bin/bash: line 1: 31504 Segmentation fault      (core dumped) ./chew -f
> ../../../binutils-2.37/bfd/doc/doc.str <
> ../../../binutils-2.37/bfd/doc/../aoutx.h > aoutx.tmp
> /bin/bash: line 1: 31513 Segmentation fault      (core dumped) ./chew -f
> ../../../binutils-2.37/bfd/doc/doc.str <
> ../../../binutils-2.37/bfd/doc/../coffcode.h > coffcode.tmp
> make[4]: *** Waiting for unfinished jobs....
> /bin/bash: line 1: 31512 Segmentation fault      (core dumped) ./chew -f
> ../../../binutils-2.37/bfd/doc/doc.str <
> ../../../binutils-2.37/bfd/doc/../cache.c > cache.tmp
>
> I started with a clean Ubuntu 20.04 machine using WSL2. I tried all the
> binutils versions from 2.34 to 2.37. I also tried this on Debian, and a
> clean Ubuntu 20.04 LTS VM (after updating all the packages).
>
> Using latest Fedora Workstation, I was able to build successfully, so the
> issue seems to be related to Debian and Ubuntu.
>
> These are the packages I installed right after setting up the machines
> (trying to follow this guide from the OSDEV wiki:
> https://wiki.osdev.org/GCC_Cross-Compiler#Installing_Dependencies ):
>
> sudo apt install build-essential bison flex libgmp3-dev libmpc-dev libmpfr-dev texinfo \
>                    nasm mtools
>
>
> And here is the build script I'm using:
> https://github.com/chibicitiberiu/nanobyte_os/blob/master/build_scripts/toolchain.mk
>
> Is this something you've encountered before? Could anyone help me figure
> out what the problem is?
>
> Thank you very much, I hope this is the right channel for asking this type
> of stuff.
>
> --
> Best regards,
> Chibici Tiberiu
>


-- 
Chibici Tiberiu


More information about the Binutils mailing list