- remove prelink build dependency

- wine-relocate-base.patch: Use the -Ttext-segment linker option to
  specify the text segment start.

OBS-URL: https://build.opensuse.org/package/show/Emulators/wine?expand=0&rev=311
This commit is contained in:
Marcus Meissner 2015-10-17 18:14:19 +00:00 committed by Git OBS Bridge
parent a752acd8e9
commit c22cb3938b
3 changed files with 77 additions and 4 deletions

68
wine-relocate-base.patch Normal file
View File

@ -0,0 +1,68 @@
Prelink was used to rewrite binares and set their text segment, but
modern linkers support setting the value at link time. Prelink is
being retired by upstream.
Signed-off-by: Michael Cronenworth <mike@cchtml.com>
---
configure.ac | 11 ++++++++---
tools/winegcc/winegcc.c | 11 +++++++++--
2 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index de8cde5..f283802 100644
--- a/configure.ac
+++ b/configure.ac
@@ -988,10 +988,15 @@ wine-installed: main.o
*) LDEXECFLAGS="$LDEXECFLAGS -Wl,--section-start,.interp=0x7bf00400" ;;
esac
])
- AC_PATH_PROG(PRELINK, prelink, false, [/sbin /usr/sbin $PATH])
- if test "x$PRELINK" = xfalse
+ WINE_TRY_CFLAGS([-Wl,-Ttext-segment=0x7bc00000],
+ [HAVE_TTEXT_SEGMENT="yes"])
+ if test "x$HAVE_TTEXT_SEGMENT" != "xyes"
then
- WINE_WARNING([prelink not found, base address of core dlls won't be set correctly.])
+ AC_PATH_PROG(PRELINK, prelink, false, [/sbin /usr/sbin $PATH])
+ if test "x$PRELINK" = xfalse
+ then
+ WINE_WARNING([prelink not found and linker does not support relocation, base address of core dlls won't be set correctly.])
+ fi
fi
;;
esac
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index 3b2794e..4acd12d 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -1134,6 +1134,12 @@ static void build(struct options* opts)
}
break;
default:
+ /* Try option first, modern linkers support this */
+ if (opts->image_base &&
+ !try_link(opts->prefix, link_args, strmake("-Wl,-Ttext-segment=%s", opts->image_base)))
+ {
+ strarray_add(link_args, strmake("-Wl,-Ttext-segment=%s", opts->image_base));
+ }
break;
}
@@ -1167,8 +1173,9 @@ static void build(struct options* opts)
spawn(opts->prefix, link_args, 0);
strarray_free (link_args);
- /* set the base address */
- if (opts->image_base && !opts->target)
+ /* set the base address with prelink if linker support is not present */
+ if (opts->image_base && !opts->target &&
+ try_link(opts->prefix, link_args, strmake("-Wl,-Ttext-segment=%s", opts->image_base)))
{
const char *prelink = PRELINK;
if (prelink[0] && strcmp(prelink,"false"))
--
2.4.3

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Sat Oct 17 18:13:42 UTC 2015 - meissner@suse.com
- remove prelink build dependency
- wine-relocate-base.patch: Use the -Ttext-segment linker option to
specify the text segment start.
-------------------------------------------------------------------
Fri Oct 16 14:24:25 UTC 2015 - meissner@suse.com

View File

@ -48,10 +48,6 @@ BuildRequires: openal-soft-devel
BuildRequires: openldap2-devel
BuildRequires: openssl-devel
BuildRequires: pkgconfig
%ifarch %{ix86} x86_64
# only used on win32 and win64 today
BuildRequires: prelink
%endif
# Marcus: remove it in devel too if you remove it here.
BuildRequires: gcc48
@ -80,6 +76,7 @@ Source7: baselibs.conf
# SUSE specific patches
# - currently none, but add them here
#Patch0: susepatches.patch
Patch1: wine-relocate-base.patch
Recommends: wine-gecko >= 2.24
Recommends: wine-mp3
# not packaged in distro...
@ -126,6 +123,7 @@ libraries.
%prep
%setup -q
#%patch0 -p1
%patch1 -p1
#
cp %{S:3} .
#