bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ld.gold doesn't like if -L points to not a directory


From: Ian Lance Taylor
Subject: Re: ld.gold doesn't like if -L points to not a directory
Date: Sat, 02 Jul 2011 21:16:52 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Arkadiusz Miskiewicz <address@hidden> writes:

> address@hidden ~]$ more ~/test/x.c
> int main() { return 0; }
> address@hidden ~]$ g++ -L/bin/sh ~/test/x.c
> /usr/bin/ld: error: /bin/sh: can not read directory: Not a directory
> collect2: ld returned 1 exit status
>
> but
>
> address@hidden ~]$ g++ -L/notexistant ~/test/x.c
> address@hidden ~]$
>
> (doesn't complain)
>
> $ ld --version
> GNU gold (Linux/GNU Binutils 2.21.52.0.2.20110610) 1.11
> [...]
>
> Note that ld.bfd has no trouble with -L pointing to not a directory (it 
> simply 
> ignores that fact).
>
> IMO gold should match ld.bfd behaviour and simply ignore not a directories.

Makes sense.  Fixed like so.  Committed to mainline.

Ian


2011-07-02  Ian Lance Taylor  <address@hidden>

        * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.


Index: dirsearch.cc
===================================================================
RCS file: /cvs/src/src/gold/dirsearch.cc,v
retrieving revision 1.13
diff -u -p -r1.13 dirsearch.cc
--- dirsearch.cc        25 May 2011 06:15:28 -0000      1.13
+++ dirsearch.cc        3 Jul 2011 04:15:01 -0000
@@ -66,8 +66,9 @@ Dir_cache::read_files()
   DIR* d = opendir(this->dirname_);
   if (d == NULL)
     {
-      // We ignore directories which do not exist.
-      if (errno != ENOENT)
+      // We ignore directories which do not exist or are actually file
+      // names.
+      if (errno != ENOENT && errno != ENOTDIR)
        gold::gold_error(_("%s: can not read directory: %s"),
                         this->dirname_, strerror(errno));
       return;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]