This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: [Mingw-users] gcc -save-temps foo.c fails to build foo.o


"Rekha Deshmukh" <RekhaD@kpit.com> wrote:

> Hi Earnie,
> 
> Thanks for the reply. 
> From your mail I understood that the patch should be modified,
> where the st_ino of two files are compared and apply some other
> logic so as to know the file's unique existance. 
> I searched through the gcc source but was unable to find the
> code, where two files were compared for uniqueness.

 The GNU ld has this problem too, when handling '.so' files
on MinGW-host, the DT_NEEDED entries in the files don't work.
The code causing this seems to be in 'emultemps/elf32.em' and
is:
 
-------------------- clip ---------------------------
/* See if an input file matches a DT_NEEDED entry by running stat on
   the file.  */

static void
gld${EMULATION_NAME}_stat_needed (s)
     lang_input_statement_type *s;
{
  struct stat st;
  const char *suffix;
  const char *soname;

  if (global_found)
    return;
  if (s->the_bfd == NULL)
    return;

  if (bfd_stat (s->the_bfd, &st) != 0)
    {
      einfo ("%P:%B: bfd_stat failed: %E\n", s->the_bfd);
      return;
    }

  if (st.st_dev == global_stat.st_dev		<----- !!
      && st.st_ino == global_stat.st_ino)	<----- !!
    {
      global_found = true;
      return;
    }
-------------------- clip ---------------------------

 If only the plain vanilla file name, without the absolute
path, is the input here, how the 'uniqueness' will be
solved ?  Or is it necessary -- in this case it would be
enough if a file with the right name could be found. So
wrapping the '&& st.st_ino == global_stat.st_ino)' between
'#ifndef __MINGW32__' and '#endif' could fix this case.
Assuming that the 'st.st_dev' has the right disk number...

 Haven't tried this yet though...

Cheers, Kai


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