Skip to content

Commit 0487292

Browse files
committed
std: Move pc-windows-gnu to SEH-based unwinding
This commit moves the `*-pc-windows-gnu` targets (e.g. the MinGW targets) to use SEH-based unwinding instead of libunwind-based unwinding. There are a number of ramifications on these targets as a result: * Binary distributions of the standard library are no longer tied to a particular compiler toolchain. The MinGW toolchains typically ship with either SEH, Dwarf, or SjLj based unwinding and are binary-incompatible, but with SEH unwinding we'll be able to link with any of the toolchains. * The GNU implementation is now much closer to the MSVC implementation, reducing the amount of duplicated code we'll have to maintain (yay!). * Due to the loss of the libunwind stack unwinder the libbacktrace library is no longer used on Windows. The same unwinding code for MSVC is now used for GNU as well, and unfortunately this has empirically led to worse stack traces in the past. In theory, though, this should be fixed for both MSVC and GNU at the same time! * Due to the lack of a need for frame unwind info registration, the `rsend.o` and `rsbegin.o` startup object files are no longer built. Additionally the `crt2.o` and `dllcrt2.o` files are no longer distributed. It's assumed that the linker in use will inject these as usual. The `-nostdlib` flag is no longer passed to the linker to indicate this. This change also opened up the possibility to reorganize a few modules, so the following changes were also made: * The `custom_unwind_resume` option and all support code was removed from trans as this is no longer necessary. * The `sys_common::unwind` module was refactored to have the platform-specific portions live in `sys::unwind`. * A similar refactoring was applied to backtrace writing (just shuffling some files around). * Documentation was updated in shuffled modules to reflect the current state of affairs.
1 parent 7fce503 commit 0487292

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+238
-987
lines changed

mk/cfg/i686-pc-windows-gnu.mk

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,5 @@ CFG_LDPATH_i686-pc-windows-gnu :=
2222
CFG_RUN_i686-pc-windows-gnu=$(2)
2323
CFG_RUN_TARG_i686-pc-windows-gnu=$(call CFG_RUN_i686-pc-windows-gnu,,$(2))
2424
CFG_GNU_TRIPLE_i686-pc-windows-gnu := i686-w64-mingw32
25-
CFG_THIRD_PARTY_OBJECTS_i686-pc-windows-gnu := crt2.o dllcrt2.o
26-
CFG_INSTALLED_OBJECTS_i686-pc-windows-gnu := crt2.o dllcrt2.o rsbegin.o rsend.o
27-
CFG_RUSTRT_HAS_STARTUP_OBJS_i686-pc-windows-gnu := 1
25+
CFG_THIRD_PARTY_OBJECTS_i686-pc-windows-gnu :=
26+
CFG_INSTALLED_OBJECTS_i686-pc-windows-gnu :=

mk/cfg/x86_64-pc-windows-gnu.mk

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,5 @@ CFG_LDPATH_x86_64-pc-windows-gnu :=
2222
CFG_RUN_x86_64-pc-windows-gnu=$(2)
2323
CFG_RUN_TARG_x86_64-pc-windows-gnu=$(call CFG_RUN_x86_64-pc-windows-gnu,,$(2))
2424
CFG_GNU_TRIPLE_x86_64-pc-windows-gnu := x86_64-w64-mingw32
25-
CFG_THIRD_PARTY_OBJECTS_x86_64-pc-windows-gnu := crt2.o dllcrt2.o
26-
CFG_INSTALLED_OBJECTS_x86_64-pc-windows-gnu := crt2.o dllcrt2.o rsbegin.o rsend.o
27-
CFG_RUSTRT_HAS_STARTUP_OBJS_x86_64-pc-windows-gnu := 1
25+
CFG_THIRD_PARTY_OBJECTS_x86_64-pc-windows-gnu :=
26+
CFG_INSTALLED_OBJECTS_x86_64-pc-windows-gnu :=

mk/dist.mk

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ PKG_FILES := \
5858
libcoretest \
5959
libbacktrace \
6060
rt \
61-
rtstartup \
6261
rustllvm \
6362
snapshots.txt \
6463
rust-installer \

