Tiny C Compiler

Tiny C Compiler
Developer(s)Fabrice Bellard
Stable release
0.9.27 / 17 December 2017; 7 years ago (2017-12-17)
Repositoryrepo.or.cz/w/tinycc.git
Written inC and Assembly[citation needed]
Operating systemLinux, Unix, Windows
PredecessorOTCC, Obfuscated Tiny C Compiler[1]
TypeC compiler
LicenseLGPLv2.1
Websitewww.tinycc.org

The Tiny C Compiler (a.k.a. TCC, tCc, or TinyCC) is an x86, X86-64 and ARM processor C compiler initially written by Fabrice Bellard. It is designed to work for slower computers with little disk space (e.g. on rescue disks). Windows operating system support was added in version 0.9.23 (17 June 2005). TCC is distributed under the GNU Lesser General Public License.

TCC claims to implement all of ANSI C (C89/C90),[2] much of the C99 ISO standard,[3] and many GNU C extensions including inline assembly.

Features

TCC has a number of features that differentiate it from other current C compilers:

  • Its small file size (about 100 KB for the x86 TCC executable) and memory footprint allow it to be used directly from a single 1.44 M floppy disk, such as a rescue disk.
  • TCC is intended to produce native x86, x86-64 and ARM code very quickly; according to Bellard, it compiles, assembles and links about nine times faster than GCC does.[4] As of 2023, the "mob" development branch also includes support for RISC-V and TMS320C67xx (a DSP chip).
  • TCC has a number of compiler-specific language features intended to improve its practicality, such as an optional memory and bound checker, for improved code stability.
  • TCC allows programs to be run automatically at compile time using a command-line switch. This allows programs to be run as a shell script under Unix-like systems that support the shebang interpreter directive syntax.

Compiled program performance

In general, TCC's implementation emphasizes smallness instead of optimally-performing results. TCC generates code in a single pass, and does not perform most of the optimizations performed by other compilers. TCC compiles every statement on its own, and at the end of each statement register values are written back to the stack and must be re-read even if the next line uses the values in registers (creating extraneous save/load pairs between statements). TCC uses only some of the available registers (e.g., on x86 it never uses ebx, esi, or edi because they need to be preserved across function calls).[5]

TCC performs a few optimizations, such as constant propagation for all operations, multiplications and divisions are optimized to shifts when appropriate, and comparison operators are specially optimized (by maintaining a special cache for the processor flags). It also does some simple register allocation, which prevents many extraneous save/load pairs inside a single statement.

Here are two benchmark examples:

  1. A recursive Fibonacci algorithm on a 1.8 GHz Intel Centrino laptop with 512 MB RAM yields a noticeable difference in results between Microsoft Visual C++ compiler 13.10.3052 and TCC. To calculate the 49th Fibonacci number, it took a MS Visual C++ program approximately 18% longer than the TCC compiled program.[citation needed]
  2. A test compared different C compilers by using them to compile the GNU C Compiler (GCC) itself, and then using the resulting compilers to compile GCC again. Compared to GCC 3.4.2, a TCC modified to compile GCC was able to compile the compiler ten times faster, but the resulting .exe it produced was 57% larger, and much slower, taking 2.2 times as long to compile GCC again.[6]

    The results were: Running cc1 (the GCC C compiler) on itself required 518 seconds when compiled using GCC 3.4.2, 545 seconds using Microsoft C compiler, and 1145 seconds using TCC. To create these compilers in the first place, GCC (3.4.2) took 744 seconds to compile the GCC compiler, whereas TCC took only 73 seconds. The level of optimization in each compiler was -O1 or similar.

Uses

  • TCCBOOT,[7] a hack where TCC loads and boots a Linux kernel from source in about 10 seconds. That is to say, it is a "boot loader" that reads Linux kernel source code from disk, writes executable instructions to memory, and begins running it. This did require changes to the Linux build process.
  • TCC has been used to compile GCC, though various patches were required to make this work.[8]
  • TCC was used to demonstrate a defense against the trust attack.[9] It is also used in GNU Guix[10] in an attempt to make the distribution bootstrapable without using any binary.[11]
  • Cinpy[12] is a Python library that allows you to implement functions with C in Python modules. The functions are compiled with TCC at runtime. The results are made callable in Python through the ctypes library.
  • Comes installed on JavaScript Linux[13] (also by Bellard).
  • Has been used as a reference for the compiled version of the Super Micro-Max Chess program source.[14]
  • Bun, the JavaScript runtime, uses TCC to expose an API which allows users to compile and run C programs from JavaScript.[15]

History

TCC has its origins in the Obfuscated Tiny C Compiler (OTCC),[1] a program Bellard wrote to win the International Obfuscated C Code Contest (IOCCC) in 2001. After that time, Bellard expanded and deobfuscated the program to produce tcc.[1]

