Skip to content

Commit e5f2021

Browse files
committed
auto merge of #10874 : vadimcn/rust/integrated-as, r=alexcrichton
Last LLVM update seems to have fixed whatever prevented LLVM integrated assembler from generating correct unwind tables on Windows. This PR switches Windows builds to use internal assembler by default. Compilation via external assembler can still be requested via the newly added `-Z no-integrated-as` option. Closes #8809
2 parents 09db61f + c8498c1 commit e5f2021

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/librustc/driver/driver.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -356,13 +356,7 @@ pub fn phase_5_run_llvm_passes(sess: Session,
356356
trans: &CrateTranslation,
357357
outputs: &OutputFilenames) {
358358

359-
// On Windows, LLVM integrated assembler emits bad stack unwind tables when
360-
// segmented stacks are enabled. However, unwind info directives in assembly
361-
// output are OK, so we generate assembly first and then run it through
362-
// an external assembler.
363-
if sess.targ_cfg.os == abi::OsWin32 &&
364-
(sess.opts.output_type == link::output_type_object ||
365-
sess.opts.output_type == link::output_type_exe) {
359+
if sess.no_integrated_as() {
366360
let output_type = link::output_type_assembly;
367361
let asm_filename = outputs.obj_filename.with_extension("s");
368362

@@ -375,7 +369,7 @@ pub fn phase_5_run_llvm_passes(sess: Session,
375369

376370
link::write::run_assembler(sess, &asm_filename, &outputs.obj_filename);
377371

378-
// Remove assembly source unless --save-temps was specified
372+
// Remove assembly source, unless --save-temps was specified
379373
if !sess.opts.save_temps {
380374
fs::unlink(&asm_filename);
381375
}

src/librustc/driver/session.rs

+6
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ pub static no_prepopulate_passes: uint = 1 << 25;
6666
pub static use_softfp: uint = 1 << 26;
6767
pub static gen_crate_map: uint = 1 << 27;
6868
pub static prefer_dynamic: uint = 1 << 28;
69+
pub static no_integrated_as: uint = 1 << 29;
6970

7071
pub fn debugging_opts_map() -> ~[(&'static str, &'static str, uint)] {
7172
~[("verbose", "in general, enable more debug printouts", verbose),
@@ -117,6 +118,8 @@ pub fn debugging_opts_map() -> ~[(&'static str, &'static str, uint)] {
117118
("soft-float", "Generate software floating point library calls", use_softfp),
118119
("gen-crate-map", "Force generation of a toplevel crate map", gen_crate_map),
119120
("prefer-dynamic", "Prefer dynamic linking to static linking", prefer_dynamic),
121+
("no-integrated-as",
122+
"Use external assembler rather than LLVM's integrated one", no_integrated_as),
120123
]
121124
}
122125

@@ -335,6 +338,9 @@ impl Session_ {
335338
pub fn prefer_dynamic(&self) -> bool {
336339
self.debugging_opt(prefer_dynamic)
337340
}
341+
pub fn no_integrated_as(&self) -> bool {
342+
self.debugging_opt(no_integrated_as)
343+
}
338344

339345
// pointless function, now...
340346
pub fn str_of(&self, id: ast::Ident) -> @str {

src/test/run-pass/test-runner-hides-main.rs

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
// compile-flags:--test
1212
// xfail-fast
13+
// xfail-win32 #10872
1314

1415
extern mod extra;
1516

0 commit comments

Comments
 (0)