mk/rt.mk

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -291,10 +291,8 @@ BACKTRACE_NAME_$(1) := $$(call CFG_STATIC_LIB_NAME_$(1),backtrace)
291291
BACKTRACE_LIB_$(1) := $$(RT_OUTPUT_DIR_$(1))/$$(BACKTRACE_NAME_$(1))
292292
BACKTRACE_BUILD_DIR_$(1) := $$(RT_OUTPUT_DIR_$(1))/libbacktrace
293293

294-
# We don't use this on platforms that aren't linux-based (with the exception of
295-
# msys2/mingw builds on windows, which use it to read the dwarf debug
296-
# information) so just make the file available, the compilation of libstd won't
297-
# actually build it.
294+
# We don't use this on platforms that aren't linux-based so just make the file
295+
# available, the compilation of libstd won't actually build it.
298296
ifeq ($$(findstring darwin,$$(OSTYPE_$(1))),darwin)
299297
# See comment above
300298
$$(BACKTRACE_LIB_$(1)):
@@ -307,7 +305,7 @@ $$(BACKTRACE_LIB_$(1)):
307305
touch $$@
308306
else
309307

310-
ifeq ($$(findstring msvc,$(1)),msvc)
308+
ifeq ($$(findstring windows,$(1)),windows)
311309
# See comment above
312310
$$(BACKTRACE_LIB_$(1)):
313311
touch $$@
@@ -382,10 +380,6 @@ endif # endif for darwin
382380
ifeq ($$(findstring musl,$(1)),musl)
383381
$$(RT_OUTPUT_DIR_$(1))/%: $$(CFG_MUSL_ROOT)/lib/%
384382
cp $$^ $$@
385-
else
386-
# Ask gcc where it is
387-
$$(RT_OUTPUT_DIR_$(1))/%:
388-
cp $$(shell $$(CC_$(1)) -print-file-name=$$(@F)) $$@
389383
endif
390384

391385
endef

mk/target.mk

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -126,34 +126,6 @@ $$(TBIN$(1)_T_$(2)_H_$(3))/$(4)$$(X_$(2)): \
126126

127127
endef
128128

129-
# Macro for building runtime startup/shutdown object files;
130-
# these are Rust's equivalent of crti.o, crtn.o
131-
#
132-
# $(1) - stage
133-
# $(2) - target triple
134-
# $(3) - host triple
135-
# $(4) - object basename
136-
define TARGET_RUSTRT_STARTUP_OBJ
137-
138-
$$(TLIB$(1)_T_$(2)_H_$(3))/$(4).o: \
139-
$(S)src/rtstartup/$(4).rs \
140-
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.core \
141-
$$(HSREQ$(1)_T_$(2)_H_$(3)) \
142-
| $$(TBIN$(1)_T_$(2)_H_$(3))/
143-
@$$(call E, rustc: $$@)
144-
$$(STAGE$(1)_T_$(2)_H_$(3)) --emit=obj -o $$@ $$<
145-
146-
ifeq ($$(CFG_RUSTRT_HAS_STARTUP_OBJS_$(2)), 1)
147-
# Add dependencies on Rust startup objects to all crates that depend on core.
148-
# This ensures that they are built after core (since they depend on it),
149-
# but before everything else (since they are needed for linking dylib crates).
150-
$$(foreach crate, $$(TARGET_CRATES), \
151-
$$(if $$(findstring core,$$(DEPS_$$(crate))), \
152-
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.$$(crate))) : $$(TLIB$(1)_T_$(2)_H_$(3))/$(4).o
153-
endif
154-
155-
endef
156-
157129
# Every recipe in RUST_TARGET_STAGE_N outputs to $$(TLIB$(1)_T_$(2)_H_$(3),
158130
# a directory that can be cleaned out during the middle of a run of
159131
# the get-snapshot.py script. Therefore, every recipe needs to have
@@ -166,7 +138,10 @@ SNAPSHOT_RUSTC_POST_CLEANUP=$(HBIN0_H_$(CFG_BUILD))/rustc$(X_$(CFG_BUILD))
166138

