|
From: | Christian Jullien |
Subject: | Re: [Tinycc-devel] Linking system dylibs on macOS 11+ |
Date: | Thu, 8 Jul 2021 08:51:20 +0200 |
Hi, I get the two warnings with gcc, not with clang: ./configure --cc=gcc --cpu=x86_64 … gcc -o tccmacho.o -c tccmacho.c -DCONFIG_USR_INCLUDE="\"/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include\"" -DTCC_TARGET_X86_64 -DTCC_TARGET_MACHO -DONE_SOURCE=0 -Wall -O2 -Wdeclaration-after-statement -fno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -Wno-unused-result -Wno-format-truncation -I. In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/string.h:194, from tcc.h:35, from tccmacho.c:18: tccmacho.c: In function 'add_segment': tccmacho.c:265:5: warning: '__builtin_strncpy' specified bound 16 equals destination size [-Wstringop-truncation] 265 | strncpy(sc->segname, name, 16); | ^~~~~~~ In function 'add_section', inlined from 'collect_sections' at tccmacho.c:649:22, inlined from 'macho_output_file' at tccmacho.c:812:9: tccmacho.c:285:5: warning: '__builtin_strncpy' specified bound 16 equals destination size [-Wstringop-truncation] 285 | strncpy(sec->sectname, name, 16); | ^~~~~~~ Are you on Big Sur M1 (= aarch64) or Big Sur Intel? Rosetta comes only with M1 and it translates Intel code to Aarch64 on the fly. My previous attempt to build tcc on M1 was in fact to build a M1 (Aarch64) binary cross-compiler for x86_64. This way, tcc is a native binary on M1 which produce x86_64 user code translated by Rosetta (on a M1) to produce a workable program. Most (not to say about all) test fails. I get a much better result if I compile tcc as native x86_64 binary using: ./configure --extra-cflags="-arch x86_64" --extra-ldflags="-arch x86_64" --cpu=x86_64 Make test gives NO error at all!!!! To summarize: On Big Sur Intel, I recommend ./configure; make On Big Sur M1, I recommend ./configure --extra-cflags="-arch x86_64" --extra-ldflags="-arch x86_64" --cpu=x86_64 I’ll try to make the later options the ./configure default on M1. Many thanks all to make M1 support happen. C. From: Tinycc-devel [mailto:tinycc-devel-bounces+eligis=orange.fr@nongnu.org] On Behalf Of Sushant Pandurangi Hello Christian, Thanks for the Windows patches and the long double fix. To clarify about tcc -run, I'm not using --cpu=x86-64 at all, I am on a fresh M1 and Rosetta is not even installed. Here, `tcc -run` starts running main() and very simple stuff (like Hello World) works already. On the other hand in a cross-compiler config, I wonder if tcc -run can work at all -- not unless Rosetta can do in-memory translation of the JIT'd x86-64 code. The 2 warnings at tccmacho.c:265/285 -- those are not from my code, did they show up only after my patch? I wonder why. I'm not familiar with that function and probably not the best person to make a fix. To Herman, thanks a lot for catching the memcheck issues. Regards, Sushant
|
[Prev in Thread] | Current Thread | [Next in Thread] |