Skip to content

Commit

Permalink
mk: Stop using cmake for compiler-rt
Browse files Browse the repository at this point in the history
The compiler-rt build system has been a never ending cause of pain for Rust
unfortunately:

* The build system is very difficult to invoke and configure to only build
  compiler-rt, especially across platforms.
* The standard build system doesn't actually do what we want, not working for
  some of our platforms and requiring a significant number of patches on our end
  which are difficult to apply when updating compiler-rt.
* Compiling compiler-rt requires LLVM to be compiled, which... is a big
  dependency! This also means that over time compiler-rt is not guaranteed to
  build against older versions of LLVM (or newer versions), and we often want to
  work with multiple versions of LLVM simultaneously.

The makefiles and rustbuild already know how to compile C code, the code here is
far from the *only* C code we're compiling. This patch jettisons all logic to
work with compiler-rt's build system and just goes straight to the source. We
just list all files manually (copied from compiler-rt's
lib/builtins/CMakeLists.txt) and compile them into an archive.

It's likely that this means we'll fail to pick up new files when we upgrade
compiler-rt, but that seems like a much less significant cost to pay than what
we're currently paying.

cc #34400, first steps towards that
  • Loading branch information
alexcrichton committed Jul 20, 2016
1 parent b45c15e commit ee6011f
Show file tree
Hide file tree
Showing 6 changed files with 724 additions and 183 deletions.

2 comments on commit ee6011f

@asomers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit breaks the build on FreeBSD.

'clang' -fno-builtin -fvisibility=hidden -fomit-frame-pointer -ffreestanding  -O2 -g -fPIC -I/usr/local/include  -Qunused-arguments -c -o x86_64-unknown-freebsd/rt/compiler-rt/gcc_personality_v0.o /usr/home/somers/rust/src/compiler-rt/lib/builtins/gcc_personality_v0.c
/usr/home/somers/rust/src/compiler-rt/lib/builtins/gcc_personality_v0.c:14:10: fatal error: 
      'unwind.h' file not found
#include <unwind.h>
         ^
1 error generated.

@asomers
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I posted a fix at #35004

Please sign in to comment.