167139
define TARGET_HOST_RULES
168140

169-
$$(TLIB$(1)_T_$(2)_H_$(3))/:
141+
$$(TLIB$(1)_T_$(2)_H_$(3))/: | $$(SNAPSHOT_RUSTC_POST_CLEANUP)
142+
mkdir -p $$@
143+
144+
$$(TBIN$(1)_T_$(2)_H_$(3))/: | $$(SNAPSHOT_RUSTC_POST_CLEANUP)
170145
mkdir -p $$@
171146

172147
$$(TLIB$(1)_T_$(2)_H_$(3))/%: $$(RT_OUTPUT_DIR_$(2))/% \
@@ -197,8 +172,33 @@ $(foreach host,$(CFG_HOST), \
197172
$(foreach tool,$(TOOLS), \
198173
$(eval $(call TARGET_TOOL,$(stage),$(target),$(host),$(tool)))))))
199174

175+
# FIXME(stage0) - remove everything here after a snapshot
176+
#
177+
# The stage0 compiler requires the rsend.o, rsbegin.o, crt2.o, and dllcrt2.o
178+
# startup objects on the pc-windows-gnu targets, but that's no longer the case.
179+
# Hack in support to the makefiles to ensure that these objects all exist.
180+
#
181+
# Note that the rs*.o files can just be blank object files.
182+
define STARTUP_OBJS_COMPAT
183+
ifeq ($$(findstring pc-windows-gnu,$(2)),pc-windows-gnu)
184+
DUMMY_DEPS_$(2)_H_$(3) := \
185+
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.core \
186+
$$(HSREQ$(1)_T_$(2)_H_$(3))/stamp.core
187+
$$(TLIB$(1)_T_$(2)_H_$(3))/rsend.o $$(TLIB$(1)_T_$(2)_H_$(3))/rsbegin.o: \
188+
$$(DUMMY_DEPS_$(2)_H_$(3) \
189+
| $$(TLIB$(1)_T_$(2)_H_$(3))/ $$(SNAPSHOT_RUSTC_POST_CLEANUP)
190+
$$(CC_$(2)) $$(CFG_GCCISH_CFLAGS_$(2)) -c -x c - -o $$@ < /dev/null
191+
$$(TLIB$(1)_T_$(2)_H_$(3))/dllcrt2.o $$(TLIB$(1)_T_$(2)_H_$(3))/crt2.o: \
192+
$$(DUMMY_DEPS_$(2)_H_$(3) \
193+
| $$(TLIB$(1)_T_$(2)_H_$(3))/ $$(SNAPSHOT_RUSTC_POST_CLEANUP)
194+
cp $$(shell $$(CC_$(2)) -print-file-name=$$(@F)) $$@
195+
$$(TLIB$(1)_T_$(2)_H_$(3))/stamp.std: \
196+
$$(TLIB$(1)_T_$(2)_H_$(3))/rsend.o \
197+
$$(TLIB$(1)_T_$(2)_H_$(3))/rsbegin.o \
198+
$$(TLIB$(1)_T_$(2)_H_$(3))/dllcrt2.o \
199+
$$(TLIB$(1)_T_$(2)_H_$(3))/crt2.o
200+
endif
201+
endef
200202
$(foreach host,$(CFG_HOST), \
201203
$(foreach target,$(CFG_TARGET), \
202-
$(foreach stage,$(STAGES), \
203-
$(foreach obj,rsbegin rsend, \
204-
$(eval $(call TARGET_RUSTRT_STARTUP_OBJ,$(stage),$(target),$(host),$(obj)))))))
204+
$(eval $(call STARTUP_OBJS_COMPAT,0,$(target),$(host)))))