At some time prior to 4 February 2012 Fabrice Bellard updated the project's official web page to report that he was no longer working on TCC.[16]

Since Bellard's departure from the project, various people and groups have distributed patches or maintained forks of TCC to build upon or fix issues with TCC. This includes Dave Dodge's collection of unofficial tcc patches,[17] Debian and kfreebsd downstream patches,[18] and grischka's gcc patches.[6] Grischka also set up a public Git repository for the project[19] that contains a mob branch[20] where numerous contributions, including a shared build, cross-compilers, and SELinux compatibility were added. Grischka's GIT repository later became the official TCC repository (linked to by Fabrice Bellard's Savannah project page [21]).

Current status

As of December 2017 both the official TCC mailing list[22] and the official Git repository (as linked to by Fabrice Bellard's Savannah project page[23]) show active discussion and development by many developers and interested users. In December 2017, grischka announced on the mailing list that TCC version 0.9.27 was released.[24]

See also

References

  1. ^ a b c Bellard, Fabrice. Obfuscated Tiny C Compiler, winning entry of IOCCC 2001. https://bellard.org/otcc/ and at the Internet Archive at https://web.archive.org/web/20130721162702/http://www.ioccc.org/2001/
  2. ^ Tiny C Compiler Reference Documentation accessed on 2008-08-07
  3. ^ According to the project's TODO list complex types are the only missing C99 feature. Variable Length Arrays have been added in TCC 0.9.26
  4. ^ "TCC : Tiny C Compiler". bellard.org. Retrieved 27 March 2023.
  5. ^ Glöckner, Daniel. Re: Tinycc-devel (no subject), 8 September 2006.
  6. ^ a b grischka, GCC by TCC (some fixes), 29 September 2005
  7. ^ "TCCBOOT: TinyCC Boot Loader". bellard.org. Retrieved 27 March 2023.
  8. ^ "tinycc-devel (thread)". lists.gnu.org. Retrieved 27 March 2023.
  9. ^ Wheeler, David A. Countering Trusting Trust through Diverse Double-Compiling. ACSAC.
  10. ^ "Guix Further Reduces Bootstrap Seed to 25% — 2020 — Blog — GNU Guix".
  11. ^ "Bootstrappable builds". bootstrappable.org. Retrieved 29 March 2023.
  12. ^ "Cinpy". Archived from the original on 20 November 2008. Retrieved 27 March 2023.
  13. ^ "JSLinux". bellard.org. Retrieved 27 March 2023.
  14. ^ "Super Micro Chess". SourceForge. 18 April 2016. Retrieved 27 March 2023.
  15. ^ "C compiler". Bun. Retrieved 22 November 2024.
  16. ^ "TCC : Tiny C Compiler". 4 February 2012. Archived from the original on 4 February 2012. Retrieved 27 March 2023.
  17. ^ "Unofficial tcc Patches". www.dododge.net. Archived from the original on 31 March 2007. Retrieved 27 March 2023.
  18. ^ "Debian -- Details of package tcc in sid". packages.debian.org. Retrieved 27 March 2023.
  19. ^ grischka, Public Git Hosting for tcc
  20. ^ grischka, mob branch for tcc
  21. ^ "Tiny C Compiler - Summary [Savannah]". savannah.nongnu.org. Retrieved 27 March 2023.
  22. ^ "tinycc-devel Archives". lists.gnu.org. Retrieved 27 March 2023.
  23. ^ "Public Git Hosting - tinycc.git/summary". repo.or.cz. Retrieved 27 March 2023.
  24. ^ "[Tinycc-devel] TCC version 0.9.27 is out". lists.nongnu.org. Retrieved 27 March 2023.

Read other articles:

International sporting eventMen's team sprint at the 2023 Pan American GamesVenueVelódromo PeñalolénDates24 OctoberCompetitors21 from 7 nationsWinning time43.396Medalists Tyler RorkeNick WammesJames Hedgcock  Canada Carlos EcheverriRubén MurilloKevin Quintero  Colombia Jafet LópezJuan RuízEdgar Verdugo  Mexico«2019 Cycling at the2023 Pan American GamesQualificationBMX RacingmenwomenFreestylemenwomenMountain bikingCross-country...

 

Befloxatone Names Preferred IUPAC name (5R)-5-(Methoxymethyl)-3-{4-[(3R)-4,4,4-trifluoro-3-hydroxybutoxy]phenyl}-1,3-oxazolidin-2-one Identifiers CAS Number 134564-82-2 N 3D model (JSmol) Interactive image ChEMBL ChEMBL416578 Y ChemSpider 54811 Y IUPHAR/BPS 6637 KEGG D02563 N PubChem CID 60824 UNII 4H75PAD8M3 Y CompTox Dashboard (EPA) DTXSID70158800 InChI InChI=1S/C15H18F3NO5/c1-22-9-12-8-19(14(21)24-12)10-2-4-11(5-3-10)23-7-6-13(20)15(16,17)18/h2-5,12-13,20H,6-9H2,1...

 

BisceglieNama lengkapAssociazione Sportiva Bisceglie Calcio 1913Berdiri1913StadionStadio Gustavo Ventura,Bisceglie, Italy(Kapasitas: 5,000)PresidentNicola CanonicoHead coachNicola RagnoLigaSerie D/H2011–12Eccellenza Apulia, 3rd (promoted) Kostum kandang Kostum tandang Associazione Sportiva Bisceglie Calcio 1913 adalah sebuah klub sepak bola Italia yang berada di Bisceglie, Apulia. Saat ini mereka bermain di Seri D. lbsSerie D Klub 2019–2020 Girone A Borgosesia Bra Caronnese Casale Chieri ...

Constituency of the National Assembly of Pakistan NA-138 Okara-IVConstituencyfor the National Assembly of PakistanRegionDepalpur Tehsil (partly) of Okara DistrictElectorate521,359 [1]Current constituencyMember(s)VacantCreated fromNA-147 Okara-V NA-138 Okara-IV (این اے-138، اوكاڑه-4) is a constituency for the National Assembly of Pakistan.[2] Members of Parliament 2018-2022: NA-144 (Okara-IV) Election Member Party 2018 Muhammad Moeen Wattoo PML (N) Election 2002 Fur...

 

artikel ini perlu dirapikan agar memenuhi standar Wikipedia. Tidak ada alasan yang diberikan. Silakan kembangkan artikel ini semampu Anda. Merapikan artikel dapat dilakukan dengan wikifikasi atau membagi artikel ke paragraf-paragraf. Jika sudah dirapikan, silakan hapus templat ini. (Pelajari cara dan kapan saatnya untuk menghapus pesan templat ini) PT Wijaya Karya (Persero) TbkGedung WIKA, kantor pusat Wijaya Karya di JakartaNama dagangWIKASebelumnyaPN Widjaja Karja (1961 - 1972)JenisBadan us...

 

British statistician and educator (1924–2022) SirDavid CoxFRS FBA FRSE FRSCCox in 1980Born(1924-07-15)15 July 1924Birmingham, EnglandDied18 January 2022(2022-01-18) (aged 97)Alma mater St John's College, Cambridge (MA) University of Leeds (PhD) Known for Cox proportional hazards model Cox process Box-Cox transform Matrix-exponential distribution Method of supplementary variables Stochastic processes Design of experiments Analysis of binary data Spouse Joyce Drummo...

1908 restoration of constitutional rule in the Ottoman Empire This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Young Turk Revolution – news · newspapers · books · scholar · JSTOR (July 2021) (Learn how and when to remove this message) Young Turk RevolutionPart of the collapse of the Ottoman EmpireDeclaration ...

 

Mausoleum of Chinese Emperor Taizong of Tang Zhao Mausoleum Chinese officer of the Guard of Honour. Tomb of Princess Changle (长乐公主墓), Zhao Mausoleum, Shaanxi province. Tang Zhenguan year 17, i.e. 644 CE Zhao Mausoleum (昭陵; pinyin: Zhāolíng; Zhao means the light of the sun) is the mausoleum of Emperor Taizong of Tang (599–649). It is located in Jiuzong Mountain, Shaanxi, China, it is the biggest mausoleum of the Tang dynasty. Besides being the last resting place of Emper...

 

Lethal Weapon 2Poster rilis layar lebarSutradaraRichard DonnerProduserRichard DonnerJoel SilverSkenarioJeffrey BoamCerita Shane Black Warren Murphy BerdasarkanPara karakteroleh Shane BlackPemeran Mel Gibson Danny Glover Joe Pesci Joss Ackland Derrick O'Connor Patsy Kensit Penata musik Michael Kamen Eric Clapton David Sanborn SinematograferStephen GoldblattPenyuntingStuart BairdPerusahaanproduksiSilver PicturesDistributorWarner Bros.Tanggal rilis 7 Juli 1989 (1989-07-07) Durasi114 m...

Anne de FoixPermaisuri Hungaria dan BohemiaFresko dari dinding Kapel St. Wenceslas di Katedral Santo Vitus, Praha (1508)Periode1502–1506Penobatan29 September 1502Kelahiran1484Kematian26 Juli 1506 – 1484; umur -23–-22 tahunBuda, HungariaWangsaFoix-CandaleAyahGaston de Foix, Comte CandaleIbuCatherine de Foix-CandalePasanganWładysław II dari HungariaAnakAnna JagellonicaLajos II dari Hungaria Anne de Foix (1484-26 Juli 1506) adalah Permaisuri Bohemia dan istri Władysław II ...

 

كأس تونس للكرة الطائرة للرجال الموسم 2016-2017 البلد تونس  المنظم الجامعة التونسية للكرة الطائرة  النسخة 61 الفائز الترجي الرياضي التونسي كأس تونس للكرة الطائرة للرجال 2015–16 كأس تونس للكرة الطائرة للرجال 2017–18 تعديل مصدري - تعديل   كأس تونس للكرة الطائرة للرجال 2016-2017 هو �...

 

Cet article est une ébauche concernant un coureur cycliste néerlandais. Vous pouvez partager vos connaissances en l’améliorant (comment ?). Pour plus d’informations, voyez le projet cyclisme. Antoine MazairacAntoine Mazairac (à gauche) opposé à Willy Falck Hansen lors de la demi-finale de la vitesse individuelle des Jeux olympiques de 1928InformationsNaissance 24 mai 1901RosendaelDécès 11 septembre 1966 (à 65 ans)DortmundNationalité néerlandaisePrincipales victoires ...

Independent politician in Northern Ireland (born 1943) For other people named Brian Wilson, see Brian Wilson (disambiguation). Brian WilsonMayor of North DownIn office1993–1994Preceded byLeslie CreeSucceeded byRoy BradfordMember of North Down Borough CouncilIn office15 May 1985 – 22 May 2014Preceded byDistrict createdSucceeded byCouncil abolishedConstituencyBangor WestIn office20 May 1981 – 15 May 1985Preceded byThomas RollinsSucceeded byDistrict abolishedConstituencyN...

 

Jack the BearSutradaraMarshall HerskovitzProduserBruce GilbertPeter BurrellSkenarioSteven ZaillianBerdasarkanJack the Bearoleh Dan McCallPemeran Danny DeVito Penata musikJames HornerSinematograferFred MurphyPenyuntingSteven RosenblumDistributor20th Century FoxTanggal rilis 2 April 1993 (1993-04-02) Durasi99 menitNegaraAmerika SerikatBahasaInggrisPendapatankotor$ 5.145.823[1] Jack the Bear adalah film drama Amerika Serikat yang dirilis tahun 1993 dan disutradarai oleh Marsha...

 

For the 19th century critic and judge, see Barron Field (author). Barron FieldCamp Taliaferro Field #2Everman, Texas Barron Field, Texas, 1918Barron FieldCoordinates32°37′26″N 97°18′24″W / 32.62389°N 97.30667°W / 32.62389; -97.30667 (Barron Field)TypePilot training airfieldSite informationControlled by  Royal Flying Corps (1917)  Air Service, United States Army (1918-1921)ConditionRedeveloped into urban areaSite historyBuilt1917In...

American shipyard located on the Kennebec River in Bath, Maine This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages) This article is missing information about multiple liquidations & reorganizations (see Talk). Please expand the article to include this information. Further details may exist on the talk page. (January 2021) This article includes a list of general references, but it lacks suf...

 

Graph of the variation in the electrical load versus time This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Load profile – news · newspapers · books · scholar · JSTOR (April 2009) (Learn how and when to remove this message) Typical seasonal loads of electric utilities in Eastern New England Division in 1919. U...

 

Nabil FekirFekir con la Francia ai Mondiali 2018Nazionalità Francia Altezza173 cm Peso72 kg Calcio RuoloCentrocampista, attaccante Squadra Al-Jazira CarrieraGiovanili 2010-2011 Saint-Priest2011-2013 Olympique Lione Squadre di club1 2013-2019 Olympique Lione145 (55)2019-2024 Betis134 (21)2024- Al-Jazira1 (0) Nazionale 2014-2015 Francia U-211 (0)2015-2020 Francia25 (2) Palmarès  Mondiali di calcio OroRussia 2018 1 I due numeri indicano le presenze e le ...

System of British noble titles from 1707 to 1800 This article includes a list of general references, but it lacks sufficient corresponding inline citations. Please help to improve this article by introducing more precise citations. (August 2019) (Learn how and when to remove this message) Part of a series onPeerages in theUnited Kingdom RanksDuke / DuchessMarquess / MarchionessEarl / CountessViscount / ViscountessBaron / Baroness (in Scotland, replaced by Lord / Lady of Parliament) TypesHered...

 

最も一般的な木質燃料である薪 木質燃料(もくしつねんりょう、英: Wood fuel または Fuelwood)、または木質バイオマス(もくしつバイオマス、英: Woody biomass)とは、薪や炭、ウッドチップ、木質ペレット、おがくずなどの木材を原料とする燃料を指す[注 1]。 概要 木質燃料を運ぶ女性 炉内で燃える木質燃料 木質燃料は人類にとって最も古くから使われてきた燃�...