using llvm-ld with existing libraries

I am running into some problems when trying to use
llvm-ld to link object files, created by llvm-gcc-4.2
at -O4, with the stock libraries available on
powerpc-apple-darwin9. In particular, I am finding that
the link command...

llvm-ld -O4 -native -o molscript molscript.tab.o global.o lex.o col.o select.o state.o graphics.o segment.o coord.o xform.o postscript.o raster3d.o vrml.o regex.o opengl.o image.o eps_img.o sgi_img.o jpeg_img.o png_img.o clib/clib.a /sw/lib/libfreeglut.3.8.0.dylib /usr/X11R6/lib/libGLU.1.3.dylib /usr/X11R6/lib/libGL.1.2.dylib /System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib /usr/X11R6/lib/libX11.6.2.0.dylib /usr/X11R6/lib/libXi.6.0.0.dylib /usr/X11R6/lib/libXmu.6.2.0.dylib /sw/lib/libjpeg.62.0.0.dylib /sw/lib/libpng.3.18.0.dylib /usr/lib/libz.1.2.3.dylib /usr/lib/libSystem.B.dylib

...produces the warnings...

llvm-ld: warning: Ignoring file '/sw/lib/libfreeglut.3.8.0.dylib' because does not contain bitcode.
llvm-ld: warning: Ignoring file '/sw/lib/libjpeg.62.0.0.dylib' because does not contain bitcode.
llvm-ld: warning: Ignoring file '/sw/lib/libpng.3.18.0.dylib' because does not contain bitcode.

...followed by errors of the form...

Undefined symbols:
  "_jpeg_stdio_dest", referenced from:
      _jpgi_first_plot in ccDTZ2L8.o
  "_jpeg_write_scanlines", referenced from:
      _jpgi_finish_output in ccDTZ2L8.o
  "_glutGet", referenced from:
      _ogl_start_plot in ccDTZ2L8.o
      _ogl_start_plot in ccDTZ2L8.o
      _menu_action in ccDTZ2L8.o
      _menu_action in ccDTZ2L8.o
      _menu_action in ccDTZ2L8.o
      _menu_action in ccDTZ2L8.o
      _ogl_first_plot in ccDTZ2L8.o
      _ogl_first_plot in ccDTZ2L8.o
      _ogl_display_mode_not_available in clib.a(ogl_utils.o)
      _ogl_display_mode_not_available_fatal in clib.a(ogl_utils.o)

...etc. Does this work on any other platform (eg linux)? Also, I find that
when I invoke the llvm-ld linker with '-L' and '-l' to link in shared libraries
that the libraries don't seem to be found. I have to explicitly add the libraries
with their full path in order for them to be found. Thanks in advance for any
advice on whether these are known issues or if I should fill bug reports on
them.
            Jack

  I am running into some problems when trying to use
llvm-ld to link object files, created by llvm-gcc-4.2
at -O4, with the stock libraries available on
powerpc-apple-darwin9. In particular, I am finding that
the link command...

llvm-ld -O4 -native -o molscript molscript.tab.o global.o lex.o col.o select.o state.o graphics.o segment.o coord.o xform.o postscript.o raster3d.o vrml.o regex.o opengl.o image.o eps_img.o sgi_img.o jpeg_img.o png_img.o clib/clib.a /sw/lib/libfreeglut.3.8.0.dylib /usr/X11R6/lib/libGLU.1.3.dylib /usr/X11R6/lib/libGL.1.2.dylib /System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib /usr/X11R6/lib/libX11.6.2.0.dylib /usr/X11R6/lib/libXi.6.0.0.dylib /usr/X11R6/lib/libXmu.6.2.0.dylib /sw/lib/libjpeg.62.0.0.dylib /sw/lib/libpng.3.18.0.dylib /usr/lib/libz.1.2.3.dylib /usr/lib/libSystem.B.dylib

...produces the warnings...

llvm-ld: warning: Ignoring file '/sw/lib/libfreeglut.3.8.0.dylib' because does not contain bitcode.
llvm-ld: warning: Ignoring file '/sw/lib/libjpeg.62.0.0.dylib' because does not contain bitcode.
llvm-ld: warning: Ignoring file '/sw/lib/libpng.3.18.0.dylib' because does not contain bitcode.

As expected, /sw/lib/libjpeg.62.0.0.dylib is not llvm bitcode and llvm-ld only accepts bitcode files as input. What you want to do is

$ llvm-ld -O4 -native molscript.tab.o global.o lex.o col.o select.o state.o graphics.o segment.o coord.o xform.o postscript.o raster3d.o vrml.o regex.o opengl.o image.o eps_img.o sgi_img.o jpeg_img.o png_img.o -o my_big.o

$ <my_compiler_or_linker_driver> my_big.o -o molscript clib/clib.a /sw/lib/libfreeglut.3.8.0.dylib /usr/X11R6/lib/libGLU.1.3.dylib /usr/X11R6/lib/libGL.1.2.dylib /System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib /usr/X11R6/lib/libX11.6.2.0.dylib /usr/X11R6/lib/libXi.6.0.0.dylib /usr/X11R6/lib/libXmu.6.2.0.dylib /sw/lib/libjpeg.62.0.0.dylib /sw/lib/libpng.3.18.0.dylib /usr/lib/libz.1.2.3.dylib /usr/lib/libSystem.B.dylib

...etc. Does this work on any other platform (eg linux)? Also, I find that
when I invoke the llvm-ld linker with '-L' and '-l' to link in shared libraries
that the libraries don't seem to be found. I have to explicitly add the libraries
with their full path in order for them to be found.

Are you using -L=<blah> and -l=<blah> syntax ? See llvm-ld --help.