This is the mail archive of the binutils@sources.redhat.com 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: Do not use glob on MinGW hosts


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


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