On 5/26/20 7:43 AM, Christian Jullien wrote:
>
> For Michael,
>
>  
>
> Again, many thanks for riscv64 backend.
>
> I finally found a way to give riscv64 a try … and it is again from
> Fabrice Bellard solution using jslinux online VM.
>
>  
>
> For that I use the fedora29 risvc64 vm in text mode and raised to 1Gb:
>
> https://bellard.org/jslinux/vm.html?cpu=riscv64&url=fedora29-riscv-2.cfg&mem=1024&rows=48&cols=160&font_size=12
>
>  
>
> It is very slow but it works well.
>
>  
>
> I started with gcc and my own projects. Now it’s the tcc turn (please
> be sure I don’t ask you anything to support tcc on this VM).
>
>  
>
> Tcc is configured with: ./configure --with-selinux
>
>  
>
> While compiling tcc (2020-05-mob) I get very few warnings:
>
> tccrun.c:844:2: warning: #warning add arch specific rt_get_caller_pc()
> [-Wcpp]
>
> #warning add arch specific rt_get_caller_pc()
>
>   ^~~~~~~
>
> gcc -o riscv64-gen.o -c riscv64-gen.c -DCONFIG_LDDIR="\"lib64\""
> -DHAVE_SELINUX -DTCC_TARGET_RISCV64       -DONE_SOURCE=0 -Wall -O2
> -Wdeclaration-after-statemen
>
> t -fno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare
> -Wno-unused-result -Wno-format-truncation -I.
>
> riscv64-gen.c: In function ‘load_symofs’:
>
> riscv64-gen.c:161:71: warning: format ‘%llx’ expects argument of type
> ‘long long unsigned int’, but argument 2 has type ‘uint64_t’ {aka
> ‘long unsigned int’} [-W
>
> format=]
>
>                tcc_error("unimp: large addend for global address
> (0x%llx)", sv->c.i);
>
>                           
>                                          ~~~^    ~~~~~~~
>
>                                                                     %lx
>
>  
>
> It produces a valid tcc binary which allows me to make “Hello World”
> compile and run.
>
>  
>
> But test suite unfortunately fails because of map memory error.
>
> Please note that I was also unable to mmap OpenLisp memory on this VM
> but, in this case, OpenLisp uses  malloc.
>
>  
>
> [root@localhost tinycc]# make test
>
> make[1]: Entering directory '/root/tinycc/tests'
>
> ------------ hello-exe ------------
>
> Hello World
>
> ------------ hello-run ------------
>
> tcc: error: tccrun: could not map memory
>
> + ../tcc -vv
>
> tcc version 0.9.27 (riscv64 Linux)
>
> install: /usr/local/lib/tcc
>
> include:
>
>   /usr/local/lib/tcc/include
>
>   /usr/local/include
>
>   /usr/include
>
> libraries:
>
>   /usr/lib64
>
>   /lib64
>
>   /usr/local/lib64
>
> libtcc1:
>
>   /usr/local/lib/tcc/libtcc1.a
>
> crt:
>
>   /usr/lib64
>
> elfinterp:
>
>   /lib/ld-linux-riscv64-lp64d.so.1
>
> + ldd ../tcc
>
>         linux-vdso.so.1 (0x000000200001d000)
>
>         libm.so.6 => /lib64/lp64d/libm.so.6 (0x0000002000030000)
>
>         libpthread.so.0 => /lib64/lp64d/libpthread.so.0
> (0x00000020000cf000)
>
>         libdl.so.2 => /lib64/lp64d/libdl.so.2 (0x00000020000eb000)
>
>         libc.so.6 => /lib64/lp64d/libc.so.6 (0x00000020000f0000)
>
>         /lib/ld-linux-riscv64-lp64d.so.1 (0x0000002000000000)
>
> + exit 1
>
> make[2]: *** [Makefile:82: hello-run] Error 1
>
> make[1]: *** [Makefile:74: all] Error 2
>
> make[1]: Leaving directory '/root/tinycc/tests'
>
> make: *** [Makefile:378: test] Error 2
>
>
> _______________________________________________
> Tinycc-devel mailing list
> Tinycc-devel@nongnu.org
> https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Hello,

I don't know a lot about tccrun, but I think it will map memory as
write+execute.

If selinux is in enabled enforcing then this might be prevented even if
running as unconfined_t, so please check if it there are any denials
related to tcc (e.g. allow unconfined_t self:process execmem;) or try it
with selinux temporarily in permissive mode (setenforce 0 ; <test> ;
setenforce 1)

Greetings - bauen1

_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to