Skip to content

Latest commit

 

History

History
73 lines (60 loc) · 2.34 KB

README.md

File metadata and controls

73 lines (60 loc) · 2.34 KB

GCC

Cheat on the GNU Compile Collection (GCC) language extensions and command line utilities.

  1. Introduction
    1. Compilation steps
    2. Invocation
    3. Spec files
    4. GCC as library
  2. Extensions
    1. Types
      1. Empty struct
      2. Zero length array
      3. 128-bit int
      4. Complex integer
      5. __auto_type
    2. Language
      1. Literals
      2. Identifiers
      3. Nested functions
      4. typeof
      5. Case range
      6. Array range initializer
      7. Local label
      8. Statment expression
    3. Attribute
      1. Variable
        1. weak
        2. Vector extensions
      2. Function
        1. sentinel
    4. asm
      1. asm.md
      2. asm.c
    5. Built-in functions
      1. alloca()
      2. __atomic_fetch_add
      3. __builtin_expect
      4. __builtin_constant_p
      5. __builtin_prefetch
      6. __builtin_return_address
  3. cpp
    1. cpp invocation
    2. cpp
  4. Internals
    1. Build
      1. Cross compiler
    2. Compilation passes
    3. Source tree
    4. libgcc

WIP

  1. IDE
  2. Spec files

Scope

This will only cover C specifics. Generic ELF manipulation tools like ld (which can work across any language) are not included.

Cross compile

Cross compiling means to compile a program for a different OS or architecture than the one the compiler is running.

GCC cannot cross compile for windows from Linux (TODO check).

This can be done with MinGW (TODO how).

Infamous error messages

Error messages that are difficult to interpret for newbs:

  • struct has incomplete type = struct undefined. You forgot to include some header.