Install cross LTO plugin when installing qemu-accel 37/38137/1 accepted/tizen/3.0.2015.q2/common/20150616.100208 accepted/tizen/common/20150616.100059 submit/tizen_3.0.2015.q2_common/20150616.095826 submit/tizen_common/20150616.095732
authorNikolai Bozhenov <n.bozhenov@samsung.com>
Tue, 24 Feb 2015 12:08:25 +0000 (15:08 +0300)
committerNikolai Bozhenov <n.bozhenov@samsung.com>
Mon, 13 Apr 2015 13:27:01 +0000 (16:27 +0300)
So that binutils can work with LTO objects without additional flags
in qemu-accel mode

Change-Id: Ic50d79a6453a51ca39e7dc6b251190e70304dae2

packaging/baselibs.conf
packaging/qemu-accel-aarch64.spec
packaging/qemu-accel-armv7l.spec
packaging/qemu-accel.spec.in

index 73d841c..8bfedf9 100644 (file)
@@ -63,6 +63,22 @@ qemu-accel-armv7l
     post "    ln -s /usr/lib/gcc/armv7l-tizen-linux-gnueabi/${GCCVER}/$f /usr/armv7l-tizen-linux-gnueabi/bin/$f;"
     post "  done"
     post "fi"
+    post ""
+    post "HOST_ARCH=`echo -n %{_host_cpu} | sed -e 's/i.86/i586/'`"
+    post "ACCEL_DIR=/emul/$HOST_ARCH-for-arm"
+    post "mkdir -p %_bindir/../lib/bfd-plugins"
+    post "%_sbindir/update-alternatives --install \"
+    post "    %_bindir/../lib/bfd-plugins/liblto_plugin_%{_arch}.so \"
+    post "    liblto_plugin_%{_arch}.so \"
+    post "    $ACCEL_DIR/usr/lib/gcc/armv7l-tizen-linux-gnueabi/${GCCVER}/liblto_plugin.so \"
+    post "    3"
+    post ""
+    postun "HOST_ARCH=`echo -n %{_host_cpu} | sed -e 's/i.86/i586/'`"
+    postun "ACCEL_DIR=/emul/$HOST_ARCH-for-arm"
+    postun "GCCVER=$(LANG=C gcc --version | head -1 | sed -e "s/^.*gcc[^0-9]*\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*$/\1.\2/") "
+    postun "%_sbindir/update-alternatives --remove \"
+    postun "    liblto_plugin_%{_arch}.so          \"
+    postun "    $ACCEL_DIR/usr/lib/gcc/armv7l-tizen-linux-gnueabi/${GCCVER}/liblto_plugin.so"
     +/
 
 qemu-accel-aarch64
@@ -129,4 +145,20 @@ qemu-accel-aarch64
     post "    ln -s /usr/lib64/gcc/aarch64-tizen-linux/${GCCVER}/$f /usr/lib/$f;"
     post "  done"
     post "fi"
+    post ""
+    post "HOST_ARCH=`echo -n %{_host_cpu} | sed -e 's/i.86/i586/'`"
+    post "ACCEL_DIR=/emul/$HOST_ARCH-for-aarch64"
+    post "mkdir -p %_bindir/../lib/bfd-plugins"
+    post "%_sbindir/update-alternatives --install \"
+    post "    %_bindir/../lib/bfd-plugins/liblto_plugin_%{_arch}.so \"
+    post "    liblto_plugin_%{_arch}.so \"
+    post "    $ACCEL_DIR/usr/lib/gcc/aarch64-tizen-linux/${GCCVER}/liblto_plugin.so \"
+    post "    3"
+    post ""
+    postun "HOST_ARCH=`echo -n %{_host_cpu} | sed -e 's/i.86/i586/'`"
+    postun "ACCEL_DIR=/emul/$HOST_ARCH-for-aarch64"
+    postun "GCCVER=$(LANG=C gcc --version | head -1 | sed -e "s/^.*gcc[^0-9]*\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*$/\1.\2/") "
+    postun "%_sbindir/update-alternatives --remove \"
+    postun "    liblto_plugin_%{_arch}.so \"
+    postun "    $ACCEL_DIR/usr/lib/gcc/aarch64-tizen-linux/${GCCVER}/liblto_plugin.so"
     +/
