This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: Do not use glob on MinGW hosts
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Wed, 16 Feb 2005 10:51:37 +0100
- Subject: Re: PATCH: Do not use glob on MinGW hosts
- References: <200502160630.j1G6U9Rs025084@sirius.codesourcery.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Feb 15, 2005 at 10:30:09PM -0800, Mark Mitchell wrote:
>
> When building a MinGW-hosted Linux-targeted compiler, we get a
> compilation failure in the linker. The problem is that the linker
> wants to use "glob" to handle "#include" directives in /etc/ld.so.conf
> (appropriately adjusted for sysroot, of course) -- but Windows does
> not have this routine.
>
> This patch avoids the use of glob -- by assuming the the included file
> is just a literal pathname rather than a glob pattern. As #include's
> in ld.so.conf are rare, and glob-pattern includes are rarer, this
> seems like a satisfactory solution.
Well, they aren't that rare.
E.g. every recent Fedora Core and Red Hat Enterprise Linux installation has
include ld.so.conf.d/*.conf
in /etc/ld.so.conf by default and a bunch of *.conf files in
/etc/ld.so.conf.d/.
So IMHO you should also check for M$ globbing like functions and use them.
Does MinGW have fnmatch? If yes, you could e.g. loop with
FindFirstFile/FindNextFile and fnmatch on each filename, etc.
> + #ifdef HAVE_GLOB
> if (glob (pattern, 0, NULL, &gl) == 0)
> {
> size_t i;
>
> for (i = 0; i < gl.gl_pathc; ++i)
> gld${EMULATION_NAME}_parse_ld_so_conf (info, gl.gl_pathv[i]);
> globfree (&gl);
> }
> + #else
> + /* If we do not have glob, treat the pattern as a literal filename. */
> + gld${EMULATION_NAME}_parse_ld_so_conf (info, pattern);
> + #endif
Jakub