Skip to content

e2k-ports/llvm-project

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LLVM port to Elbrus 2000

about

the project is an attempt to port LLVM to Elbrus 2000 (E2K) architecture. this project is WIP (work in progress), on a very early development stages. of course, it's not intended to be used in production, installed on end-users machines and so on. this project is developed voluntary, only in spare time and when I am in good mood. in other words, it's a hobby side-project I develop for fun to get familiar with both LLVM and E2K. therefore, it may take months, if not years, to get some satisfactory state. don't expect it to compile even hello-world for now, or produce working executables.

the source code is periodically synchronized with upstream and rebased on top of the main branch. therefore, the history is frequently rewritten, and changes are force-pushed from time to time.

source code

there are several good places to start getting familiar with the source code changes.

in LLVM:

in clang:

in lld:

generic:

compiling the project

recommended options for CMake build:

  • -G Ninja - recommended (faster) generator is ninja-build
  • -DCMAKE_BUILD_TYPE=Debug - on an early development stage, it's easier to have all the debug checks
  • -DLLVM_ENABLE_PROJECTS=clang;lld - projects being ported first are clang and lld
  • -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=E2K - to activate an actual E2K target
  • -DCMAKE_VERBOSE_MAKEFILE=ON - to display full compiler/linker command lines
  • -DLLVM_USE_LINKER=lld - lld is usually faster compare to regular ld or gold linkers

for E2K, to avoid "relocation truncated to fit" error:

  • -DCMAKE_C_FLAGS="--dwarf2-64bit"
  • -DCMAKE_CXX_FLAGS="--dwarf2-64bit"

compiling for EK2 via project

there are several must-have (mandatory) options to use compiled clang executable:

  • -fuse-ld=lld - as your system linker probably knows nothing about E2K, it's needed to use compiled one
  • -fintegrated-as - same for your assembler and binutils, it's needed to use compiled one
  • -target e2k64 - actually instructs compiler to generate code for E2K

helpful resources and tools

microprocessor commands:

  • (ru) microprocessor commands - an official reference
  • elbrus-docs - describes instruction encoding
  • e2k-stuff - opcode tables from the bintuils port
  • alops.inc - opcode tables from the QEMU-E2K port
  • ldis - MCST disassembler
  • objdump - disassembler, port to E2K (part of LCC suite, implemented in binutils-gdb port)