@@ -3,7 +3,6 @@ use std::env;
3
3
use std:: time:: Instant ;
4
4
5
5
use gccjit:: {
6
- Context ,
7
6
FunctionType ,
8
7
GlobalKind ,
9
8
} ;
@@ -18,8 +17,9 @@ use rustc_codegen_ssa::mono_item::MonoItemExt;
18
17
use rustc_codegen_ssa:: traits:: DebugInfoMethods ;
19
18
use rustc_session:: config:: DebugInfo ;
20
19
use rustc_span:: Symbol ;
20
+ use rustc_target:: spec:: PanicStrategy ;
21
21
22
- use crate :: { LockedTargetInfo , gcc_util} ;
22
+ use crate :: { LockedTargetInfo , gcc_util, new_context } ;
23
23
use crate :: GccContext ;
24
24
use crate :: builder:: Builder ;
25
25
use crate :: context:: CodegenCx ;
@@ -88,20 +88,18 @@ pub fn compile_codegen_unit(tcx: TyCtxt<'_>, cgu_name: Symbol, target_info: Lock
88
88
fn module_codegen ( tcx : TyCtxt < ' _ > , ( cgu_name, target_info) : ( Symbol , LockedTargetInfo ) ) -> ModuleCodegen < GccContext > {
89
89
let cgu = tcx. codegen_unit ( cgu_name) ;
90
90
// Instantiate monomorphizations without filling out definitions yet...
91
- let context = Context :: default ( ) ;
91
+ let context = new_context ( & tcx ) ;
92
92
93
- context. add_command_line_option ( "-fexceptions" ) ;
94
- context. add_driver_option ( "-fexceptions" ) ;
93
+ if tcx. sess . panic_strategy ( ) == PanicStrategy :: Unwind {
94
+ context. add_command_line_option ( "-fexceptions" ) ;
95
+ context. add_driver_option ( "-fexceptions" ) ;
96
+ }
95
97
96
98
let disabled_features: HashSet < _ > = tcx. sess . opts . cg . target_feature . split ( ',' )
97
99
. filter ( |feature| feature. starts_with ( '-' ) )
98
100
. map ( |string| & string[ 1 ..] )
99
101
. collect ( ) ;
100
102
101
- if tcx. sess . target . arch == "x86" || tcx. sess . target . arch == "x86_64" {
102
- context. add_command_line_option ( "-masm=intel" ) ;
103
- }
104
-
105
103
if !disabled_features. contains ( "avx" ) && tcx. sess . target . arch == "x86_64" {
106
104
// NOTE: we always enable AVX because the equivalent of llvm.x86.sse2.cmp.pd in GCC for
107
105
// SSE2 is multiple builtins, so we use the AVX __builtin_ia32_cmppd instead.
0 commit comments