index e4f4b26..5536629 100644 (file)
@@ -59,6 +59,8 @@ BuildRequires:  qemu-linux-user
 BuildRequires: elfutils
 BuildRequires: libxslt-tools
 Requires:       coreutils
+Requires(post): update-alternatives
+Requires(postun): update-alternatives
 Summary:        Native binaries for speeding up cross compile
 License:        GPL-2.0
 Group:          Development/Cross Compilation
@@ -76,6 +78,11 @@ ExclusiveArch:  x86_64 %ix86
 %define binaries_binutils addr2line ar as elfedit gprof ld ld.bfd ld.gold nm objcopy objdump ranlib readelf size strings strip
 %define binaries_binutils_comma %(echo %{binaries_binutils} | sed -e "s/ /,/g")
 
+%define bfd_plugin_dir      %{_bindir}/../lib/bfd-plugins
+%define bfd_plugin_lto_name liblto_plugin_%{_arch}.so
+%define bfd_plugin_lto      %{bfd_plugin_dir}/%{bfd_plugin_lto_name}
+%define gcc_plugin_lto %{our_path}%{_libdir}/gcc/%{emulated_arch_triple_long}/%{gcc_version_dot}/liblto_plugin.so
+
 %description
 This package is used in %{emulated_arch_long} architecture builds using qemu to speed up builds
 with native binaries.
@@ -288,11 +295,17 @@ ln -s %{our_path}/usr/sbin %{buildroot}/%{our_path}/sbin
 ln -s %{our_path}/usr/bin/rpm %{buildroot}/%{our_path}/usr/bin/rpmquery
 ln -s %{our_path}/usr/bin/rpm %{buildroot}/%{our_path}/usr/bin/rpmverify
 
+mkdir -p "%{buildroot}%{bfd_plugin_dir}"
+touch "%{buildroot}%{bfd_plugin_lto}"
+
 %post
 ldconfig
+"%_sbindir/update-alternatives" --install \
+    "%{bfd_plugin_lto}" "%{bfd_plugin_lto_name}" "%{gcc_plugin_lto}" 3
 
 %postun
 ldconfig
+"%_sbindir/update-alternatives" --remove %{bfd_plugin_lto_name} "%{gcc_plugin_lto}"
 
 %files
 %defattr(-,root,root)
@@ -301,5 +314,6 @@ ldconfig
 /usr/%{emulated_arch_triple_long}/include
 /emul
 /qemu
+%ghost %{bfd_plugin_lto}
 
 %changelog
index 358b6d9..a22c5ed 100644 (file)
@@ -59,6 +59,8 @@ BuildRequires:  qemu-linux-user
 BuildRequires: elfutils
 BuildRequires: libxslt-tools
 Requires:       coreutils
+Requires(post): update-alternatives
+Requires(postun): update-alternatives
 Summary:        Native binaries for speeding up cross compile
 License:        GPL-2.0
 Group:          Development/Cross Compilation
@@ -76,6 +78,11 @@ ExclusiveArch:  x86_64 %ix86
 %define binaries_binutils addr2line ar as elfedit gprof ld ld.bfd ld.gold nm objcopy objdump ranlib readelf size strings strip
 %define binaries_binutils_comma %(echo %{binaries_binutils} | sed -e "s/ /,/g")
 
+%define bfd_plugin_dir      %{_bindir}/../lib/bfd-plugins
+%define bfd_plugin_lto_name liblto_plugin_%{_arch}.so
+%define bfd_plugin_lto      %{bfd_plugin_dir}/%{bfd_plugin_lto_name}
+%define gcc_plugin_lto %{our_path}%{_libdir}/gcc/%{emulated_arch_triple_long}/%{gcc_version_dot}/liblto_plugin.so
+
 %description
 This package is used in %{emulated_arch_long} architecture builds using qemu to speed up builds
 with native binaries.
