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_channel 1.11.0
%global bootstrap_date 2016-08-16 %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 # 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 # 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 # ABI for linking. However, eu-strip was then clobbering .dynsym when it tried
@ -60,11 +65,20 @@ BuildRequires: make
BuildRequires: cmake BuildRequires: cmake
BuildRequires: gcc BuildRequires: gcc
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: llvm-devel llvm-static BuildRequires: llvm-devel
BuildRequires: zlib-devel BuildRequires: zlib-devel
BuildRequires: python2 BuildRequires: python2
BuildRequires: curl 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 %if %without bootstrap
BuildRequires: %{name} <= %{version} BuildRequires: %{name} <= %{version}
BuildRequires: %{name} >= %{bootstrap_channel} 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 sed -i.libdir -e '/^HLIB_RELATIVE/s/lib$/$$(CFG_LIBDIR_RELATIVE)/' mk/main.mk
%endif %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 %build