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 22:23:24 +0200 (CEST)
- Subject: Re: is main() provided by a library valid C ?
On Wed, 18 May 2005, Daniel Jacobowitz wrote:
> On Wed, May 18, 2005 at 09:34:53PM +0200, Peter S. Mazinger wrote:
> > 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.
>
> No, my question above is my response to this, which is what I figured
> you were doing. You haven't explained why you're making this change.
> What is the problem with a weak reference from libc?
the change would be "good to have", to be able to build libc w/ -z defs,
that weak is "disturbing" this ;)
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