Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ELFFileEmit(): building the OW runtime libraries for mips-linux fails with a segmentation fault #1249

Open
winspool opened this issue Mar 4, 2024 · 6 comments

Comments

@winspool
Copy link
Contributor

winspool commented Mar 4, 2024

I tried mathlib and clib, but i get crashes in differnt programs.
Some code is shared between projects, and this bug is likely in the same location.

( linux.mps.tar.gz )

[<somewhere>/bld/mathlib/library/linux.mps/_s]
$ wmake -v -y -sn
Open Watcom Make Version 2.0 beta Mar  3 2024 23:04:16 (64-bit)
Copyright (c) 2002-xxxx The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See https://github.com/open-watcom/open-watcom-v2#readme for details.
cbrt.obj will be built because of ../../../../../bld/mathlib/c/cbrt.c
	%make echo_cc
	bwccmps -zq -eoe -D_BLDVER=1300 -D_CYEAR=2024 -DNDEBUG -D_ENABLE_AUTODEPEND   ../../../../../bld/mathlib/c/cbrt.c -I"../../../../../bld/mathlib/h" -I"../../../../../bld/hdr/linux/h" -I"../../../../../bld/watcom/h" -I"../../../../../bld/lib_misc/h" -I"../../../../../bld/comp_cfg/h" -wx-wce=C310-j-zastd=c99-we-x-xx-zam-s-oax-zl-wpx -fo=.obj   -bt=linux
Segmentation fault (core dumped)
Error(E42): Last command making (cbrt.obj) returned a bad status

I used gdb with set follow-fork-mode child and got:

Thread 3.1 "bwccmps" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff7f87740 (LWP 329550)]
0x00005555555dd3ba in ELFFileEmit ()
(gdb) bt
#0  0x00005555555dd3ba in ELFFileEmit ()
#1  0x00005555555db21a in OWLFileFini ()
#2  0x00005555555a8af0 in ObjFini ()
#3  0x00005555555b3043 in FiniCG ()
#4  0x000055555559a848 in BEStop ()
#5  0x000055555558c10a in DoCompile ()
#6  0x00005555555611d7 in DoCCompile ()
#7  0x0000555555561404 in FrontEnd ()
#8  0x000055555558043d in IDERunYourSelfArgv ()
#9  0x000055555558fcf9 in IdeDrvExecDLLArgv ()
#10 0x000055555558fee2 in main ()

I also tried to build "*/bld/mathlib/library/linux.ppc/_s/" and got the same crash.

And now another crash for mips-linux,
where the makefile is already present in the OW source tree:

[<somewhere>/bld/clib/cgsupp/library/linux.mps/_s]
$ wmake -v -y -sn 
Open Watcom Make Version 2.0 beta Mar  3 2024 23:04:16 (64-bit)
Copyright (c) 2002-xxxx The Open Watcom Contributors. All Rights Reserved.
Portions Copyright (c) 1988-2002 Sybase, Inc. All Rights Reserved.
Source code is available under the Sybase Open Watcom Public License.
See https://github.com/open-watcom/open-watcom-v2#readme for details.
stksmps.obj will be built because of ../../../a/stksmps.asm
	%make echo_as
	bwasmps -q -oe -D_BLDVER=1300 -D_CYEAR=2024 -DNDEBUG -D__MT__   ../../../a/stksmps.asm -I"../../../h" -I"../../../../../../bld/clib/h"  -I"../../../../../../bld/watcom/h" -I"../../../../../../bld/lib_misc/h" -I"../../../../../../bld/comp_cfg/h"  -we -fo=.obj    -bt=linux
Segmentation fault (core dumped)
Error(E42): Last command making (stksmps.obj) returned a bad status

I used gdb with set follow-fork-mode child and got:

Thread 3.1 "bwasmps" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff7f87740 (LWP 329027)]
0x0000555555567aa0 in ELFFileEmit ()
(gdb) bt
#0  0x0000555555567aa0 in ELFFileEmit ()
#1  0x0000555555565a1b in OWLFileFini ()
#2  0x00005555555606ed in ObjFini ()
#3  0x000055555555fc0b in main ()
(gdb) 

/me wishes for a crash handler.

@winspool winspool changed the title building the OW runtime libraries for mips-linux fails with a segmentation fault) ELFFileEmit(): building the OW runtime libraries for mips-linux fails with a segmentation fault Mar 4, 2024
@jmalak
Copy link
Member

jmalak commented Mar 4, 2024

This is an unsupported platform. the solution depends on any contributor with knowledge of this platform if taking care of it.

@winspool
Copy link
Contributor Author

winspool commented Mar 4, 2024

This is an unsupported platform.
the solution depends on any contributor with knowledge of this platform if taking care of it.

The build was running on x86_64-linux.
I know, that mips-linux is not supported yet, but the available code generators for Alpha, Mips and PowerPC are unfortunately unused.

A simple helloworld.c compiles for mips into an object file, but linking fails:

searching libraries
Warning! W1008: cannot open math.lib : No such file or directory
Warning! W1008: cannot open clib.lib : No such file or directory
Error! E2028: _cstart_ is an undefined reference
Error! E2028: puts is an undefined reference
Warning! W1023: no starting address found, using 00000000
Error! E2044: exported symbol _cstart_ not found
Error! E2044: exported symbol puts not found

@jmalak
Copy link
Member

jmalak commented Mar 4, 2024

No, it is not supported, there is no tools builded for MIPS. Only MIPS C cross-compiler for Intel host is build. It is to get info if C compiler build is somehow broken for MIPS and other RISC architectures. No CRTL implemented for MIPS. No tests etc.

@jmalak jmalak closed this as completed Mar 4, 2024
@jmalak jmalak reopened this Mar 4, 2024
@jmalak
Copy link
Member

jmalak commented Mar 6, 2024

Only Alpha Windows NT platform is somehow complete that you could build complete OW for Alpha.
But it is untested etc.

@winspool
Copy link
Contributor Author

winspool commented Mar 7, 2024

Only Alpha Windows NT platform is somehow complete that you could build complete OW for Alpha.
But it is untested etc.

Thanks for the Info.
I will take a look with qemu and my NT4 install CD

For building the mips-linux runtime,
removing the bootstrap tools (bwasmps & bwccmps)
and using links to the tools from a full build instead
eleminates the crashes and
building the mips runtime goes a lot further.

@winspool
Copy link
Contributor Author

winspool commented Mar 7, 2024

I have no idea, why bwccmps(+ bwasmps) always fail,
but wccmps (+ wasmps) mostly works.

When using wccmps (+wasmps), only a few issues left for building the mips-linux clib runtime (math.lib builds):

clib/mthread:
wccmps fails to compile register.c

W131: No prototype found for function `_beginthread`
W131: No prototype found for function `_endthread`

(flag -we used: treat all warnings as errors)

clib/posix:
wccmps fails to compile ptcreate.c

W131: No prototype found for function `_beginthread`
W308: The function `_beginthread` without prototyped parameters called

(flag -we used: treat all warnings as errors)

clib/startup:
wasmsp crashes while assembling a/cstrtlmp.asm with:

free(): invalid pointer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants