Skip to content

Commit 9e98edd

Browse files
Fix rebase fallout.
1 parent d8d1d2c commit 9e98edd

File tree

15 files changed

+74
-131
lines changed

15 files changed

+74
-131
lines changed

mk/cfg/le32-unknown-nacl.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,3 @@ CFG_GNU_TRIPLE_le32-unknown-nacl := le32-unknown-nacl
4040
# strdup isn't defined unless -std=gnu++11 is used
4141
LLVM_FILTER_CXXFLAGS_le32-unknown-nacl := -std=c++11
4242
LLVM_EXTRA_CXXFLAGS_le32-unknown-nacl := -std=gnu++11
43-
LLVM_HAS_TARGETMACHINE_le32-unknown-nacl := 0

mk/rt.mk

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,13 @@ NATIVE_DEPS_hoedown_$(1) := hoedown/src/autolink.c \
5353
NATIVE_DEPS_miniz_$(1) = miniz.c
5454
NATIVE_DEPS_rust_builtin_$(1) := rust_builtin.c \
5555
rust_android_dummy.c
56-
NATIVE_DEPS_rustrt_native_$(1) := \
57-
rust_try.ll
56+
NATIVE_DEPS_rustrt_native_$(1) :=
5857

5958
NATIVE_DEPS_rust_test_helpers_$(1) := rust_test_helpers.c
6059

6160
ifneq ($$(RUNTIME_DISABLE_ASM_$(1)), 1)
6261
NATIVE_DEPS_rustrt_native_$(1) += arch/$$(HOST_$(1))/record_sp.S
6362
NATIVE_DEPS_morestack_$(1) := arch/$$(HOST_$(1))/morestack.S
64-
6563
endif
6664

6765
################################################################################
@@ -73,26 +71,6 @@ endif
7371

7472
RT_OUTPUT_DIR_$(1) := $(1)/rt
7573

76-
ifneq ($$(LLVM_HAS_TARGETMACHINE_$(1)),0)
77-
else
78-
# le32-unknown-nacl doesn't have a target machine, so llc chokes.
79-
# Fortunately, PNaCl object files are just bitcode.
80-
$$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.ll \
81-
$$(MKFILE_DEPS) $$(LLVM_CONFIG_$$(CFG_BUILD))
82-
@mkdir -p $$(@D)
83-
@$$(call E, compile: $$@)
84-
$$(OPT_$$(CFG_BUILD)) -Oz -o $$@ $$<
85-
$$(RT_OUTPUT_DIR_$(1))/%.o: $(CFG_PNACL_TOOLCHAIN)/lib/clang/3.7.0/lib/le32-nacl/%.bc \
86-
$$(MKFILE_DEPS) $$(LLVM_CONFIG_$$(CFG_BUILD))
87-
@mkdir -p $$(@D)
88-
@$$(call E, compile: $$@)
89-
$$(OPT_$$(CFG_BUILD)) -Oz -o $$@ $$<
90-
$$(RT_OUTPUT_DIR_$(1))/%.o: $(CFG_PNACL_TOOLCHAIN)/le32-nacl/lib/%.bc \
91-
$$(MKFILE_DEPS) $$(LLVM_CONFIG_$$(CFG_BUILD))
92-
@mkdir -p $$(@D)
93-
@$$(call E, compile: $$@)
94-
$$(OPT_$$(CFG_BUILD)) -Oz -o $$@ $$<
95-
endif
9674
$$(RT_OUTPUT_DIR_$(1))/%.o: $(S)src/rt/%.c $$(MKFILE_DEPS)
9775
@mkdir -p $$(@D)
9876
@$$(call E, compile: $$@)
@@ -132,7 +110,6 @@ OBJS_$(2)_$(1) := $$(NATIVE_DEPS_$(2)_$(1):%=$$(RT_OUTPUT_DIR_$(1))/%)
132110
OBJS_$(2)_$(1) := $$(OBJS_$(2)_$(1):.c=.o)
133111
OBJS_$(2)_$(1) := $$(OBJS_$(2)_$(1):.cpp=.o)
134112
OBJS_$(2)_$(1) := $$(OBJS_$(2)_$(1):.S=.o)
135-
OBJS_$(2)_$(1) := $$(OBJS_$(2)_$(1):.bc=.o)
136113
NATIVE_$(2)_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),$(2))
137114
$$(RT_OUTPUT_DIR_$(1))/$$(NATIVE_$(2)_$(1)): $$(OBJS_$(2)_$(1))
138115
@$$(call E, link: $$@)

