This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH mingw/gold] Fix mingw gold build with plugins enabled for non-dlfcn case


On Wed, Jan 9, 2013 at 7:50 PM, Ian Lance Taylor <iant@google.com> wrote:
> On Wed, Jan 9, 2013 at 6:35 AM, Pavel Chupin <pavel.v.chupin@gmail.com> wrote:
>> On Sat, Jan 5, 2013 at 11:18 PM, Ian Lance Taylor <iant@google.com> wrote:
>>> On Fri, Dec 28, 2012 at 10:41 AM, Pavel Chupin <pavel.v.chupin@gmail.com> wrote:
>>>
>>>> Attached patch fixes mingw build configured (for example) as:
>>>>
>>>> ../configure --prefix=`pwd`/../INSTALL --target=i686-linux-android
>>>> --host=i586-pc-mingw32msvc --build=i386-linux-gnu --enable-plugins
>>>> --enable-gold
>>>> make
>>>>
>>>> Error message:
>>>>
>>>> ../../gold/plugin.cc:32:19: fatal error: dlfcn.h: No such file or directory
>>>>
>>>> I'm fixing it like it's done in bfd configure: check for headers and
>>>> library, add/not-add -ldl on link.
>>>> Also adding windows.h case into plugin.cc to handle case when
>>>> mingw-dlfcn is not installed on the system.
>>>>
>>>> ChangeLog:
>>>>
>>>> 2012-12-25  Pavel Chupin  <pavel.v.chupin@intel.com>
>>>>
>>>>        Fix mingw gold build with plugins enabled
>>>>        * gold/Makefile.am: Replace -ldl with @lt_cv_dlopen_libs@.
>>>>        * gold/aclocal.m4: Include libtool modules.
>>>>        * gold/configure.ac: Export lt_cv_dlopen_libs and add headers check.
>>>>        * gold/plugin.cc: Handle non-dlfcn case.
>>>>        * gold/Makefile.in: Regenerate.
>>>>        * gold/config.in: Regenerate.
>>>>        * gold/configure: Regenerate.
>>>>        * gold/testsuite/Makefile.in: Regenerate.
>>>
>>> Sorry for the slow review.  The general idea is fine but the
>>> formatting is wrong.  This is C++ code, not C: no space between
>>> function name and left parenthesis.  Keep line lengths less than 80
>>> columns--the body of dlsym needs a line break.  Don't define
>>> dlclose--it's not called.  dlerror should return an ordinary error
>>> string--no capitalization, no punctuation.
>>>
>>> In configure.ac, the comment should be a complete sentence with proper
>>> capitalization and punctuation.  It should explain why you are using
>>> libtool.
>>>
>>> Thanks.
>>>
>>> Ian
>>
>> Hi Ian,
>> Thanks for review. Please see modified patch attached.
>
> Hmmmm, there is a problem here.  You have introduced the use of
> libtool into configure.ac when it was not there before.  When I run
> autoreconf, this causes automake to rebuild the linker Makefile to use
> libtool rather than the simple commands that it used before.  I'm not
> at all sure that that is a good idea.
>
> Can we get this information without using libtool?
>
> Ian

Well, we need to find the library which provides dlopen somehow.
libtool is doing that the long and correct way, it checks the
architecture, and tries different options to determine available
library. libtool is shared between several projects so if any fix is
made it will be propagated. IMHO it is the best long term fix. I don't
know if it's possible to reuse only LT_INIT(dlopen) part of libtool,
my attempts failed.

My goal is to fix mingw build when there is no libdl. If we don't
really care about other libraries which may provide dlopen I can try
to implement the following:

1) Check for dlfcn.h header
2) If found just add hardcoded -ldl. If not found add nothing.

What do you think?

--
Pavel Chupin
Intel Corporation


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]