Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 542030

Summary: sys-devel/llvm-3.5.0-r99 Failed Patch: llvm-3.5-musl-support.patch on hardened/musl
Product: Gentoo Linux Reporter: Cato Auestad <cato>
Component: HardenedAssignee: Anthony Basile <blueness>
Status: RESOLVED FIXED    
Severity: normal CC: gentoo
Priority: Normal    
Version: unspecified   
Hardware: AMD64   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 430702    
Attachments: Patch to make llvm ebuild use correct patch with clang
llvm build log
Updated llvm-3.5-musl-compiler-rt.patch
Updated llvm-3.5-musl-support.patch
New llvm-3.5-musl-clang-support.patch
llvm-3.5-musl-path-fix.patch

Description Cato Auestad 2015-03-03 19:48:39 UTC
Created attachment 397966 [details, diff]
Patch to make llvm ebuild use correct patch with clang

This should be assigned to blueness@gentoo.org who maintains the musl overlay

sys-devel/llvm fails to install on the musl overlay for the following reasons:

1) The patch llvm-3.5-musl-support.patch fails because the file locations in the diff point to "llvm-3.5.0.src/include/llvm/ADT/Triple.h" while in fact it should omit the "llvm-3.5.0.src" part and just have "include/...". Removing "llvm-3.5.0.src" fixed this issue.
2) The patch llvm-3.5-musl-support.patch includes a diff for the file "tools/clang/lib/Driver/Tools.cpp". This path only exists if llvm is emerged with the "clang" USE-flag. 
3) As number 1, the patch llvm-3.5-musl-compiler-rt.patch fails because the file location is prefixed with "llvm-3.5.0.src", and like number 2, if the "clang" USE-flag is not enabled the patch fails

To fix those issues I have removed the "llvm-3.5.0.src" prefix from those patches. I have also extracted the diff in llvm-3.5-musl-support.patch, which points to a clang-specific path, to an own file called llvm-3.5-musl-clang-support.patch. Lastly I modified the ebuild script to only run llvm-3.5-musl-clang-support.patch and llvm-3.5-musl-compiler-rt.patch if "clang" is added as a USE flag.

Attached is a diff of the ebuild as well as the updated patch files and the new, extracted llvm-3.5-musl-clang-support patch. For visibility I've also attached a diff showing what part of llvm-3.5-musl-support.patch I extracted to llvm-3.5-musl-clang-support.patch.
Comment 1 Cato Auestad 2015-03-03 19:49:04 UTC
Created attachment 397968 [details]
llvm build log
Comment 2 Cato Auestad 2015-03-03 19:50:05 UTC
Created attachment 397970 [details, diff]
Updated llvm-3.5-musl-compiler-rt.patch

This is the updated llvm-3.5-musl-compiler-rt.patch which don't have the wrong prefix
Comment 3 Cato Auestad 2015-03-03 19:50:56 UTC
Created attachment 397972 [details, diff]
Updated llvm-3.5-musl-support.patch

This is the updated llvm-3.5-musl-support.patch with the correct paths and don't have the clang specific things
Comment 4 Cato Auestad 2015-03-03 19:51:46 UTC
Created attachment 397974 [details, diff]
New llvm-3.5-musl-clang-support.patch

This is what I extracted from llvm-3.5-musl-support.patch which requires the clang use flag.
Comment 5 Felix Janda 2015-03-03 20:15:50 UTC
The botched patch is from me. Obviously I didn't try building without
the clang use flag. Thanks for the fixes.

Please attach a patch against the musl branch of the hardened-overlay
that blueness can directly apply.
Comment 6 Cato Auestad 2015-03-04 01:01:58 UTC
(In reply to Felix Janda from comment #5)
> The botched patch is from me. Obviously I didn't try building without
> the clang use flag. Thanks for the fixes.
> 
> Please attach a patch against the musl branch of the hardened-overlay
> that blueness can directly apply.

Didn't know if it was a good idea to create a patch for a patch, but seems like its okay. I'll make a single patch for the ebuild and the patches for musl-support and musl-compiler-rt tomorrow. Then it should only be necessary to apply the patch and copy llvm-3.5-musl-clang-support.patch to make llvm install correctly.
Comment 7 Cato Auestad 2015-03-05 17:57:37 UTC
Created attachment 398182 [details, diff]
llvm-3.5-musl-path-fix.patch

Attached is a single patch which fixes all the issues reported in this bug. Run from layman/hardened-development/sys-devel/llvm with "patch -p1 < llvm-3.5-musl-path-fix.patch"
Comment 8 Anthony Basile gentoo-dev 2015-03-20 18:40:08 UTC
(In reply to Cato Auestad from comment #7)
> Created attachment 398182 [details, diff] [details, diff]
> llvm-3.5-musl-path-fix.patch
> 
> Attached is a single patch which fixes all the issues reported in this bug.
> Run from layman/hardened-development/sys-devel/llvm with "patch -p1 <
> llvm-3.5-musl-path-fix.patch"

Okay this is in the tree.  I'm not sure these patches could go upstream to llvm, but I'm not going to track that here, so I'm closing this RESOLVED FIX.  If there's any problem with this, please reopen the bug.