• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Re: Link errors on dyld_stub_binding_helper, multiple definitions of __start
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: Link errors on dyld_stub_binding_helper, multiple definitions of __start


  • Subject: Re: Re: Link errors on dyld_stub_binding_helper, multiple definitions of __start
  • From: "abstract water" <email@hidden>
  • Date: Fri, 24 Nov 2006 02:24:07 -0800

On 11/23/06, Eric Albert <email@hidden> wrote:

Unless you really, really, really know what you're doing and you're willing to change what you're doing for every different release of either Mac OS X or gcc, don't use -nostdlib, -nodefaultlibs, or - nostartfiles. If you use those flags, you have to know exactly which set of system libraries is required for your particular set of compiler options, developer tools, and OS target. That information isn't documented.

If you remove those flags (and don't use -lcrt1.o), you won't have
any trouble with dyld_stub_binding_helper or _start.

Hi Eric, thanks for the prompt reply. I confess I never used those flags before, but they were in the makefile of the software I was trying to port (http://louhi.kempele.fi/~skyostil/uv/wandering_star.blog/). Yes, removing them does build it (and yeah I could stop here ;-))

However I wanted to achieve what the authors of the source achieved on
Linux, i.e. a really small executable (I get 32 Kb, or 25 Kb with gcc
3.3, vs their 4 Kb). The problem actually is that they define their
own _start() function instead of having a normal main() function:

void _start() { ... }

Compiling just that (even w/ an empty body) on OS X:

gcc -s -Os -Wall -fprofile-arcs -fpack-struct -fno-common -c
main-start.c -o main-start.o

gcc -s -Os -Wall -fprofile-arcs -fpack-struct -fno-common -nostdlib
-nodefaultlibs -nostartfiles main-start.o -lgcc -lcrt1.o -o main-start

/usr/bin/ld: multiple definitions of symbol __start
main-start.o definition of __start in section (__TEXT,__text)
/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../crt1.o private
external definition of __start in section (__TEXT,__text)
collect2: ld returned 1 exit status
make: *** [main-start] Error 1

I understand I probably shouldn't do that, but I am curious to know
how I could compile that code the hacky way.

Thanks again,

Ed
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Link errors on dyld_stub_binding_helper, multiple definitions of __start (From: "abstract water" <email@hidden>)
 >Re: Link errors on dyld_stub_binding_helper, multiple definitions of __start (From: Eric Albert <email@hidden>)

  • Prev by Date: Re: Link errors on dyld_stub_binding_helper, multiple definitions of __start
  • Next by Date: [ann] New Cocoa App Project Template
  • Previous by thread: Re: Link errors on dyld_stub_binding_helper, multiple definitions of __start
  • Next by thread: [ann] New Cocoa App Project Template
  • Index(es):
    • Date
    • Thread