Skip to content

Latest commit

 

History

History
80 lines (59 loc) · 2.17 KB

README.md

File metadata and controls

80 lines (59 loc) · 2.17 KB

XOS-Language

XOS? SAUCE?

Build Status Build Status Sanitized

Min Requirements

This could potentially build with earlier versions. These just happen to be the ones tested with locally.

  • gcc v13
    • Can also use clang v16
  • make v4
  • googletest v1.12.1 (only needed for testing)
  • LLVM v16
    • NOTE: If using a prebuilt for x86_64 linux, use the 16.04 prebuilt. The normal v16.0.0 version seems to be built incorrectly since I run into a segfault with the prebuilt in llvm::ConstantExpr::getGetElementPtr(llvm::Type*, llvm::Constant*, llvm::ArrayRef<llvm::Value*>, bool, std::optional<unsigned int>, llvm::Type*) but don't hit this when I build from source.

Building + Running

$ cat test_input.txt
main( () => () )
    out "Hi! I am ALIVE!"

$ make  # Creates ./main
$ ./main test_input.txt
; ModuleID = 'my cool jit'
source_filename = "my cool jit"

@0 = private unnamed_addr constant [16 x i8] c"Hi! I am ALIVE!\00", align 1

define void @main() {
entry:
  %0 = call i32 @printf(ptr @0)
  ret void
}

declare i32 @printf(ptr %0)

Define EXTRA_CPPFLAGS to pass flags to the build. For example, to build with sanitizers:

$ make EXTRA_CPPFLAGS="-fsanitize=address -fsanitize=undefined"

Using the compiler

$ ./main test_input.txt |& llc -filetype=obj -o /tmp/out.o --relocation-model=pic  # Creates a.out
$ ./a.out
Hi! I am ALIVE!

Testing

$ make test GTEST_HDR=<path to include dir> GTEST_LIB=<path to lib dir>

Reproducing the github actions builders

The github actions can also be tested locally via docker containers using act.

NOTE: Docker containers don't have sudo by default, so you'll want to remove all the sudos in the build file you're running.

$ act --workflows .github/workflows/build.yml