tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] Fail to build binaries when an object file is compile


From: Herman ten Brugge
Subject: Re: [Tinycc-devel] Fail to build binaries when an object file is compiled by clang or gcc on arm mac
Date: Thu, 23 Feb 2023 16:03:03 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0

On 2/22/23 08:36, Levo D wrote:
I tried creating an account so I can submit a bug report but I didn't receive a 
confirmation email. tcc fails to build binaries when an object file is compiled 
by clang or gcc on arm mac

Using todays build of tcc I confirmed this problem on ARM mac 
(bdec3c534583066cf097543f265ad620a8baa30d, tcc version 0.9.27 mob:bdec3c5 
2023-02-03T18:04:56+01:00 (AArch64 Darwin), built using "./configure 
--config-new_macho --config-codesign")

Compile the below using `-c a.c` on either clang or gcc. I tried with Apple 
clang version 14.0.0 (clang-1400.0.29.202) and gcc version 12.2.0 (Homebrew GCC 
12.2.0)

//a.c
int get() { return 1; }

Then compile the below using `tcc -g b.c a.o`. You get an "unrecognized file 
type" error. Following these steps on linux will create a working binary

a.o: error: a.o: unrecognized file type

//b.c
int get();
int main() {
        return get();
}

This is expected. The object files that tcc generates and read are in elf format and not in macos format. The reason is that macos differs a lot from elf format and it is difficult to implement this in tcc.
The output executable/dll is in macos format.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]