Skip to content

Commit 33cd9cf

Browse files
committed
powerpc: initialize llvm
1 parent c8442af commit 33cd9cf

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
use target::Target;
12+
13+
pub fn target() -> Target {
14+
let mut base = super::linux_base::opts();
15+
base.pre_link_args.push("-m32".to_string());
16+
17+
Target {
18+
data_layout: "E-S8-p:32:32-f64:32:64-i64:32:64-f80:32:32-n8:16:32".to_string(),
19+
llvm_target: "powerpc-unknown-linux-gnu".to_string(),
20+
target_endian: "big".to_string(),
21+
target_word_size: "32".to_string(),
22+
arch: "powerpc".to_string(),
23+
target_os: "linux".to_string(),
24+
options: base,
25+
}
26+
}

src/librustc_llvm/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,6 +1974,11 @@ extern {
19741974
pub fn LLVMInitializeMipsTargetMC();
19751975
pub fn LLVMInitializeMipsAsmPrinter();
19761976
pub fn LLVMInitializeMipsAsmParser();
1977+
pub fn LLVMInitializePowerPCTargetInfo();
1978+
pub fn LLVMInitializePowerPCTarget();
1979+
pub fn LLVMInitializePowerPCTargetMC();
1980+
pub fn LLVMInitializePowerPCAsmPrinter();
1981+
pub fn LLVMInitializePowerPCAsmParser();
19771982

19781983
pub fn LLVMRustAddPass(PM: PassManagerRef, Pass: *const c_char) -> bool;
19791984
pub fn LLVMRustCreateTargetMachine(Triple: *const c_char,
@@ -2249,6 +2254,12 @@ pub unsafe fn static_link_hack_this_sucks() {
22492254
LLVMInitializeMipsAsmPrinter();
22502255
LLVMInitializeMipsAsmParser();
22512256

2257+
LLVMInitializePowerPCTargetInfo();
2258+
LLVMInitializePowerPCTarget();
2259+
LLVMInitializePowerPCTargetMC();
2260+
LLVMInitializePowerPCAsmPrinter();
2261+
LLVMInitializePowerPCAsmParser();
2262+
22522263
LLVMRustSetLLVMOptions(0 as c_int,
22532264
0 as *const _);
22542265

src/librustc_trans/back/write.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,6 +1039,12 @@ unsafe fn configure_llvm(sess: &Session) {
10391039
llvm::LLVMInitializeMipsAsmPrinter();
10401040
llvm::LLVMInitializeMipsAsmParser();
10411041

1042+
llvm::LLVMInitializePowerPCTargetInfo();
1043+
llvm::LLVMInitializePowerPCTarget();
1044+
llvm::LLVMInitializePowerPCTargetMC();
1045+
llvm::LLVMInitializePowerPCAsmPrinter();
1046+
llvm::LLVMInitializePowerPCAsmParser();
1047+
10421048
llvm::LLVMRustSetLLVMOptions(llvm_args.len() as c_int,
10431049
llvm_args.as_ptr());
10441050
});

0 commit comments

Comments
 (0)