Discussion:
[OpenRISC] Clang and GCC toolchains improvements
Alessandro Di Federico
2014-07-29 13:25:33 UTC
Permalink
Hi! I'm writing this e-mail to present you what we've been doing here
at the Polimi Compiler Group lately.

Basically you can find everything at the following URL:

http://compilergroup-srv.elet.polimi.it/pulp/git/

The repositories
================

As you can see there are several repositories:

* binutils-gdb: binutils, newlib and GCC
* or1ksim: the simulator for OR1K with our customizations
* gcc: the GNU compiler collection
* llvm: the LLVM repo
* clang: the Clang repo
* compiler-rt: compiler-rt, a project under the LLVM umbrella we
mainly use for the C builtins
* cruntime: a project tied to LLVM we created containing
minimal implementations of the C runtime files, such as crtbegin.c
and crtend.c
* lld: a linker under the umbrella of the LLVM project, unused for now
* mclinker: another linker tied to LLVM we want to support for OR1K,
unused for now

If you want to filter commits we made, here are the names of the three
developers who have been working on the various projects:

* Alessandro Di Federico
* Michele Beretta
* Michele Scandale

Please note that the repos we linked previously have been dropped,
update your remotes if necessary.

In the following I'll briefly describe two less obvious repositories we
have.

eld
---

eld, is a very small dynamic loader we've been developing targeting
embedded systems. It's not perfect but it works pretty well. Take a look
at the README.md file for further details and usage.

The or1k-toolchain meta-repo
----------------------------

We also set up a repository called or1k-toolchain which contains as
git submodules all of the above mentioned repositories plus a Makefile
and some configuration scripts, so that if you launch `make all` in the
root of this repo you'll get in the `root/` subdirectory the clang and
GCC toolchains for OR1K. Just add `root/bin` to your PATH and
everything should work automagically.

Here's how to set up this repository and build everything in Debug:

git clone \
http://compilergroup-srv.elet.polimi.it/pulp/git/pulp-public/or1k-toolchain.git
cd or1k-toolchain
git submodule init
git submodule update
make all

Its purpose is to simplify the build process for GCC, explained in the
wiki:

http://opencores.org/or1k/OpenRISC_GNU_tool_chain

It also eases the integration of LLVM with the other projects which
depend on it (Clang, compiler-rt, cruntime...). We also use this repo
to automate builds and produce binary archives with the full toolchains.
If you like this approach, feel free to reuse this repo. Just beware
that those repositories won't be available forever.

What've been doing
==================

Little-endian support
---------------------

Both big-endian and little-endian targets are now supported in
binutils, gdb, GCC, LLVM/Clang and or1ksim. The big-endian target is
"or1k", while the little endian one is "or1kle":

$ clang -target or1k -c main.c -o main.o
$ file main.o
main.o: ELF 32-bit MSB relocatable, OpenRISC, version 1 (SYSV)...

$ clang -target or1kle -c main.c -o main.o
$ file main.o
main.o: ELF 32-bit LSB relocatable, OpenRISC, version 1 (SYSV)...

$ or1k-elf-gcc -c main.c -o main.o
$ file main.o
main.o: ELF 32-bit MSB relocatable, OpenRISC, version 1 (SYSV)...

$ or1kle-elf-gcc -c main.c -o main.o
$ file main.o
main.o: ELF 32-bit LSB relocatable, OpenRISC, version 1 (SYSV)...

`-target or1k-elf`
------------------

We are progressively dropping GCC in favour of LLVM. In particular we
switched from libgcc to compiler-rt for C language builtins and for
crtbegin and crtend to a small new project, cruntime. You can test this
combination using the or1k-elf target in Clang, which also invokes the
linker in the appropriate way:

clang -target or1k-elf main.c -o main

If you don't want to use this new features for now, use clang only to
generate object files and link manually:

clang -target or1k-elf -c main.c -o main.o
or1k-elf-ld ... main.o ... -o main

Note also that C++ support for the compiler-rt + cruntime configuration
is under development.

Other stuffs
------------

* We've kept the various project in sync with the upstream repositories
* Implemented NOP_GETC in the simulator and in libgloss
* Fixed some stuffs related shared objects and dynamic linking
* Probably more, take a look at the various `git log`s

Let us know if you have any comments.

--
Ale
Stefan Kristiansson
2014-08-27 06:02:36 UTC
Permalink
On Tue, Jul 29, 2014 at 4:25 PM, Alessandro Di Federico
Post by Alessandro Di Federico
Hi! I'm writing this e-mail to present you what we've been doing here
at the Polimi Compiler Group lately.
http://compilergroup-srv.elet.polimi.it/pulp/git/
Great work!
However, I've been trying to clone the repos to check it out, but to no success.
It always fails after transferring about 10MB.
Could you take a look at what's wrong with your servers, or consider
pushing to a more reliable server (for instance github)?

Stefan
Alessandro Di Federico
2014-10-14 07:22:23 UTC
Permalink
On Wed, 27 Aug 2014 09:02:36 +0300
Post by Stefan Kristiansson
Great work!
However, I've been trying to clone the repos to check it out, but to
no success. It always fails after transferring about 10MB.
Could you take a look at what's wrong with your servers, or consider
pushing to a more reliable server (for instance github)?
Here's the new address of our public repository:

http://compilergroup.polimicg.org/git/

Sorry for the delay but we had severe network issues.
Let me know if you have any issue/comment.

--
Ale

Loading...