This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Problem with main() defined in shared object


On Wed, Mar 24, 2004 at 09:50:44AM -0700, marcus hall wrote:
] When I build xx, I do get an undefined reference to main (ultimately
] from glibc/csu/arm/elf/start.S), as I believe I should

On Wed, Mar 24, 2004 at 12:40:15PM -0500, Daniel Jacobowitz wrote:
> No, you shouldn't.  If shared.so is being used by ld, then it'll
> resolve main to there.

Yes, sorry, I didn't type what I really meant.  I meant to say that
when I built xx I had an outstanding reference to main, that should
be resolved at run-time by shared.so (ie: nm xx shows a line:
         U main
).


When I run this test on my desktop (i386, glibc 2.2.93) I get the output:

11967:  transferring control: ./xx
11967:
11967:  symbol=main;  lookup in file=./xx
11967:  symbol=main;  lookup in file=/home/marcus/rje/xx/shared.so
11967:  binding file ./xx to /home/marcus/rje/xx/shared.so: normal symbol `main'11967:  symbol=__errno_location;  lookup in file=./xx
11967:  symbol=__errno_location;  lookup in file=/home/marcus/rje/xx/shared.so
11967:  symbol=__errno_location;  lookup in file=/lib/i686/libc.so.6
11967:  symbol=__errno_location;  lookup in file=/lib/ld-linux.so.2
11967:  binding file /lib/i686/libc.so.6 to /lib/i686/libc.so.6: normal symbol `__errno_location' [GLIBC_2.0]
Got inside main

The "transferring control:" line is in __libc_start_main(), just before it
calls main().  The "symbol=" lines come from elf/do_lookup.h, which
does not get overtly called from __libc_start_main(), so I assume that
when xx is intially loaded, the pointer to main is supposed to be set to
a resolution routine to bind it to the proper address.

However, since it seems that the main pointer is still zero, this setup
is somehow not being performed.

Where should I be looking to find the code that sets up the pointers to
this lazy-binding routine?

Thanks!

Marcus Hall
marcus@tuells.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]