Link ffi as a workaround for rust#34486

This commit is contained in:
Josh Stone 2016-10-13 18:26:06 -07:00
parent ee0eb2e7eb
commit 171389492c

View File

@ -8,6 +8,11 @@
%global bootstrap_channel 1.11.0
%global bootstrap_date 2016-08-16
# We generally don't want llvm-static present at all, since llvm-config will
# make us link statically. But we can opt in, e.g. to aid LLVM rebases.
%bcond_without llvm_static
# Rust 1.12 metadata is now unallocated data (.rustc), and in theory it should
# be fine to strip this entirely, since we don't want to expose Rust's unstable
# ABI for linking. However, eu-strip was then clobbering .dynsym when it tried
@ -60,11 +65,20 @@ BuildRequires: make
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: llvm-devel llvm-static
BuildRequires: llvm-devel
BuildRequires: zlib-devel
BuildRequires: python2
BuildRequires: curl
%if %with llvm_static
BuildRequires: llvm-static
BuildRequires: libffi-devel
%else
# Make sure llvm-config doesn't see it.
BuildConflicts: llvm-static
%endif
%if %without bootstrap
BuildRequires: %{name} <= %{version}
BuildRequires: %{name} >= %{bootstrap_channel}
@ -167,6 +181,13 @@ sed -i.nomips -e '/target=mips/,+1s/^/# unsupported /' \
sed -i.libdir -e '/^HLIB_RELATIVE/s/lib$/$$(CFG_LIBDIR_RELATIVE)/' mk/main.mk
%endif
%if %with llvm_static
# Static linking to distro LLVM needs to add -lffi
# https://github.com/rust-lang/rust/issues/34486
sed -i.ffi -e '$a #[link(name = "ffi")] extern {}' \
src/librustc_llvm/lib.rs
%endif
%build