This is the mail archive of the binutils@sourceware.org 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: ld: creating a dynamically linked executable ...


> 2) ld -o use-of-lib use-of-lib.o -lc

Many uses of -lc also require the use of the corresponding startup object
files with names such as crt0.o, crt1.o, crtn.o, etc.  Use gcc for linking
until you become an expert.

  gcc -v -o use-of-lib use-of-lib.o


> $> ./use-of-lib
> zsh: no such file or directory: ./use-of-lib

zsh has a bug in its error reporting.  It is not ./use-of-lib which cannot
be found, but rather the [PT_]INTERP which cannot be found.
To be fair to zsh, the kernel does not say which file suffers ENOENT.
However, *all* shells could be more user-friendly in this case.
Obviously ./use-of-lib does exist (and most shells check for existence and
+x permission _before_ trying execve()), so the shell should investigate
further instead of emitting a message that makes no sense.


$ readelf --segments /bin/date
  INTERP         0x0000000000000238 0x0000000000400238 0x0000000000400238
                 0x000000000000001c 0x000000000000001c  R      1
      [Requesting program interpreter: /lib64/ld-linux-x86-64.so.2]

So /lib64/ld-linux-x86-64.so.2 also must exist in order for /bin/date to run.


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