This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: is main() provided by a library valid C ?
- From: "Peter S. Mazinger" <ps dot m at gmx dot net>
- To: Daniel Jacobowitz <drow at false dot org>
- Cc: binutils at sourceware dot org, <Joakim dot Tjernlund at lumentis dot se>
- Date: Wed, 18 May 2005 21:34:53 +0200 (CEST)
- Subject: Re: is main() provided by a library valid C ?
On Fri, 13 May 2005, Daniel Jacobowitz wrote:
> On Fri, May 13, 2005 at 09:47:01AM +0200, Peter S. Mazinger wrote:
> > The circumstances:
> > The weak definition of main() is moved from libc.so to crt1.o written in
> > asm as '.protected main'.
>
> Why?
>
> You certainly can't declare main as a protected symbol if it lives in a
> library. I don't see why you want it to be a protected symbol, either.
I wasn't clear enough.
libc does not define anything about main (not even as weak:
glibc/uclibc/dietlibc). It is obvious that it can't be defined as
protected in a library. To remove any weak declaration of main from libc,
one solution was to put it into crt1.o. This change (although .protected)
does not fail on most of the apps, but fails 2 tests (subversion and
bind), because those tests "deliver" main() from a library.
My question is:
Is it valid to provide main() from a library or not? If it is valid, then
the solution to do '.protected main' in crt1.S is not ok and/or linker
fails. If it is not valid, then the apps themselves should be corrected.
Peter
--
Peter S. Mazinger <ps dot m at gmx dot net> ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08 BB6E C389 975E A5F0 59F2