-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Add x86_64-musl as a host architecture #55163
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
cafc01e
Enable dist-x86_64-musl as a host architexture
strfry cb823df
throwaway commit: Test Travis build only on x86_64 musl
strfry e52ea15
Set RUSTFLAGS env to make dylib work
strfry c775e0b
build a proper c++-enabled musl toolchain with musl-cross-make
strfry 7d21c49
Make the musl dynamic loader known to the system, so it can execute t…
strfry 19b4bc6
runtest: Fix proc-macro tests on musl hosts
smaeul 7e984c9
musl-toolchain: fix global lib paths (dont create /lib/libc.so)
strfry a72cfe2
musl: enable dynamic linking in the spec
mati865 609afa6
fix RelroLevel
strfry a4a325c
Revert "Set RUSTFLAGS env to make dylib work"
strfry File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# Copyright 2016 The Rust Project Developers. See the COPYRIGHT | ||
# file at the top-level directory of this distribution and at | ||
# http://rust-lang.org/COPYRIGHT. | ||
# | ||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
# option. This file may not be copied, modified, or distributed | ||
# except according to those terms. | ||
|
||
set -ex | ||
|
||
hide_output() { | ||
set +x | ||
on_err=" | ||
echo ERROR: An error was encountered with the build. | ||
cat /tmp/build.log | ||
exit 1 | ||
" | ||
trap "$on_err" ERR | ||
bash -c "while true; do sleep 30; echo \$(date) - building ...; done" & | ||
PING_LOOP_PID=$! | ||
$@ &> /tmp/build.log | ||
trap - ERR | ||
kill $PING_LOOP_PID | ||
rm /tmp/build.log | ||
set -x | ||
} | ||
|
||
TARGET=$1 | ||
#ARCH=$1 | ||
#TARGET=linux-musl-$ARCH | ||
ARCH=x86_64 | ||
|
||
OUTPUT=/usr/local | ||
shift | ||
|
||
git clone https://github.com/richfelker/musl-cross-make -b v0.9.7 | ||
cd musl-cross-make | ||
|
||
hide_output make -j$(nproc) TARGET=$TARGET | ||
hide_output make install TARGET=$TARGET OUTPUT=$OUTPUT | ||
|
||
cd .. | ||
|
||
# Make musl binaries executable | ||
|
||
ln -s $OUTPUT/$TARGET/lib/libc.so /lib/ld-musl-$ARCH.so.1 | ||
echo $OUTPUT/$TARGET/lib >> /etc/ld-musl-$ARCH.path | ||
|
||
|
||
export CC=$TARGET-gcc | ||
export CXX=$TARGET-g++ | ||
|
||
LLVM=60 | ||
|
||
# may have been downloaded in a previous run | ||
if [ ! -d libunwind-release_$LLVM ]; then | ||
curl -L https://github.com/llvm-mirror/llvm/archive/release_$LLVM.tar.gz | tar xzf - | ||
curl -L https://github.com/llvm-mirror/libunwind/archive/release_$LLVM.tar.gz | tar xzf - | ||
fi | ||
|
||
mkdir libunwind-build | ||
cd libunwind-build | ||
cmake ../libunwind-release_$LLVM \ | ||
-DLLVM_PATH=/build/llvm-release_$LLVM \ | ||
-DLIBUNWIND_ENABLE_SHARED=0 \ | ||
-DCMAKE_C_COMPILER=$CC \ | ||
-DCMAKE_CXX_COMPILER=$CXX \ | ||
-DCMAKE_C_FLAGS="$CFLAGS" \ | ||
-DCMAKE_CXX_FLAGS="$CXXFLAGS" | ||
|
||
hide_output make -j$(nproc) | ||
cp lib/libunwind.a $OUTPUT/$TARGET/lib | ||
cd ../ && rm -rf libunwind-build | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Idem. |
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
use spec::{LinkerFlavor, TargetOptions}; | ||
use spec::{LinkerFlavor, TargetOptions, RelroLevel}; | ||
|
||
pub fn opts() -> TargetOptions { | ||
let mut base = super::linux_base::opts(); | ||
|
@@ -40,5 +40,13 @@ pub fn opts() -> TargetOptions { | |
// These targets allow the user to choose between static and dynamic linking. | ||
base.crt_static_respected = true; | ||
|
||
// Defaults for dynamic linking | ||
base.dynamic_linking = true; | ||
base.executables = true; | ||
base.has_elf_tls = true; | ||
base.has_rpath = true; | ||
base.position_independent_executables = true; | ||
base.relro_level = RelroLevel::Full; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also change import to include |
||
|
||
base | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cd -
would be more general.