@@ -288,11 +295,17 @@ ln -s %{our_path}/usr/sbin %{buildroot}/%{our_path}/sbin
 ln -s %{our_path}/usr/bin/rpm %{buildroot}/%{our_path}/usr/bin/rpmquery
 ln -s %{our_path}/usr/bin/rpm %{buildroot}/%{our_path}/usr/bin/rpmverify
 
+mkdir -p "%{buildroot}%{bfd_plugin_dir}"
+touch "%{buildroot}%{bfd_plugin_lto}"
+
 %post
 ldconfig
+"%_sbindir/update-alternatives" --install \
+    "%{bfd_plugin_lto}" "%{bfd_plugin_lto_name}" "%{gcc_plugin_lto}" 3
 
 %postun
 ldconfig
+"%_sbindir/update-alternatives" --remove %{bfd_plugin_lto_name} "%{gcc_plugin_lto}"
 
 %files
 %defattr(-,root,root)
@@ -301,5 +314,6 @@ ldconfig
 /usr/%{emulated_arch_triple_long}/include
 /emul
 /qemu
+%ghost %{bfd_plugin_lto}
 
 %changelog
index a37ac97..22732df 100644 (file)
@@ -59,6 +59,8 @@ BuildRequires:  qemu-linux-user
 BuildRequires: elfutils
 BuildRequires: libxslt-tools
 Requires:       coreutils
+Requires(post): update-alternatives
+Requires(postun): update-alternatives
 Summary:        Native binaries for speeding up cross compile
 License:        GPL-2.0
 Group:          Development/Cross Compilation
@@ -76,6 +78,11 @@ ExclusiveArch:  x86_64 %ix86
 %define binaries_binutils addr2line ar as elfedit gprof ld ld.bfd ld.gold nm objcopy objdump ranlib readelf size strings strip
 %define binaries_binutils_comma %(echo %{binaries_binutils} | sed -e "s/ /,/g")
 
+%define bfd_plugin_dir      %{_bindir}/../lib/bfd-plugins
+%define bfd_plugin_lto_name liblto_plugin_%{_arch}.so
+%define bfd_plugin_lto      %{bfd_plugin_dir}/%{bfd_plugin_lto_name}
+%define gcc_plugin_lto %{our_path}%{_libdir}/gcc/%{emulated_arch_triple_long}/%{gcc_version_dot}/liblto_plugin.so
+
 %description
 This package is used in %{emulated_arch_long} architecture builds using qemu to speed up builds
 with native binaries.
@@ -288,11 +295,17 @@ ln -s %{our_path}/usr/sbin %{buildroot}/%{our_path}/sbin
 ln -s %{our_path}/usr/bin/rpm %{buildroot}/%{our_path}/usr/bin/rpmquery
 ln -s %{our_path}/usr/bin/rpm %{buildroot}/%{our_path}/usr/bin/rpmverify
 
+mkdir -p "%{buildroot}%{bfd_plugin_dir}"
+touch "%{buildroot}%{bfd_plugin_lto}"
+
 %post
 ldconfig
+"%_sbindir/update-alternatives" --install \
+    "%{bfd_plugin_lto}" "%{bfd_plugin_lto_name}" "%{gcc_plugin_lto}" 3
 
 %postun
 ldconfig
+"%_sbindir/update-alternatives" --remove %{bfd_plugin_lto_name} "%{gcc_plugin_lto}"
 
 %files
 %defattr(-,root,root)
@@ -301,5 +314,6 @@ ldconfig
 /usr/%{emulated_arch_triple_long}/include
 /emul
 /qemu
+%ghost %{bfd_plugin_lto}
 
 %changelog