Commit adbb0988 authored by Alexandre Julliard's avatar Alexandre Julliard

Added support for the --image-base linker option in winegcc using the

prelink tool.
parent 9f32a5c8
......@@ -47,6 +47,7 @@ TOOLSDIR = @TOOLSDIR@
AS = @AS@
LD = @LD@
LDFLAGS = @LDFLAGS@
PRELINK = @PRELINK@
RM = rm -f
MV = mv
LINT = @LINT@
......
......@@ -311,7 +311,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS DLLDEFS build build_cpu build_vendor build_os host host_cpu host_vendor host_os WIN16_FILES WIN16_INSTALL SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPPBIN ac_ct_CPPBIN TOOLSDIR CPP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LEX LEXLIB LEX_OUTPUT_ROOT XLEX BISON AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES LN_S LN EGREP LDCONFIG INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LINT LINTFLAGS FONTFORGE PKG_CONFIG LIBPTHREAD XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS GLUT_LIBS GLUT32FILES NASLIBS XML2LIBS XML2INCL CURSESLIBS sane_devel SANELIBS SANEINCL ICULIBS LCMSLIBS LDAPLIBS FREETYPELIBS FREETYPEINCL ft_devel ft_devel2 FONTSSUBDIRS ARTSCCONFIG ARTSLIBS ARTSINCL ESDCONFIG ESDLIBS ESDINCL ALSALIBS AUDIOIOLIBS EXTRACFLAGS DLLEXT DLLFLAGS DLLIBS LDSHARED LDDLLFLAGS LIBEXT IMPLIBEXT DLLTOOL ac_ct_DLLTOOL DLLWRAP ac_ct_DLLWRAP LDEXECFLAGS LDLIBWINEFLAGS COREFOUNDATIONLIB IOKITLIB CROSSTEST CROSSCC CROSSWINDRES LDPATH CRTLIBS SOCKETLIBS WINE_BINARIES MAIN_BINARY LDD LIBOBJS LTLIBOBJS'
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS DLLDEFS build build_cpu build_vendor build_os host host_cpu host_vendor host_os WIN16_FILES WIN16_INSTALL SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPPBIN ac_ct_CPPBIN TOOLSDIR CPP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LEX LEXLIB LEX_OUTPUT_ROOT XLEX BISON AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES LN_S LN EGREP LDCONFIG INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LINT LINTFLAGS FONTFORGE PKG_CONFIG PRELINK LIBPTHREAD XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS GLUT_LIBS GLUT32FILES NASLIBS XML2LIBS XML2INCL CURSESLIBS sane_devel SANELIBS SANEINCL ICULIBS LCMSLIBS LDAPLIBS FREETYPELIBS FREETYPEINCL ft_devel ft_devel2 FONTSSUBDIRS ARTSCCONFIG ARTSLIBS ARTSINCL ESDCONFIG ESDLIBS ESDINCL ALSALIBS AUDIOIOLIBS EXTRACFLAGS DLLEXT DLLFLAGS DLLIBS LDSHARED LDDLLFLAGS LIBEXT IMPLIBEXT DLLTOOL ac_ct_DLLTOOL DLLWRAP ac_ct_DLLWRAP LDEXECFLAGS LDLIBWINEFLAGS COREFOUNDATIONLIB IOKITLIB CROSSTEST CROSSCC CROSSWINDRES LDPATH CRTLIBS SOCKETLIBS WINE_BINARIES MAIN_BINARY LDD LIBOBJS LTLIBOBJS'
ac_subst_files='MAKE_RULES MAKE_DLL_RULES MAKE_TEST_RULES MAKE_LIB_RULES MAKE_PROG_RULES'
# Initialize some variables set by options.
......@@ -5682,6 +5682,52 @@ done
test -n "$PKG_CONFIG" || PKG_CONFIG="false"
case $host_cpu in
*i[3456789]86*)
for ac_prog in prelink
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
echo "$as_me:$LINENO: checking for $ac_word" >&5
echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
if test "${ac_cv_prog_PRELINK+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$PRELINK"; then
ac_cv_prog_PRELINK="$PRELINK" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in /sbin /usr/sbin $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_PRELINK="$ac_prog"
echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
fi
fi
PRELINK=$ac_cv_prog_PRELINK
if test -n "$PRELINK"; then
echo "$as_me:$LINENO: result: $PRELINK" >&5
echo "${ECHO_T}$PRELINK" >&6
else
echo "$as_me:$LINENO: result: no" >&5
echo "${ECHO_T}no" >&6
fi
test -n "$PRELINK" && break
done
test -n "$PRELINK" || PRELINK="false"
;;
esac
echo "$as_me:$LINENO: checking for i386_set_ldt in -li386" >&5
......@@ -19104,6 +19150,7 @@ s,@LINT@,$LINT,;t t
s,@LINTFLAGS@,$LINTFLAGS,;t t
s,@FONTFORGE@,$FONTFORGE,;t t
s,@PKG_CONFIG@,$PKG_CONFIG,;t t
s,@PRELINK@,$PRELINK,;t t
s,@LIBPTHREAD@,$LIBPTHREAD,;t t
s,@XLIB@,$XLIB,;t t
s,@XFILES@,$XFILES,;t t
......
......@@ -136,6 +136,12 @@ dnl Check for various programs
AC_CHECK_PROGS(FONTFORGE, fontforge, false)
AC_CHECK_PROGS(PKG_CONFIG, pkg-config, false)
case $host_cpu in
*i[[3456789]]86*)
AC_CHECK_PROGS(PRELINK, prelink, false, [/sbin /usr/sbin $PATH])
;;
esac
dnl **** Check for some libraries ****
dnl Check for -li386 for NetBSD and OpenBSD
......
......@@ -7,7 +7,8 @@ DEFS = \
-DCC="\"$(CC)\"" \
-DCPP="\"@CPPBIN@\"" \
-DCXX="\"$(CXX)\"" \
-DLD="\"$(LD)\""
-DLD="\"$(LD)\"" \
-DPRELINK="\"$(PRELINK)\""
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
......
......@@ -72,7 +72,7 @@
* Linker Options
* object-file-name -llibrary -nostartfiles -nodefaultlibs
* -nostdlib -s -static -static-libgcc -shared -shared-libgcc
* -symbolic -Wl,option -Xlinker option -u symbol
* -symbolic -Wl,option -Xlinker option -u symbol --image-base
*
* Directory Options
* -Bprefix -Idir -I- -Ldir -specs=file
......@@ -155,6 +155,7 @@ struct options
int compile_only;
int wine_mode;
const char* output_name;
const char* image_base;
strarray* prefix;
strarray* lib_dirs;
strarray* linker_args;
......@@ -625,6 +626,22 @@ static void build(struct options* opts)
spawn(opts->prefix, link_args);
/* set the base address */
if (opts->image_base)
{
const char *prelink = PRELINK;
if (prelink[0] && strcmp(prelink,"false"))
{
strarray *prelink_args = strarray_alloc();
strarray_add(prelink_args, prelink);
strarray_add(prelink_args, "--reloc-only");
strarray_add(prelink_args, opts->image_base);
strarray_add(prelink_args, strmake("%s.so", output_file));
spawn(opts->prefix, prelink_args);
strarray_free(prelink_args);
}
}
/* create the loader script */
if (generate_app_loader)
{
......@@ -892,8 +909,20 @@ int main(int argc, char **argv)
case 'W':
if (strncmp("-Wl,", argv[i], 4) == 0)
{
if (strstr(argv[i], "-static"))
linking = -1;
unsigned int j;
strarray* Wl = strarray_fromstring(argv[i] + 4, ",");
for (j = 0; j < Wl->size; j++)
{
if (!strcmp(Wl->base[j], "--image-base") && j < Wl->size - 1)
{
opts.image_base = strdup( Wl->base[++j] );
continue;
}
if (!strcmp(Wl->base[j], "-static")) linking = -1;
strarray_add(opts.linker_args, strmake("-Wl,%s",Wl->base[j]));
}
strarray_free(Wl);
raw_compiler_arg = raw_linker_arg = 0;
}
else if (strncmp("-Wb,", argv[i], 4) == 0)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment