提交 b2f67c8d 编写于 作者: B bors

Auto merge of #45041 - est31:master, r=alexcrichton

Remove support for the PNaCl target (le32-unknown-nacl)

This removes support for the `le32-unknown-nacl` target which is currently supported by rustc on tier 3. Despite the "nacl" in the name, the target doesn't output native code (x86, ARM, MIPS), instead it outputs binaries in the PNaCl format.

There are two reasons for the removal:

* Google [has announced](https://blog.chromium.org/2017/05/goodbye-pnacl-hello-webassembly.html) deprecation of the PNaCl format. The suggestion is to migrate to wasm. Happens we already have a wasm backend!
* Our PNaCl LLVM backend is provided by the fastcomp patch set that the LLVM fork used by rustc contains in addition to vanilla LLVM (`src/llvm/lib/Target/JSBackend/NaCl`). Upstream LLVM doesn't have PNaCl support. Removing PNaCl support will enable us to move away from fastcomp (#44006) and have a lighter set of patches on top of upstream LLVM inside our LLVM fork. This will help distribution packagers of Rust.

Fixes #42420
// Copyright 2015 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.
use LinkerFlavor;
use super::{LinkArgs, Target, TargetOptions, TargetResult};
pub fn target() -> TargetResult {
let mut pre_link_args = LinkArgs::new();
pre_link_args.insert(LinkerFlavor::Gcc,
vec!["--pnacl-exceptions=sjlj".to_string(),
"--target=le32-unknown-nacl".to_string(),
"-Wl,--start-group".to_string()]);
let mut post_link_args = LinkArgs::new();
post_link_args.insert(LinkerFlavor::Gcc,
vec!["-Wl,--end-group".to_string()]);
let opts = TargetOptions {
linker: "pnacl-clang".to_string(),
ar: "pnacl-ar".to_string(),
pre_link_args,
post_link_args,
dynamic_linking: false,
executables: true,
exe_suffix: ".pexe".to_string(),
linker_is_gnu: true,
allow_asm: false,
max_atomic_width: Some(32),
.. Default::default()
};
Ok(Target {
llvm_target: "le32-unknown-nacl".to_string(),
target_endian: "little".to_string(),
target_pointer_width: "32".to_string(),
target_c_int_width: "32".to_string(),
target_os: "nacl".to_string(),
target_env: "newlib".to_string(),
target_vendor: "unknown".to_string(),
data_layout: "e-i64:64:64-p:32:32:32-v128:32:32".to_string(),
arch: "le32".to_string(),
linker_flavor: LinkerFlavor::Gcc,
options: opts,
})
}
......@@ -215,7 +215,6 @@ fn $module() {
("i686-pc-windows-msvc", i686_pc_windows_msvc),
("i586-pc-windows-msvc", i586_pc_windows_msvc),
("le32-unknown-nacl", le32_unknown_nacl),
("asmjs-unknown-emscripten", asmjs_unknown_emscripten),
("wasm32-unknown-emscripten", wasm32_unknown_emscripten),
("wasm32-experimental-emscripten", wasm32_experimental_emscripten),
......
......@@ -88,7 +88,7 @@ fn main() {
let is_crossed = target != host;
let mut optional_components =
vec!["x86", "arm", "aarch64", "mips", "powerpc", "pnacl",
vec!["x86", "arm", "aarch64", "mips", "powerpc",
"systemz", "jsbackend", "webassembly", "msp430", "sparc", "nvptx"];
let mut version_cmd = Command::new(&llvm_config);
......
......@@ -346,10 +346,6 @@ fn init() { }
LLVMInitializePowerPCTargetMC,
LLVMInitializePowerPCAsmPrinter,
LLVMInitializePowerPCAsmParser);
init_target!(llvm_component = "pnacl",
LLVMInitializePNaClTargetInfo,
LLVMInitializePNaClTarget,
LLVMInitializePNaClTargetMC);
init_target!(llvm_component = "systemz",
LLVMInitializeSystemZTargetInfo,
LLVMInitializeSystemZTarget,
......
......@@ -337,7 +337,6 @@ fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
"l4re" => "L4Re",
"linux" => "Linux",
"macos" => "macOS",
"nacl" => "NaCl",
"netbsd" => "NetBSD",
"openbsd" => "OpenBSD",
"redox" => "Redox",
......@@ -886,4 +885,4 @@ fn test_render_long_html() {
only."
);
}
}
\ No newline at end of file
}
......@@ -38,7 +38,6 @@
#[cfg(all(not(dox), target_os = "haiku"))] pub mod haiku;
#[cfg(all(not(dox), target_os = "ios"))] pub mod ios;
#[cfg(all(not(dox), target_os = "macos"))] pub mod macos;
#[cfg(all(not(dox), target_os = "nacl"))] pub mod nacl;
#[cfg(all(not(dox), target_os = "netbsd"))] pub mod netbsd;
#[cfg(all(not(dox), target_os = "openbsd"))] pub mod openbsd;
#[cfg(all(not(dox), target_os = "solaris"))] pub mod solaris;
......
// 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.
#![stable(feature = "metadata_ext", since = "1.1.0")]
use libc;
use fs::Metadata;
use sys_common::AsInner;
#[allow(deprecated)]
use os::nacl::raw;
/// OS-specific extension methods for `fs::Metadata`
#[stable(feature = "metadata_ext", since = "1.1.0")]
pub trait MetadataExt {
/// Gain a reference to the underlying `stat` structure which contains
/// the raw information returned by the OS.
///
/// The contents of the returned `stat` are **not** consistent across
/// Unix platforms. The `os::unix::fs::MetadataExt` trait contains the
/// cross-Unix abstractions contained within the raw stat.
#[stable(feature = "metadata_ext", since = "1.1.0")]
#[rustc_deprecated(since = "1.8.0",
reason = "deprecated in favor of the accessor \
methods of this trait")]
#[allow(deprecated)]
fn as_raw_stat(&self) -> &raw::stat;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_dev(&self) -> u64;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_ino(&self) -> u64;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_mode(&self) -> u32;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_nlink(&self) -> u64;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_uid(&self) -> u32;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_gid(&self) -> u32;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_rdev(&self) -> u64;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_size(&self) -> u64;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_atime(&self) -> i64;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_atime_nsec(&self) -> i64;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_mtime(&self) -> i64;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_mtime_nsec(&self) -> i64;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_ctime(&self) -> i64;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_ctime_nsec(&self) -> i64;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_blksize(&self) -> u64;
#[stable(feature = "metadata_ext2", since = "1.8.0")]
fn st_blocks(&self) -> u64;
}
#[stable(feature = "metadata_ext", since = "1.1.0")]
impl MetadataExt for Metadata {
#[allow(deprecated)]
fn as_raw_stat(&self) -> &raw::stat {
unsafe {
&*(self.as_inner().as_inner() as *const libc::stat64
as *const raw::stat)
}
}
fn st_dev(&self) -> u64 {
self.as_inner().as_inner().st_dev as u64
}
fn st_ino(&self) -> u64 {
self.as_inner().as_inner().st_ino as u64
}
fn st_mode(&self) -> u32 {
self.as_inner().as_inner().st_mode as u32
}
fn st_nlink(&self) -> u64 {
self.as_inner().as_inner().st_nlink as u64
}
fn st_uid(&self) -> u32 {
self.as_inner().as_inner().st_uid as u32
}
fn st_gid(&self) -> u32 {
self.as_inner().as_inner().st_gid as u32
}
fn st_rdev(&self) -> u64 {
self.as_inner().as_inner().st_rdev as u64
}
fn st_size(&self) -> u64 {
self.as_inner().as_inner().st_size as u64
}
fn st_atime(&self) -> i64 {
self.as_inner().as_inner().st_atime as i64
}
fn st_atime_nsec(&self) -> i64 {
self.as_inner().as_inner().st_atime_nsec as i64
}
fn st_mtime(&self) -> i64 {
self.as_inner().as_inner().st_mtime as i64
}
fn st_mtime_nsec(&self) -> i64 {
self.as_inner().as_inner().st_mtime_nsec as i64
}
fn st_ctime(&self) -> i64 {
self.as_inner().as_inner().st_ctime as i64
}
fn st_ctime_nsec(&self) -> i64 {
self.as_inner().as_inner().st_ctime_nsec as i64
}
fn st_blksize(&self) -> u64 {
self.as_inner().as_inner().st_blksize as u64
}
fn st_blocks(&self) -> u64 {
self.as_inner().as_inner().st_blocks as u64
}
}
// Copyright 2015 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.
//! Nacl-specific definitions
#![stable(feature = "raw_ext", since = "1.1.0")]
pub mod raw;
pub mod fs;
// Copyright 2015 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.
//! Nacl-specific raw type definitions
#![stable(feature = "raw_ext", since = "1.1.0")]
#![rustc_deprecated(since = "1.8.0",
reason = "these type aliases are no longer supported by \
the standard library, the `libc` crate on \
crates.io should be used instead for the correct \
definitions")]
#![allow(deprecated)]
#[stable(feature = "raw_ext", since = "1.1.0")] pub type time_t = i64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type off_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type dev_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type ino_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type pid_t = i32;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type uid_t = u32;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type gid_t = u32;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type mode_t = u32;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type nlink_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blksize_t = u64;
#[stable(feature = "raw_ext", since = "1.1.0")] pub type blkcnt_t = u64;
#[stable(feature = "pthread_t", since = "1.8.0")]
pub type pthread_t = usize;
#[repr(C)]
#[derive(Copy, Clone)]
#[stable(feature = "raw_ext", since = "1.1.0")]
pub struct stat {
#[stable(feature = "raw_ext", since = "1.1.0")] pub st_dev: dev_t,
#[stable(feature = "raw_ext", since = "1.1.0")] pub st_ino: ino_t,
#[stable(feature = "raw_ext", since = "1.1.0")] pub st_mode: mode_t,
#[stable(feature = "raw_ext", since = "1.1.0")] pub st_nlink: nlink_t,
#[stable(feature = "raw_ext", since = "1.1.0")] pub st_uid: uid_t,
#[stable(feature = "raw_ext", since = "1.1.0")] pub st_gid: gid_t,
#[stable(feature = "raw_ext", since = "1.1.0")] pub st_rdev: dev_t,
#[stable(feature = "raw_ext", since = "1.1.0")] pub st_size: off_t,
#[stable(feature = "raw_ext", since = "1.1.0")] pub st_blksize: blksize_t,
#[stable(feature = "raw_ext", since = "1.1.0")] pub st_blocks: blkcnt_t,
#[stable(feature = "raw_ext", since = "1.1.0")] pub st_atime: time_t,
#[stable(feature = "raw_ext", since = "1.1.0")] pub st_atime_nsec: i64,
#[stable(feature = "raw_ext", since = "1.1.0")] pub st_mtime: time_t,
#[stable(feature = "raw_ext", since = "1.1.0")] pub st_mtime_nsec: i64,
#[stable(feature = "raw_ext", since = "1.1.0")] pub st_ctime: time_t,
#[stable(feature = "raw_ext", since = "1.1.0")] pub st_ctime_nsec: i64,
}
......@@ -118,27 +118,6 @@ pub mod os {
pub const EXE_EXTENSION: &'static str = "";
}
#[cfg(all(target_os = "nacl", not(target_arch = "le32")))]
pub mod os {
pub const FAMILY: &'static str = "unix";
pub const OS: &'static str = "nacl";
pub const DLL_PREFIX: &'static str = "lib";
pub const DLL_SUFFIX: &'static str = ".so";
pub const DLL_EXTENSION: &'static str = "so";
pub const EXE_SUFFIX: &'static str = ".nexe";
pub const EXE_EXTENSION: &'static str = "nexe";
}
#[cfg(all(target_os = "nacl", target_arch = "le32"))]
pub mod os {
pub const FAMILY: &'static str = "unix";
pub const OS: &'static str = "pnacl";
pub const DLL_PREFIX: &'static str = "lib";
pub const DLL_SUFFIX: &'static str = ".pso";
pub const DLL_EXTENSION: &'static str = "pso";
pub const EXE_SUFFIX: &'static str = ".pexe";
pub const EXE_EXTENSION: &'static str = "pexe";
}
#[cfg(target_os = "haiku")]
pub mod os {
pub const FAMILY: &'static str = "unix";
......
......@@ -22,7 +22,6 @@
#[cfg(all(not(dox), target_os = "haiku"))] pub use os::haiku as platform;
#[cfg(all(not(dox), target_os = "ios"))] pub use os::ios as platform;
#[cfg(all(not(dox), target_os = "macos"))] pub use os::macos as platform;
#[cfg(all(not(dox), target_os = "nacl"))] pub use os::nacl as platform;
#[cfg(all(not(dox), target_os = "netbsd"))] pub use os::netbsd as platform;
#[cfg(all(not(dox), target_os = "openbsd"))] pub use os::openbsd as platform;
#[cfg(all(not(dox), target_os = "solaris"))] pub use os::solaris as platform;
......@@ -77,11 +76,11 @@ pub fn init() {
reset_sigpipe();
}
#[cfg(not(any(target_os = "nacl", target_os = "emscripten", target_os="fuchsia")))]
#[cfg(not(any(target_os = "emscripten", target_os="fuchsia")))]
unsafe fn reset_sigpipe() {
assert!(signal(libc::SIGPIPE, libc::SIG_IGN) != libc::SIG_ERR);
}
#[cfg(any(target_os = "nacl", target_os = "emscripten", target_os="fuchsia"))]
#[cfg(any(target_os = "emscripten", target_os="fuchsia"))]
unsafe fn reset_sigpipe() {}
}
......
......@@ -483,12 +483,10 @@ pub fn home_dir() -> Option<PathBuf> {
#[cfg(any(target_os = "android",
target_os = "ios",
target_os = "nacl",
target_os = "emscripten"))]
unsafe fn fallback() -> Option<OsString> { None }
#[cfg(not(any(target_os = "android",
target_os = "ios",
target_os = "nacl",
target_os = "emscripten")))]
unsafe fn fallback() -> Option<OsString> {
let amt = match libc::sysconf(libc::_SC_GETPW_R_SIZE_MAX) {
......
......@@ -464,7 +464,6 @@ unsafe fn sigaddset(set: *mut libc::sigset_t, signum: libc::c_int) -> libc::c_in
// test from being flaky we ignore it on macOS.
#[test]
#[cfg_attr(target_os = "macos", ignore)]
#[cfg_attr(target_os = "nacl", ignore)] // no signals on NaCl.
// When run under our current QEMU emulation test suite this test fails,
// although the reason isn't very clear as to why. For now this test is
// ignored there.
......
......@@ -184,8 +184,8 @@ unsafe fn do_exec(&mut self, stdio: ChildPipes) -> io::Error {
*sys::os::environ() = envp.as_ptr();
}
// NaCl has no signal support.
#[cfg(not(any(target_os = "nacl", target_os = "emscripten")))]
// emscripten has no signal support.
#[cfg(not(any(target_os = "emscripten")))]
{
use mem;
// Reset signal handling so the child process starts in a
......
......@@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![cfg_attr(target_os = "nacl", allow(dead_code))]
/// Common code for printing the backtrace in the same way across the different
/// supported platforms.
......
......@@ -1554,16 +1554,14 @@ pub fn fmt_metrics(&self) -> String {
/// elimination.
///
/// This function is a no-op, and does not even read from `dummy`.
#[cfg(not(any(all(target_os = "nacl", target_arch = "le32"),
target_arch = "asmjs", target_arch = "wasm32")))]
#[cfg(not(any(target_arch = "asmjs", target_arch = "wasm32")))]
pub fn black_box<T>(dummy: T) -> T {
// we need to "use" the argument in some way LLVM can't
// introspect.
unsafe { asm!("" : : "r"(&dummy)) }
dummy
}
#[cfg(any(all(target_os = "nacl", target_arch = "le32"),
target_arch = "asmjs", target_arch = "wasm32"))]
#[cfg(any(target_arch = "asmjs", target_arch = "wasm32"))]
#[inline(never)]
pub fn black_box<T>(dummy: T) -> T {
dummy
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册