This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: bug-report: ld: hidden symbol `stat' in /usr/lib/libc_nonshared.a(stat.oS) is referenced by DSO
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Stefaan <stefaandr at hotmail dot com>
- Cc: binutils at sources dot redhat dot com
- Date: Wed, 21 Jan 2004 12:55:07 +0100
- Subject: Re: bug-report: ld: hidden symbol `stat' in /usr/lib/libc_nonshared.a(stat.oS) is referenced by DSO
- References: <Pine.LNX.4.44.0401211115490.29227-100000@lea>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Jan 21, 2004 at 11:22:34AM +0100, Stefaan wrote:
> Hi,
>
> I get the error
> "hidden symbol `stat' in /usr/lib/libc_nonshared.a(stat.oS) is referenced
> by DSO"
> both on debian/unstable and redhat 9 with self-compiled binutils 2.14.
>
> I produce it with the following code:
> main.c:
> int main() {};
>
> libfile.c:
> #include <sys/stat.h>
> void func(void) {
> stat(0, 0);
> };
>
> gcc -o main.o -c main.c
> gcc -o libfile.o -c libfile.c
> ld -o libmylib.so -shared libfile.o
> gcc -o exec main.o -L. -lmylib
>
> The last command invokes ld and gives the error. I don't get this error
> when using binutils-2.13.2. I also got this error using the
> binutils-weekly.
But the bug is on the line above the last.
You should never use ld directly unless you know what you're doing,
instead gcc or g++ drivers should be used because they know all the options
which must be passed to the linker.
Jakub