Skip to content

Backport to beta: disable jemalloc on executables for ios targets #46911

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

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
language: shell
sudo: required
dist: trusty
group: deprecated-2017Q4
services:
- docker

Expand Down
250 changes: 147 additions & 103 deletions src/Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ members = [
"tools/rls/test_data/infer_custom_bin",
"tools/rls/test_data/infer_lib",
"tools/rls/test_data/workspace_symbol",
"tools/rls/test_data/deglob",
]

# Curiously, compiletest will segfault if compiled with opt-level=3 on 64-bit
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,8 @@ impl<'a> Builder<'a> {
.env("RUSTC_LIBDIR", self.sysroot_libdir(compiler, self.build.build))
.env("CFG_RELEASE_CHANNEL", &self.build.config.channel)
.env("RUSTDOC_REAL", self.rustdoc(host))
.env("RUSTDOC_CRATE_VERSION", self.build.rust_version());
.env("RUSTDOC_CRATE_VERSION", self.build.rust_version())
.env("RUSTC_BOOTSTRAP", "1");
if let Some(linker) = self.build.linker(host) {
cmd.env("RUSTC_TARGET_LINKER", linker);
}
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub const CFG_RELEASE_NUM: &str = "1.23.0";
// An optional number to put after the label, e.g. '.2' -> '-beta.2'
// Be sure to make this starts with a dot to conform to semver pre-release
// versions (section 9)
pub const CFG_PRERELEASE_VERSION: &str = ".1";
pub const CFG_PRERELEASE_VERSION: &str = ".2";

pub struct GitInfo {
inner: Option<Info>,
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl Step for CargoBook {

let target = self.target;
let name = self.name;
let src = PathBuf::from("src/tools/cargo/src/doc/book");
let src = build.src.join("src/tools/cargo/src/doc/book");

let out = build.doc_out(target);
t!(fs::create_dir_all(&out));
Expand Down
9 changes: 5 additions & 4 deletions src/ci/docker/scripts/crosstool-ng.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@

set -ex

url="http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.22.0.tar.bz2"
curl -f $url | tar xjf -
cd crosstool-ng
url="https://github.com/crosstool-ng/crosstool-ng/archive/crosstool-ng-1.22.0.tar.gz"
curl -Lf $url | tar xzf -
cd crosstool-ng-crosstool-ng-1.22.0
./bootstrap
./configure --prefix=/usr/local
make -j$(nproc)
make install
cd ..
rm -rf crosstool-ng
rm -rf crosstool-ng-crosstool-ng-1.22.0
2 changes: 1 addition & 1 deletion src/ci/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ fi
# FIXME: need a scheme for changing this `nightly` value to `beta` and `stable`
# either automatically or manually.
if [ "$DEPLOY$DEPLOY_ALT" != "" ]; then
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=nightly"
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --release-channel=beta"
RUST_CONFIGURE_ARGS="$RUST_CONFIGURE_ARGS --enable-llvm-static-stdcpp"

if [ "$NO_LLVM_ASSERTIONS" = "1" ]; then
Expand Down
4 changes: 3 additions & 1 deletion src/librustc/ty/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,9 @@ impl<'a, 'tcx> LayoutDetails {
// We have exactly one non-ZST field.
(Some((i, field)), None, None) => {
// Field fills the struct and it has a scalar or scalar pair ABI.
if offsets[i].bytes() == 0 && size == field.size {
if offsets[i].bytes() == 0 &&
align.abi() == field.align.abi() &&
size == field.size {
match field.abi {
// For plain scalars we can't unpack newtypes
// for `#[repr(C)]`, as that affects C ABIs.
Expand Down
4 changes: 4 additions & 0 deletions src/librustc_back/target/apple_ios_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ pub fn opts(arch: Arch) -> Result<TargetOptions, String> {
executables: true,
pre_link_args,
has_elf_tls: false,
// The following line is a workaround for jemalloc 4.5 being broken on
// ios. jemalloc 5.0 is supposed to fix this.
// see https://github.com/rust-lang/rust/issues/45262
exe_allocation_crate: None,
.. super::apple_base::opts()
})
}
3 changes: 2 additions & 1 deletion src/librustc_trans/abi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,8 @@ impl<'a, 'tcx> FnType<'tcx> {
// dependencies rather than pointer equality
let no_alias = match kind {
PointerKind::Shared => false,
PointerKind::Frozen | PointerKind::UniqueOwned => true,
PointerKind::UniqueOwned => true,
PointerKind::Frozen |
PointerKind::UniqueBorrowed => !is_return
};
if no_alias {
Expand Down
12 changes: 5 additions & 7 deletions src/librustc_trans/mir/lvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,14 +359,12 @@ impl<'a, 'tcx> LvalueRef<'tcx> {
/// Set the discriminant for a new value of the given case of the given
/// representation.
pub fn trans_set_discr(&self, bcx: &Builder<'a, 'tcx>, variant_index: usize) {
match self.layout.variants {
if self.layout.for_variant(bcx.ccx, variant_index).abi == layout::Abi::Uninhabited {
return;
}
match self.layout.variants {
layout::Variants::Single { index } => {
if index != variant_index {
// If the layout of an enum is `Single`, all
// other variants are necessarily uninhabited.
assert_eq!(self.layout.for_variant(bcx.ccx, variant_index).abi,
layout::Abi::Uninhabited);
}
assert_eq!(index, variant_index);
}
layout::Variants::Tagged { .. } => {
let ptr = self.project_field(bcx, 0);
Expand Down
8 changes: 4 additions & 4 deletions src/stage0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# source tarball for a stable release you'll likely see `1.x.0` for rustc and
# `0.x.0` for Cargo where they were released on `date`.

date: 2017-10-20
rustc: beta
cargo: beta
date: 2017-11-20
rustc: 1.22.0
cargo: 0.23.0

# When making a stable release the process currently looks like:
#
Expand All @@ -34,4 +34,4 @@ cargo: beta
# looking at a beta source tarball and it's uncommented we'll shortly comment it
# out.

#dev: 1
dev: 1
11 changes: 11 additions & 0 deletions src/test/codegen/packed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,14 @@ pub fn pkd_pair(pair1: &mut PackedPair, pair2: &mut PackedPair) {
// CHECK: call void @llvm.memcpy.{{.*}}(i8* %{{.*}}, i8* %{{.*}}, i{{[0-9]+}} 5, i32 1, i1 false)
*pair2 = *pair1;
}

#[repr(packed)]
#[derive(Copy, Clone)]
pub struct PackedNestedPair((u32, u32));

// CHECK-LABEL: @pkd_nested_pair
#[no_mangle]
pub fn pkd_nested_pair(pair1: &mut PackedNestedPair, pair2: &mut PackedNestedPair) {
// CHECK: call void @llvm.memcpy.{{.*}}(i8* %{{.*}}, i8* %{{.*}}, i{{[0-9]+}} 8, i32 1, i1 false)
*pair2 = *pair1;
}
5 changes: 5 additions & 0 deletions src/test/run-make/issue-46239/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-include ../tools.mk

all:
$(RUSTC) main.rs -C opt-level=1
$(call RUN,main)
18 changes: 18 additions & 0 deletions src/test/run-make/issue-46239/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Copyright 2017 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.

fn project<T>(x: &(T,)) -> &T { &x.0 }

fn dummy() {}

fn main() {
let f = (dummy as fn(),);
(*project(&f))();
}
37 changes: 37 additions & 0 deletions src/test/run-pass/issue-46519.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright 2017 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.

// compile-flags:--test -O

#[test]
#[should_panic(expected = "creating inhabited type")]
fn test() {
FontLanguageOverride::system_font(SystemFont::new());
}

pub enum FontLanguageOverride {
Normal,
Override(&'static str),
System(SystemFont)
}

pub enum SystemFont {}

impl FontLanguageOverride {
fn system_font(f: SystemFont) -> Self {
FontLanguageOverride::System(f)
}
}

impl SystemFont {
fn new() -> Self {
panic!("creating inhabited type")
}
}
2 changes: 1 addition & 1 deletion src/tools/rls
Submodule rls updated from 015073 to 33cc1e
2 changes: 1 addition & 1 deletion src/tools/rustfmt