[Tinycc-devel] tcc-busybox-w32 broken since 20a1ebf (tccpp : get rid of 'ch')

2022-10-08 Thread avih via Tinycc-devel
Hi,

It's the first time I tried building it (cute), and turns out that it's 
currently broken.

tcc-busybox is:
  http://download.savannah.nongnu.org/releases/tinycc/tcc-busybox-for-win32.zip

building this busybox using tcc which was built from mob 20a1ebf
or later results in sh.exe which always prints "sh: applet not found".

The steps to reproduce below are using MSYS2 mingw, but it was
reproduced also after building win32 tcc in other environments.

Interestingly, renaming the binary to ash.exe seem to "fix" it. e.g.
  ./sh.exe -c 'echo hello'  #  -> sh: applet not found
  mv ./sh.exe ./ash.exe
  ./ash.exe -c 'echo hello'  #  -> hello

This happens with both win32 tcc i386 and x86-64, and tcc i386
does pass all tests (x86-64 fails some tests, but probably unrelated).

Building one commit earlier (85c32dd tccpp: integrate __has_include..)
and both i386 and x86-64 tcc build sh.exe which seem to work as expected.

I didn't try to find what fails in busybox, and the the bad commit
20a1ebf is quite big, so it's hard to pinpoint the culprit, if any.

regards,
avih


steps to reproduce using MSYS2 with mingw i686 and x86-64 installed:

the following prints "sh: applet not found" if built using tcc from
20a1ebf, but prints "OK" if built using tcc from 85c32dd or earlier.


# get the sources once:

mkdir /c/test \
&& cd /c/test \
&& wget 
http://download.savannah.nongnu.org/releases/tinycc/tcc-busybox-for-win32.zip \
&& unzip tcc-busybox-for-win32.zip \
&& git clone http://repo.or.cz/tinycc.git


# build tcc32, busybox, and test:
# MSYSTEM=... PATH=...  emulates the mingw32 desktop shortcut

cd /c/test/tinycc \
&& git clean -xfd \
&& rm -rf /c/test/tcc-busybox-for-win32/tcc \
&& (
MSYSTEM=MINGW32 PATH=/mingw32/bin:$PATH \
&& ./configure --cpu=i386 --prefix=/c/test/tcc-busybox-for-win32/tcc \
&& make \
&& make install \
&& cd /c/test/tcc-busybox-for-win32/busybox \
&& rm -f ../sh.exe \
&& PATH=/c/test/tcc-busybox-for-win32/tcc \
&& tcc @0.tcc/busybox.tcc.rsp -w \
&& ../sh.exe -c 'echo OK'
)

# tcc64: ... MSYSTEM=MINGW64 PATH=/mingw64/bin:$PATH \
#&& ./configure --cpu=x86_64 --prefix=...

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


[Tinycc-devel] test failures on win32 x86-64

2022-10-08 Thread avih via Tinycc-devel
Hi,

The following tests fail for me currently (0fd7376 gnu hash) when
building tcc for win32 x86-64 (but pass when building i386)

from tests/:
- test3
- test1b

from tests/tests2/:
- 104_inline.test

I sampled several revisions since release_0_9_27, and all of them
fail somehow, mostly in tests (one revision also failed to build).

This could be related to the mingw gcc I'm testing with - gcc 11.3.0
using mingw64 in MSYS2. I _think_ the x86-64 win32 tests did pass
in thepast, so if someone could confirm the failures it may help.

I tested as follows on Windows 10:
- launch the mingw64 MSYS2 desktop shortcut
- cd path/to/tinycc
- git clean -xfd
- ./configure --cpu=x86_64 --config-mingw32 && make && make test


regards,
avih

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


[Tinycc-devel] How to force TinyCC to compile code to ARMv4 code instead of ARMv6 like in current version, and how to generate Thumb-1 code instead of ARM code?

2022-10-08 Thread Giang Vĩnh Lộc
Hello!

I was the guy who asked the question in the thread
https://lists.nongnu.org/archive/html/tinycc-devel/2022-10/msg4.html

The compiler works well (as least for now).

I compile a C source file (call it `main.c`), with `arm-tcc main.c -o
main.o`, then parse the output ELF file with `readelf -A main.o`, and the
result said that the file has the target instruction of ARMv6.

But I actually need the code to be compiled to ARMv4, particularly for
ARM7TDMI-S cpus. In GCC, there was an option `-march=` to specify the
target CPU to run on, therefore generate the instructions properly. But I
can't see an option like this in tcc.

In `./configure`, there is a variable called `cpuver` (
https://github.com/TinyCC/tinycc/blob/0fd7376000c68784d82464875bb1a6be58c63b29/configure#L221),
but I believe this is only for building the correct tcc for running on *the
host*

My question is, how can I force TinyCC to compile code to ARMv4 code
instead of ARMv6 like in current version?

Also another question: output of arm-tcc is usually in ARM32 instructions.
How can I force tcc to output Thumb-1 code? Is there any options like
`-mthumb` on GCC?

Thank you!
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel