Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

multicompiler: add multicompiler package #30632

Closed
wants to merge 2 commits into from
Closed

Conversation

kquick
Copy link
Contributor

@kquick kquick commented Oct 21, 2017

Motivation for this change

Adds the multicompiler, which is a fork of the llvm-based clang which provides artificial software diversity to protect software from code-reuse attacks.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Allows setting specific prefix for C compiler targets.  This can be
useful when multiple compilers should be available side-by-side; the
default wrapper operation creates '${out}/bin/cc' and
'${out}/bin/c++', generating a prefix only when the targetPlatform is
different.  The new optional 'overridePrefix' parameter allows a
specific prefix (e.g. llvm and gcc could be used side-by-side by
building llvm with 'overridePrefix="llvm"' to subsequently invoke it
as 'llvmcc'.
Adds the multicompiler variation of clang/llvm which allows compiling
with artificial software diversity.
@kquick kquick requested a review from edolstra as a code owner October 21, 2017 04:55
@kquick
Copy link
Contributor Author

kquick commented Oct 21, 2017

Please note that the checks fail due to the Travis timeout on the build job; building llvm+clang takes longer than Travis will allow, but I have built this successfully in a local sandbox... several times, unfortunately :-).

@dtzWill
Copy link
Member

dtzWill commented Mar 1, 2018

Can you update this for latest master?

I'll review this shortly...

Also pinging cc-wrapper maintainers @Ericson2314 @orivej

@@ -0,0 +1,140 @@
{ pkgs ? import <nixpkgs> {}
Copy link
Member

Choose a reason for hiding this comment

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

Remove this please, add dependencies as arguments instead.

cd ..
'';

buildInputs = with pkgs; [ cmake libedit libxml2 llvm python perl groff libffi ];
Copy link
Member

Choose a reason for hiding this comment

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

cmake, python, perl, and groff should be "nativeBuildInputs".

postPatch = ''
#sed -i -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/Tools.cpp
#sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' lib/Driver/ToolChains.cpp
'';
Copy link
Member

Choose a reason for hiding this comment

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

Please look at current LLVM/Clang 3.5 expressions and sync this to match updates/fixes there.

# Clang expects to find LLVMgold in its own prefix
# Clang expects to find sanitizer libraries in its own prefix
postInstall = ''
#ln -sv ${pkgs.llvm}/lib/LLVMgold.so $out/lib
Copy link
Member

Choose a reason for hiding this comment

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

What's this about?

@Ericson2314
Copy link
Member

Oh! I am sorry I didn't see this earlier. I have in fact used the multicompiler.

@Ericson2314
Copy link
Member

Ericson2314 commented May 19, 2019

This had looked pretty good modulo @dtzWill's comments. Now that we support cross compilation with llvm, it should be easier too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants