-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for FreeBSD on PowerPC64 #57758
Changes from all commits
02204eb
52330d4
bc8b4bb
c47fc9d
3a1198c
8bc75aa
e739c81
df9095f
a9829b4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -263,7 +263,12 @@ fn main() { | |
} else if cxxflags.contains("stdlib=libc++") { | ||
println!("cargo:rustc-link-lib=c++"); | ||
} else { | ||
println!("cargo:rustc-link-lib={}", stdcppname); | ||
if target.contains("powerpc64-unknown-freebsd") { | ||
println!("cargo:rustc-link-search=native=/usr/local/lib/gcc6"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you put gcc8, this is our default gcc version since a few weeks. |
||
println!("cargo:rustc-link-lib=static=stdc++"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This particular piece of code should perhaps be moved slightly up to where |
||
} else { | ||
println!("cargo:rustc-link-lib={}", stdcppname); | ||
} | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use spec::{LinkerFlavor, Target, TargetResult}; | ||
|
||
pub fn target() -> TargetResult { | ||
let mut base = super::freebsd_base::opts(); | ||
base.cpu = "ppc64".to_string(); | ||
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m64".to_string()); | ||
base.max_atomic_width = Some(64); | ||
|
||
Ok(Target { | ||
llvm_target: "powerpc64-unknown-freebsd".to_string(), | ||
target_endian: "big".to_string(), | ||
target_pointer_width: "64".to_string(), | ||
target_c_int_width: "32".to_string(), | ||
data_layout: "E-m:e-i64:64-n32:64".to_string(), | ||
arch: "powerpc64".to_string(), | ||
target_os: "freebsd".to_string(), | ||
target_env: String::new(), | ||
target_vendor: "unknown".to_string(), | ||
linker_flavor: LinkerFlavor::Gcc, | ||
options: base, | ||
}) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does
llvm-config
not print this path out? If I remember my freebsd correctly, this would mean thatgcc
would be required to build rustc then. Which is not that big of a deal, but still something to improve on.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FreeBSD on powerpc64 ships an old version of gcc (4.2.1) in the 'base' system, since it can't build llvm I had to use gcc7 from our 'ports tree'. For whatever reason the linker tried to link 'something' against libstdc++ from gcc-4.2.1 instead of libstdc++ from gcc7 and the link failed (I was not able to figure out how to pass -Wl,-rpath=/usr/local/lib/gcc7). Linking to a static version of libstdc++ made the problem go away.
This is just an ugly hack to fix a FreeBSD problem and should probably stays as a patch file in our 'ports tree'