Skip to content

Commit

Permalink
lang/rust: avoid LLVM targeting SSE2 on i386 by default
Browse files Browse the repository at this point in the history
This may help ports like textproc/ripgrep to run on old hardware.
Rust itself still requires SSE2 until bootstrap is regenerated.

PR:		223415
Approved by:	rust (dumbbell)
  • Loading branch information
jbeich committed Nov 27, 2017
1 parent 24f8089 commit d65b288
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Mk/bsd.gecko.mk
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ MOZ_OPTIONS+= --enable-debug --disable-release
STRIP= # ports/184285
.else
MOZ_OPTIONS+= --disable-debug --disable-debug-symbols --enable-release
. if ${MOZILLA_VER:R:R} >= 56
. if ${MOZILLA_VER:R:R} >= 56 && (${MACHINE_CPU:Msse2} || ${ARCH:Maarch64})
MOZ_OPTIONS+= --enable-rust-simd
. endif
.endif
Expand Down
1 change: 1 addition & 0 deletions lang/rust/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

PORTNAME= rust
PORTVERSION?= 1.22.1
PORTREVISION?= 1
CATEGORIES= lang
MASTER_SITES= http://static.rust-lang.org/dist/:src \
LOCAL/dumbbell/rust:rust_bootstrap \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- src/librustc_back/target/i686_unknown_freebsd.rs.orig 2017-10-09 20:04:51 UTC
+++ src/librustc_back/target/i686_unknown_freebsd.rs
@@ -13,7 +13,7 @@ use target::{Target, TargetResult};

pub fn target() -> TargetResult {
let mut base = super::freebsd_base::opts();
- base.cpu = "pentium4".to_string();
+ base.cpu = "pentiumpro".to_string();
base.max_atomic_width = Some(64);
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string());
base.stack_probes = true;
11 changes: 8 additions & 3 deletions textproc/ripgrep/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

PORTNAME= ripgrep
PORTVERSION= 0.7.1
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= textproc

MAINTAINER= [email protected]
Expand Down Expand Up @@ -68,11 +68,15 @@ PLIST_FILES= bin/rg \
man/man1/rg.1.gz

OPTIONS_DEFINE= BASH FISH ZSH SIMD
OPTIONS_DEFAULT=BASH FISH ZSH SIMD
OPTIONS_DEFAULT=BASH FISH ZSH

OPTIONS_DEFINE_amd64= AVX
OPTIONS_DEFINE_i386= AVX

OPTIONS_DEFAULT_aarch64=SIMD
OPTIONS_DEFAULT_amd64= ${OPTIONS_DEFAULT_i386}
OPTIONS_DEFAULT_i386= ${MACHINE_CPU:tu:S/SSE2/SIMD/}

AVX_DESC= ${SSE_DESC:S/SSE/AVX/}
FISH_DESC= Install programmable completions for Fish

Expand All @@ -86,7 +90,8 @@ FISH_PLIST_FILES= share/fish/completions/rg.fish
# unstable features similar to how lang/rust bootstraps. www/firefox
# uses the same hack when building with --enable-rust-simd.
SIMD_MAKE_ENV= RUSTC_BOOTSTRAP=1
SIMD_VARS= CARGO_FEATURES+=simd-accel
SIMD_VARS= CARGO_FEATURES+=simd-accel ${SIMD_VARS_${ARCH}}
SIMD_VARS_i386= RUSTFLAGS+="-C target-feature=+sse2"

ZSH_PLIST_FILES= share/zsh/site-functions/_rg

Expand Down
2 changes: 1 addition & 1 deletion www/firefox/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

PORTNAME= firefox
DISTVERSION= 57.0
PORTREVISION= 2
PORTREVISION= 3
PORTEPOCH= 1
CATEGORIES= www ipv6
MASTER_SITES= MOZILLA/${PORTNAME}/releases/${DISTVERSION}/source \
Expand Down

0 comments on commit d65b288

Please sign in to comment.