This is the mail archive of the
mailing list for the binutils project.
Re: [patch bfd]: Fix PR ld/12742 for windows targets
2012/3/10 Jeffrey Walton <email@example.com>:
> On Sat, Mar 10, 2012 at 3:58 AM, Jeffrey Walton <firstname.lastname@example.org> wrote:
>> On Fri, Mar 9, 2012 at 2:54 PM, Kai Tietz <email@example.com> wrote:
>>> this patch adds compatible implementation of dlfcn API on Windows
>>> targets, if this header/API isn't present.
>>> 2012-03-09 ?Kai Tietz ?<firstname.lastname@example.org>
>>> ? ? ? ?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?
>> 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);
GetProcAddress with name of NULL is simply invalid. Any ordinal has
to start at 1 AFAIK. Ordinal 0 doesn't exists.
for more details.