GSoc Proposal

Enabling llvm’s self-hosted modules builds using libstdc++

Bianca-Cristina Cristescu, MSc Computer Science, ETH Zurich

Problem description

Nowadays, the software projects are growing in size and functionality, and in order to avoid reinventing the wheel they use many software libraries. Including libraries adds complexity and can cause fragility, problems with compile-time scalability and tool confusion [1].

Clang [2] is a C, C++, Objective C and Objective C++ front-end for the LLVM [3] compiler. To solve the above mentioned issues LLVM and Clang propose to use Modules [1] as an alternative to include libraries. Modules give a access to the API of the software libraries using a more efficient semantic model [1].

A buildbot [4] for building llvm with modules exists when using libc++ (usually available by default on MacOS), but there is no support to using modules when having libstdc++. Given that a large amount of software projects are developed on Unix operating systems, the necessity of modules to support libstdc++ emerges. The problem is that there is a different merging model for the modules when using libstdc++ compared to libc++ given by the fact that libc++ has a module aware implementation whereas libstdc++ does not.

The project aims to enable the building of llvm’s self-hosted modules using libstdc++ by reporting issues, submitting bug reports, proposing fixes and creating a buildbot.

Deliverables

  • A buildbot to build llvm using libstdc++.

  • Bug reports submitted to the LLVM Bug Tracking System [5] for the encountered issues.

  • Minimalistic reproducers for the bugs in the order of priority.

  • Fixes of the bugs which I can fix with my experience.

Timeline

22nd April - 22nd May (Before the official coding time)

  • Background literature on modules;

  • Familiarization with the architecture of the modules;

  • Update on the current state of the modules.

23rd May - 29th May (Official coding time starts)

  • Set up the working environment and check synchronisation with the clang/llvm community.

30th May - 12th June

  • Attempt to build llvm with modules.

  • Create a report of the existing issues at the time of the build with the current version of clang and llvm.

13th June - 26th June

  • In the order of the priority list previously created reduce the issues to minimalistic examples.

  • Possibly use tools such as C-reduce [6] to help and accelerate the minimization of the reproducers.

  • File bug reports for the minimised issues to clang.

  • Provide fixes for the trivial issues (such as missing includes) encountered in the process.

27th June - 17th July (Midterm evaluation)

  • Prioritise the existing issues in close contact with the clang/llvm community.

  • Propose fixes for a feasible amount of the reported issues.

  • Provide the fixes in patches on Phabricator for review by the clang/llvm community.

18th July - 7th of August

  • Implement a buildbot in which clang builds llvm using modules.

8th August - 23rd of August Week 12

  • Review and evaluate results.

  • Buffer time for unpredictable delay.

Background

  • Bachelors in Computer Science from The University of Manchester

  • Improved my C++ knowledge by working on ROOT’s [7] interpreter, Cling which is built on top of Clang and LLVM.

  • Isolated and submitted minimal issue reproducers for Clang Modules in 2014. For instance: https://llvm.org/bugs/show_bug.cgi?id=20475

https://llvm.org/bugs/show_bug.cgi?id=20674

https://llvm.org/bugs/show_bug.cgi?id=20399

  • Enrolled in a Computer Science MSc at ETH Zurich.

References

[1] Modules, http://clang.llvm.org/docs/Modules.html

[2] Clang, http://clang.llvm.org/

[3] LLVM, http://llvm.org/

[4] Buildbot, http://lab.llvm.org:8011/builders/clang-x86_64-linux-selfhost-modules

[5] LLVM Bug Tracking System, http://llvm.org/bugs/enter_bug.cgi

[6] C-reduce, https://embed.cs.utah.edu/creduce/

[7] ROOT, https://root.cern.ch/

This seems like a great project. Just a couple of concerns: who will provide hosting infrastructure for this buildbot, and who will maintain it once the project ends?

I thought we can host it at lab.llvm.org. Would that be possible? About the maintenance: maintaining the buildbot is almost zero cost. Maintaining its green status is challenging :wink: USCMS/FNAL/CERN are interested (mainly because of the ROOT analysis framework) in modules stability and after the project ends it’d be probably me taking care of it.