src/librustc/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ pub mod diagnostics;
9696

9797
pub mod back {
9898
pub use rustc_back::abi;
99-
pub use rustc_back::le32;
10099
pub use rustc_back::rpath;
101100
pub use rustc_back::svh;
102101
}

src/librustc/middle/entry.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ fn find_item(item: &Item, ctxt: &mut EntryContext) {
8787
let link_name =
8888
attr::first_attr_value_str_by_name(&item.attrs,
8989
"main_link_name")
90-
.unwrap_or_else(|| token::get_name(ctxt.main_name));
90+
.unwrap_or_else(|| {
91+
token::InternedString::new_from_name(ctxt.main_name)
92+
});
9193
ctxt.main_fn = Some((item.id, link_name, item.span));
9294
} else {
9395
span_err!(ctxt.session, item.span, E0136,
@@ -104,7 +106,9 @@ fn find_item(item: &Item, ctxt: &mut EntryContext) {
104106
if ctxt.attr_main_fn.is_none() {
105107
let link_name = attr::first_attr_value_str_by_name(&item.attrs,
106108
"main_link_name")
107-
.unwrap_or_else(|| token::get_name(ctxt.main_name));
109+
.unwrap_or_else(|| {
110+
token::InternedString::new_from_name(ctxt.main_name)
111+
});
108112
ctxt.attr_main_fn = Some((item.id, link_name, item.span));
109113
} else {
110114
span_err!(ctxt.session, item.span, E0137,
@@ -116,7 +120,9 @@ fn find_item(item: &Item, ctxt: &mut EntryContext) {
116120
if ctxt.start_fn.is_none() {
117121
let link_name = attr::first_attr_value_str_by_name(&item.attrs,
118122
"main_link_name")
119-
.unwrap_or_else(|| token::get_name(ctxt.main_name));
123+
.unwrap_or_else(|| {
124+
token::InternedString::new_from_name(ctxt.main_name)
125+
});
120126
ctxt.start_fn = Some((item.id, link_name, item.span));
121127
} else {
122128
span_err!(ctxt.session, item.span, E0138,

src/librustc_back/le32.rs

Lines changed: 0 additions & 26 deletions
This file was deleted.

src/librustc_back/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ extern crate rustc_llvm;
5252

5353
pub mod abi;
5454
pub mod tempdir;
55-
pub mod le32;
5655
pub mod rpath;
5756
pub mod sha2;
5857
pub mod svh;

src/librustc_back/target/le32_unknown_nacl.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ pub fn target() -> Target {
1515
linker: "pnacl-clang".to_string(),
1616
ar: "pnacl-ar".to_string(),
1717

18+
data_layout: "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-\
19+
i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32".to_string(),
20+
1821
pre_link_args: vec!("--pnacl-exceptions=sjlj".to_string(),
1922
"-Wl,--start-group".to_string()),
2023
post_link_args: vec!("-Wl,--end-group".to_string()),
@@ -27,11 +30,10 @@ pub fn target() -> Target {
2730
is_like_pnacl: true,
2831
no_asm: true,
2932
lto_supported: false, // `pnacl-ld` runs "LTO".
33+
archive_format: "gnu".to_string(),
3034
.. Default::default()
3135
};
3236
Target {
33-
data_layout: "e-i1:8:8-i8:8:8-i16:16:16-i32:32:32-\
34-
i64:64:64-f32:32:32-f64:64:64-p:32:32:32-v128:32:32".to_string(),
3537
// Pretend that we are ARM for name mangling and assembly conventions.
3638
// https://code.google.com/p/nativeclient/issues/detail?id=2554
3739
llvm_target: "armv7a-none-nacl-gnueabi".to_string(),

src/librustc_driver/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -812,7 +812,7 @@ fn write_out_deps(sess: &Session,
812812
continue;
813813
}
814814
let p = link::filename_for_input(sess, *output,
815-
id, &file);
815+
id, outputs);
816816
out_filenames.push(p);
817817
}
818818
}

src/librustc_trans/back/link.rs

Lines changed: 28 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@ use std::fs::{self, PathExt};
3737
use std::io::{self, Read, Write};
3838
use std::mem;
3939
use std::path::{Path, PathBuf};
40-
use std::ptr;
4140
use std::process::Command;
4241
use std::str;
4342
use flate;
44-
use llvm;
4543
use serialize::hex::ToHex;
4644
use syntax::ast;
4745
use syntax::attr::AttrMetaMethods;
@@ -77,34 +75,6 @@ pub const RLIB_BYTECODE_OBJECT_V1_DATASIZE_OFFSET: usize =
7775
pub const RLIB_BYTECODE_OBJECT_V1_DATA_OFFSET: usize =
7876
RLIB_BYTECODE_OBJECT_V1_DATASIZE_OFFSET + 8;
7977

80-
81-
pub fn llvm_actual_err(sess: &Session, msg: String) {
82-
unsafe {
83-
let cstr = llvm::LLVMRustGetLastError();
84-
if cstr == ptr::null() {
85-
sess.err(&msg[..]);
86-
} else {
87-
let err = ffi::CStr::from_ptr(cstr).to_bytes();
88-
let err = String::from_utf8_lossy(&err[..]).to_string();
89-
sess.err(&format!("{}: {}",
90-
msg, err)[..]);
91-
}
92-
}
93-
}
94-
pub fn llvm_warn(sess: &Session, msg: String) {
95-
use llvm;
96-
unsafe {
97-
let cstr = llvm::LLVMRustGetLastError();
98-
if cstr == ptr::null() {
99-
sess.warn(&msg[..]);
100-
} else {
101-
let err = ffi::CStr::from_ptr(cstr).to_bytes();
102-
let err = String::from_utf8_lossy(&err[..]).to_string();
103-
sess.warn(&format!("{}: {}",
104-
msg, err)[..]);
105-
}
106-
}
107-
}
10878
/*
10979
* Name mangling and its relationship to metadata. This is complex. Read
11080
* carefully.
@@ -529,6 +499,21 @@ fn link_binary_output(sess: &Session,
529499
crate_name: &str) -> PathBuf {
530500
let objects = object_filenames(sess, outputs);
531501

502+
let out_filename = match outputs.single_output_file {
503+
Some(ref file) => file.clone(),
504+
None => filename_for_input(sess, crate_type, crate_name, outputs),
505+
};
506+
507+
// Make sure files are writeable. Mac, FreeBSD, and Windows system linkers
508+
// check this already -- however, the Linux linker will happily overwrite a
509+
// read-only file. We should be consistent.
510+
for file in objects.iter().chain(Some(&out_filename)) {
511+
if !is_writeable(file) {
512+
sess.fatal(&format!("output file {} is not writeable -- check its \
513+
permissions", file.display()));
514+
}
515+
}
516+
532517
let tmpdir = TempDir::new("rustc").ok().expect("needs a temp dir");
533518
match crate_type {
534519
config::CrateTypeRlib => {
@@ -551,8 +536,6 @@ fn link_binary_output(sess: &Session,
551536
out_filename
552537
}
553538

554-
}
555-
556539
fn object_filenames(sess: &Session, outputs: &OutputFilenames) -> Vec<PathBuf> {
557540
(0..sess.opts.cg.codegen_units).map(|i| {
558541
let ext = format!("{}.o", i);
@@ -598,7 +581,6 @@ fn link_rlib<'a>(sess: &'a Session,
598581
for obj in objects {
599582
ab.add_file(obj);
600583
}
601-
gold_plugin: None,
602584

603585
for &(ref l, kind) in sess.cstore.get_used_libraries().borrow().iter() {
604586
match kind {
@@ -660,7 +642,7 @@ fn link_rlib<'a>(sess: &'a Session,
660642
// For LTO purposes, the bytecode of this library is also inserted
661643
// into the archive. If codegen_units > 1, we insert each of the
662644
// bitcode files.
663-
if !sess.target.target.options.is_like_pnacl {
645+
if sess.target.target.options.lto_supported {
664646
for obj in objects {
665647
// Note that we make sure that the bytecode filename in the
666648
// archive is never exactly 16 bytes long by adding a 16 byte
@@ -702,21 +684,22 @@ fn link_rlib<'a>(sess: &'a Session,
702684

703685
ab.add_file(&bc_deflated_filename);
704686

705-
// See the bottom of back::write::run_passes for an explanation
706-
// of when we do and don't keep .0.bc files around.
707-
let user_wants_numbered_bitcode =
687+
// See the bottom of back::write::run_passes for an explanation
688+
// of when we do and don't keep .0.bc files around.
689+
let user_wants_numbered_bitcode =
708690
sess.opts.output_types.contains(&OutputTypeBitcode) &&
709691
sess.opts.cg.codegen_units > 1;
710-
if !sess.opts.cg.save_temps && !user_wants_numbered_bitcode {
711-
remove(sess, &bc_filename);
692+
if !sess.opts.cg.save_temps && !user_wants_numbered_bitcode {
693+
remove(sess, &bc_filename);
694+
}
712695
}
713-
}
714696

715-
// After adding all files to the archive, we need to update the
716-
// symbol table of the archive. This currently dies on OSX (see
717-
// #11162), and isn't necessary there anyway
718-
if !sess.target.target.options.is_like_osx || ab.using_llvm() {
719-
ab.update_symbols();
697+
// After adding all files to the archive, we need to update the
698+
// symbol table of the archive. This currently dies on OSX (see
699+
// #11162), and isn't necessary there anyway
700+
if !sess.target.target.options.is_like_osx || ab.using_llvm() {
701+
ab.update_symbols();
702+
}
720703
}
721704
}
722705

@@ -840,8 +823,6 @@ fn link_natively(sess: &Session, trans: &CrateTranslation, dylib: bool,
840823

841824
// The compiler's sysroot often has some bundled tools, so add it to the
842825
// PATH for the child.
843-
let mut new_path = sess.host_filesearch(PathKind::All)
844-
.get_tools_search_paths();
845826
let root = sess.target_filesearch(PathKind::Native).get_lib_path();
846827
cmd.args(&sess.target.target.options.pre_link_args);
847828
for obj in &sess.target.target.options.pre_link_objects {
@@ -1242,7 +1223,6 @@ fn add_upstream_rust_crates(cmd: &mut Linker, sess: &Session,
12421223
if any_objects {
12431224
archive.build();
12441225
cmd.link_whole_rlib(&fix_windows_verbatim_for_gcc(&dst));
1245-
gold_plugin: None,
12461226
}
12471227
});
12481228
}

src/librustc_trans/back/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
pub use rustc_back::abi;
1212
pub use rustc_back::rpath;
1313
pub use rustc_back::svh;
14-
pub use rustc_back::target_strs;
1514

1615
pub mod archive;
1716
pub mod linker;

src/libstd/sys/unix/c.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#![allow(dead_code)]
2525
#![allow(non_camel_case_types)]
2626

27-
pub use self::signal_os::{sigaction, siginfo, sigset_t, sigaltstack};
2827
pub use self::signal_os::*;
2928

3029
use libc;
@@ -52,9 +51,6 @@ pub const FIOCLEX: libc::c_ulong = 0x5451;
5251
target_arch = "powerpc")))]
5352
pub const FIOCLEX: libc::c_ulong = 0x6601;
5453

55-
#[cfg(target_os = "nacl")]
56-
mod consts { }
57-
5854

5955
pub const WNOHANG: libc::c_int = 1;
6056

@@ -151,6 +147,7 @@ extern {
151147
act: *const sigaction,
152148
oldact: *mut sigaction) -> libc::c_int;
153149

150+
#[cfg(not(target_os = "nacl"))]
154151
pub fn sigaltstack(ss: *const sigaltstack,
155152
oss: *mut sigaltstack) -> libc::c_int;
156153

@@ -334,6 +331,8 @@ mod signal_os {
334331
}
335332
}
336333
}
334+
335+
/// Note: Although the signal functions are defined on NaCl, they always fail.
337336
#[cfg(target_os = "nacl")]
338337
mod signal_os {
339338
use libc;
@@ -354,6 +353,7 @@ mod signal_os {
354353
pub handler: extern fn(libc::c_int),
355354
}
356355
}
356+
357357
#[cfg(any(target_os = "macos",
358358
target_os = "ios",
359359
target_os = "freebsd",

0 commit comments

Comments
 (0)