Bug 524011 - "clang -emit-llvm" should know to use "llvm-ld" instead of "ld"
Summary: "clang -emit-llvm" should know to use "llvm-ld" instead of "ld"
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: binutils
Version: rawhide
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Nick Clifton
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-09-17 15:19 UTC by John Ellson
Modified: 2009-09-29 16:58 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-09-29 16:58:06 UTC


Attachments (Terms of Use)

Description John Ellson 2009-09-17 15:19:16 UTC
Description of problem:
There are no bugzilla components for "clang" or "llvm", so I'll unreasonably blame this on binutils, on the grounds that /usr/bin/ld should know how to do this;-)

I want to try building existing C programs using the llvm byte code interpreter.  I was expecting something like this to work:

   export CC=/usr/bin/clang
   export CFLAGS=-emit-llvm
   ./configure
   make

but no such luck, and still no luck if I add:

   export LD=/usr/bin/llvm-ld


Version-Release number of selected component (if applicable):
clang-2.6-0.5.pre1.fc12.x86_64
llvm-2.6-0.5.pre1.fc12.x86_64
binutils-2.19.51.0.14-31.fc12.x86_64

How reproducible:
100%  on both 'x86_64-unknown-linux-gnu' and 'i386-pc-linux-gnu'

Steps to Reproduce:
1.  (write a trivial "Hello, World!" program in hello.c)
2.  clang -emit-llvm hello.c -o hello
3.
  
Actual results:
clang: error: 'x86_64-unknown-linux-gnu': unable to pass LLVM bit-code files to linker

Expected results:
clang should know to use llvm-ld as its linker.

Additional info:
This does work:

    clang -emit-llvm hello.c -o hello.o
    llvm-ld hello.o -o hello

Comment 1 Nick Clifton 2009-09-29 16:58:06 UTC
Hi John,

  There are no clang or llvm components because these tools are not part of a Fedora release.  So really you should report this problem to the clang project itself.  You can use their bugzilla system here:

  http://llvm.org/bugs/


Please also note that according to the documentation at:

  http://clang.llvm.org/get_start.html#build

You should be using "clang-cc" to build C programs, rather than "clang".  In fact I tried this with a simple hello world program and sure enough it worked:

  % clang hello.c -emit-llvm
clang: error: 'x86_64-unknown-linux-gnu': unable to pass LLVM bit-code files to
linker

  % clang-cc hello.c -emit-llvm
  %

Cheers
  Nick


Note You need to log in before you can comment on or make changes to this bug.