[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tinycc-devel] Ported tcc to Solaris/Illumos x86
From: |
Brian Callahan |
Subject: |
Re: [Tinycc-devel] Ported tcc to Solaris/Illumos x86 |
Date: |
Fri, 14 Jul 2023 13:30:51 +0000 |
Hi grischka --
On 7/14/2023 6:03 AM, grischka wrote:
> On 11.07.2023 07:22, Brian Callahan wrote:
>> Hi all --
>>
>> Attached for review/testing is a diff that enables TCC to work on
>> Solaris/Illumos x86. Tested on an OpenIndiana (Illumos distro) machine,
>> where all tests pass when running TCC as an i386 compiler.
>> Solaris/Illumos is a multiarch environment. Modern Illumos is a 64-bit
>> kernel only, but 32-bit binaries work just fine; the Illumos people care
>> a lot about backwards compatibility.
>
> Hi,
>
> that sounds good. For the people who might want to try this but do
> not necessarily have the same insight as you do have by now, I'd suggest
> to at least try to tackle the remaining issues in the sense of an out
> of the box experience:
>
> * configure: maybe it is possible to let configure detect this
> "not smart enough" shell and if so print some informative message
> (such as "Better use bash configure on this system") or maybe even
> re-execute itself using bash then.
>
> * path to diff etc. tools: it might be possible to set the "Path"
> variable in the (top section of the top level-) Makefile, conditionally
>
Good to know about these two.
> * gcc build cross tcc on i386: Maybe it's still possible one way or
> the other to detect that we're compiling for i386 even under gcc.
> The logic in tcc.h is
>
> # if defined __i386__ && defined TCC_TARGET_I386
> # define TCC_IS_NATIVE
>
> For example MSVC defines just _x86_, which is why there is
>
> # ifdef _X86_
> # define __i386__ 1
> # endif
>
Will check on this.
> * __start_crt_compiler: referenced symbol not found
> Seems you'd need to provide this function, for example in libtcc1.a.
> Google has some info about it.
>
This symbol is provided in the Solaris C runtime startup files, and it
is linked into the binary. Which is why I think the relocation error is
the real problem, and this is one is a red herring.
> * relocation R_AMD64_COPY offset invalid: _DYNAMIC: offset=0xa00a08 lies
> outside memory image;
>
> Don't know. COPY relocs normally are generated only by the tcc linker
> itself for bss symbols. Is "_DYNAMIC" the symbol name? Does it have
> a "symbol size" (esym->st_size) ? Try objdump -R, See also
> tccelf.c:1941
>
Started on this but nothing conclusive yet.
~Brian