Hi All,
As suspected, I have a proof that current version does not allow to mix
clang and tcc objects (which is of course a big issue).
The root of this issue is that a tcc .o is not a Mach-O but a ELF 64 object
file.
After successfully compiled tcc here is my test:
--- foo.c
Int foo = 1;
--- main.c
#include <stdio.h>
extern int foo;
int
main() {
printf("foo: %d\n", foo);
}
jullien@byas tinycc % clang -O3 -c foo.c -o foo-clang.o
jullien@byas tinycc % ./tcc -c foo.c -o foo-tcc.o
jullien@byas tinycc % ls -ls foo*o
8 -rw-r--r-- 1 jullien staff 420 Jun 23 06:53 foo-clang.o
8 -rw-r--r-- 1 jullien staff 660 Jun 23 06:54 foo-tcc.o
jullien@byas tinycc % file foo-clang.o
foo-clang.o: Mach-O 64-bit object x86_64
jullien@byas tinycc % file foo-tcc.o
foo-tcc.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not
stripped
Obviously, foo-tcc.o is not seen as a Mach-O object file
Now
- when linking with clang a tcc object:
% clang main.c -o main foo-tcc.o && ./main
ld: warning: ignoring file foo-tcc.o, building for macOS-x86_64 but
attempting to link with file built for unknown-unsupported file format (
0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
0x00 )
Undefined symbols for architecture x86_64:
"_foo", referenced from:
_main in main-fc9898.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
- when linking with tcc a clang object
% tcc main.c foo-clang.o
foo-clang.o: error: foo-clang.o: unrecognized file type 0
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel