-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #56840 - pietroalbini:rollup, r=pietroalbini
Rollup of 14 pull requests Successful merges: - #56718 (Use libbacktrace pretty-printing) - #56725 (fix rust-lang/rust issue #50583) - #56731 (Add missing urls in ffi module docs) - #56738 (Fix private_no_mangle_fns message grammar) - #56746 (Add test of current behavior (infer free region within closure body)) - #56747 (target: remove Box returned by get_targets) - #56751 (Allow ptr::hash to accept fat pointers) - #56755 (Account for `impl Trait` when suggesting lifetime) - #56758 (Add short emoji status to toolstate updates) - #56760 (Deduplicate unsatisfied trait bounds) - #56769 (Add x86_64-unknown-uefi target) - #56792 (Bootstrap: Add testsuite for compiletest tool) - #56808 (Fixes broken links) - #56809 (Fix docs path to PermissionsExt) Failed merges: r? @ghost
- Loading branch information
Showing
27 changed files
with
419 additions
and
96 deletions.
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
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
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
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
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,74 @@ | ||
// Copyright 2018 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. | ||
|
||
// This defines a base target-configuration for native UEFI systems. The UEFI specification has | ||
// quite detailed sections on the ABI of all the supported target architectures. In almost all | ||
// cases it simply follows what Microsoft Windows does. Hence, whenever in doubt, see the MSDN | ||
// documentation. | ||
// UEFI uses COFF/PE32+ format for binaries. All binaries must be statically linked. No dynamic | ||
// linker is supported. As native to COFF, binaries are position-dependent, but will be relocated | ||
// by the loader if the pre-chosen memory location is already in use. | ||
// UEFI forbids running code on anything but the boot-CPU. Not interrupts are allowed other than | ||
// the timer-interrupt. Device-drivers are required to use polling-based models. Furthermore, all | ||
// code runs in the same environment, no process separation is supported. | ||
|
||
use spec::{LinkArgs, LinkerFlavor, LldFlavor, PanicStrategy, TargetOptions}; | ||
use std::default::Default; | ||
|
||
pub fn opts() -> TargetOptions { | ||
let mut pre_link_args = LinkArgs::new(); | ||
|
||
pre_link_args.insert(LinkerFlavor::Lld(LldFlavor::Link), vec![ | ||
// Suppress the verbose logo and authorship debugging output, which would needlessly | ||
// clog any log files. | ||
"/NOLOGO".to_string(), | ||
|
||
// UEFI is fully compatible to non-executable data pages. Tell the compiler that | ||
// non-code sections can be marked as non-executable, including stack pages. | ||
"/NXCOMPAT".to_string(), | ||
|
||
// There is no runtime for UEFI targets, prevent them from being linked. UEFI targets | ||
// must be freestanding. | ||
"/nodefaultlib".to_string(), | ||
|
||
// Non-standard subsystems have no default entry-point in PE+ files. We have to define | ||
// one. "efi_main" seems to be a common choice amongst other implementations and the | ||
// spec. | ||
"/entry:efi_main".to_string(), | ||
|
||
// COFF images have a "Subsystem" field in their header, which defines what kind of | ||
// program it is. UEFI has 3 fields reserved, which are EFI_APPLICATION, | ||
// EFI_BOOT_SERVICE_DRIVER, and EFI_RUNTIME_DRIVER. We default to EFI_APPLICATION, | ||
// which is very likely the most common option. Individual projects can override this | ||
// with custom linker flags. | ||
// The subsystem-type only has minor effects on the application. It defines the memory | ||
// regions the application is loaded into (runtime-drivers need to be put into | ||
// reserved areas), as well as whether a return from the entry-point is treated as | ||
// exit (default for applications). | ||
"/subsystem:efi_application".to_string(), | ||
]); | ||
|
||
TargetOptions { | ||
dynamic_linking: false, | ||
executables: true, | ||
disable_redzone: true, | ||
exe_suffix: ".efi".to_string(), | ||
allows_weak_linkage: false, | ||
panic_strategy: PanicStrategy::Abort, | ||
singlethread: true, | ||
emit_debug_gdb_scripts: false, | ||
|
||
linker: Some("lld-link".to_string()), | ||
lld_flavor: LldFlavor::Link, | ||
pre_link_args, | ||
|
||
.. Default::default() | ||
} | ||
} |
Oops, something went wrong.