Skip to content

Commit 0febeee

Browse files
committed
---
yaml --- r: 234811 b: refs/heads/tmp c: 0c05492 h: refs/heads/master i: 234809: 4eccfc5 234807: 130a21f v: v3
1 parent 887348e commit 0febeee

File tree

16 files changed

+65
-13
lines changed

16 files changed

+65
-13
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: d2e13e822a73e0ea46ae9e21afdd3155fc997f6d
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: 6de473addd874834fbd7fe42428564fc17159d81
28+
refs/heads/tmp: 0c05492ee17c544600d3e1ea2740f8b398d01fc0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: ab792abf1fcc28afbd315426213f6428da25c085
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/src/compiletest/runtest.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,8 +1669,7 @@ fn compile_test_and_save_ir(config: &Config, props: &TestProps,
16691669
// FIXME (#9639): This needs to handle non-utf8 paths
16701670
let mut link_args = vec!("-L".to_owned(),
16711671
aux_dir.to_str().unwrap().to_owned());
1672-
let llvm_args = vec!("--emit=llvm-ir".to_owned(),
1673-
"--crate-type=lib".to_owned());
1672+
let llvm_args = vec!("--emit=llvm-ir".to_owned(),);
16741673
link_args.extend(llvm_args);
16751674
let args = make_compile_args(config,
16761675
props,

branches/tmp/src/librustc_back/target/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ pub struct TargetOptions {
157157
/// Whether to disable linking to compiler-rt. Defaults to false, as LLVM
158158
/// will emit references to the functions that compiler-rt provides.
159159
pub no_compiler_rt: bool,
160+
/// Whether to disable linking to the default libraries, typically corresponds
161+
/// to `-nodefaultlibs`. Defaults to true.
162+
pub no_default_libraries: bool,
160163
/// Dynamically linked executables can be compiled as position independent
161164
/// if the default relocation model of position independent code is not
162165
/// changed. This is a requirement to take advantage of ASLR, as otherwise
@@ -212,6 +215,7 @@ impl Default for TargetOptions {
212215
linker_is_gnu: false,
213216
has_rpath: false,
214217
no_compiler_rt: false,
218+
no_default_libraries: true,
215219
position_independent_executables: false,
216220
pre_link_objects: Vec::new(),
217221
post_link_objects: Vec::new(),
@@ -319,6 +323,7 @@ impl Target {
319323
key!(linker_is_gnu, bool);
320324
key!(has_rpath, bool);
321325
key!(no_compiler_rt, bool);
326+
key!(no_default_libraries, bool);
322327
key!(pre_link_args, list);
323328
key!(post_link_args, list);
324329
key!(allow_asm, bool);

branches/tmp/src/librustc_back/target/windows_base.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ pub fn opts() -> TargetOptions {
2323
exe_suffix: ".exe".to_string(),
2424
staticlib_prefix: "".to_string(),
2525
staticlib_suffix: ".lib".to_string(),
26+
// Unfortunately right now passing -nodefaultlibs to gcc on windows
27+
// doesn't work so hot (in terms of native dependencies). This flag
28+
// should hopefully be removed one day though!
29+
no_default_libraries: false,
2630
is_like_windows: true,
2731
archive_format: "gnu".to_string(),
2832
pre_link_args: vec!(

branches/tmp/src/librustc_trans/back/link.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,9 @@ fn link_args(cmd: &mut Linker,
970970
// default. Note that this does not happen for windows because windows pulls
971971
// in some large number of libraries and I couldn't quite figure out which
972972
// subset we wanted.
973-
cmd.no_default_libraries();
973+
if t.options.no_default_libraries {
974+
cmd.no_default_libraries();
975+
}
974976

975977
// Take careful note of the ordering of the arguments we pass to the linker
976978
// here. Linkers will assume that things on the left depend on things to the

branches/tmp/src/librustc_trans/back/linker.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,7 @@ impl<'a> Linker for GnuLinker<'a> {
159159
}
160160

161161
fn no_default_libraries(&mut self) {
162-
// Unfortunately right now passing -nodefaultlibs to gcc on windows
163-
// doesn't work so hot (in terms of native dependencies). This if
164-
// statement should hopefully be removed one day though!
165-
if !self.sess.target.target.options.is_like_windows {
166-
self.cmd.arg("-nodefaultlibs");
167-
}
162+
self.cmd.arg("-nodefaultlibs");
168163
}
169164

170165
fn build_dylib(&mut self, out_filename: &Path) {

branches/tmp/src/librustc_trans/trans/debuginfo/gdb.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use llvm;
1414
use llvm::ValueRef;
1515

16-
use trans::common::{C_bytes, CrateContext};
16+
use trans::common::{C_bytes, CrateContext, C_i32};
1717
use trans::declare;
1818
use trans::type_::Type;
1919
use session::config::NoDebugInfo;
@@ -31,11 +31,21 @@ pub fn insert_reference_to_gdb_debug_scripts_section_global(ccx: &CrateContext)
3131
let gdb_debug_scripts_section_global =
3232
get_or_insert_gdb_debug_scripts_section_global(ccx);
3333
unsafe {
34+
// Load just the first byte as that's all that's necessary to force
35+
// LLVM to keep around the reference to the global.
36+
let indices = [C_i32(ccx, 0), C_i32(ccx, 0)];
37+
let element =
38+
llvm::LLVMBuildInBoundsGEP(ccx.raw_builder(),
39+
gdb_debug_scripts_section_global,
40+
indices.as_ptr(),
41+
indices.len() as ::libc::c_uint,
42+
empty.as_ptr());
3443
let volative_load_instruction =
3544
llvm::LLVMBuildLoad(ccx.raw_builder(),
36-
gdb_debug_scripts_section_global,
45+
element,
3746
empty.as_ptr());
3847
llvm::LLVMSetVolatile(volative_load_instruction, llvm::True);
48+
llvm::LLVMSetAlignment(volative_load_instruction, 1);
3949
}
4050
}
4151
}

branches/tmp/src/rt/hoedown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Subproject commit 8ff3d82f2dde2cead36402a59c62d3e266c2f6ec
1+
Subproject commit 4638c60dedfa581fd5fa7c6420d8f32274c9ca0b

branches/tmp/src/test/codegen/adjustments.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
// compile-flags: -C no-prepopulate-passes
1212

13+
#![crate_type = "lib"]
14+
1315
// Hack to get the correct size for the length part in slices
1416
// CHECK: @helper([[USIZE:i[0-9]+]])
1517
#[no_mangle]

branches/tmp/src/test/codegen/coercions.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
// compile-flags: -C no-prepopulate-passes
1212

13+
#![crate_type = "lib"]
14+
1315
static X: i32 = 5;
1416

1517
// CHECK-LABEL: @raw_ptr_to_raw_ptr_noop

branches/tmp/src/test/codegen/extern-functions.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// compile-flags: -C no-prepopulate-passes
1212

13+
#![crate_type = "lib"]
1314
#![feature(unwind_attributes)]
1415

1516
extern {

branches/tmp/src/test/codegen/function-arguments.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// compile-flags: -C no-prepopulate-passes
1212

13+
#![crate_type = "lib"]
1314
#![feature(allocator)]
1415

1516
pub struct S {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// ignore-tidy-linelength
12+
// ignore-windows
13+
// ignore-macos
14+
15+
// compile-flags: -g -C no-prepopulate-passes
16+
17+
#![feature(start)]
18+
19+
// CHECK-LABEL: @main
20+
// CHECK: load volatile i8, i8* getelementptr inbounds ([[B:\[[0-9]* x i8\]]], [[B]]* @__rustc_debug_gdb_scripts_section__, i32 0, i32 0), align 1
21+
22+
#[start]
23+
fn start(_: isize, _: *const *const u8) -> isize {
24+
return 0;
25+
}

branches/tmp/src/test/codegen/link_section.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
// compile-flags: -C no-prepopulate-passes
1212

13+
#![crate_type = "lib"]
14+
1315
// CHECK: @VAR1 = constant i32 1, section ".test_one"
1416
#[no_mangle]
1517
#[link_section = ".test_one"]

branches/tmp/src/test/codegen/loads.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
// compile-flags: -C no-prepopulate-passes
1212

13+
#![crate_type = "lib"]
14+
1315
pub struct Bytes {
1416
a: u8,
1517
b: u8,

branches/tmp/src/test/codegen/stores.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
// compile-flags: -C no-prepopulate-passes
1212

13+
#![crate_type = "lib"]
14+
1315
pub struct Bytes {
1416
a: u8,
1517
b: u8,

0 commit comments

Comments
 (0)