<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 6/24/14, 10:11 PM, Gaoyao Xiao
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAMtnhbA0h6Q0iYj-jLnpP92zmj92vYx1aYx6AXn-PNhAqf0qoA@mail.gmail.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div>
                  <div>Hello,<br>
                    <br>
                  </div>
                  I am trying to use clang to generate bitcode file. I
                  read in <a moz-do-not-send="true"
                    href="http://llvm.org/docs/GoldPlugin.html">http://llvm.org/docs/GoldPlugin.html</a>
                  that clang with -flto option can generate bitcode
                  files. I have built LLVMgold.so and have gold with
                  plugin support. I tried "clang -c -flto toy.c -o
                  toy.bc" and it does produce bitcode. However, when I
                  try it on lighttpd 1.4.35, then it only produce the
                  binary, but not produce bitcode of lighttpd. I also
                  tried it on apache2.0.56, and it create the errors
                  like the following when linking.<br>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    In the case of lighttpd, I suspect that the configure script is not
    picking up the -flto option.  Examine the output of the build (or
    look at the Makefiles) to see if it is indeed compiling with the
    -flto option as expected.  If not, you either need to play around
    with the configure script (e.g., set CC to "clang -flto") or modify
    the Makefiles.<br>
    <br>
    <blockquote
cite="mid:CAMtnhbA0h6Q0iYj-jLnpP92zmj92vYx1aYx6AXn-PNhAqf0qoA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div>
                  <br>
                  /usr/bin/ld.gold.real: error:
                  strings/.libs/apr_cpystrn.o:1:3: invalid character<br>
                  /usr/bin/ld.gold.real: error:
                  strings/.libs/apr_cpystrn.o:1:3: syntax error,
                  unexpected $end<br>
                  /usr/bin/ld.gold.real: error:
                  strings/.libs/apr_cpystrn.o: not an object or archive<br>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    This error is most likely caused by a program that is expecting a
    regular object file but is reading a bitcode file instead.  You
    should determine what command the make program is running that is
    generating this error.  Once you know that, you can determine how to
    fix the error (by modifying the Makefiles or adjusting the variable
    you set before running configure).<br>
    <br>
    Also be aware that ar, nm, etc. need to find the libLTO.so file in a
    particular place in order to read bitcode files.  Be sure that is
    installed properly.  The SAFECode libLTO directions may provide some
    illumination: <a class="moz-txt-link-freetext" href="http://sva.cs.illinois.edu/docs/Install.html#install">http://sva.cs.illinois.edu/docs/Install.html#install</a>.<br>
    <br>
    The Apache build system in particular does some interesting things. 
    You'll probably need to modify the build system to get it to work.<br>
    <br>
    Regards,<br>
    <br>
    John Criswell<br>
    <br>
    <blockquote
cite="mid:CAMtnhbA0h6Q0iYj-jLnpP92zmj92vYx1aYx6AXn-PNhAqf0qoA@mail.gmail.com"
      type="cite">
      <div dir="ltr">
        <div>
          <div>
            <div>
              <div>
                <div>
                  <br>
                </div>
                I am using ubuntu 12.04. I have the following questions:<br>
              </div>
              1) for lighttpd, why is it able to build but not produce
              bitcode?<br>
            </div>
            2) for apache, does the error means that gold plugin is not
            found by clang and make it fail to link? I read
            "-use-gold-plugin" can solve this problem on clang 3.0. But
            this option is not recognized by clang 3.5. Will clang 3.0
            solve this problem?<br>
            <br>
          </div>
          Many thanks!<br>
        </div>
        Gaoyao<br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>