Skip to content

Commit d65b288

Browse files
committed
lang/rust: avoid LLVM targeting SSE2 on i386 by default
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)
1 parent 24f8089 commit d65b288

File tree

5 files changed

+22
-5
lines changed

5 files changed

+22
-5
lines changed

‎Mk/bsd.gecko.mk‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ MOZ_OPTIONS+= --enable-debug --disable-release
395395
STRIP= # ports/184285
396396
.else
397397
MOZ_OPTIONS+= --disable-debug --disable-debug-symbols --enable-release
398-
. if ${MOZILLA_VER:R:R} >= 56
398+
. if ${MOZILLA_VER:R:R} >= 56 && (${MACHINE_CPU:Msse2} || ${ARCH:Maarch64})
399399
MOZ_OPTIONS+= --enable-rust-simd
400400
. endif
401401
.endif

‎lang/rust/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
PORTNAME= rust
55
PORTVERSION?= 1.22.1
6+
PORTREVISION?= 1
67
CATEGORIES= lang
78
MASTER_SITES= http://static.rust-lang.org/dist/:src \
89
LOCAL/dumbbell/rust:rust_bootstrap \
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- src/librustc_back/target/i686_unknown_freebsd.rs.orig 2017-10-09 20:04:51 UTC
2+
+++ src/librustc_back/target/i686_unknown_freebsd.rs
3+
@@ -13,7 +13,7 @@ use target::{Target, TargetResult};
4+
5+
pub fn target() -> TargetResult {
6+
let mut base = super::freebsd_base::opts();
7+
- base.cpu = "pentium4".to_string();
8+
+ base.cpu = "pentiumpro".to_string();
9+
base.max_atomic_width = Some(64);
10+
base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-m32".to_string());
11+
base.stack_probes = true;

‎textproc/ripgrep/Makefile‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
PORTNAME= ripgrep
77
PORTVERSION= 0.7.1
8-
PORTREVISION= 2
8+
PORTREVISION= 3
99
CATEGORIES= textproc
1010

1111
MAINTAINER= petteri.valkonen@iki.fi
@@ -68,11 +68,15 @@ PLIST_FILES= bin/rg \
6868
man/man1/rg.1.gz
6969

7070
OPTIONS_DEFINE= BASH FISH ZSH SIMD
71-
OPTIONS_DEFAULT=BASH FISH ZSH SIMD
71+
OPTIONS_DEFAULT=BASH FISH ZSH
7272

7373
OPTIONS_DEFINE_amd64= AVX
7474
OPTIONS_DEFINE_i386= AVX
7575

76+
OPTIONS_DEFAULT_aarch64=SIMD
77+
OPTIONS_DEFAULT_amd64= ${OPTIONS_DEFAULT_i386}
78+
OPTIONS_DEFAULT_i386= ${MACHINE_CPU:tu:S/SSE2/SIMD/}
79+
7680
AVX_DESC= ${SSE_DESC:S/SSE/AVX/}
7781
FISH_DESC= Install programmable completions for Fish
7882

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

9196
ZSH_PLIST_FILES= share/zsh/site-functions/_rg
9297

‎www/firefox/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
PORTNAME= firefox
55
DISTVERSION= 57.0
6-
PORTREVISION= 2
6+
PORTREVISION= 3
77
PORTEPOCH= 1
88
CATEGORIES= www ipv6
99
MASTER_SITES= MOZILLA/${PORTNAME}/releases/${DISTVERSION}/source \

0 commit comments

Comments
 (0)