winegcc: Check for linker relocation support before relying on prelink.
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> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
998e5a0432
commit
a35f9a13a8
|
@ -8678,6 +8678,31 @@ if test "x$ac_cv_cflags__Wl___section_start__interp_0x7bf00400" = xyes; then :
|
||||||
esac
|
esac
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -Wl,-Ttext-segment=0x7bc00000" >&5
|
||||||
|
$as_echo_n "checking whether the compiler supports -Wl,-Ttext-segment=0x7bc00000... " >&6; }
|
||||||
|
if ${ac_cv_cflags__Wl__Ttext_segment_0x7bc00000+:} false; then :
|
||||||
|
$as_echo_n "(cached) " >&6
|
||||||
|
else
|
||||||
|
ac_wine_try_cflags_saved=$CFLAGS
|
||||||
|
CFLAGS="$CFLAGS -Wl,-Ttext-segment=0x7bc00000"
|
||||||
|
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||||
|
/* end confdefs.h. */
|
||||||
|
int main(int argc, char **argv) { return 0; }
|
||||||
|
_ACEOF
|
||||||
|
if ac_fn_c_try_link "$LINENO"; then :
|
||||||
|
ac_cv_cflags__Wl__Ttext_segment_0x7bc00000=yes
|
||||||
|
else
|
||||||
|
ac_cv_cflags__Wl__Ttext_segment_0x7bc00000=no
|
||||||
|
fi
|
||||||
|
rm -f core conftest.err conftest.$ac_objext \
|
||||||
|
conftest$ac_exeext conftest.$ac_ext
|
||||||
|
CFLAGS=$ac_wine_try_cflags_saved
|
||||||
|
fi
|
||||||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__Wl__Ttext_segment_0x7bc00000" >&5
|
||||||
|
$as_echo "$ac_cv_cflags__Wl__Ttext_segment_0x7bc00000" >&6; }
|
||||||
|
if test "x$ac_cv_cflags__Wl__Ttext_segment_0x7bc00000" = xyes; then :
|
||||||
|
:
|
||||||
|
else
|
||||||
# Extract the first word of "prelink", so it can be a program name with args.
|
# Extract the first word of "prelink", so it can be a program name with args.
|
||||||
set dummy prelink; ac_word=$2
|
set dummy prelink; ac_word=$2
|
||||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
|
||||||
|
@ -8721,8 +8746,9 @@ fi
|
||||||
|
|
||||||
if test "x$PRELINK" = xfalse
|
if test "x$PRELINK" = xfalse
|
||||||
then
|
then
|
||||||
as_fn_append wine_warnings "|prelink not found, base address of core dlls won't be set correctly."
|
as_fn_append wine_warnings "|prelink not found and linker does not support relocation, base address of core dlls won't be set correctly."
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -988,11 +988,12 @@ wine-installed: main.o
|
||||||
*) LDEXECFLAGS="$LDEXECFLAGS -Wl,--section-start,.interp=0x7bf00400" ;;
|
*) LDEXECFLAGS="$LDEXECFLAGS -Wl,--section-start,.interp=0x7bf00400" ;;
|
||||||
esac
|
esac
|
||||||
])
|
])
|
||||||
AC_PATH_PROG(PRELINK, prelink, false, [/sbin /usr/sbin $PATH])
|
WINE_TRY_CFLAGS([-Wl,-Ttext-segment=0x7bc00000],[:],
|
||||||
|
[AC_PATH_PROG(PRELINK, prelink, false, [/sbin /usr/sbin $PATH])
|
||||||
if test "x$PRELINK" = xfalse
|
if test "x$PRELINK" = xfalse
|
||||||
then
|
then
|
||||||
WINE_WARNING([prelink not found, base address of core dlls won't be set correctly.])
|
WINE_WARNING([prelink not found and linker does not support relocation, base address of core dlls won't be set correctly.])
|
||||||
fi
|
fi])
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
|
@ -776,6 +776,7 @@ static void build(struct options* opts)
|
||||||
char *output_file;
|
char *output_file;
|
||||||
const char *spec_o_name;
|
const char *spec_o_name;
|
||||||
const char *output_name, *spec_file, *lang;
|
const char *output_name, *spec_file, *lang;
|
||||||
|
const char *prelink = NULL;
|
||||||
int generate_app_loader = 1;
|
int generate_app_loader = 1;
|
||||||
int fake_module = 0;
|
int fake_module = 0;
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
|
@ -1134,6 +1135,13 @@ static void build(struct options* opts)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
if (opts->image_base)
|
||||||
|
{
|
||||||
|
if (!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));
|
||||||
|
else
|
||||||
|
prelink = PRELINK;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1167,10 +1175,9 @@ static void build(struct options* opts)
|
||||||
spawn(opts->prefix, link_args, 0);
|
spawn(opts->prefix, link_args, 0);
|
||||||
strarray_free (link_args);
|
strarray_free (link_args);
|
||||||
|
|
||||||
/* set the base address */
|
/* set the base address with prelink if linker support is not present */
|
||||||
if (opts->image_base && !opts->target)
|
if (prelink && !opts->target)
|
||||||
{
|
{
|
||||||
const char *prelink = PRELINK;
|
|
||||||
if (prelink[0] && strcmp(prelink,"false"))
|
if (prelink[0] && strcmp(prelink,"false"))
|
||||||
{
|
{
|
||||||
strarray *prelink_args = strarray_alloc();
|
strarray *prelink_args = strarray_alloc();
|
||||||
|
|
Loading…
Reference in New Issue