[LLVMbugs] [Bug 20366] New: Can't set entry point (OS X Mavericks)

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jul 19 08:15:31 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20366

            Bug ID: 20366
           Summary: Can't set entry point (OS X Mavericks)
           Product: lld
           Version: unspecified
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: matt.fichman at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140719/b1ae74a3/attachment.html>


More information about the llvm-bugs mailing list