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.

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

Reply via email to