~zyedidia


#62 Build musl libc 3 months ago

Comment by ~zyedidia on ~mcf/cproc

I did some more digging on this, stubbing out inline asm blocks and other problems to try to get as much compiling as possible. I have documented below the issues that I ran into. In the end I did get every object file to compile, though I didn't fill in the assembly functions that the final library will attempt to link with, and some of the hacks that were employed to get it to build are incorrect.

  • inline assembly is not yet supported

    • unresolved; continued by marking inline asm functions as extern
  • src/aio/aio.c:230:16: error: volatile store is not yet supported

    • unresolved; continued by removing volatile with -Dvolatile=
  • ./include/complex.h:16:8: error: _Complex is not yet supported

    • unresolved; continued by removing _Complex with -D_Complex=
  • cproc-qbe: long double is not yet supported

    • unresolved; continued by marking long double as double in cproc source code
  • src/ipc/semctl.c:27:41: error: va_arg with non-scalar type is not yet supported

    • unresolved; continued by commenting the line out (!)
  • src/legacy/ftw.c:7:33: error: base types of pointer assignment must be compatible or void

    • resolved with corrected type cast
  • src/malloc/mallocng/malloc.c:9:77: error: unexpected ';' at top-level

    • resolved by removing the ';'
  • src/process/posix_spawn.c:151:46: error: operands of conditional operator must have compatible types

    • resolved with corrected type cast
  • src/thread/__syscall_cp.c:12:38: error: function '__syscall_cp_c' redeclared with incompatible type

    • unresolved; this appears to be an issue with __typeof, which is used to declare a function alias with a weak attribute. Continued by commenting out.
  • src/thread/pthread_cancel.c:23:1: error: function '__syscall_cp_c' redeclared with incompatible type

    • unresolved; these are redefinitions using hidden, where the prototype isn't the same as the real definition. Continued by commenting out.

My changes are here. To build, first configure with CFLAGS="-Dvolatile= -D_Complex=" CC=cproc ./configure --target=x86_64-linux-musl, then go to cproc's source code and set typeldouble = FLTTYPE(TYPELDOUBLE, 8), and then run make lib/libc.a.

#90 QBE Error: ssa temporary %.xxx is used undefined 3 months ago

Ticket created by ~zyedidia on ~mcf/cproc

While trying to build muon (https://github.com/muon-build/muon) with cproc I ran into an error when QBE is invoked. I'm not sure if this issue is a problem with cproc or QBE. Here are the steps to reproduce

git clone https://github.com/muon-build/muon
cd muon
mkdir build
cd build
cproc -DMUON_BOOTSTRAPPED -I . -I .. -I ../include -I subprojects/tinyjson -I ../subprojects/tinyjson -I src/script -DMUON_PLATFORM_posix -DMUON_ENDIAN=0 -o analyze.c.o -c ../src/lang/analyze.c

This produces the following error:

qbe:-:7102: ssa temporary %.294 is used undefined in @for_join.337
cproc: codegen: process 21147 exited with status 1
cproc: compile: process signaled: Terminated
cproc: assemble: process signaled: Terminated

Thanks!