src/doc/book/custom-allocators.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,6 @@ pub extern fn __rust_usable_size(size: usize, _align: usize) -> usize {
138138
# fn main() {}
139139
# #[lang = "panic_fmt"] fn panic_fmt() {}
140140
# #[lang = "eh_personality"] fn eh_personality() {}
141-
# #[lang = "eh_unwind_resume"] extern fn eh_unwind_resume() {}
142-
# #[no_mangle] pub extern fn rust_eh_register_frames () {}
143-
# #[no_mangle] pub extern fn rust_eh_unregister_frames () {}
144141
```
145142

146143
After we compile this crate, it can be used as follows:

src/doc/book/lang-items.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ fn main(argc: isize, argv: *const *const u8) -> isize {
5959

6060
#[lang = "eh_personality"] extern fn eh_personality() {}
6161
#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
62-
# #[lang = "eh_unwind_resume"] extern fn rust_eh_unwind_resume() {}
63-
# #[no_mangle] pub extern fn rust_eh_register_frames () {}
64-
# #[no_mangle] pub extern fn rust_eh_unregister_frames () {}
6562
```
6663

6764
Note the use of `abort`: the `exchange_malloc` lang item is assumed to

src/doc/book/no-stdlib.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@ fn start(_argc: isize, _argv: *const *const u8) -> isize {
3939
// provided by libstd.
4040
#[lang = "eh_personality"] extern fn eh_personality() {}
4141
#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
42-
# #[lang = "eh_unwind_resume"] extern fn rust_eh_unwind_resume() {}
43-
# #[no_mangle] pub extern fn rust_eh_register_frames () {}
44-
# #[no_mangle] pub extern fn rust_eh_unregister_frames () {}
4542
# // fn main() {} tricked you, rustdoc!
4643
```
4744

@@ -66,9 +63,6 @@ pub extern fn main(argc: i32, argv: *const *const u8) -> i32 {
6663

6764
#[lang = "eh_personality"] extern fn eh_personality() {}
6865
#[lang = "panic_fmt"] fn panic_fmt() -> ! { loop {} }
69-
# #[lang = "eh_unwind_resume"] extern fn rust_eh_unwind_resume() {}
70-
# #[no_mangle] pub extern fn rust_eh_register_frames () {}
71-
# #[no_mangle] pub extern fn rust_eh_unregister_frames () {}
7266
# // fn main() {} tricked you, rustdoc!
7367
```
7468

src/librustc/middle/lang_items.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@ lets_do_this! {
340340

341341
EhPersonalityLangItem, "eh_personality", eh_personality;
342342
EhPersonalityCatchLangItem, "eh_personality_catch", eh_personality_catch;
343-
EhUnwindResumeLangItem, "eh_unwind_resume", eh_unwind_resume;
344343
MSVCTryFilterLangItem, "msvc_try_filter", msvc_try_filter;
345344

346345
OwnedBoxLangItem, "owned_box", owned_box;

src/librustc/middle/weak_lang_items.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,6 @@ pub fn check_crate(krate: &hir::Crate,
4343
if items.eh_personality().is_none() {
4444
items.missing.push(lang_items::EhPersonalityLangItem);
4545
}
46-
if sess.target.target.options.custom_unwind_resume &
47-
items.eh_unwind_resume().is_none() {
48-
items.missing.push(lang_items::EhUnwindResumeLangItem);
49-
}
5046

5147
{
5248
let mut cx = Context { sess: sess, items: items };
@@ -123,5 +119,4 @@ impl<'a, 'v> Visitor<'v> for Context<'a> {
123119
weak_lang_items! {
124120
panic_fmt, PanicFmtLangItem, rust_begin_unwind;
125121
eh_personality, EhPersonalityLangItem, rust_eh_personality;
126-
eh_unwind_resume, EhUnwindResumeLangItem, rust_eh_unwind_resume;
127122
}

src/librustc_back/target/mod.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -191,11 +191,6 @@ pub struct TargetOptions {
191191
pub archive_format: String,
192192
/// Is asm!() allowed? Defaults to true.
193193
pub allow_asm: bool,
194-
/// Whether the target uses a custom unwind resumption routine.
195-
/// By default LLVM lowers `resume` instructions into calls to `_Unwind_Resume`
196-
/// defined in libgcc. If this option is enabled, the target must provide
197-
/// `eh_unwind_resume` lang item.
198-
pub custom_unwind_resume: bool,
199194

200195
/// Default crate for allocation symbols to link against
201196
pub lib_allocation_crate: String,
@@ -250,7 +245,6 @@ impl Default for TargetOptions {
250245
post_link_objects: Vec::new(),
251246
late_link_args: Vec::new(),
252247
archive_format: String::new(),
253-
custom_unwind_resume: false,
254248
lib_allocation_crate: "alloc_system".to_string(),
255249
exe_allocation_crate: "alloc_system".to_string(),
256250
allow_asm: true,
@@ -365,7 +359,6 @@ impl Target {
365359
key!(post_link_args, list);
366360
key!(archive_format);
367361
key!(allow_asm, bool);
368-
key!(custom_unwind_resume, bool);
369362

370363
base
371364
}

src/librustc_back/target/windows_base.rs

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn opts() -> TargetOptions {
2323
exe_suffix: ".exe".to_string(),
2424
staticlib_prefix: "".to_string(),
2525
staticlib_suffix: ".lib".to_string(),
26-
no_default_libraries: true,
26+
no_default_libraries: false,
2727
is_like_windows: true,
2828
archive_format: "gnu".to_string(),
2929
pre_link_args: vec!(
@@ -60,30 +60,7 @@ pub fn opts() -> TargetOptions {
6060

6161
// Always enable DEP (NX bit) when it is available
6262
"-Wl,--nxcompat".to_string(),
63-
64-
// Do not use the standard system startup files or libraries when linking
65-
"-nostdlib".to_string(),
66-
),
67-
pre_link_objects_exe: vec!(
68-
"crt2.o".to_string(), // mingw C runtime initialization for executables
69-
"rsbegin.o".to_string(), // Rust compiler runtime initialization, see rsbegin.rs
70-
),
71-
pre_link_objects_dll: vec!(
72-
"dllcrt2.o".to_string(), // mingw C runtime initialization for dlls
73-
"rsbegin.o".to_string(),
74-
),
75-
late_link_args: vec!(
76-
"-lmingwex".to_string(),
77-
"-lmingw32".to_string(),
78-
"-lgcc".to_string(), // alas, mingw* libraries above depend on libgcc
79-
"-lmsvcrt".to_string(),
80-
"-luser32".to_string(),
81-
"-lkernel32".to_string(),
82-
),
83-
post_link_objects: vec!(
84-
"rsend.o".to_string()
8563
),
86-
custom_unwind_resume: true,
8764

8865
.. Default::default()
8966
}

src/librustc_llvm/lib.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2490,3 +2490,17 @@ impl Drop for OperandBundleDef {
24902490
mod llvmdeps {
24912491
include! { env!("CFG_LLVM_LINKAGE_FILE") }
24922492
}
2493+
2494+
// Currenty when compiling LLVM for i686-pc-windows-gnu it will think that it's
2495+
// got "ehtable support", and these two symbols here will be referenced from
2496+
// RTDyldMemoryManager. This class is, however, only really used from jits, so
2497+
// we don't really need it to work. For now just define two dummy symbols, but
2498+
// ideally we'd upstream some patch or configure LLVM in such a way that it
2499+
// doesn't even need these symbols defined.
2500+
#[cfg(all(windows, target_env = "gnu", target_arch = "x86"))]
2501+
pub mod __dummy_llvm_required_symbols {
2502+
#[no_mangle]
2503+
pub extern fn __register_frame(_ptr: *mut u8) {}
2504+
#[no_mangle]
2505+
pub extern fn __deregister_frame(_ptr: *mut u8) {}
2506+
}

src/librustc_trans/trans/base.rs

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -980,11 +980,9 @@ pub fn invoke<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
980980

981981
/// Returns whether this session's target will use SEH-based unwinding.
982982
///
983-
/// This is only true for MSVC targets, and even then the 64-bit MSVC target
984-
/// currently uses SEH-ish unwinding with DWARF info tables to the side (same as
985-
/// 64-bit MinGW) instead of "full SEH".
983+
/// This is currentlyt true for all Windows targets.
986984
pub fn wants_msvc_seh(sess: &Session) -> bool {
987-
sess.target.target.options.is_like_msvc
985+
sess.target.target.options.is_like_windows
988986
}
989987

990988
pub fn avoid_invoke(bcx: Block) -> bool {
@@ -1220,19 +1218,6 @@ pub fn call_lifetime_end(cx: Block, ptr: ValueRef) {
12201218
})
12211219
}
12221220

1223-
// Generates code for resumption of unwind at the end of a landing pad.
1224-
pub fn trans_unwind_resume(bcx: Block, lpval: ValueRef) {
1225-
if !bcx.sess().target.target.options.custom_unwind_resume {
1226-
Resume(bcx, lpval);
1227-
} else {
1228-
let exc_ptr = ExtractValue(bcx, lpval, 0);
1229-
let llunwresume = bcx.fcx.eh_unwind_resume();
1230-
Call(bcx, llunwresume, &[exc_ptr], None, DebugLoc::None);
1231-
Unreachable(bcx);
1232-
}
1233-
}
1234-
1235-
12361221
pub fn call_memcpy(cx: Block, dst: ValueRef, src: ValueRef, n_bytes: ValueRef, align: u32) {
12371222
let _icx = push_ctxt("call_memcpy");
12381223
let ccx = cx.ccx();
@@ -1981,7 +1966,9 @@ pub fn trans_closure<'a, 'b, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
19811966
record_translation_item_as_generated(ccx, fn_ast_id, param_substs);
19821967

19831968
let _icx = push_ctxt("trans_closure");
1984-
attributes::emit_uwtable(llfndecl, true);
1969+
if !wants_msvc_seh(ccx.sess()) {
1970+
attributes::emit_uwtable(llfndecl, true);
1971+
}
19851972

19861973
debug!("trans_closure(..., param_substs={:?})", param_substs);
19871974

src/librustc_trans/trans/cleanup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,7 @@ impl<'blk, 'tcx> CleanupHelperMethods<'blk, 'tcx> for FunctionContext<'blk, 'tcx
747747
.unwrap();
748748
let lp = build::Load(bcx, addr);
749749
base::call_lifetime_end(bcx, addr);
750-
base::trans_unwind_resume(bcx, lp);
750+
build::Resume(bcx, lp);
751751
}
752752
UnwindKind::CleanupPad(_) => {
753753
let pad = build::CleanupPad(bcx, None, &[]);

src/librustc_trans/trans/common.rs

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -534,35 +534,6 @@ impl<'a, 'tcx> FunctionContext<'a, 'tcx> {
534534
}
535535
}
536536
}
537-
538-
// Returns a ValueRef of the "eh_unwind_resume" lang item if one is defined,
539-
// otherwise declares it as an external funtion.
540-
pub fn eh_unwind_resume(&self) -> ValueRef {
541-
use trans::attributes;
542-
assert!(self.ccx.sess().target.target.options.custom_unwind_resume);
543-
match self.ccx.tcx().lang_items.eh_unwind_resume() {
544-
Some(def_id) => {
545-
callee::trans_fn_ref(self.ccx, def_id, ExprId(0),
546-
self.param_substs).val
547-
}
548-
None => {
549-
let mut unwresume = self.ccx.eh_unwind_resume().borrow_mut();
550-
match *unwresume {
551-
Some(llfn) => llfn,
552-
None => {
553-
let fty = Type::func(&[Type::i8p(self.ccx)], &Type::void(self.ccx));
554-
let llfn = declare::declare_fn(self.ccx,
555-
"rust_eh_unwind_resume",
556-
llvm::CCallConv,
557-
fty, ty::FnDiverging);
558-
attributes::unwind(llfn, true);
559-
*unwresume = Some(llfn);
560-
llfn
561-
}
562-
}
563-
}
564-
}
565-
}
566537
}
567538

568539
// Basic block context. We create a block context for each basic block

0 commit comments

Comments
 (0)