Portable C Compiler

Last updated
Portable C Compiler
Original author(s) Stephen C. Johnson
Developer(s) AT&T Bell Laboratories
Initial release1979;45 years ago (1979)
Stable release
1.1.0 / December 10, 2014;9 years ago (2014-12-10)
Written in C
Operating system Unix and Unix-like
Type C Compiler
License BSD License
Website web.archive.org/web/20231212090621/http://pcc.ludd.ltu.se/ OOjs UI icon edit-ltr-progressive.svg

The Portable C Compiler (also known as pcc or sometimes pccm - portable C compiler machine) is an early compiler for the C programming language written by Stephen C. Johnson of Bell Labs in the mid-1970s, [1] based in part on ideas proposed by Alan Snyder in 1973, [2] [3] and "distributed as the C compiler by Bell Labs... with the blessing of Dennis Ritchie." [4]

Contents

Being one of the first compilers that could easily be adapted to output code for different computer architectures, the compiler had a long life span. It debuted in Seventh Edition Unix and shipped with BSD Unix until the release of 4.4BSD in 1994, when it was replaced by the GNU C Compiler. It was very influential in its day, so much so that at the beginning of the 1980s, the majority of C compilers were based on it. [5] Anders Magnusson and Peter A Jonsson restarted development of pcc in 2007, rewriting it extensively to support the C99 standard. [6]

Features

Key features of pcc are its portability and improved diagnostic capabilities. The compiler was designed so that only a few of its source files are machine-dependent. It is relatively robust to syntax errors and performs more thorough validity checks than its contemporaries.[ according to whom? ]

The first C compiler, written by Dennis Ritchie, used a recursive descent parser, incorporated specific knowledge about the PDP-11, and relied on an optional machine-specific optimizer to improve the assembly language code it generated. In contrast, Johnson's pccm was based on a yacc-generated parser and used a more general target machine model. Both compilers produced target-specific assembly language code which they then assembled to produce linkable object modules.

Later versions of PCC, known within Bell Labs as "QCC" and "RCC," supported other target architecture models.[ citation needed ]

