<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Can't set entry point (OS X Mavericks)"
   href="http://llvm.org/bugs/show_bug.cgi?id=20366">20366</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Can't set entry point (OS X Mavericks)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lld
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>matt.fichman@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I have the following program:

    #include <stdio.h>

    int bob() {
        printf("bob\n");
        return 0;
    }

    int main() {
        printf("main\n");
        return 0;
    }

On Linux, I can enable a custom entry point via:

    gcc test.c -Wl,-e,bob

When I run the resulting program, I get:

    ./a.out
    bob

On OS X (with clang/ldd), however, this doesn't work:

    clang test.c -Wl,-e,bob
    ./a.out
    main

I've also tried:

    clang test.c -e bob -v

...with no luck. Anyway, here's the output with the -v option:

    clang test.c -Wl,-e,bob -v

Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
Target: x86_64-apple-darwin13.3.0
Thread model: posix

"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"
-cc1 -triple x86_64-apple-macosx10.9.0 -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -main-file-name test.c -mrelocation-model pic -pic-level
2 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2
-target-linker-version 236.3 -v -resource-dir
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1
-fdebug-compilation-dir /Users/mfichman/jogo -ferror-limit 19 -fmessage-length
125 -stack-protector 1 -mstackrealign -fblocks -fobjc-runtime=macosx-10.9.0
-fencode-extended-block-signature -fdiagnostics-show-option -fcolor-diagnostics
-vectorize-slp -o
/var/folders/4z/q41by0256hjc7s6v8ljmfpw8lywh5g/T/test-9b80a6.o -x c test.c
clang -cc1 version 5.1 based upon LLVM 3.4svn default target
x86_64-apple-darwin13.3.0
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/include

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
 /usr/include
 /System/Library/Frameworks (framework directory)
 /Library/Frameworks (framework directory)
End of search list.

"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld"
-demangle -dynamic -arch x86_64 -macosx_version_min 10.9.0 -e bob -o a.out
/var/folders/4z/q41by0256hjc7s6v8ljmfpw8lywh5g/T/test-9b80a6.o -lSystem
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/5.1/lib/darwin/libclang_rt.osx.a


You can see that clang is correctly passing -e to ld, so maybe this is a
problem with ld.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>