winegcc: Support building with non-default LD.

Gerald Pfeifer gerald at pfeifer.com
Mon Dec 29 17:04:59 CST 2014


Assume you want to build with a newer version of GCC, say, that
leverages a newer version of ld, both in non-standard locations.
An older ld still in the PATH, often the one provided by the OS.

Setting CC=.../some/where/gcc has been working fine for years.

And that version of GCC does invoke the version of ld it was
built with.

winegcc runs into problems, though, simply invoking ld and ignoring
any LD setting. (Analysis courtesy Tijl Coosemans).


This patch has winegcc invoke winebuild with --ld-cmd=${LD} and
adjust configure and Makefiles such that LD is used during configury
and passed down into tools/winegcc and then into winegcc.c as a define.

It addresses a real world user report and has verified as fixing the
issue by her.

Gerald

---
 Make.vars.in              | 1 +
 configure.ac              | 1 +
 tools/winegcc/Makefile.in | 1 +
 tools/winegcc/winegcc.c   | 2 ++
 4 files changed, 5 insertions(+)

diff --git a/Make.vars.in b/Make.vars.in
index ee8ee39..e825f4b 100644
--- a/Make.vars.in
+++ b/Make.vars.in
@@ -40,6 +40,7 @@ RANLIB          = @RANLIB@
 STRIP           = @STRIP@
 LN_S            = @LN_S@
 TOOLSDIR        = @TOOLSDIR@
+LD              = @LD@
 LDFLAGS         = @LDFLAGS@
 DLLFLAGS        = @DLLFLAGS@
 PRELINK         = @PRELINK@
diff --git a/configure.ac b/configure.ac
index 9f64cd3..2a9d671 100644
--- a/configure.ac
+++ b/configure.ac
@@ -122,6 +122,7 @@ AC_PROG_CXX
 dnl We can't use AC_PROG_CPP for winegcc, it uses by default $(CC) -E
 AC_CHECK_TOOL(CPPBIN,cpp,cpp)
 AC_DEFINE_UNQUOTED(EXEEXT,["$ac_exeext"],[Define to the file extension for executables.])
+AC_CHECK_TOOL(LD,ld)
 
 case $host in
   *-darwin*)
diff --git a/tools/winegcc/Makefile.in b/tools/winegcc/Makefile.in
index 3975ca5..370a2e4 100644
--- a/tools/winegcc/Makefile.in
+++ b/tools/winegcc/Makefile.in
@@ -16,6 +16,7 @@ winegcc_EXTRADEFS = \
 	-DCC="\"$(CC)\"" \
 	-DCPP="\"$(CPPBIN)\"" \
 	-DCXX="\"$(CXX)\"" \
+	-DLD="\"$(LD)\"" \
 	-DPRELINK="\"$(PRELINK)\""
 
 winegcc$(EXEEXT): winegcc.o utils.o
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index a2f09d2..3b2794e 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -1034,6 +1034,8 @@ static void build(struct options* opts)
     /* run winebuild to generate the .spec.o file */
     spec_args = get_winebuild_args( opts );
     strarray_add( spec_args, strmake( "--cc-cmd=%s", build_tool_name( opts, "gcc", CC )));
+    strarray_add( spec_args, strmake( "--ld-cmd=%s", build_tool_name( opts, "ld", LD )));
+
     spec_o_name = get_temp_file(output_name, ".spec.o");
     if (opts->force_pointer_size)
         strarray_add(spec_args, strmake("-m%u", 8 * opts->force_pointer_size ));
-- 
2.2.1



More information about the wine-patches mailing list