Open jadudm opened 4 years ago
The segfaults are due to PIE (position independent executables) being a default in gcc now:
https://stackoverflow.com/questions/2463150/what-is-the-fpie-option-for-position-independent-executables-in-gcc-and-ld https://wiki.ubuntu.com/SecurityTeam/PIE
$ gcc foo.c
$ file a.out
a.out: ELF 32-bit LSB pie executable...
I was able to get a working kroc by adding:
-no-pie -fno-pie
to KROC_CCSP_CFLAGS
in m4/kroc.m4
.
Unrelated to PIE, I also had to add an extern
to harness.c
to fix the following compile error:
/usr/bin/ld: harness.o:/home/virt/projects/occam/kroc/tools/occ21/misc/harness.c:567: multiple definition of 'oc_help_info'; version.o:/home/virt/projects/occam/kroc/tools/occ21/version.c:39: first defined here
Built and tested on a Debian i386 virtual machine.
Given this program:
the TVM segfaults. (I don't know if
kroc
would segfault, because I'm just trying to get a TVM build going.)building as follows:
CFLAGS=-DDEBUG_INTERPRETER ./build --prefix=/home/jadudm/local/kroc --with-toolchain=tvm --with-wrapper=posix
and compiling the program with
occbuild --program skip.occ
, I get a TCE and TBC file.I get the following debug output from running
tvm skip.tbc
:Dumping the TCE file:
I'm not sure what is going on. The LDNLP (load non-local pointer) instructions... could be loading the top-level channels (KYB, SCR, ERR)... but... Hm.
The entire program compiles down to a RET instruction. However, the actual run looks different... which I think is because the TVM wrapper/runtime for POSIX has to do some additional work (that is, making FFI calls in order to check the external channels, etc.).
I think the segfault has to do with the external channel linkages, but that's a hunch, not something supported by evidence.
This is a start, anyway.