Giter VIP home page Giter VIP logo

tinycc's Introduction

andreiw's tinycc changes

This tree adds:

  • some bare minimum OSX support (merged).
  • support for generating ARM64 PE32+ images (not yet merged).
  • support for generating X64, ARM64, IA32 (untested) and ARM (untested) UEFI images (not yet merged).
  • a "Hello, World!" UEFI example in examples/uefi (not yet merged).
  • a UEFI-targetting compiler (x86_64-uefi-tcc and arm64-uefi-tcc), that can be built (Tiano EDK2) to be hosted on UEFI (not yet merged).

OSX support

Today this includes some basic build support (CONFIG_OSX) in ./configure and ./Makefile. It also makes the '-run' mode function, allowing tcc to open up libc.dylib.

Usage:

$ ./configure
$ make
$ ./tcc -B. -I./include -I. -I.. -D_ANSI_SOURCE -run examples/ex1.c
Hello World

ARM64 PE32+ images

The targets are arm64-win32-tcc and arm64-uefi-tcc. libtcc1 is not built, so this is only useful for standalone code, such as UEFI images.

UEFI images

This example requires a Tiano Core source tree:

#include <Uefi.h>

CHAR16 *gHello = L"Hello from a TinyCC compiled UEFI binary!\r\n";

EFI_STATUS EFIAPI
_start(EFI_HANDLE Handle,
       EFI_SYSTEM_TABLE *SystemTable)
{
  SystemTable->ConOut->OutputString(SystemTable->ConOut, gHello);
  return EFI_SUCCESS;
}

Building:

$ x86_64-win32-tcc -I ../edk2/MdePkg/Include/ -I ../edk2/MdePkg/Include/X64/  efitest.c  -Wl,-subsystem=efiapp -nostdlib -o efitest.x64.efi
$ arm64-win32-tcc -I ../edk2/MdePkg/Include/ -I ../edk2/MdePkg/Include/AArch64/  efitest.c  -Wl,-subsystem=efiapp -nostdlib -o efitest.aa64.efi

Or, with the UEFI-targetting compiler, which is is a subset of the win32 compiler.

$ x86_64-uefi-tcc -I ../edk2/MdePkg/Include/ -I ../edk2/MdePkg/Include/X64/ efitest.c -o efitest.x64.efi
$ arm64-uefi-tcc -I ../edk2/MdePkg/Include/ -I ../edk2/MdePkg/Include/AArch64/ efitest.c -o efitest.aa64.efi

Running (on the appropriate architecture, of course!):

fs0:\> efitest.aa64.efi
Hello from a TinyCC compiled UEFI binary!
fs0:\>

A similar example is already present in examples/uefi. To build:

$ make -C examples/uefi

TCC in UEFI

This has only been validated with X64 and AArch64. To build, you need an EDK2 tree. Use the TCCInUEFI.inf build file. This will get you a compiler equivalent to x86_64-uefi-tcc/arm64-uefi-tcc.

Also see https://github.com/andreiw/UefiToolsPkg, which might be an easier way of building my private TinyCC tree for UEFI.

fs16:> tcc hello.c
fs16:> hello.efi
Hello, World!

Note: too lazy to copy headers, so far only tested building pre-processed files (-E is your friend).

tinycc's People

Contributors

akimd avatar andreiw avatar avih avatar cosmo-ray avatar cypriani avatar egrimley avatar jcbeaudoin avatar jsoroka avatar ldoolitt avatar leeduhem avatar mikijov avatar mingodad avatar minux avatar navytux avatar pipcet avatar raphaelcohn avatar rdoeffinger avatar robotux avatar roytam1 avatar run4flat avatar s09bq5 avatar seyko2 avatar shinh avatar susematz avatar vinc17fr avatar waddlesplash avatar winspool avatar wqweto avatar xppxppgh avatar zde avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

tinycc's Issues

suggest: use tcc to compile tcc

target:
./configure

#expected output ./tcc
make

mkdir _build
cd _build

../configure --cc=$PWD/../tcc

#expected _build/tcc which compile by ../tcc
make

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.