Sujet : Re: question about linker
De : antispam (at) *nospam* fricas.org (Waldek Hebisch)
Groupes : comp.lang.cDate : 12. Dec 2024, 00:33:48
Autres entêtes
Organisation : To protect and to server
Message-ID : <vjd7gq$1cdcv$1@paganini.bofh.team>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
User-Agent : tin/2.6.2-20221225 ("Pittyvaich") (Linux/6.1.0-9-amd64 (x86_64))
bart <
bc@freeuk.com> wrote:
On 11/12/2024 09:18, Michael S wrote:
On Wed, 11 Dec 2024 05:37:15 -0000 (UTC)
antispam@fricas.org (Waldek Hebisch) wrote:
I remember running TCC on both RPi1 (2012) and RPi4 (2019). That would
be ARM32 (some version of ARMv7 I guess; I find ARM model numbers
bewildering).
It's possible I also tried TCC in the ARM64 mode of RPi4.
So it sounds rather unlikely that TCC doesn't support ARM.
To add to what Michael S wrote: AFAICS TCC can generate code
for ARM version 5. This is 32-bit ARM instructions set and
should work on all reasonably new (sey less than 25 years
old) non-embedded ARM processors supporting 32-bit instructions.
TCC can also generate instructions for 64-bit ARM (usually
called aarch64). AFAICS it does not support Thumb instruction
set which is used in popular Cortex-M series. Some old
embedded processors use 32-bit ARM instructions, but
there are restrictions and chance that tcc compiled code will
work on embedded processor is not big. And even if it works,
32-bit instructions give significantly bigger code than
Thumb encoding, and that on top of bigger code size from
tcc. So even, if tcc code could work, it is rather unattractive.
Let me add that MCU-s typically support only a subset of
ARM/Thumb instructions. For example, still quite popular
is Cortex-M0. It supports only Thumb1 instructions which
are quite limited. Basically, if processor supports more
instructions you want to use additional instructions, as that
makes code significantly faster. Cortex-M3 and Cortex-M4
are better, but IIRC still lacks some Thumb instructions
present in bigger processors. And bigger processors can
switch between Thumb and 32-bit encoding, while Cortex-M
is Thumb-only.
There are now embedded Risc-V processors. But Risc-V can
be 32-bit or 64-bit. Embedded Risc-V processors are
32-bit, while IIUC tcc supports only 64-bit Risc-V.
There are also intermediate-style machines. They support
64-bit instructions, but have small memory that comfortably
could be addressed using 32-bit. For such a machine it makes
sense to use 64-bit instructions, but use 32-bit pointers and
long. gcc and clang support such mode for Intel/AMD
processors under name x86_64-x32. It seems that no
mainstream compiler supports similar mode for Risc-V
(there is some talk, so maybe one can find some experimental
support).
-- Waldek Hebisch