Allow not emitting uwtable
on Android
This commit is contained in:
parent
2b8fbe6b0b
commit
f900ee331d
@ -863,7 +863,7 @@ impl Session {
|
|||||||
} else if self.target.requires_uwtable {
|
} else if self.target.requires_uwtable {
|
||||||
true
|
true
|
||||||
} else {
|
} else {
|
||||||
self.opts.cg.force_unwind_tables.unwrap_or(false)
|
self.opts.cg.force_unwind_tables.unwrap_or(self.target.default_uwtable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,10 @@ pub fn opts() -> TargetOptions {
|
|||||||
base.dwarf_version = Some(2);
|
base.dwarf_version = Some(2);
|
||||||
base.position_independent_executables = true;
|
base.position_independent_executables = true;
|
||||||
base.has_elf_tls = false;
|
base.has_elf_tls = false;
|
||||||
base.requires_uwtable = true;
|
// This is for backward compatibility, see https://github.com/rust-lang/rust/issues/49867
|
||||||
|
// for context. (At that time, there was no `-C force-unwind-tables`, so the only solution
|
||||||
|
// was to always emit `uwtable`).
|
||||||
|
base.default_uwtable = true;
|
||||||
base.crt_static_respected = false;
|
base.crt_static_respected = false;
|
||||||
base
|
base
|
||||||
}
|
}
|
||||||
|
@ -1111,6 +1111,10 @@ pub struct TargetOptions {
|
|||||||
/// unwinders.
|
/// unwinders.
|
||||||
pub requires_uwtable: bool,
|
pub requires_uwtable: bool,
|
||||||
|
|
||||||
|
/// Whether or not to emit `uwtable` attributes on functions if `-C force-unwind-tables`
|
||||||
|
/// is not specified and `uwtable` is not required on this target.
|
||||||
|
pub default_uwtable: bool,
|
||||||
|
|
||||||
/// Whether or not SIMD types are passed by reference in the Rust ABI,
|
/// Whether or not SIMD types are passed by reference in the Rust ABI,
|
||||||
/// typically required if a target can be compiled with a mixed set of
|
/// typically required if a target can be compiled with a mixed set of
|
||||||
/// target features. This is `true` by default, and `false` for targets like
|
/// target features. This is `true` by default, and `false` for targets like
|
||||||
@ -1248,6 +1252,7 @@ impl Default for TargetOptions {
|
|||||||
default_hidden_visibility: false,
|
default_hidden_visibility: false,
|
||||||
emit_debug_gdb_scripts: true,
|
emit_debug_gdb_scripts: true,
|
||||||
requires_uwtable: false,
|
requires_uwtable: false,
|
||||||
|
default_uwtable: false,
|
||||||
simd_types_indirect: true,
|
simd_types_indirect: true,
|
||||||
limit_rdylib_exports: true,
|
limit_rdylib_exports: true,
|
||||||
override_export_symbols: None,
|
override_export_symbols: None,
|
||||||
@ -1711,6 +1716,7 @@ impl Target {
|
|||||||
key!(default_hidden_visibility, bool);
|
key!(default_hidden_visibility, bool);
|
||||||
key!(emit_debug_gdb_scripts, bool);
|
key!(emit_debug_gdb_scripts, bool);
|
||||||
key!(requires_uwtable, bool);
|
key!(requires_uwtable, bool);
|
||||||
|
key!(default_uwtable, bool);
|
||||||
key!(simd_types_indirect, bool);
|
key!(simd_types_indirect, bool);
|
||||||
key!(limit_rdylib_exports, bool);
|
key!(limit_rdylib_exports, bool);
|
||||||
key!(override_export_symbols, opt_list);
|
key!(override_export_symbols, opt_list);
|
||||||
@ -1947,6 +1953,7 @@ impl ToJson for Target {
|
|||||||
target_option_val!(default_hidden_visibility);
|
target_option_val!(default_hidden_visibility);
|
||||||
target_option_val!(emit_debug_gdb_scripts);
|
target_option_val!(emit_debug_gdb_scripts);
|
||||||
target_option_val!(requires_uwtable);
|
target_option_val!(requires_uwtable);
|
||||||
|
target_option_val!(default_uwtable);
|
||||||
target_option_val!(simd_types_indirect);
|
target_option_val!(simd_types_indirect);
|
||||||
target_option_val!(limit_rdylib_exports);
|
target_option_val!(limit_rdylib_exports);
|
||||||
target_option_val!(override_export_symbols);
|
target_option_val!(override_export_symbols);
|
||||||
|
15
src/test/codegen/default-requires-uwtable.rs
Normal file
15
src/test/codegen/default-requires-uwtable.rs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// revisions: WINDOWS ANDROID
|
||||||
|
// needs-llvm-components: x86 arm
|
||||||
|
// compile-flags: -C panic=abort
|
||||||
|
// [WINDOWS] compile-flags: --target=x86_64-pc-windows-msvc
|
||||||
|
// [ANDROID] compile-flags: --target=armv7-linux-androideabi
|
||||||
|
|
||||||
|
#![feature(no_core, lang_items)]
|
||||||
|
#![crate_type = "lib"]
|
||||||
|
#![no_core]
|
||||||
|
|
||||||
|
#[lang = "sized"]
|
||||||
|
trait Sized {}
|
||||||
|
|
||||||
|
// CHECK: attributes #{{.*}} uwtable
|
||||||
|
pub fn foo() {}
|
7
src/test/codegen/force-no-unwind-tables.rs
Normal file
7
src/test/codegen/force-no-unwind-tables.rs
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// compile-flags: -C no-prepopulate-passes -C panic=abort -C force-unwind-tables=n
|
||||||
|
// ignore-windows
|
||||||
|
|
||||||
|
#![crate_type="lib"]
|
||||||
|
|
||||||
|
// CHECK-NOT: attributes #{{.*}} uwtable
|
||||||
|
pub fn foo() {}
|
Loading…
x
Reference in New Issue
Block a user