n64chain icon indicating copy to clipboard operation
n64chain copied to clipboard

Libn64 Segmentation fault error

Open cdlt opened this issue 3 years ago • 4 comments

Hi all! I have a problem with n64chain specific libn64 compiling from Ubuntu 18.04. The libn64/header.bin is present (this is copied from libdragon header file). Compilation tools is successfully from tools/build-posix64-toolchain.sh Libn64 compiling error logs: cd libn64 make Compiling: libn64/io/init.c Compiling: libn64/io/filesystem.c Compiling: libn64/io/pi_thread.c Compiling: libn64/io/si_thread.c Compiling: libn64/os/fbtext.c Compiling: libn64/os/main.c os/main.c: In function 'libn64_main': os/main.c:25:47: warning: unused parameter 'bss_end' [-Wunused-parameter] void libn64_main(uint32_t kernel_sp, uint32_t bss_end) { Compiling: libn64/os/mm.c Compiling: libn64/os/panic.c Compiling: libn64/os/thread.c Compiling: libn64/os/time.c Compiling: libn64/rcp/vi.c Compiling: libn64/sp/init.c Compiling: libn64/sp/sp_thread.c Assembling: libn64/os/asm/boot.s Assembling: libn64/os/asm/context.s Assembling: libn64/os/asm/exception.s Assembling: libn64/os/asm/idle_thread.s Assembling: libn64/os/asm/message.s Assembling: libn64/os/asm/syscall.s Assembling: /ucodes/init.o Makefile:87: recipe for target 'ucodes/init.o' failed make: *** [ucodes/init.o] Segmentation fault

Thank you very much

cdlt avatar Jul 11 '20 04:07 cdlt

What if you manually assemble the file, but through gdb? Would you be able to provide a back trace?

ijacquez avatar Jul 13 '20 22:07 ijacquez

Hi Israel Jacquez

Thank you and I'm sorry my poor english

make libn64:

Compiling: libn64/io/init.c Compiling: libn64/io/filesystem.c Compiling: libn64/io/pi_thread.c Compiling: libn64/io/si_thread.c Compiling: libn64/os/fbtext.c Compiling: libn64/os/main.c Compiling: libn64/os/mm.c Compiling: libn64/os/panic.c Compiling: libn64/os/thread.c Compiling: libn64/os/time.c Compiling: libn64/rcp/vi.c Compiling: libn64/sp/init.c Compiling: libn64/sp/sp_thread.c Assembling: libn64/os/asm/boot.s Assembling: libn64/os/asm/context.s Assembling: libn64/os/asm/exception.s Assembling: libn64/os/asm/idle_thread.s Assembling: libn64/os/asm/message.s Assembling: libn64/os/asm/syscall.s

.... without errors Assembling: /ucodes/init.o:

/tmp/ramdisk/n64chain/libn64/../tools/bin/mips64-elf-cpp -E -Iucodes ucodes/init.rsp > ucodes/init.rsppch

ok without errors

/tmp/ramdisk/n64chain/libn64/../tools/bin/rspasm ucodes/init.rsppch -o ucodes/init.bin

Segmentation fault error on all lines of init.rsppch containing addiu instructions. There is not error when removing these lines and continue....

/tmp/ramdisk/n64chain/libn64/../tools/bin/mips64-elf-gcc -x assembler-with-cpp -Wall -Wextra -pedantic -std=c99 -I. -Iinclude -Ipriv_include -Os -march=vr4300 -mtune=vr4300 -mabi=eabi -mgp32 -mlong32 -flto -ffat-lto-objects -ffunction-sections -fdata-sections -G4 -mno-extern-sdata -mgpopt -mfix4300 -mbranch-likely -mno-check-zero-division -MMD -c ucodes/init.rsps -o ucodes/init.o

ok building libn64/libn64.a

make libgfx:

Compiling: libgfx/src/init.c Compiling: libgfx/src/rspbuf.c

.... without errors

Assembling: /ucodes/gfx.o:

/tmp/ramdisk/n64chain/libgfx/../tools/bin/mips64-elf-cpp -E -I../libn64/ucodes -Iucodes ucodes/gfx.rsp > ucodes/gfx.rsppch

ok without errors

/tmp/ramdisk/n64chain/libgfx/../tools/bin/rspasm ucodes/gfx.rsppch -o ucodes/gfx.bin

Segmentation fault error on all lines of gfx.rsppch containing addiu instructions. There is not error when removing these lines and continue....

/tmp/ramdisk/n64chain/libgfx/../tools/bin/mips64-elf-gcc -x assembler-with-cpp -Wall -Wextra -pedantic -std=c99 -I. -Iinclude -I../libn64/include -Os -march=vr4300 -mtune=vr4300 -mabi=eabi -mgp32 -mlong32 -flto -ffat-lto-objects -ffunction-sections -fdata-sections -G4 -mno-extern-sdata -mgpopt -mfix4300 -mbranch-likely -mno-check-zero-division -mno-memcpy -MMD -c ucodes/gfx.rsps -o ucodes/gfx.o

ok building: libgfx/libgfx.a

I don't believe the libraries work well without the removed instructions.

Thanks very much for your support. P.S: I attach the files with problems: files.zip

cdlt avatar Jul 14 '20 06:07 cdlt

Thanks for the information.

Could you do: gdb /tmp/ramdisk/n64chain/libn64/../tools/bin/rspasm, and within GDB, type run ucodes/init.rsppch -o ucodes/init.bin?

And see what's happening? Assuming that rspasm is compiled with -g.

This all may be of help to @tj90241.

ijacquez avatar Jul 14 '20 18:07 ijacquez

Hi @ijacquez:

Starting program: /tmp/ramdisk/n64chain/tools/bin/rspasm ucodes/init.rsppch -o ucodes/init.bin

Program received signal SIGSEGV, Segmentation fault. __strcmp_sse4_2 () at ../sysdeps/i386/i686/multiarch/strcmp-sse4.S:229 229 ../sysdeps/i386/i686/multiarch/strcmp-sse4.S: No such file or directory. (gdb) backtrace #0 __strcmp_sse4_2 () at ../sysdeps/i386/i686/multiarch/strcmp-sse4.S:229 #1 0x0040dcf9 in rspasm_symbol_binary_search () #2 0x0040dd26 in rspasm_symbol_binary_search () #3 0x0040dc43 in rspasm_get_symbol_address () #4 0x0040d051 in rspasmparse () #5 0x0040b42a in assemble () #6 0x0040b839 in main ()

cdlt avatar Jul 14 '20 19:07 cdlt