LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

llvm-gcc

Obsolete GCC-based C front-end for LLVM, superseded by clang

TLDR

Compile C program
$ llvm-gcc -o [program] [source.c]
copy
Compile with optimization
$ llvm-gcc -O2 -o [program] [source.c]
copy
Generate LLVM bitcode
$ llvm-gcc -emit-llvm -c [source.c] -o [source.bc]
copy
Generate human-readable LLVM assembly
$ llvm-gcc -emit-llvm -S [source.c] -o [source.ll]
copy
Modern equivalent using clang
$ clang -emit-llvm -c [source.c] -o [source.bc]
copy

SYNOPSIS

llvm-gcc [options] filename...

DESCRIPTION

llvm-gcc was the LLVM C front-end: a modified version of GCC 4.2 whose parser fed LLVM's optimizer and code generator. By default it produced native object files like GCC; with -emit-llvm it wrote LLVM bitcode or LLVM assembly for use with tools such as opt, llc and lli. Since it was derived from GCC it accepted most GCC options and extensions, and also compiled Objective-C.

PARAMETERS

-o file

Output file name.
-O level
Optimization level (0-3, s).
-emit-llvm
Emit LLVM bitcode (with -c) or LLVM assembly (with -S) instead of native code.
-c
Compile only, no linking.
-S
Generate assembly output.
-I directory
Add a directory to the header search path.
-L directory
Add a directory to the library search path.
-lname
Link with library name.
-g
Include debug information.
--help
Print a summary of command line options.

CAVEATS

Obsolete and unmaintained. It is not part of any current LLVM release or distribution, and on macOS any remaining llvm-gcc name is just an alias for clang. Use clang instead.

HISTORY

llvm-gcc was the original front-end of the LLVM project, based on GCC 4.0 and later GCC 4.2. Apple shipped llvm-gcc-4.2 as a default compiler in Xcode 4. It was deprecated after LLVM 2.9 (2011), replaced by clang and the short-lived DragonEgg GCC plugin, and removed from Xcode in version 5 (2013).

SEE ALSO

clang(1), gcc(1), llvm-g++(1), opt(1), llc(1), lli(1)

RESOURCES

Copied to clipboard
Kai