LLVM2.8rc2 on MinGW 4.5.1 with --enable-shared

Anybody having success building an LLVM.dll in this configuration?
It's failing for me, in tools/llvm-shlib, with an error suggesting
that the gcc ld doesn't understand the format of the exports map
being generated.

(plain configure && make works just fine, it's just this shared
option that fails; google shows support for --enable-shared was
added around 2.7 timeframe and worked for both cygwin and mingw.
MinGW's been getting some activity this year, with regard to
shared libs, so I've been tracking current versions; not sure
whether this is a mingw regression or what's really going on.)

Anywyay, here's what that generated exports map looks like:

$cat tools/llvm-shlib/Release/LLVM-2.8rc.exports.map
     ...many many more symbols...
     x86DisassemblerThreeByte3AOpcodes DATA;
     x86DisassemblerTwoByteOpcodes DATA;
   local: *;

and this is the error:

llvm[0]: Linking Release Shared Library LLVM-2.8rc.dll
c:\MinGW\mingw-nuwen6.6\bin/ld.exe:C:/msys/llvm/rc2/tools/llvm-shlib/Release/LLVM-2.8rc.exports.map: file format not recognized; treating as linker script
c:\MinGW\mingw-nuwen6.6\bin/ld.exe:C:/msys/llvm/rc2/tools/llvm-shlib/Release/LLVM-2.8rc.exports.map:1: syntax error
collect2: ld returned 1 exit status
make: *** [/llvm/rc2/Release/bin/LLVM-2.8rc.dll] Error 1

So I'm thinking that there's some missing syntax in the map
file, but I don't know what ld expects. Google didn't help
me there. :slight_smile:

This isn't worth a lot of time, since the static libs work just
fine, but getting shared to work would be nice. If anybody's
done this, I'd appreciate hearing about it.


LLVM checked out from release/2.8/rc2 and configured with:
   ../28rc2/configure --enable-optimized --enable-shared

$ gcc --version
gcc.exe (GCC) 4.5.1
Copyright (C) 2010 Free Software Foundation, Inc. ...

$ ld --version
GNU ld (GNU Binutils)
Copyright 2009 Free Software Foundation, Inc. ...

Good midnight, Kevin.

cygming/shared might have been broken since r112976, IIRC. (ToT, too)

A trivial patch;

--- a/Makefile.rules
+++ b/Makefile.rules
@@ -942,6 +942,11 @@ ifdef EXPORTED_SYMBOL_FILE
# First, set up the native export file, which may differ from the source
# export file.

+# The option --version-script is not effective on GNU ld win32.
+ifneq (,$(filter $(HOST_OS),Cygwin MingW))

A trivial patch;

Beautiful! That worked perfectly for me. Thanks much.


Good morning, Bill.

I saw my *trivial* patch has been applied in r115093 on branch_28, thank you.
The comment says "Disable MinGW & shared because it never worked."
but it oughta be a proper thing to activate cygming --enable-shared. :wink:

May I apply it on ToT, too?