Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add compiler-rt project #88

Closed
jbush001 opened this issue Jul 16, 2017 · 0 comments
Closed

Add compiler-rt project #88

jbush001 opened this issue Jul 16, 2017 · 0 comments

Comments

@jbush001
Copy link
Owner

jbush001 commented Jul 16, 2017

https://compiler-rt.llvm.org/ There is currently a minimal subset of assembly runtime functions in https://github.com/jbush001/NyuziProcessor/tree/master/software/libs/compiler-rt that could be copied into the architecture specific directory. The challenging part is getting this to be built as a cross compiler. See:

http://lists.llvm.org/pipermail/llvm-dev/2016-May/099179.html
https://reviews.llvm.org/D19742

Modify clang to automatically link in this library, in tools/clang/lib/Driver/ToolChains/Nyuzi.cpp, nyuzi::Linker::ConstructJob by calling tools::AddRunTimeLibs.

jbush001 added a commit that referenced this issue Feb 20, 2018
compiler-rt is now build and installed by the compiler. It will be linked
into apps by default.

I had to do a number of hacks to get this to work:
- All of the build files assume that, if you are cross compiling and the
host is a mac, OSX must be the target OS (they use if (APPLE) to do this).
While this is usually true, it's not in this case. I've ANDed it with
XXX_DISABLE_NYUZI everywhere.
- When there was no OS specified, the build system was using the host OS
when building the path to the runtime library. So, it would end up in
'/usr/local/llvm-nyuzi/lib/clang/7.0.0/darwin'. When building this library
path, the linker does not add the host OS. I changed this to leave the OS
blank.
- CMAKE_SIZEOF_VOID_P is not specified when building Nyuzi for some reason.
I added a hack to hard code it to 4 if not set.
- In lib/builtins/CMakeLists.txt, explicitly disabled areas that add sources
that don't build with Nyuzi (because of library dependencies). This could be
cleaned up to properly detect a Nyuzi build.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant