Merge branch 'master' into rusty-hermit

This commit is contained in:
Stefan Lankes 2019-10-20 10:48:58 +02:00 committed by GitHub
commit b6801b7dcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1077 changed files with 17752 additions and 10318 deletions

View file

@ -738,7 +738,11 @@ impl FieldPlacement {
pub fn offset(&self, i: usize) -> Size {
match *self {
FieldPlacement::Union(_) => Size::ZERO,
FieldPlacement::Union(count) => {
assert!(i < count,
"Tried to access field {} of union with {} fields", i, count);
Size::ZERO
},
FieldPlacement::Array { stride, count } => {
let i = i as u64;
assert!(i < count);

View file

@ -691,6 +691,9 @@ pub struct TargetOptions {
/// defined in libgcc. If this option is enabled, the target must provide
/// `eh_unwind_resume` lang item.
pub custom_unwind_resume: bool,
/// Whether the runtime startup code requires the `main` function be passed
/// `argc` and `argv` values.
pub main_needs_argc_argv: bool,
/// Flag indicating whether ELF TLS (e.g., #[thread_local]) is available for
/// this target.
@ -849,6 +852,7 @@ impl Default for TargetOptions {
link_env_remove: Vec::new(),
archive_format: "gnu".to_string(),
custom_unwind_resume: false,
main_needs_argc_argv: true,
allow_asm: true,
has_elf_tls: false,
obj_is_bitcode: false,
@ -1159,6 +1163,7 @@ impl Target {
key!(archive_format);
key!(allow_asm, bool);
key!(custom_unwind_resume, bool);
key!(main_needs_argc_argv, bool);
key!(has_elf_tls, bool);
key!(obj_is_bitcode, bool);
key!(no_integrated_as, bool);
@ -1376,6 +1381,7 @@ impl ToJson for Target {
target_option_val!(archive_format);
target_option_val!(allow_asm);
target_option_val!(custom_unwind_resume);
target_option_val!(main_needs_argc_argv);
target_option_val!(has_elf_tls);
target_option_val!(obj_is_bitcode);
target_option_val!(no_integrated_as);

View file

@ -101,6 +101,10 @@ pub fn target() -> Result<Target, String> {
// without a main function.
options.crt_static_allows_dylibs = true;
// WASI's `sys::args::init` function ignores its arguments; instead,
// `args::args()` makes the WASI API calls itself.
options.main_needs_argc_argv = false;
Ok(Target {
llvm_target: "wasm32-wasi".to_string(),
target_endian: "little".to_string(),