[patch bfd]: Fix PR ld/12742 for windows targets
Jeffrey Walton
noloader@gmail.com
Sat Mar 10 09:03:00 GMT 2012
On Sat, Mar 10, 2012 at 3:58 AM, Jeffrey Walton <noloader@gmail.com> wrote:
> On Fri, Mar 9, 2012 at 2:54 PM, Kai Tietz <ktietz70@googlemail.com> wrote:
>> Hi,
>>
>> this patch adds compatible implementation of dlfcn API on Windows
>> targets, if this header/API isn't present.
>>
>> ChangeLog
>>
>> 2012-03-09 Kai Tietz <ktietz@redhat.com>
>>
>> PR ld/12742
>> * configure.in (AC_CHECK_HEADERS): Test for windows.h and dlfcn.h.
>> * plugin.c: Guard include of dlfcn.h if HAVE_DLFCN_H is defined.
>> Add windows.h header include if HAVE_WINDOWS_H is defined.
>> (dlerror): New static function if windows variant is used instead
>> of dlfcn.h.
>> (dlclose): Likewise.
>> (dlopen): Likewise.
>> (dlsym): Likewise.
>> * configure: Regenerated.
>> * config.in: Regenerated.
>>
>> Tested for i686-w64-mingw32 and x86_64-w64-mingw32. Ok for apply?
>>
>> Regards,
>> Kai
>>
>> [SNIP]
>
> If filename is NULL, I believe LoadLibrary will treat the filename as
> an ordinal. Perhaps you should explicitly test the char* against NULL
> (unless, of course, you want to return the function at ordinal 0):
>
>> +dlopen (const char *file, int mode ATTRIBUTE_UNUSED)
>> +{
>> + return LoadLibrary (file);
>> +}
>
> I think you wil get expected behavior if there are no ordinals, which
> means you might have an intermittent problem.
My bad - I meant function name:
+static void *
+dlsym (void *handle, const char *name)
+{
+ return GetProcAddress (handle, name);
+}
More information about the Binutils
mailing list