This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib 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: hidden symbol `__divdi3' is referenced by DSO


The rpath is also used to tell the linker where to find shared libraries during the link. See the paragraph below. I know I had to add it to my script that builds my shared executables.

`-rpath DIR'
     Add a directory to the runtime library search path.  This is used
     when linking an ELF executable with shared objects.  All `-rpath'
     arguments are concatenated and passed to the runtime linker, which
     uses them to locate shared objects at runtime.  The `-rpath'
     option is also used when locating shared objects which are needed
     by shared objects explicitly included in the link; see the
     description of the `-rpath-link' option.  If `-rpath' is not used
     when linking an ELF executable, the contents of the environment
     variable `LD_RUN_PATH' will be used if it is defined.

-- Jeff J.

Shaun Jackman wrote:
My problem occurs not at run time, but at link time.

cc -nostdlib -L/home/sjackman/lib/newlib -Wl,-rpath
/home/sjackman/lib/newlib /home/sjackman/lib/newlib/crt0.o hello.o -lc -lm -lgcc -o hello
/usr/bin/ld: hello: hidden symbol `__divdi3' in
/usr/lib/gcc-lib/i486-linux/3.3.4/libgcc.a(_divdi3.oS) is referenced
by DSO
collect2: ld returned 1 exit status


Cheers,
Shaun


On Thu, 02 Dec 2004 14:53:34 -0500, Jeff Johnston <jjohnstn@redhat.com> wrote:


Works fine for me.

It looks like you need an rpath specified. Try adding:

-Wl,-rpath /home/sjackman/lib/newlib

-- Jeff J.


Shaun Jackman wrote:


When trying to link "Hello, world!" with a native shared newlib
library, I get this hidden symbol error. The same application links
perfectly with -static.

Thanks in advance for any help you can give.

Please cc me in your reply. Cheers,
Shaun

newlib 1.12.0 (CVS 2004-11-26)
gcc 3.3.4

$ cc -g -O2 -W -Wall -Werror -I/home/sjackman/include/newlib -nostdlib
-L/home/sjackman/lib/newlib /home/sjackman/lib/newlib/crt0.o  hello.c
-lc -lm -lgcc -o hello
/usr/bin/ld: hello: hidden symbol `__divdi3' in
/usr/lib/gcc-lib/i486-linux/3.3.4/libgcc.a(_divdi3.oS) is referenced
by DSO
collect2: ld returned 1 exit status
make: *** [hello] Error 1
$ cc --version | head -1
cc (GCC) 3.3.4 (Debian 1:3.3.4-13)


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