The language that PCC implements is an extended version of K&R C that Bjarne Stroustrup has called "Classic C", incorporating the void return type (for functions that don't return any value), enumerations and structure assignment. [4]

Current version

A new version of pcc, based on the original by Steve Johnson, is maintained[ when? ] by Anders Magnusson. [6] The compiler is provided under the BSD licence and its development is funded by a non-profit organization called BSD Fund. According to Magnusson:

The big benefit of it (apart from that it's BSD licensed, for license geeks) is that it is fast, 5-10 times faster than gcc, while still producing reasonable code. <...> [I]t is also quite simple to port...

Anders Magnusson [7]

This new version was added to the NetBSD pkgsrc and OpenBSD source trees in September 2007, [8] and later into the main NetBSD source tree. [9] There had been some speculation that it might eventually be used to supplant the GNU C Compiler on BSD-based operating systems, [10] though FreeBSD [11] [12] and NetBSD [13] are both looking to Clang as a potential replacement, and Theo de Raadt of OpenBSD asserts that pcc is not ready yet to be a gcc replacement, and the disposal of gcc is not top priority. [14] On December 29, 2009, pcc became capable of building a functional x86 OpenBSD kernel image. [15]

pcc version 1.0 was released on 1 April 2011. [16] As of this release, the compiler supports x86 and x86-64 processor architectures and runs on NetBSD, OpenBSD, FreeBSD, various Linux distributions, and Microsoft Windows. [17] Further development, including support for more architectures, and FORTRAN 77 and C++ front ends, is continuing as of 2022.

PCC was removed from the OpenBSD source tree in 2012. [18] Development on it had stalled and no maintainer had stepped up to develop it into something that could make a practical alternative to GNU Compiler Collection. [19] [20]

The latest version of pcc, namely 1.1.0, was released on 10 December 2014. [21]

See also

Related Research Articles

<span class="mw-page-title-main">Executable and Linkable Format</span> Standard file format for executables, object code, shared libraries, and core dumps.

In computing, the Executable and Linkable Format, is a common standard file format for executable files, object code, shared libraries, and core dumps. First published in the specification for the application binary interface (ABI) of the Unix operating system version named System V Release 4 (SVR4), and later in the Tool Interface Standard, it was quickly accepted among different vendors of Unix systems. In 1999, it was chosen as the standard binary file format for Unix and Unix-like systems on x86 processors by the 86open project.

<span class="mw-page-title-main">GNU Compiler Collection</span> Free and open-source compiler for various programming languages

The GNU Compiler Collection (GCC) is a collection of compilers from the GNU Project that support various programming languages, hardware architectures and operating systems. The Free Software Foundation (FSF) distributes GCC as free software under the GNU General Public License. GCC is a key component of the GNU toolchain which is used for most projects related to GNU and the Linux kernel. With roughly 15 million lines of code in 2019, GCC is one of the biggest free programs in existence. It has played an important role in the growth of free software, as both a tool and an example.

Yacc is a computer program for the Unix operating system developed by Stephen C. Johnson. It is a lookahead left-to-right rightmost derivation (LALR) parser generator, generating a LALR parser based on a formal grammar, written in a notation similar to Backus–Naur form (BNF). Yacc is supplied as a standard utility on BSD and AT&T Unix. GNU-based Linux distributions include Bison, a forward-compatible Yacc replacement.

In software development, Make is a command-line interface (CLI) software tool that performs actions ordered by configured dependencies as defined in a configuration file called a makefile. It is commonly used for build automation to build executable code from source code. But, not limited to building, Make can perform any operation available via the operating system shell.

<span class="mw-page-title-main">Version 7 Unix</span> 1979 minicomputer operating system

Version 7 Unix, also called Seventh Edition Unix, Version 7 or just V7, was an important early release of the Unix operating system. V7, released in 1979, was the last Bell Laboratories release to see widespread distribution before the commercialization of Unix by AT&T Corporation in the early 1980s. V7 was originally developed for Digital Equipment Corporation's PDP-11 minicomputers and was later ported to other platforms.

A cross compiler is a compiler capable of creating executable code for a platform other than the one on which the compiler is running. For example, a compiler that runs on a PC but generates code that runs on Android devices is a cross compiler.

patch (Unix) Unix utility to apply changes to text files

The computer tool patch is a Unix program that updates text files according to instructions contained in a separate file, called a patch file. The patch file is a text file that consists of a list of differences and is produced by running the related diff program with the original and updated file as arguments. Updating files with patch is often referred to as applying the patch or simply patching the files.

The GNU toolchain is a broad collection of programming tools produced by the GNU Project. These tools form a toolchain used for developing software applications and operating systems.

<span class="mw-page-title-main">LLVM</span> Compiler backend for multiple programming languages

LLVM is a set of compiler and toolchain technologies that can be used to develop a frontend for any programming language and a backend for any instruction set architecture. LLVM is designed around a language-independent intermediate representation (IR) that serves as a portable, high-level assembly language that can be optimized with a variety of transformations over multiple passes. The name LLVM originally stood for Low Level Virtual Machine, though the project has expanded and the name is no longer officially an initialism.

Source Code Control System (SCCS) is a version control system designed to track changes in source code and other text files during the development of a piece of software. This allows the user to retrieve any of the previous versions of the original source code and the changes which are stored. It was originally developed at Bell Labs beginning in late 1972 by Marc Rochkind for an IBM System/370 computer running OS/360.

UNIX/32V is an early version of the Unix operating system from Bell Laboratories, released in June 1979. 32V was a direct port of the Seventh Edition Unix to the DEC VAX architecture.

<span class="mw-page-title-main">Version 6 Unix</span> 6th Edition of Research Unix alias UNIX Time-Sharing System

Sixth Edition Unix, also called Version 6 Unix or just V6, was the first version of the Unix operating system to see wide release outside Bell Labs. It was released in May 1975 and, like its direct predecessor, targeted the DEC PDP-11 family of minicomputers. It was superseded by Version 7 Unix in 1978/1979, although V6 systems remained in regular operation until at least 1985.

The OpenBSD operating system focuses on security and the development of security features. According to author Michael W. Lucas, OpenBSD "is widely regarded as the most secure operating system available anywhere, under any licensing terms."

Clang is a compiler front end for the C, C++, Objective-C, and Objective-C++ programming languages, as well as the OpenMP, OpenCL, RenderScript, CUDA, SYCL, and HIP frameworks. It acts as a drop-in replacement for the GNU Compiler Collection (GCC), supporting most of its compilation flags and unofficial language extensions. It includes a static analyzer, and several code analysis tools.

<span class="mw-page-title-main">OpenBSD</span> Operating system

OpenBSD is a security-focused, free and open-source, Unix-like operating system based on the Berkeley Software Distribution (BSD). Theo de Raadt created OpenBSD in 1995 by forking NetBSD 1.0. The OpenBSD project emphasizes portability, standardization, correctness, proactive security, and integrated cryptography.

<span class="mw-page-title-main">Unix</span> Family of computer operating systems

Unix is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, and others.

Bionic is an implementation of the standard C library, developed by Google for its Android operating system. It differs from the GNU C Library (glibc) in being designed for devices with less memory and processor power than a typical Linux system. It is a combination of new code and code from FreeBSD, NetBSD, and OpenBSD released under a BSD license, rather than glibc, which uses the GNU Lesser General Public License. This difference was important in the early days of Android, when static linking was common, and since bionic has its own ABI, it can't be replaced by a different libc without breaking all existing apps.

Mingw-w64 is a free and open-source suite of developments tools that generate Portable Executable (PE) binaries for Microsoft Windows. It was forked in 2005–2010 from MinGW.

<span class="mw-page-title-main">LibreSSL</span> Open-source implementation of TLS protocols; forked from OpenSSL in 2014

LibreSSL is an open-source implementation of the Transport Layer Security (TLS) protocol. The implementation is named after Secure Sockets Layer (SSL), the deprecated predecessor of TLS, for which support was removed in release 2.3.0. The OpenBSD project forked LibreSSL from OpenSSL 1.0.1g in April 2014 as a response to the Heartbleed security vulnerability, with the goals of modernizing the codebase, improving security, and applying development best practices.

References

  1. Johnson, S.C. (1978). "A portable compiler: theory and practice". Proceedings of the 5th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages. Tucson, Arizona.: 97–104. doi: 10.1145/512760.512771 . S2CID   14390804.
  2. Snyder, A. (1975). "A Portable Compiler for the Language C". Master's Thesis. MIT, Cambridge, Mass. Archived from the original on 2006-09-05. Retrieved 2006-07-19.
  3. Johnson, S.C. (1981). A Tour Through the Portable C Compiler. Unix Programmer's Manual, 7th edition, Volume 2. Holt, Rinehart and Winston. ISBN   0-03-061743-X.
  4. 1 2 Stroustrup, Bjarne (2002). Sibling rivalry: C and C++ (PDF) (Report). AT&T Labs.
  5. Ritchie, Dennis M. (1993). "The development of the C language". The second ACM SIGPLAN conference on History of programming languages. Cambridge, Massachusetts. pp. 201–208. Retrieved 2008-12-30. At the start of the decade, nearly every compiler was based on Johnson's pcc; by 1985 there were many independently-produced compiler products.
  6. 1 2 "pcc history". pcc - portable c compiler. 2010-06-21. Retrieved 2012-06-26.
  7. Erdely, Mike (2007-09-15). "BSD Licensed PCC Compiler Imported". OpenBSD Journal . Retrieved 2011-12-17.
  8. Moerbeek, Otto (2007-09-15). "CVS: cvs.openbsd.org: src". openbsd-cvs (Mailing list).
  9. Brownlee, David (2007-09-20). "CVS commit: src/dist/pcc". source-changes (Mailing list).
  10. "GCC Compiler Finally Supplanted by PCC?". /. 2007-09-17.
  11. Larabel, Michael (12 May 2012). "FreeBSD 10 To Use Clang Compiler, Deprecate GCC". Phoronix. Archived from the original on 10 April 2015. Retrieved 23 April 2015.
  12. Brooks, Davis (5 November 2012). "HEADS UP: Clang now the default on x86" (Mailing list). Retrieved 23 April 2015.
  13. Joerg, Sonnenberger (17 October 2013). "Importing LLVM/Clang" (Mailing list). Retrieved 23 April 2015.
  14. Matzan, Jem (2007-10-15). "More on OpenBSD's new compiler". The Jem Report. Archived from the original on 2012-01-04. Retrieved 2011-12-17. But that's never really been the agenda, see. Some people think we hate GNU code. But the thing is we hate large code, and buggy code that upstream does not maintain. That's the real problem… gcc gets about 5-6% slower every release, has new bugs, generates crappy code, and drives us nuts. This is just an attempt to see if something better can show up.
  15. de Weerd, Paul (2009-12-29). "Call for testing: pcc and the OpenBSD kernel". OpenBSD Journal . Retrieved 2011-12-17.
  16. Magnusson, Anders (2011-04-01). "1.0 Release". Portable C Compiler. Retrieved 2011-12-17.
  17. "BSD Fund: pcc fund". bsdfund.org. 2011-04-01. Archived from the original on 2009-01-05. Retrieved 2012-06-26.
  18. Paul Irofti (2012-04-12). "CVS: cvs.openbsd.org: src".
  19. Peter Hessler (2012-06-18). "Re: Story behind PCC's removal?".
  20. Miod Vallat (2013-07-31). "Compilers in OpenBSD".
  21. Magnusson, Anders (2014-12-10). "1.1.0 Release". Portable C Compiler. Retrieved 2022-04-22.