File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
crates/rustc_codegen_nvvm_v7 Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,34 @@ pub fn tracked_env_var_os<K: AsRef<OsStr> + Display>(key: K) -> Option<OsString>
143143 env:: var_os ( key)
144144}
145145
146+ fn run_llvm_as ( ) {
147+ // Check if libintrinsics.ll exists
148+ let libintrinsics_path = Path :: new ( "libintrinsics.ll" ) ;
149+ if !libintrinsics_path. exists ( ) {
150+ fail ( "libintrinsics.ll not found" ) ;
151+ }
152+
153+ println ! ( "cargo:rerun-if-changed=libintrinsics.ll" ) ;
154+
155+ let mut cmd = Command :: new ( "llvm-as-7" ) ;
156+ cmd. arg ( "libintrinsics.ll" ) ;
157+
158+ let output = match cmd. stderr ( Stdio :: inherit ( ) ) . output ( ) {
159+ Ok ( status) => status,
160+ Err ( e) => fail ( & format ! (
161+ "failed to execute llvm-as: {:?}\n error: {}" ,
162+ cmd, e
163+ ) ) ,
164+ } ;
165+
166+ if !output. status . success ( ) {
167+ fail ( & format ! (
168+ "llvm-as failed: {:?}\n status: {}" ,
169+ cmd, output. status
170+ ) ) ;
171+ }
172+ }
173+
146174fn rustc_llvm_build ( ) {
147175 let target = env:: var ( "TARGET" ) . expect ( "TARGET was not set" ) ;
148176 let llvm_config = find_llvm_config ( & target) ;
@@ -165,6 +193,9 @@ fn rustc_llvm_build() {
165193 println ! ( "cargo:rustc-cfg=llvm_component=\" {}\" " , component) ;
166194 }
167195
196+ // Run llvm-as on libintrinsics.ll
197+ run_llvm_as ( ) ;
198+
168199 // Link in our own LLVM shims, compiled with the same flags as LLVM
169200 let mut cmd = Command :: new ( & llvm_config) ;
170201 cmd. arg ( "--cxxflags" ) ;
You can’t perform that action at this time.
0 commit comments